From 038355c2583df7b1c5da8933700454aa89521e12 Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Thu, 13 Aug 2020 00:55:56 +0530 Subject: [PATCH 01/20] update npm module --- dist/rudder-sdk-js/index.js | 3711 ++++++++++++++++++++++++++++++++++- 1 file changed, 3694 insertions(+), 17 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 61e5819190..e10b1ddac3 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -735,7 +735,11 @@ PRODUCT_REVIEWED: "Product Reviewed" }; // Enumeration for integrations supported +<<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; +>>>>>>> update npm module var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -6186,6 +6190,2683 @@ }(); var core = createCommonjsModule(function (module, exports) { +<<<<<<< HEAD +======= + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(); + } + }(commonjsGlobal, function () { + + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || (function (Math, undefined$1) { + /* + * Local polyfil of Object.create + */ + var create = Object.create || (function () { + function F() {} + return function (obj) { + var subtype; + + F.prototype = obj; + + subtype = new F(); + + F.prototype = null; + + return subtype; + }; + }()); + + /** + * CryptoJS namespace. + */ + var C = {}; + + /** + * Library namespace. + */ + var C_lib = C.lib = {}; + + /** + * Base object for prototypal inheritance. + */ + var Base = C_lib.Base = (function () { + + + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function (overrides) { + // Spawn + var subtype = create(this); + + // Augment + if (overrides) { + subtype.mixIn(overrides); + } + + // Create default initializer + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } + + // Initializer's prototype is the subtype object + subtype.init.prototype = subtype; + + // Reference supertype + subtype.$super = this; + + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function () { + var instance = this.extend(); + instance.init.apply(instance, arguments); + + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function () { + }, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function (properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } + + // IE won't copy toString using the loop above + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function () { + return this.init.prototype.extend(this); + } + }; + }()); + + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function (words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined$1) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function (encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function (wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; + + // Clamp excess bits + this.clamp(); + + // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); + } + } else { + // Copy one word at a time + for (var i = 0; i < thatSigBytes; i += 4) { + thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; + } + } + this.sigBytes += thatSigBytes; + + // Chainable + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function () { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; + + // Clamp + words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function (nBytes) { + var words = []; + + var r = (function (m_w) { + var m_w = m_w; + var m_z = 0x3ade68b1; + var mask = 0xffffffff; + + return function () { + m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; + m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; + var result = ((m_z << 0x10) + m_w) & mask; + result /= 0x100000000; + result += 0.5; + return result * (Math.random() > .5 ? 1 : -1); + } + }); + + for (var i = 0, rcache; i < nBytes; i += 4) { + var _r = r((rcache || Math.random()) * 0x100000000); + + rcache = _r() * 0x3ade67b7; + words.push((_r() * 0x100000000) | 0); + } + + return new WordArray.init(words, nBytes); + } + }); + + /** + * Encoder namespace. + */ + var C_enc = C.enc = {}; + + /** + * Hex encoding strategy. + */ + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var hexChars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function (hexStr) { + // Shortcut + var hexStrLength = hexStr.length; + + // Convert + var words = []; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + + /** + * Latin1 encoding strategy. + */ + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + + // Convert + var latin1Chars = []; + for (var i = 0; i < sigBytes; i++) { + var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function (latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; + + // Convert + var words = []; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); + } + + return new WordArray.init(words, latin1StrLength); + } + }; + + /** + * UTF-8 encoding strategy. + */ + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function (wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function (utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function () { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function (data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } + + // Append + this._data.concat(data); + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function (doFlush) { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; + + // Count blocks ready + var nBlocksReady = dataSigBytes / blockSizeBytes; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } + + // Count words ready + var nWordsReady = nBlocksReady * blockSize; + + // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); + + // Process blocks + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } + + // Remove processed words + var processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } + + // Return processed words + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function () { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + + return clone; + }, + + _minBufferSize: 0 + }); + + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function (cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Set initial values + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-hasher logic + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function (messageUpdate) { + // Append + this._append(messageUpdate); + + // Update the hash + this._process(); + + // Chainable + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } + + // Perform concrete-hasher logic + var hash = this._doFinalize(); + + return hash; + }, + + blockSize: 512/32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function (hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function (hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + + return C; + }(Math)); + + + return CryptoJS; + + })); + }); + + var encBase64 = createCommonjsModule(function (module, exports) { + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + }(commonjsGlobal, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + + /** + * Base64 encoding strategy. + */ + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. + * + * @static + * + * @example + * + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function (wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; + + // Clamp excess bits + wordArray.clamp(); + + // Convert + var base64Chars = []; + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; + var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; + var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + + var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + + for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { + base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); + } + } + + // Add padding + var paddingChar = map.charAt(64); + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function (base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } + + // Ignore padding + var paddingChar = map.charAt(64); + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } + + // Convert + return parseLoop(base64Str, base64StrLength, reverseMap); + + }, + + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); + words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); + nBytes++; + } + } + return WordArray.create(words, nBytes); + } + }()); + + + return CryptoJS.enc.Base64; + + })); + }); + + var md5$1 = createCommonjsModule(function (module, exports) { + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + }(commonjsGlobal, function (CryptoJS) { + + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Constants table + var T = []; + + // Compute constants + (function () { + for (var i = 0; i < 64; i++) { + T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; + } + }()); + + /** + * MD5 hash algorithm. + */ + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + + M[offset_i] = ( + (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | + (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) + ); + } + + // Shortcuts + var H = this._hash.words; + + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; + + // Working varialbes + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + + // Computation + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( + (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | + (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) + ); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( + (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | + (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) + ); + + data.sigBytes = (dataWords.length + 1) * 4; + + // Hash final blocks + this._process(); + + // Shortcuts + var hash = this._hash; + var H = hash.words; + + // Swap endian + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + + H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | + (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); + } + + // Return final computed hash + return hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + ((b & c) | (~b & d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + ((b & d) | (c & ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return ((n << s) | (n >>> (32 - s))) + b; + } + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + C.MD5 = Hasher._createHelper(MD5); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + C.HmacMD5 = Hasher._createHmacHelper(MD5); + }(Math)); + + + return CryptoJS.MD5; + + })); + }); + + var sha1 = createCommonjsModule(function (module, exports) { + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + }(commonjsGlobal, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; + + // Reusable object + var W = []; + + /** + * SHA-1 hash algorithm. + */ + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function () { + this._hash = new WordArray.init([ + 0x67452301, 0xefcdab89, + 0x98badcfe, 0x10325476, + 0xc3d2e1f0 + ]); + }, + + _doProcessBlock: function (M, offset) { + // Shortcut + var H = this._hash.words; + + // Working variables + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; + + // Computation + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = (n << 1) | (n >>> 31); + } + + var t = ((a << 5) | (a >>> 27)) + e + W[i]; + if (i < 20) { + t += ((b & c) | (~b & d)) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; + } else /* if (i < 80) */ { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = (b << 30) | (b >>> 2); + b = a; + a = t; + } + + // Intermediate hash value + H[0] = (H[0] + a) | 0; + H[1] = (H[1] + b) | 0; + H[2] = (H[2] + c) | 0; + H[3] = (H[3] + d) | 0; + H[4] = (H[4] + e) | 0; + }, + + _doFinalize: function () { + // Shortcuts + var data = this._data; + var dataWords = data.words; + + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; + + // Add padding + dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; + + // Hash final blocks + this._process(); + + // Return final computed hash + return this._hash; + }, + + clone: function () { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + + return clone; + } + }); + + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + C.SHA1 = Hasher._createHelper(SHA1); + + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + }()); + + + return CryptoJS.SHA1; + + })); + }); + + var hmac = createCommonjsModule(function (module, exports) { + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + }(commonjsGlobal, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + + /** + * HMAC algorithm. + */ + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function (hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); + + // Convert string to WordArray, else assume WordArray already + if (typeof key == 'string') { + key = Utf8.parse(key); + } + + // Shortcuts + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; + + // Allow arbitrary length keys + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } + + // Clamp excess bits + key.clamp(); + + // Clone key for inner and outer pads + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); + + // Shortcuts + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; + + // XOR keys with pad constants + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; + + // Set initial values + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function () { + // Shortcut + var hasher = this._hasher; + + // Reset + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function (messageUpdate) { + this._hasher.update(messageUpdate); + + // Chainable + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function (messageUpdate) { + // Shortcut + var hasher = this._hasher; + + // Compute HMAC + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + + return hmac; + } + }); + }()); + + + })); + }); + + var evpkdf = createCommonjsModule(function (module, exports) { + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, sha1, hmac); + } + }(commonjsGlobal, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128/32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function (cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function (password, salt) { + // Shortcut + var cfg = this.cfg; + + // Init hasher + var hasher = cfg.hasher.create(); + + // Initial values + var derivedKey = WordArray.create(); + + // Shortcuts + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; + + // Generate key + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + var block = hasher.update(password).finalize(salt); + hasher.reset(); + + // Iterations + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + derivedKey.sigBytes = keySize * 4; + + return derivedKey; + } + }); + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + }()); + + + return CryptoJS.EvpKDF; + + })); + }); + + var cipherCore = createCommonjsModule(function (module, exports) { + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, evpkdf); + } + }(commonjsGlobal, function (CryptoJS) { + + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || (function (undefined$1) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function (key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function (key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function (xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); + + // Store transform mode and key + this._xformMode = xformMode; + this._key = key; + + // Set initial values + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function () { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); + + // Perform concrete-cipher logic + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function (dataUpdate) { + // Append + this._append(dataUpdate); + + // Process available blocks + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function (dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } + + // Perform concrete-cipher logic + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + + keySize: 128/32, + + ivSize: 128/32, + + _ENC_XFORM_MODE: 1, + + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: (function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function (message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + + decrypt: function (ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }()) + }); + + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function () { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + + blockSize: 1 + }); + + /** + * Mode namespace. + */ + var C_mode = C.mode = {}; + + /** + * Abstract base block cipher mode template. + */ + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function (cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function (cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function (cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + + /** + * Cipher Block Chaining mode. + */ + var CBC = C_mode.CBC = (function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + + /** + * CBC encryptor. + */ + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // XOR and encrypt + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); + + // Remember this block to use with next block + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + + /** + * CBC decryptor. + */ + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function (words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; + + // Remember this block to use with next block + var thisBlock = words.slice(offset, offset + blockSize); + + // Decrypt and XOR + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); + + // This block becomes the previous block + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + // Shortcut + var iv = this._iv; + + // Choose mixing block + if (iv) { + var block = iv; + + // Remove IV for subsequent blocks + this._iv = undefined$1; + } else { + var block = this._prevBlock; + } + + // XOR blocks + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }()); + + /** + * Padding namespace. + */ + var C_pad = C.pad = {}; + + /** + * PKCS #5/7 padding strategy. + */ + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function (data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; + + // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + + // Create padding word + var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; + + // Create padding + var paddingWords = []; + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); + + // Add padding + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function (data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + + // Remove padding + data.sigBytes -= nPaddingBytes; + } + }; + + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + + reset: function () { + // Reset cipher + Cipher.reset.call(this); + + // Shortcuts + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; + + // Reset block mode + if (this._xformMode == this._ENC_XFORM_MODE) { + var modeCreator = mode.createEncryptor; + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + var modeCreator = mode.createDecryptor; + // Keep at least one block in the buffer for unpadding + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + + _doProcessBlock: function (words, offset) { + this._mode.processBlock(words, offset); + }, + + _doFinalize: function () { + // Shortcut + var padding = this.cfg.padding; + + // Finalize + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); + + // Process final blocks + var finalProcessedBlocks = this._process(!!'flush'); + } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { + // Process final blocks + var finalProcessedBlocks = this._process(!!'flush'); + + // Unpad data + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + + blockSize: 128/32 + }); + + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function (cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function (formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + + /** + * Format namespace. + */ + var C_format = C.format = {}; + + /** + * OpenSSL formatting strategy. + */ + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function (cipherParams) { + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; + + // Format + if (salt) { + var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + var wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function (openSSLStr) { + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); + + // Shortcut + var ciphertextWords = ciphertext.words; + + // Test for salt + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + var salt = WordArray.create(ciphertextWords.slice(2, 4)); + + // Remove salt from ciphertext + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ ciphertext: ciphertext, salt: salt }); + } + }; + + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Encrypt + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); + + // Shortcut + var cipherCfg = encryptor.cfg; + + // Create and return serializable cipher params + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Decrypt + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function (ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + + /** + * Key derivation function namespace. + */ + var C_kdf = C.kdf = {}; + + /** + * OpenSSL key derivation function. + */ + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function (password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64/8); + } + + // Derive key and IV + var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); + + // Separate key and IV + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; + + // Return params + return CipherParams.create({ key: key, iv: iv, salt: salt }); + } + }; + + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function (cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Encrypt + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); + + // Mix in derived params + ciphertext.mixIn(derivedParams); + + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function (cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); + + // Convert string to CipherParams + ciphertext = this._parse(ciphertext, cfg.format); + + // Derive key and other params + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); + + // Add IV to config + cfg.iv = derivedParams.iv; + + // Decrypt + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + + return plaintext; + } + }); + }()); + + + })); + }); + + var aes = createCommonjsModule(function (module, exports) { + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); + } + }(commonjsGlobal, function (CryptoJS) { + + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; + + // Lookup tables + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; + + // Compute lookup tables + (function () { + // Compute double table + var d = []; + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = (i << 1) ^ 0x11b; + } + } + + // Walk GF(2^8) + var x = 0; + var xi = 0; + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); + sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; + + // Compute multiplication + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; + + // Compute sub bytes, mix columns tables + var t = (d[sx] * 0x101) ^ (sx * 0x1010100); + SUB_MIX_0[x] = (t << 24) | (t >>> 8); + SUB_MIX_1[x] = (t << 16) | (t >>> 16); + SUB_MIX_2[x] = (t << 8) | (t >>> 24); + SUB_MIX_3[x] = t; + + // Compute inv sub bytes, inv mix columns tables + var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); + INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); + INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); + INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); + INV_SUB_MIX_3[sx] = t; + + // Compute next counter + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + }()); + + // Precomputed Rcon lookup + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + + /** + * AES block cipher algorithm. + */ + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function () { + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } + + // Shortcuts + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; + + // Compute number of rounds + var nRounds = this._nRounds = keySize + 6; + + // Compute number of key schedule rows + var ksRows = (nRounds + 1) * 4; + + // Compute key schedule + var keySchedule = this._keySchedule = []; + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + var t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = (t << 8) | (t >>> 24); + + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + + // Mix Rcon + t ^= RCON[(ksRow / keySize) | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } + + // Compute inv key schedule + var invKeySchedule = this._invKeySchedule = []; + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ + INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + + encryptBlock: function (M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + + decryptBlock: function (M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); + + // Inv swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + + _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; + + // Get input, add round key + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; + + // Key schedule row counter + var ksRow = 4; + + // Rounds + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; + + // Update state + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } + + // Shift rows, sub bytes, add round key + var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; + + // Set output + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + + keySize: 256/32 + }); + + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + C.AES = BlockCipher._createHelper(AES); + }()); + + + return CryptoJS.AES; + + })); + }); + + var encUtf8 = createCommonjsModule(function (module, exports) { + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + }(commonjsGlobal, function (CryptoJS) { + + return CryptoJS.enc.Utf8; + + })); + }); + + /** + * toString ref. + */ +>>>>>>> update npm module (function (root, factory) { { @@ -12044,13 +14725,26 @@ this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel +<<<<<<< HEAD if (this.analytics.methodToCallbackMapping.syncPixel) { this.analytics.emit("syncPixel", { destination: this.name }); +======= + }, { + key: "set", + value: function set(key, value) { + try { + rudderComponentCookie(key, value, clone_1(this._options)); + return true; + } catch (e) { + logger.error(e); + return false; +>>>>>>> update npm module } } }, { +<<<<<<< HEAD key: "compileUrl", value: function compileUrl(map, url) { Object.keys(map).forEach(function (key) { @@ -12061,6 +14755,11 @@ } }); return url; +======= + key: "get", + value: function get(key) { + return rudderComponentCookie(key); +>>>>>>> update npm module } }, { key: "identify", @@ -12146,11 +14845,26 @@ _classCallCheck(this, Optimizely); +<<<<<<< HEAD this.referrerOverride = function (referrer) { if (referrer) { window.optimizelyEffectiveReferrer = referrer; return referrer; } +======= + var defaults$1 = { + user_storage_key: "rl_user_id", + user_storage_trait: "rl_trait", + user_storage_anonymousId: "rl_anonymous_id", + group_storage_key: "rl_group_id", + group_storage_trait: "rl_group_trait", + prefix: "RudderEncrypt:", + key: "Rudder" + }; + /** + * An object that handles persisting key-val from Analytics + */ +>>>>>>> update npm module return undefined; }; @@ -12198,9 +14912,20 @@ } // For Google's nonInteraction flag +<<<<<<< HEAD if (_this.sendExperimentTrackAsNonInteractive) props.nonInteraction = 1; // If customCampaignProperties is provided overide the props with it. // If valid customCampaignProperties present it will override existing props. // const data = window.optimizely && window.optimizely.get("data"); +======= + if (Store.enabled) { + this.storage = Store; + } + } + /** + * Json stringify the given value + * @param {*} value + */ +>>>>>>> update npm module var data = campaignState; @@ -12216,18 +14941,120 @@ } } // Send to Rudder +<<<<<<< HEAD +======= + _createClass(Storage, [{ + key: "stringify", + value: function stringify(value) { + return JSON.stringify(value); + } + /** + * JSON parse the value + * @param {*} value + */ + + }, { + key: "parse", + value: function parse(value) { + // if not parseable, return as is without json parse + try { + return value ? JSON.parse(value) : null; + } catch (e) { + logger.error(e); + return value || null; + } + } + /** + * trim using regex for browser polyfill + * @param {*} value + */ + + }, { + key: "trim", + value: function trim(value) { + return value.replace(/^\s+|\s+$/gm, ""); + } + /** + * AES encrypt value with constant prefix + * @param {*} value + */ + + }, { + key: "encryptValue", + value: function encryptValue(value) { + if (this.trim(value) == "") { + return value; + } + + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); + return prefixedVal; + } + /** + * decrypt value + * @param {*} value + */ + + }, { + key: "decryptValue", + value: function decryptValue(value) { + if (!value || typeof value === "string" && this.trim(value) == "") { + return value; + } + + if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { + return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); + } + + return value; + } + /** + * + * @param {*} key + * @param {*} value + */ + + }, { + key: "setItem", + value: function setItem(key, value) { + this.storage.set(key, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ +>>>>>>> update npm module _this.analytics.track("Experiment Viewed", props, context); } +<<<<<<< HEAD if (_this.sendExperimentIdentify) { var traits = {}; traits["Experiment: ".concat(experiment.name)] = variation.name; // Send to Rudder +======= + this.storage.set(defaults$1.user_storage_key, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ + + }, { + key: "setUserTraits", + value: function setUserTraits(value) { + this.storage.set(defaults$1.user_storage_trait, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ +>>>>>>> update npm module _this.analytics.identify(traits); } }; +<<<<<<< HEAD this.analytics = analytics; this.sendExperimentTrack = config.sendExperimentTrack; this.sendExperimentIdentify = config.sendExperimentIdentify; @@ -12245,6 +15072,19 @@ value: function init() { logger.debug("=== in optimizely init ==="); this.initOptimizelyIntegration(this.referrerOverride, this.sendDataToRudder); +======= + this.storage.set(defaults$1.group_storage_key, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ + + }, { + key: "setGroupTraits", + value: function setGroupTraits(value) { + this.storage.set(defaults$1.group_storage_trait, this.encryptValue(this.stringify(value))); +>>>>>>> update npm module } }, { key: "initOptimizelyIntegration", @@ -12252,6 +15092,7 @@ var newActiveCampaign = function newActiveCampaign(id, referrer) { var state = window.optimizely.get && window.optimizely.get("state"); +<<<<<<< HEAD if (state) { var activeCampaigns = state.getCampaignStates({ isActive: true @@ -12295,6 +15136,69 @@ var registerCurrentlyActiveCampaigns = function registerCurrentlyActiveCampaigns() { window.optimizely = window.optimizely || []; var state = window.optimizely.get && window.optimizely.get("state"); +======= + this.storage.set(defaults$1.user_storage_anonymousId, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} key + */ + + }, { + key: "getItem", + value: function getItem(key) { + return this.parse(this.decryptValue(this.storage.get(key))); + } + /** + * get the stored userId + */ + + }, { + key: "getUserId", + value: function getUserId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_key))); + } + /** + * get the stored user traits + */ + + }, { + key: "getUserTraits", + value: function getUserTraits() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_trait))); + } + /** + * get the stored userId + */ + + }, { + key: "getGroupId", + value: function getGroupId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_key))); + } + /** + * get the stored user traits + */ + + }, { + key: "getGroupTraits", + value: function getGroupTraits() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_trait))); + } + /** + * get stored anonymous id + */ + + }, { + key: "getAnonymousId", + value: function getAnonymousId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_anonymousId))); + } + /** + * + * @param {*} key + */ +>>>>>>> update npm module if (state) { var referrer = checkReferrer(); @@ -12322,8 +15226,18 @@ } }; +<<<<<<< HEAD registerCurrentlyActiveCampaigns(); registerFutureActiveCampaigns(); +======= + }, { + key: "clear", + value: function clear() { + this.storage.remove(defaults$1.user_storage_key); + this.storage.remove(defaults$1.user_storage_trait); + this.storage.remove(defaults$1.group_storage_key); + this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); +>>>>>>> update npm module } }, { key: "track", @@ -12693,24 +15607,583 @@ return Fullstory; }(); - // (config-plan name, native destination.name , exported integration name(this one below)) + var Optimizely = + /*#__PURE__*/ + function () { + function Optimizely(config, analytics) { + var _this = this; - var integrations = { - HS: index, - GA: index$1, - HOTJAR: index$2, - GOOGLEADS: index$3, - VWO: VWO, - GTM: GoogleTagManager, - BRAZE: Braze, - INTERCOM: INTERCOM, - KEEN: Keen, - KISSMETRICS: Kissmetrics, - CUSTOMERIO: CustomerIO, - CHARTBEAT: Chartbeat, - COMSCORE: Comscore, - FACEBOOK_PIXEL: FacebookPixel, - LOTAME: Lotame, + _classCallCheck(this, Optimizely); + + this.referrerOverride = function (referrer) { + if (referrer) { + window.optimizelyEffectiveReferrer = referrer; + return referrer; + } + + return undefined; + }; + + this.sendDataToRudder = function (campaignState) { + logger.debug(campaignState); + var experiment = campaignState.experiment; + var variation = campaignState.variation; + var context = { + integrations: { + All: true + } + }; + var audiences = campaignState.audiences; // Reformatting this data structure into hash map so concatenating variation ids and names is easier later + + var audiencesMap = {}; + audiences.forEach(function (audience) { + audiencesMap[audience.id] = audience.name; + }); + var audienceIds = Object.keys(audiencesMap).sort().join(); + var audienceNames = Object.values(audiencesMap).sort().join(", "); + + if (_this.sendExperimentTrack) { + var props = { + campaignName: campaignState.campaignName, + campaignId: campaignState.id, + experimentId: experiment.id, + experimentName: experiment.name, + variationName: variation.name, + variationId: variation.id, + audienceId: audienceIds, + // eg. '7527562222,7527111138' + audienceName: audienceNames, + // eg. 'Peaky Blinders, Trust Tree' + isInCampaignHoldback: campaignState.isInCampaignHoldback + }; // If this was a redirect experiment and the effective referrer is different from document.referrer, + // this value is made available. So if a customer came in via google.com/ad -> tb12.com -> redirect experiment -> Belichickgoat.com + // `experiment.referrer` would be google.com/ad here NOT `tb12.com`. + + if (experiment.referrer) { + props.referrer = experiment.referrer; + context.page = { + referrer: experiment.referrer + }; + } // For Google's nonInteraction flag + + + if (_this.sendExperimentTrackAsNonInteractive) props.nonInteraction = 1; // If customCampaignProperties is provided overide the props with it. + // If valid customCampaignProperties present it will override existing props. + // const data = window.optimizely && window.optimizely.get("data"); + + var data = campaignState; + + if (data && _this.customCampaignProperties.length > 0) { + for (var index = 0; index < _this.customCampaignProperties.length; index += 1) { + var rudderProp = _this.customCampaignProperties[index].from; + var optimizelyProp = _this.customCampaignProperties[index].to; + + if (typeof props[optimizelyProp] !== "undefined") { + props[rudderProp] = props[optimizelyProp]; + delete props[optimizelyProp]; + } + } + } // Send to Rudder + + + _this.analytics.track("Experiment Viewed", props, context); + } + + if (_this.sendExperimentIdentify) { + var traits = {}; + traits["Experiment: ".concat(experiment.name)] = variation.name; // Send to Rudder + + _this.analytics.identify(traits); + } + }; + + this.analytics = analytics; + this.sendExperimentTrack = config.sendExperimentTrack; + this.sendExperimentIdentify = config.sendExperimentIdentify; + this.sendExperimentTrackAsNonInteractive = config.sendExperimentTrackAsNonInteractive; + this.revenueOnlyOnOrderCompleted = config.revenueOnlyOnOrderCompleted; + this.trackCategorizedPages = config.trackCategorizedPages; + this.trackNamedPages = config.trackNamedPages; + this.customCampaignProperties = config.customCampaignProperties ? config.customCampaignProperties : []; + this.customExperimentProperties = config.customExperimentProperties ? config.customExperimentProperties : []; + this.name = "OPTIMIZELY"; + } + + _createClass(Optimizely, [{ + key: "init", + value: function init() { + logger.debug("=== in optimizely init ==="); + this.initOptimizelyIntegration(this.referrerOverride, this.sendDataToRudder); + } + }, { + key: "initOptimizelyIntegration", + value: function initOptimizelyIntegration(referrerOverride, sendCampaignData) { + var newActiveCampaign = function newActiveCampaign(id, referrer) { + var state = window.optimizely.get && window.optimizely.get("state"); + + if (state) { + var activeCampaigns = state.getCampaignStates({ + isActive: true + }); + var campaignState = activeCampaigns[id]; + if (referrer) campaignState.experiment.referrer = referrer; + sendCampaignData(campaignState); + } + }; + + var checkReferrer = function checkReferrer() { + var state = window.optimizely.get && window.optimizely.get("state"); + + if (state) { + var referrer = state.getRedirectInfo() && state.getRedirectInfo().referrer; + + if (referrer) { + referrerOverride(referrer); + return referrer; + } + } + + return undefined; + }; + + var registerFutureActiveCampaigns = function registerFutureActiveCampaigns() { + window.optimizely = window.optimizely || []; + window.optimizely.push({ + type: "addListener", + filter: { + type: "lifecycle", + name: "campaignDecided" + }, + handler: function handler(event) { + var id = event.data.campaign.id; + newActiveCampaign(id); + } + }); + }; + + var registerCurrentlyActiveCampaigns = function registerCurrentlyActiveCampaigns() { + window.optimizely = window.optimizely || []; + var state = window.optimizely.get && window.optimizely.get("state"); + + if (state) { + var referrer = checkReferrer(); + var activeCampaigns = state.getCampaignStates({ + isActive: true + }); + Object.keys(activeCampaigns).forEach(function (id) { + if (referrer) { + newActiveCampaign(id, referrer); + } else { + newActiveCampaign(id); + } + }); + } else { + window.optimizely.push({ + type: "addListener", + filter: { + type: "lifecycle", + name: "initialized" + }, + handler: function handler() { + checkReferrer(); + } + }); + } + }; + + registerCurrentlyActiveCampaigns(); + registerFutureActiveCampaigns(); + } + }, { + key: "track", + value: function track(rudderElement) { + logger.debug("in Optimizely web track"); + var eventProperties = rudderElement.message.properties; + var event = rudderElement.message.event; + + if (eventProperties.revenue && this.revenueOnlyOnOrderCompleted) { + if (event === "Order Completed") { + eventProperties.revenue = Math.round(eventProperties.revenue * 100); + } else if (event !== "Order Completed") { + delete eventProperties.revenue; + } + } + + var eventName = event.replace(/:/g, "_"); // can't have colons so replacing with underscores + + var payload = { + type: "event", + eventName: eventName, + tags: eventProperties + }; + window.optimizely.push(payload); + } + }, { + key: "page", + value: function page(rudderElement) { + logger.debug("in Optimizely web page"); + var category = rudderElement.message.properties.category; + var name = rudderElement.message.name; + /* const contextOptimizely = { + integrations: { All: false, Optimizely: true }, + }; */ + // categorized pages + + if (category && this.trackCategorizedPages) { + // this.analytics.track(`Viewed ${category} page`, {}, contextOptimizely); + rudderElement.message.event = "Viewed ".concat(category, " page"); + rudderElement.message.type = "track"; + this.track(rudderElement); + } // named pages + + + if (name && this.trackNamedPages) { + // this.analytics.track(`Viewed ${name} page`, {}, contextOptimizely); + rudderElement.message.event = "Viewed ".concat(name, " page"); + rudderElement.message.type = "track"; + this.track(rudderElement); + } + } + }, { + key: "isLoaded", + value: function isLoaded() { + return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); + } + }, { + key: "isReady", + value: function isReady() { + return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); + } + }]); + + return Optimizely; + }(); + + var Bugsnag = + /*#__PURE__*/ + function () { + function Bugsnag(config) { + _classCallCheck(this, Bugsnag); + + this.releaseStage = config.releaseStage; + this.apiKey = config.apiKey; + this.name = "BUGSNAG"; + this.setIntervalHandler = undefined; + } + + _createClass(Bugsnag, [{ + key: "init", + value: function init() { + logger.debug("===in init Bugsnag==="); + ScriptLoader("bugsnag-id", "https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js"); + this.setIntervalHandler = setInterval(this.initBugsnagClient.bind(this), 1000); + } + }, { + key: "initBugsnagClient", + value: function initBugsnagClient() { + if (window.bugsnag !== undefined) { + window.bugsnagClient = window.bugsnag(this.apiKey); + window.bugsnagClient.releaseStage = this.releaseStage; + clearInterval(this.setIntervalHandler); + } + } + }, { + key: "isLoaded", + value: function isLoaded() { + logger.debug("in bugsnag isLoaded"); + return !!window.bugsnagClient; + } + }, { + key: "isReady", + value: function isReady() { + logger.debug("in bugsnag isReady"); + return !!window.bugsnagClient; + } + }, { + key: "identify", + value: function identify(rudderElement) { + var traits = rudderElement.message.context.traits; + var traitsFinal = { + id: rudderElement.message.userId || rudderElement.message.anonymousId, + name: traits.name, + email: traits.email + }; + window.bugsnagClient.user = traitsFinal; + window.bugsnagClient.notify(new Error("error in identify")); + } + }]); + + return Bugsnag; + }(); + + const preserveCamelCase = string => { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < string.length; i++) { + const character = string[i]; + + if (isLastCharLower && /[\p{Lu}]/u.test(character)) { + string = string.slice(0, i) + '-' + string.slice(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) { + string = string.slice(0, i - 1) + '-' + string.slice(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character; + } + } + + return string; + }; + + const camelCase = (input, options) => { + if (!(typeof input === 'string' || Array.isArray(input))) { + throw new TypeError('Expected the input to be `string | string[]`'); + } + + options = { + ...{pascalCase: false}, + ...options + }; + + const postProcess = x => options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x; + + if (Array.isArray(input)) { + input = input.map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + input = input.trim(); + } + + if (input.length === 0) { + return ''; + } + + if (input.length === 1) { + return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase(); + } + + const hasUpperCase = input !== input.toLocaleLowerCase(); + + if (hasUpperCase) { + input = preserveCamelCase(input); + } + + input = input + .replace(/^[_.\- ]+/, '') + .toLocaleLowerCase() + .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase()) + .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase()); + + return postProcess(input); + }; + + var camelcase = camelCase; + // TODO: Remove this for the next major release + var default_1 = camelCase; + camelcase.default = default_1; + + var Fullstory = + /*#__PURE__*/ + function () { + function Fullstory(config) { + _classCallCheck(this, Fullstory); + + this.fs_org = config.fs_org; + this.fs_debug_mode = config.fs_debug_mode; + this.name = "FULLSTORY"; + } + + _createClass(Fullstory, [{ + key: "init", + value: function init() { + logger.debug("===in init FULLSTORY==="); + window._fs_debug = this.fs_debug_mode; + window._fs_host = "fullstory.com"; + window._fs_script = "edge.fullstory.com/s/fs.js"; + window._fs_org = this.fs_org; + window._fs_namespace = "FS"; + + (function (m, n, e, t, l, o, g, y) { + if (e in m) { + if (m.console && m.console.log) { + m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'); + } + + return; + } + + g = m[e] = function (a, b, s) { + g.q ? g.q.push([a, b, s]) : g._api(a, b, s); + }; + + g.q = []; + o = n.createElement(t); + o.async = 1; + o.crossOrigin = "anonymous"; + o.src = "https://".concat(_fs_script); + y = n.getElementsByTagName(t)[0]; + y.parentNode.insertBefore(o, y); + + g.identify = function (i, v, s) { + g(l, { + uid: i + }, s); + if (v) g(l, v, s); + }; + + g.setUserVars = function (v, s) { + g(l, v, s); + }; + + g.event = function (i, v, s) { + g("event", { + n: i, + p: v + }, s); + }; + + g.shutdown = function () { + g("rec", !1); + }; + + g.restart = function () { + g("rec", !0); + }; + + g.log = function (a, b) { + g("log", [a, b]); + }; + + g.consent = function (a) { + g("consent", !arguments.length || a); + }; + + g.identifyAccount = function (i, v) { + o = "account"; + v = v || {}; + v.acctId = i; + g(o, v); + }; + + g.clearUserCookie = function () {}; + + g._w = {}; + y = "XMLHttpRequest"; + g._w[y] = m[y]; + y = "fetch"; + g._w[y] = m[y]; + if (m[y]) m[y] = function () { + return g._w[y].apply(this, arguments); + }; + })(window, document, window._fs_namespace, "script", "user"); + } + }, { + key: "page", + value: function page(rudderElement) { + logger.debug("in FULLSORY page"); + var rudderMessage = rudderElement.message; + var pageName = rudderMessage.name; + + var props = _objectSpread2({ + name: pageName + }, rudderMessage.properties); + + window.FS.event("Viewed a Page", Fullstory.getFSProperties(props)); + } + }, { + key: "identify", + value: function identify(rudderElement) { + logger.debug("in FULLSORY identify"); + var userId = rudderElement.message.userId; + var traits = rudderElement.message.context.traits; + if (!userId) userId = rudderElement.message.anonymousId; + if (Object.keys(traits).length === 0 && traits.constructor === Object) window.FS.identify(userId);else window.FS.identify(userId, Fullstory.getFSProperties(traits)); + } + }, { + key: "track", + value: function track(rudderElement) { + logger.debug("in FULLSTORY track"); + window.FS.event(rudderElement.message.event, Fullstory.getFSProperties(rudderElement.message.properties)); + } + }, { + key: "isLoaded", + value: function isLoaded() { + logger.debug("in FULLSTORY isLoaded"); + return !!window.FS; + } + }], [{ + key: "getFSProperties", + value: function getFSProperties(properties) { + var FS_properties = {}; + Object.keys(properties).map(function (key, index) { + FS_properties[key === "displayName" || key === "email" ? key : Fullstory.camelCaseField(key)] = properties[key]; + }); + return FS_properties; + } + }, { + key: "camelCaseField", + value: function camelCaseField(fieldName) { + // Do not camel case across type suffixes. + var parts = fieldName.split("_"); + + if (parts.length > 1) { + var typeSuffix = parts.pop(); + + switch (typeSuffix) { + case "str": + case "int": + case "date": + case "real": + case "bool": + case "strs": + case "ints": + case "dates": + case "reals": + case "bools": + return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); + + default: // passthrough + + } + } // No type suffix found. Camel case the whole field name. + + + return camelcase(fieldName); + } + }]); + + return Fullstory; + }(); + + // (config-plan name, native destination.name , exported integration name(this one below)) + + var integrations = { + HS: index, + GA: index$1, + HOTJAR: index$2, + GOOGLEADS: index$3, + VWO: VWO, + GTM: GoogleTagManager, + BRAZE: Braze, + INTERCOM: INTERCOM, + KEEN: Keen, + KISSMETRICS: Kissmetrics, + CUSTOMERIO: CustomerIO, + CHARTBEAT: Chartbeat, + COMSCORE: Comscore, + FACEBOOK_PIXEL: FacebookPixel, + LOTAME: Lotame, OPTIMIZELY: Optimizely, BUGSNAG: Bugsnag, FULLSTORY: Fullstory @@ -12723,7 +16196,11 @@ this.build = "1.0.0"; this.name = "RudderLabs JavaScript SDK"; this.namespace = "com.rudderlabs.javascript"; +<<<<<<< HEAD this.version = "1.0.10"; +======= + this.version = "1.0.8"; +>>>>>>> update npm module }; // Library information class @@ -12731,7 +16208,11 @@ _classCallCheck(this, RudderLibraryInfo); this.name = "RudderLabs JavaScript SDK"; +<<<<<<< HEAD this.version = "1.0.10"; +======= + this.version = "1.0.8"; +>>>>>>> update npm module }; // Operating System information class @@ -13566,6 +17047,182 @@ if (window.localStorage) debug$2.enable(localStorage.debug); } catch (e) {} + var componentEmitter$1 = createCommonjsModule(function (module) { + /** + * Expose `Emitter`. + */ + + { + module.exports = Emitter; + } + + /** + * Initialize a new `Emitter`. + * + * @api public + */ + + function Emitter(obj) { + if (obj) return mixin(obj); + } + /** + * Mixin the emitter properties. + * + * @param {Object} obj + * @return {Object} + * @api private + */ + + function mixin(obj) { + for (var key in Emitter.prototype) { + obj[key] = Emitter.prototype[key]; + } + return obj; + } + + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.on = + Emitter.prototype.addEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []) + .push(fn); + return this; + }; + + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.once = function(event, fn){ + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + Emitter.prototype.off = + Emitter.prototype.removeListener = + Emitter.prototype.removeAllListeners = + Emitter.prototype.removeEventListener = function(event, fn){ + this._callbacks = this._callbacks || {}; + + // all + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } + + // specific event + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; + + // remove all handlers + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } + + // remove specific handler + var cb; + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } + + // Remove event specific arrays for event types that no + // one is subscribed for to avoid memory leak. + if (callbacks.length === 0) { + delete this._callbacks['$' + event]; + } + + return this; + }; + + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + Emitter.prototype.emit = function(event){ + this._callbacks = this._callbacks || {}; + + var args = new Array(arguments.length - 1) + , callbacks = this._callbacks['$' + event]; + + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + + if (callbacks) { + callbacks = callbacks.slice(0); + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + Emitter.prototype.listeners = function(event){ + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + Emitter.prototype.hasListeners = function(event){ + return !! this.listeners(event).length; + }; + }); + var uuid$2 = uuid_1.v4; var debug$3 = debug_1$2('localstorage-retry'); // Some browsers don't support Function.prototype.bind, so just including a simplified version here @@ -13637,6 +17294,10 @@ * Mix in event emitter */ +<<<<<<< HEAD +======= + componentEmitter$1(Queue.prototype); +>>>>>>> update npm module componentEmitter(Queue.prototype); /** @@ -15456,6 +19117,7 @@ instance.registerCallbacks(false); var eventsPushedAlready = !!window.rudderanalytics && window.rudderanalytics.push == Array.prototype.push; var argumentsArray = window.rudderanalytics; +<<<<<<< HEAD while (argumentsArray && argumentsArray[0] && argumentsArray[0][0] !== "load") { argumentsArray.shift(); @@ -15473,6 +19135,21 @@ var parsedQueryObject = instance.parseQueryString(window.location.search); pushDataToAnalyticsArray(argumentsArray, parsedQueryObject); +======= + + while (argumentsArray && argumentsArray[0] && argumentsArray[0][0] !== "load") { + argumentsArray.shift(); + } + + if (argumentsArray && argumentsArray.length > 0 && argumentsArray[0][0] === "load") { + var method = argumentsArray[0][0]; + argumentsArray[0].shift(); + logger.debug("=====from init, calling method:: ", method); + instance[method].apply(instance, _toConsumableArray(argumentsArray[0])); + argumentsArray.shift(); + } + +>>>>>>> update npm module if (eventsPushedAlready && argumentsArray && argumentsArray.length > 0) { for (var i$1 = 0; i$1 < argumentsArray.length; i$1++) { instance.toBeProcessedArray.push(argumentsArray[i$1]); From 4020daf1446349410451c86bad15d518c1c6a5eb Mon Sep 17 00:00:00 2001 From: Ruchira Date: Tue, 18 Aug 2020 12:28:21 +0530 Subject: [PATCH 02/20] added tvsquared as destination --- integrations/ScriptLoader.js | 4 ++ integrations/TVSquared/browser.js | 104 +++++++++++++++++++++++++++++ integrations/TVSquared/index.js | 3 + integrations/client_server_name.js | 1 + integrations/index.js | 2 + integrations/integration_cname.js | 1 + 6 files changed, 115 insertions(+) create mode 100644 integrations/TVSquared/browser.js create mode 100644 integrations/TVSquared/index.js diff --git a/integrations/ScriptLoader.js b/integrations/ScriptLoader.js index 7c3ce3221a..fe2dbb7514 100644 --- a/integrations/ScriptLoader.js +++ b/integrations/ScriptLoader.js @@ -6,9 +6,13 @@ const ScriptLoader = (id, src) => { js.src = src; js.async = true; js.type = "text/javascript"; + if(id === "TVSquared-integration"){ + js.defer = true; + } js.id = id; const e = document.getElementsByTagName("script")[0]; logger.debug("==script==", e); + console.log("==script==", e) e.parentNode.insertBefore(js, e); }; diff --git a/integrations/TVSquared/browser.js b/integrations/TVSquared/browser.js new file mode 100644 index 0000000000..1b88cd431c --- /dev/null +++ b/integrations/TVSquared/browser.js @@ -0,0 +1,104 @@ +import ScriptLoader from "../ScriptLoader"; + +class TVSquared { + constructor(config) { + this.brandId = config.brandId; + this.clientId = config.clientId; + this.eventWhiteList = config.eventWhiteList || []; + this.customMetrics = config.customMetrics || []; + this.name = "TVSquared"; + } + + init() { + logger.debug("===in init TVSquared==="); + window._tvq = window._tvq = []; + var url = document.location.protocol == "https:" ? "https://" : "http://"; + url += "collector-" + this.clientId + ".tvsquared.com/"; + window._tvq.push(["setSiteId", this.brandId]); + window._tvq.push(["setTrackerUrl", url + "tv2track.php"]); + ScriptLoader("TVSquared-integration", url + "tv2track.js"); + window._tvq.push([ + function () { + this.deleteCustomVariable(5, "page"); + }, + ]); + } + + isLoaded() { + logger.debug("in TVSqaured isLoaded"); + return !!window_tvq; + } + + isReady() { + logger.debug("in TVSqaured isReady"); + + return !!window_tvq; + } + + page() { + window._tvq.push(["trackPageView"]); + } + + track(rudderElement) { + const { event, userId, anonymousId } = rudderElement.message; + const { + revenue, + productType, + order_id, + promotion_id, + } = rudderElement.message.properties; + let i, j; + var whitelist = eventWhiteList.slice(); + whitelist = whitelist.filter((wl) => { + return wl.event !== ""; + }); + for (i = 0; i < whitelist.length; i += 1) { + if (event.toUpperCase() === whitelist[i].event.toUpperCase()) { + break; + } + if (i === whitelist.length - 1) { + return; + } + } + + var session = { user: userId || anonymousId || "" }; + var action = { + rev: this.formatRevenue(revenue) || "", + prod: productType || "", + id: order_id || "", + promo: promotion_id || "", + }; + var customMetrics = this.customMetrics.slice(); + customMetrics = customMetrics.filter((cm) => { + return cm.propertyName !== ""; + }); + if (customMetrics.length) { + for (j = 0; j < customMetrics.length; j += 1) { + var key = customMetrics[j].propertyName; + var value = rudderElement.message.properties[key]; + if (value) { + action[key] = value; + } + } + } + window._tvq.push([ + function () { + this.setCustomVariable(5, "session", JSON.stringify(session), "visit"); + }, + ]); + if (event !== "Response") { + window._tvq.push([ + function () { + this.setCustomVariable(5, event, JSON.stringify(action), "page"); + }, + ]); + window._tvq.push(["trackPageView"]); + } + } + + formatRevenue(revenue) { + revenue = parseFloat(revenue.replace(/^[^\d\.]*/, "")); + return revenue; + } +} +export { TVSquared }; diff --git a/integrations/TVSquared/index.js b/integrations/TVSquared/index.js new file mode 100644 index 0000000000..f85fe37877 --- /dev/null +++ b/integrations/TVSquared/index.js @@ -0,0 +1,3 @@ +import { TVSquared } from "./browser"; + +export default TVSquared; \ No newline at end of file diff --git a/integrations/client_server_name.js b/integrations/client_server_name.js index 18e07e319d..2babefcd23 100644 --- a/integrations/client_server_name.js +++ b/integrations/client_server_name.js @@ -19,6 +19,7 @@ const clientToServerNames = { VWO: "VWO", OPTIMIZELY: "Optimizely", FULLSTORY: "Fullstory", + TVSQUUARED: "TVSquared" }; export { clientToServerNames }; diff --git a/integrations/index.js b/integrations/index.js index 39c209f4fe..83d43e5c69 100644 --- a/integrations/index.js +++ b/integrations/index.js @@ -16,6 +16,7 @@ import * as Lotame from "./Lotame"; import * as Optimizely from "./Optimizely"; import * as Bugsnag from "./Bugsnag"; import * as Fullstory from "./Fullstory"; +import * as TVSquared from "./TVSquared"; // the key names should match the destination.name value to keep partity everywhere // (config-plan name, native destination.name , exported integration name(this one below)) @@ -39,6 +40,7 @@ const integrations = { OPTIMIZELY: Optimizely.default, BUGSNAG: Bugsnag.default, FULLSTORY: Fullstory.default, + TVSQUARED: TVSquared.default, }; export { integrations }; diff --git a/integrations/integration_cname.js b/integrations/integration_cname.js index 9a6f0e2f93..70067a3677 100644 --- a/integrations/integration_cname.js +++ b/integrations/integration_cname.js @@ -42,6 +42,7 @@ const commonNames = { FULLSTORY: "FULLSTORY", Fullstory: "FULLSTORY", BUGSNAG: "BUGSNAG", + TVSQUARED: "TVSQUARED", }; export { commonNames }; From ac32b2d045d4d15b8573456cc1f7ae811604c362 Mon Sep 17 00:00:00 2001 From: Ruchira Date: Tue, 18 Aug 2020 17:06:39 +0530 Subject: [PATCH 03/20] minor changes from review comment and formatting --- integrations/ScriptLoader.js | 4 -- integrations/TVSquared/browser.js | 67 +++++++++++++++++-------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/integrations/ScriptLoader.js b/integrations/ScriptLoader.js index fe2dbb7514..7c3ce3221a 100644 --- a/integrations/ScriptLoader.js +++ b/integrations/ScriptLoader.js @@ -6,13 +6,9 @@ const ScriptLoader = (id, src) => { js.src = src; js.async = true; js.type = "text/javascript"; - if(id === "TVSquared-integration"){ - js.defer = true; - } js.id = id; const e = document.getElementsByTagName("script")[0]; logger.debug("==script==", e); - console.log("==script==", e) e.parentNode.insertBefore(js, e); }; diff --git a/integrations/TVSquared/browser.js b/integrations/TVSquared/browser.js index 1b88cd431c..f9ac11e6f8 100644 --- a/integrations/TVSquared/browser.js +++ b/integrations/TVSquared/browser.js @@ -1,4 +1,7 @@ +/* eslint-disable camelcase */ +/* eslint-disable no-underscore-dangle */ import ScriptLoader from "../ScriptLoader"; +import logger from "../../utils/logUtil"; class TVSquared { constructor(config) { @@ -11,44 +14,47 @@ class TVSquared { init() { logger.debug("===in init TVSquared==="); - window._tvq = window._tvq = []; - var url = document.location.protocol == "https:" ? "https://" : "http://"; - url += "collector-" + this.clientId + ".tvsquared.com/"; + window._tvq = window._tvq || []; + let url = document.location.protocol === "https:" ? "https://" : "http://"; + url += `collector-${this.clientId}.tvsquared.com/`; window._tvq.push(["setSiteId", this.brandId]); - window._tvq.push(["setTrackerUrl", url + "tv2track.php"]); - ScriptLoader("TVSquared-integration", url + "tv2track.js"); + window._tvq.push(["setTrackerUrl", `&${url}tv2track.php`]); + ScriptLoader("TVSquared-integration", `${url}tv2track.js`); + window._tvq.push([ - function () { + () => { this.deleteCustomVariable(5, "page"); }, ]); } - isLoaded() { + isLoaded = () => { logger.debug("in TVSqaured isLoaded"); - return !!window_tvq; - } + return !!window._tvq; + }; - isReady() { + isReady = () => { logger.debug("in TVSqaured isReady"); - return !!window_tvq; - } + return !!window._tvq; + }; - page() { + page = () => { window._tvq.push(["trackPageView"]); - } + }; track(rudderElement) { const { event, userId, anonymousId } = rudderElement.message; const { revenue, productType, + category, order_id, promotion_id, } = rudderElement.message.properties; - let i, j; - var whitelist = eventWhiteList.slice(); + let i; + let j; + let whitelist = this.eventWhiteList.slice(); whitelist = whitelist.filter((wl) => { return wl.event !== ""; }); @@ -61,34 +67,34 @@ class TVSquared { } } - var session = { user: userId || anonymousId || "" }; - var action = { - rev: this.formatRevenue(revenue) || "", - prod: productType || "", + const session = { user: userId || anonymousId || "" }; + const action = { + rev: revenue ? this.formatRevenue(revenue) : "", + prod: category || productType || "", id: order_id || "", promo: promotion_id || "", }; - var customMetrics = this.customMetrics.slice(); + let customMetrics = this.customMetrics.slice(); customMetrics = customMetrics.filter((cm) => { return cm.propertyName !== ""; }); if (customMetrics.length) { for (j = 0; j < customMetrics.length; j += 1) { - var key = customMetrics[j].propertyName; - var value = rudderElement.message.properties[key]; + const key = customMetrics[j].propertyName; + const value = rudderElement.message.properties[key]; if (value) { action[key] = value; } } } window._tvq.push([ - function () { + () => { this.setCustomVariable(5, "session", JSON.stringify(session), "visit"); }, ]); - if (event !== "Response") { + if (event.toUpperCase() !== "RESPONSE") { window._tvq.push([ - function () { + () => { this.setCustomVariable(5, event, JSON.stringify(action), "page"); }, ]); @@ -96,9 +102,10 @@ class TVSquared { } } - formatRevenue(revenue) { - revenue = parseFloat(revenue.replace(/^[^\d\.]*/, "")); - return revenue; - } + formatRevenue = (revenue) => { + let rev = revenue; + rev = parseFloat(rev.toString().replace(/^[^\d.]*/, "")); + return rev; + }; } export { TVSquared }; From 88edb0f06c3c8cb78499bb3eee5115ef3f7c643a Mon Sep 17 00:00:00 2001 From: Ruchira Date: Wed, 19 Aug 2020 11:25:40 +0530 Subject: [PATCH 04/20] changed return avlue for isloaded and isready --- integrations/TVSquared/browser.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/integrations/TVSquared/browser.js b/integrations/TVSquared/browser.js index f9ac11e6f8..6bb2b1a316 100644 --- a/integrations/TVSquared/browser.js +++ b/integrations/TVSquared/browser.js @@ -19,7 +19,7 @@ class TVSquared { url += `collector-${this.clientId}.tvsquared.com/`; window._tvq.push(["setSiteId", this.brandId]); window._tvq.push(["setTrackerUrl", `&${url}tv2track.php`]); - ScriptLoader("TVSquared-integration", `${url}tv2track.js`); + //ScriptLoader("TVSquared-integration", `${url}tv2track.js`); window._tvq.push([ () => { @@ -30,13 +30,12 @@ class TVSquared { isLoaded = () => { logger.debug("in TVSqaured isLoaded"); - return !!window._tvq; + return !!(window._tvq && window._tvq.push !== Array.prototype.push); }; isReady = () => { logger.debug("in TVSqaured isReady"); - - return !!window._tvq; + return !!(window._tvq && window._tvq.push !== Array.prototype.push); }; page = () => { @@ -87,6 +86,8 @@ class TVSquared { } } } + console.log(session); + console.log(action); window._tvq.push([ () => { this.setCustomVariable(5, "session", JSON.stringify(session), "visit"); From 2163549943c8d69045c69d936eeb7e0bb2d0db05 Mon Sep 17 00:00:00 2001 From: Ruchira Date: Wed, 19 Aug 2020 12:23:46 +0530 Subject: [PATCH 05/20] minor changes --- integrations/TVSquared/browser.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/integrations/TVSquared/browser.js b/integrations/TVSquared/browser.js index 6bb2b1a316..26ae6d76d2 100644 --- a/integrations/TVSquared/browser.js +++ b/integrations/TVSquared/browser.js @@ -19,7 +19,7 @@ class TVSquared { url += `collector-${this.clientId}.tvsquared.com/`; window._tvq.push(["setSiteId", this.brandId]); window._tvq.push(["setTrackerUrl", `&${url}tv2track.php`]); - //ScriptLoader("TVSquared-integration", `${url}tv2track.js`); + ScriptLoader("TVSquared-integration", `${url}tv2track.js`); window._tvq.push([ () => { @@ -86,8 +86,6 @@ class TVSquared { } } } - console.log(session); - console.log(action); window._tvq.push([ () => { this.setCustomVariable(5, "session", JSON.stringify(session), "visit"); From 252c2e1c39fd259892cb0a3751436a7cd1cedf6e Mon Sep 17 00:00:00 2001 From: prabrishac Date: Thu, 3 Sep 2020 23:25:24 +0530 Subject: [PATCH 06/20] bug fix --- integrations/TVSquared/browser.js | 16 +++++----------- integrations/TVSquared/index.js | 4 ++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/integrations/TVSquared/browser.js b/integrations/TVSquared/browser.js index 26ae6d76d2..db94117a14 100644 --- a/integrations/TVSquared/browser.js +++ b/integrations/TVSquared/browser.js @@ -18,14 +18,8 @@ class TVSquared { let url = document.location.protocol === "https:" ? "https://" : "http://"; url += `collector-${this.clientId}.tvsquared.com/`; window._tvq.push(["setSiteId", this.brandId]); - window._tvq.push(["setTrackerUrl", `&${url}tv2track.php`]); + window._tvq.push(["setTrackerUrl", `${url}tv2track.php`]); ScriptLoader("TVSquared-integration", `${url}tv2track.js`); - - window._tvq.push([ - () => { - this.deleteCustomVariable(5, "page"); - }, - ]); } isLoaded = () => { @@ -87,19 +81,19 @@ class TVSquared { } } window._tvq.push([ - () => { + function () { this.setCustomVariable(5, "session", JSON.stringify(session), "visit"); }, ]); if (event.toUpperCase() !== "RESPONSE") { window._tvq.push([ - () => { + function () { this.setCustomVariable(5, event, JSON.stringify(action), "page"); }, ]); window._tvq.push(["trackPageView"]); } - } + }; formatRevenue = (revenue) => { let rev = revenue; @@ -107,4 +101,4 @@ class TVSquared { return rev; }; } -export { TVSquared }; +export default TVSquared; diff --git a/integrations/TVSquared/index.js b/integrations/TVSquared/index.js index f85fe37877..5af5065035 100644 --- a/integrations/TVSquared/index.js +++ b/integrations/TVSquared/index.js @@ -1,3 +1,3 @@ -import { TVSquared } from "./browser"; +import TVSquared from "./browser"; -export default TVSquared; \ No newline at end of file +export default TVSquared; From d0d789f0ec59278866dff4407a6ca3801d9e9dd9 Mon Sep 17 00:00:00 2001 From: Arnab Date: Thu, 10 Sep 2020 18:31:01 +0530 Subject: [PATCH 07/20] Bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 59c992a05b..5a25e7b62a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "rudder-analytics", - "version": "1.1.4", + "version": "1.1.5", "description": "", "main": "./dist/browser.min.js", "size-limit": [ From 00da687f9fad892c0d877092704c01a1e2923ef4 Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Thu, 3 Sep 2020 13:33:26 +0530 Subject: [PATCH 08/20] branch for npm and latest release --- dist/rudder-sdk-js/index.js | 14257 +++++++++++++++++++++------------- 1 file changed, 8958 insertions(+), 5299 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index e10b1ddac3..b33770530a 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -161,6 +161,7 @@ } return obj; +<<<<<<< HEAD } /** * Listen on the given `event` with `fn`. @@ -489,6 +490,261 @@ stringify: stringify }; + var componentUrl = createCommonjsModule(function (module, exports) { + /** + * Parse the given `url`. + * + * @param {String} str + * @return {Object} + * @api public + */ + exports.parse = function (url) { + var a = document.createElement('a'); + a.href = url; + return { + href: a.href, + host: a.host || location.host, + port: '0' === a.port || '' === a.port ? port(a.protocol) : a.port, + hash: a.hash, + hostname: a.hostname || location.hostname, + pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname, + protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol, + search: a.search, + query: a.search.slice(1) + }; + }; + /** + * Check if `url` is absolute. + * + * @param {String} url + * @return {Boolean} + * @api public + */ + +======= + } + /** + * Listen on the given `event` with `fn`. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + + Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) { + this._callbacks = this._callbacks || {}; + (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn); + return this; + }; + /** + * Adds an `event` listener that will be invoked a single + * time then automatically removed. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + + Emitter.prototype.once = function (event, fn) { + function on() { + this.off(event, on); + fn.apply(this, arguments); + } + + on.fn = fn; + this.on(event, on); + return this; + }; + /** + * Remove the given callback for `event` or all + * registered callbacks. + * + * @param {String} event + * @param {Function} fn + * @return {Emitter} + * @api public + */ + + + Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) { + this._callbacks = this._callbacks || {}; // all + + if (0 == arguments.length) { + this._callbacks = {}; + return this; + } // specific event + + + var callbacks = this._callbacks['$' + event]; + if (!callbacks) return this; // remove all handlers + + if (1 == arguments.length) { + delete this._callbacks['$' + event]; + return this; + } // remove specific handler + + + var cb; + + for (var i = 0; i < callbacks.length; i++) { + cb = callbacks[i]; + + if (cb === fn || cb.fn === fn) { + callbacks.splice(i, 1); + break; + } + } // Remove event specific arrays for event types that no + // one is subscribed for to avoid memory leak. + + + if (callbacks.length === 0) { + delete this._callbacks['$' + event]; + } + + return this; + }; + /** + * Emit `event` with the given args. + * + * @param {String} event + * @param {Mixed} ... + * @return {Emitter} + */ + + + Emitter.prototype.emit = function (event) { + this._callbacks = this._callbacks || {}; + var args = new Array(arguments.length - 1), + callbacks = this._callbacks['$' + event]; + + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + + if (callbacks) { + callbacks = callbacks.slice(0); + + for (var i = 0, len = callbacks.length; i < len; ++i) { + callbacks[i].apply(this, args); + } + } + + return this; + }; + /** + * Return array of callbacks for `event`. + * + * @param {String} event + * @return {Array} + * @api public + */ + + + Emitter.prototype.listeners = function (event) { + this._callbacks = this._callbacks || {}; + return this._callbacks['$' + event] || []; + }; + /** + * Check if this emitter has `event` handlers. + * + * @param {String} event + * @return {Boolean} + * @api public + */ + + + Emitter.prototype.hasListeners = function (event) { + return !!this.listeners(event).length; + }; + }); +>>>>>>> branch for npm and latest release + + exports.isAbsolute = function (url) { + return 0 == url.indexOf('//') || !!~url.indexOf('://'); + }; + /** + * Check if `url` is relative. + * + * @param {String} url + * @return {Boolean} + * @api public + */ + +<<<<<<< HEAD + + exports.isRelative = function (url) { + return !exports.isAbsolute(url); + }; + /** + * Check if `url` is cross domain. + * + * @param {String} url + * @return {Boolean} + * @api public + */ + + + exports.isCrossDomain = function (url) { + url = exports.parse(url); + var location = exports.parse(window.location.href); + return url.hostname !== location.hostname || url.port !== location.port || url.protocol !== location.protocol; + }; + /** + * Return default port for `protocol`. + * + * @param {String} protocol + * @return {String} + * @api private + */ +======= + function after(count, callback, err_cb) { + var bail = false; + err_cb = err_cb || noop; + proxy.count = count; + return count === 0 ? callback() : proxy; + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times'); + } + + --proxy.count; // after first error, rest are passed to err_cb + + if (err) { + bail = true; + callback(err); // future error callbacks will go to error handler + + callback = err_cb; + } else if (proxy.count === 0 && !bail) { + callback(null, result); + } + } + } +>>>>>>> branch for npm and latest release + + + function port(protocol) { + switch (protocol) { + case 'http:': + return 80; + + case 'https:': + return 443; + + default: + return location.port; + } + } + }); + var componentUrl_1 = componentUrl.parse; + var componentUrl_2 = componentUrl.isAbsolute; + var componentUrl_3 = componentUrl.isRelative; + var componentUrl_4 = componentUrl.isCrossDomain; + var componentUrl = createCommonjsModule(function (module, exports) { /** * Parse the given `url`. @@ -735,11 +991,15 @@ PRODUCT_REVIEWED: "Product Reviewed" }; // Enumeration for integrations supported +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; >>>>>>> update npm module +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; +>>>>>>> branch for npm and latest release var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -2103,7 +2363,11 @@ /** * toString ref. */ +<<<<<<< HEAD var toString$1 = Object.prototype.toString; +======= + var toString = Object.prototype.toString; +>>>>>>> branch for npm and latest release /** * Return the type of `val`. * @@ -2112,8 +2376,13 @@ * @api public */ +<<<<<<< HEAD var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { +======= + var componentType = function componentType(val) { + switch (toString.call(val)) { +>>>>>>> branch for npm and latest release case '[object Function]': return 'function'; @@ -3879,6 +4148,17 @@ for (var i = 0; i < n.length; i++) { n[i] = crypt.endian(n[i]); } +<<<<<<< HEAD + + return n; + }, + // Generate an array of any length of random bytes + randomBytes: function randomBytes(n) { + for (var bytes = []; n > 0; n--) { + bytes.push(Math.floor(Math.random() * 256)); + } + +======= return n; }, @@ -3888,6 +4168,7 @@ bytes.push(Math.floor(Math.random() * 256)); } +>>>>>>> branch for npm and latest release return bytes; }, // Convert a byte array to big-endian 32-bit words @@ -4592,6 +4873,27 @@ key = undefined; // if we found no matching properties // on the current object, there's no match. +<<<<<<< HEAD + + finished = true; + } + + if (!key) return; + if (null == obj) return obj; // the `obj` and `key` is one above the leaf object and key, so + // start object: { a: { 'b.c': 10 } } + // end object: { 'b.c': 10 } + // end key: 'b.c' + // this way, you can do `obj[key]` and get `10`. + + return fn(obj, key, val); + }; + } + /** + * Find an object by its key + * + * find({ first_name : 'Calvin' }, 'firstName') + */ +======= finished = true; } @@ -4612,7 +4914,18 @@ * find({ first_name : 'Calvin' }, 'firstName') */ +>>>>>>> branch for npm and latest release + + function find(obj, key) { + if (obj.hasOwnProperty(key)) return obj[key]; + } + /** + * Delete a value for a given key + * + * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } + */ +<<<<<<< HEAD function find(obj, key) { if (obj.hasOwnProperty(key)) return obj[key]; } @@ -4622,6 +4935,8 @@ * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } */ +======= +>>>>>>> branch for npm and latest release function del(obj, key) { if (obj.hasOwnProperty(key)) delete obj[key]; @@ -6191,6 +6506,7 @@ var core = createCommonjsModule(function (module, exports) { <<<<<<< HEAD +<<<<<<< HEAD ======= (function (root, factory) { { @@ -6944,4686 +7260,7554 @@ })); }); +======= +>>>>>>> branch for npm and latest release - var encBase64 = createCommonjsModule(function (module, exports) { - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - }(commonjsGlobal, function (CryptoJS) { + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(); + } + })(commonjsGlobal, function () { + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || function (Math, undefined$1) { + /* + * Local polyfil of Object.create + */ + var create = Object.create || function () { + function F() {} + return function (obj) { + var subtype; + F.prototype = obj; + subtype = new F(); + F.prototype = null; + return subtype; + }; + }(); + /** + * CryptoJS namespace. + */ - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var C_enc = C.enc; - /** - * Base64 encoding strategy. - */ - var Base64 = C_enc.Base64 = { - /** - * Converts a word array to a Base64 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Base64 string. - * - * @static - * - * @example - * - * var base64String = CryptoJS.enc.Base64.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - var map = this._map; + var C = {}; + /** + * Library namespace. + */ - // Clamp excess bits - wordArray.clamp(); + var C_lib = C.lib = {}; + /** + * Base object for prototypal inheritance. + */ - // Convert - var base64Chars = []; - for (var i = 0; i < sigBytes; i += 3) { - var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff; - var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff; + var Base = C_lib.Base = function () { + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function extend(overrides) { + // Spawn + var subtype = create(this); // Augment - var triplet = (byte1 << 16) | (byte2 << 8) | byte3; + if (overrides) { + subtype.mixIn(overrides); + } // Create default initializer - for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) { - base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f)); - } - } - // Add padding - var paddingChar = map.charAt(64); - if (paddingChar) { - while (base64Chars.length % 4) { - base64Chars.push(paddingChar); - } - } + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } // Initializer's prototype is the subtype object - return base64Chars.join(''); - }, - /** - * Converts a Base64 string to a word array. - * - * @param {string} base64Str The Base64 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Base64.parse(base64String); - */ - parse: function (base64Str) { - // Shortcuts - var base64StrLength = base64Str.length; - var map = this._map; - var reverseMap = this._reverseMap; - - if (!reverseMap) { - reverseMap = this._reverseMap = []; - for (var j = 0; j < map.length; j++) { - reverseMap[map.charCodeAt(j)] = j; - } - } + subtype.init.prototype = subtype; // Reference supertype - // Ignore padding - var paddingChar = map.charAt(64); - if (paddingChar) { - var paddingIndex = base64Str.indexOf(paddingChar); - if (paddingIndex !== -1) { - base64StrLength = paddingIndex; - } - } + subtype.$super = this; + return subtype; + }, - // Convert - return parseLoop(base64Str, base64StrLength, reverseMap); + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function create() { + var instance = this.extend(); + instance.init.apply(instance, arguments); + return instance; + }, - }, + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function init() {}, - _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' - }; + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function mixIn(properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } // IE won't copy toString using the loop above - function parseLoop(base64Str, base64StrLength, reverseMap) { - var words = []; - var nBytes = 0; - for (var i = 0; i < base64StrLength; i++) { - if (i % 4) { - var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2); - var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2); - words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8); - nBytes++; - } - } - return WordArray.create(words, nBytes); - } - }()); +<<<<<<< HEAD + /** + * toString ref. + */ +>>>>>>> update npm module + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(); + } + })(commonjsGlobal, function () { + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || function (Math, undefined$1) { + /* + * Local polyfil of Object.create + */ + var create = Object.create || function () { + function F() {} + return function (obj) { + var subtype; + F.prototype = obj; + subtype = new F(); + F.prototype = null; + return subtype; + }; + }(); + /** + * CryptoJS namespace. + */ - return CryptoJS.enc.Base64; - })); - }); + var C = {}; + /** + * Library namespace. + */ - var md5$1 = createCommonjsModule(function (module, exports) { - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - }(commonjsGlobal, function (CryptoJS) { - - (function (Math) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; - - // Constants table - var T = []; - - // Compute constants - (function () { - for (var i = 0; i < 64; i++) { - T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0; - } - }()); - - /** - * MD5 hash algorithm. - */ - var MD5 = C_algo.MD5 = Hasher.extend({ - _doReset: function () { - this._hash = new WordArray.init([ - 0x67452301, 0xefcdab89, - 0x98badcfe, 0x10325476 - ]); - }, - - _doProcessBlock: function (M, offset) { - // Swap endian - for (var i = 0; i < 16; i++) { - // Shortcuts - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - - M[offset_i] = ( - (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) | - (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00) - ); - } - - // Shortcuts - var H = this._hash.words; - - var M_offset_0 = M[offset + 0]; - var M_offset_1 = M[offset + 1]; - var M_offset_2 = M[offset + 2]; - var M_offset_3 = M[offset + 3]; - var M_offset_4 = M[offset + 4]; - var M_offset_5 = M[offset + 5]; - var M_offset_6 = M[offset + 6]; - var M_offset_7 = M[offset + 7]; - var M_offset_8 = M[offset + 8]; - var M_offset_9 = M[offset + 9]; - var M_offset_10 = M[offset + 10]; - var M_offset_11 = M[offset + 11]; - var M_offset_12 = M[offset + 12]; - var M_offset_13 = M[offset + 13]; - var M_offset_14 = M[offset + 14]; - var M_offset_15 = M[offset + 15]; - - // Working varialbes - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - - // Computation - a = FF(a, b, c, d, M_offset_0, 7, T[0]); - d = FF(d, a, b, c, M_offset_1, 12, T[1]); - c = FF(c, d, a, b, M_offset_2, 17, T[2]); - b = FF(b, c, d, a, M_offset_3, 22, T[3]); - a = FF(a, b, c, d, M_offset_4, 7, T[4]); - d = FF(d, a, b, c, M_offset_5, 12, T[5]); - c = FF(c, d, a, b, M_offset_6, 17, T[6]); - b = FF(b, c, d, a, M_offset_7, 22, T[7]); - a = FF(a, b, c, d, M_offset_8, 7, T[8]); - d = FF(d, a, b, c, M_offset_9, 12, T[9]); - c = FF(c, d, a, b, M_offset_10, 17, T[10]); - b = FF(b, c, d, a, M_offset_11, 22, T[11]); - a = FF(a, b, c, d, M_offset_12, 7, T[12]); - d = FF(d, a, b, c, M_offset_13, 12, T[13]); - c = FF(c, d, a, b, M_offset_14, 17, T[14]); - b = FF(b, c, d, a, M_offset_15, 22, T[15]); - - a = GG(a, b, c, d, M_offset_1, 5, T[16]); - d = GG(d, a, b, c, M_offset_6, 9, T[17]); - c = GG(c, d, a, b, M_offset_11, 14, T[18]); - b = GG(b, c, d, a, M_offset_0, 20, T[19]); - a = GG(a, b, c, d, M_offset_5, 5, T[20]); - d = GG(d, a, b, c, M_offset_10, 9, T[21]); - c = GG(c, d, a, b, M_offset_15, 14, T[22]); - b = GG(b, c, d, a, M_offset_4, 20, T[23]); - a = GG(a, b, c, d, M_offset_9, 5, T[24]); - d = GG(d, a, b, c, M_offset_14, 9, T[25]); - c = GG(c, d, a, b, M_offset_3, 14, T[26]); - b = GG(b, c, d, a, M_offset_8, 20, T[27]); - a = GG(a, b, c, d, M_offset_13, 5, T[28]); - d = GG(d, a, b, c, M_offset_2, 9, T[29]); - c = GG(c, d, a, b, M_offset_7, 14, T[30]); - b = GG(b, c, d, a, M_offset_12, 20, T[31]); - - a = HH(a, b, c, d, M_offset_5, 4, T[32]); - d = HH(d, a, b, c, M_offset_8, 11, T[33]); - c = HH(c, d, a, b, M_offset_11, 16, T[34]); - b = HH(b, c, d, a, M_offset_14, 23, T[35]); - a = HH(a, b, c, d, M_offset_1, 4, T[36]); - d = HH(d, a, b, c, M_offset_4, 11, T[37]); - c = HH(c, d, a, b, M_offset_7, 16, T[38]); - b = HH(b, c, d, a, M_offset_10, 23, T[39]); - a = HH(a, b, c, d, M_offset_13, 4, T[40]); - d = HH(d, a, b, c, M_offset_0, 11, T[41]); - c = HH(c, d, a, b, M_offset_3, 16, T[42]); - b = HH(b, c, d, a, M_offset_6, 23, T[43]); - a = HH(a, b, c, d, M_offset_9, 4, T[44]); - d = HH(d, a, b, c, M_offset_12, 11, T[45]); - c = HH(c, d, a, b, M_offset_15, 16, T[46]); - b = HH(b, c, d, a, M_offset_2, 23, T[47]); - - a = II(a, b, c, d, M_offset_0, 6, T[48]); - d = II(d, a, b, c, M_offset_7, 10, T[49]); - c = II(c, d, a, b, M_offset_14, 15, T[50]); - b = II(b, c, d, a, M_offset_5, 21, T[51]); - a = II(a, b, c, d, M_offset_12, 6, T[52]); - d = II(d, a, b, c, M_offset_3, 10, T[53]); - c = II(c, d, a, b, M_offset_10, 15, T[54]); - b = II(b, c, d, a, M_offset_1, 21, T[55]); - a = II(a, b, c, d, M_offset_8, 6, T[56]); - d = II(d, a, b, c, M_offset_15, 10, T[57]); - c = II(c, d, a, b, M_offset_6, 15, T[58]); - b = II(b, c, d, a, M_offset_13, 21, T[59]); - a = II(a, b, c, d, M_offset_4, 6, T[60]); - d = II(d, a, b, c, M_offset_11, 10, T[61]); - c = II(c, d, a, b, M_offset_2, 15, T[62]); - b = II(b, c, d, a, M_offset_9, 21, T[63]); - - // Intermediate hash value - H[0] = (H[0] + a) | 0; - H[1] = (H[1] + b) | 0; - H[2] = (H[2] + c) | 0; - H[3] = (H[3] + d) | 0; - }, + var C_lib = C.lib = {}; + /** + * Base object for prototypal inheritance. + */ - _doFinalize: function () { - // Shortcuts - var data = this._data; - var dataWords = data.words; + var Base = C_lib.Base = function () { + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function extend(overrides) { + // Spawn + var subtype = create(this); // Augment - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; + if (overrides) { + subtype.mixIn(overrides); + } // Create default initializer - // Add padding - dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); - var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); - var nBitsTotalL = nBitsTotal; - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = ( - (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) | - (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00) - ); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = ( - (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) | - (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00) - ); + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } // Initializer's prototype is the subtype object - data.sigBytes = (dataWords.length + 1) * 4; - // Hash final blocks - this._process(); + subtype.init.prototype = subtype; // Reference supertype - // Shortcuts - var hash = this._hash; - var H = hash.words; + subtype.$super = this; + return subtype; + }, - // Swap endian - for (var i = 0; i < 4; i++) { - // Shortcut - var H_i = H[i]; + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function create() { + var instance = this.extend(); + instance.init.apply(instance, arguments); + return instance; + }, - H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) | - (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00); - } + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function init() {}, - // Return final computed hash - return hash; - }, + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function mixIn(properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } // IE won't copy toString using the loop above +======= - clone: function () { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, - return clone; - } - }); + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function clone() { + return this.init.prototype.extend(this); + } + }; + }(); + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ - function FF(a, b, c, d, x, s, t) { - var n = a + ((b & c) | (~b & d)) + x + t; - return ((n << s) | (n >>> (32 - s))) + b; - } - function GG(a, b, c, d, x, s, t) { - var n = a + ((b & d) | (c & ~d)) + x + t; - return ((n << s) | (n >>> (32 - s))) + b; - } + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function init(words, sigBytes) { + words = this.words = words || []; - function HH(a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + x + t; - return ((n << s) | (n >>> (32 - s))) + b; - } + if (sigBytes != undefined$1) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, - function II(a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + x + t; - return ((n << s) | (n >>> (32 - s))) + b; - } + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function toString(encoder) { + return (encoder || Hex).stringify(this); + }, - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.MD5('message'); - * var hash = CryptoJS.MD5(wordArray); - */ - C.MD5 = Hasher._createHelper(MD5); + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function concat(wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; // Clamp excess bits - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacMD5(message, key); - */ - C.HmacMD5 = Hasher._createHmacHelper(MD5); - }(Math)); + this.clamp(); // Concat + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; + } + } else { + // Copy one word at a time + for (var i = 0; i < thatSigBytes; i += 4) { + thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; + } + } - return CryptoJS.MD5; + this.sigBytes += thatSigBytes; // Chainable - })); - }); + return this; + }, - var sha1 = createCommonjsModule(function (module, exports) { - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - }(commonjsGlobal, function (CryptoJS) { + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function clamp() { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; // Clamp - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; + words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; + words.length = Math.ceil(sigBytes / 4); + }, - // Reusable object - var W = []; + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + return clone; + }, - /** - * SHA-1 hash algorithm. - */ - var SHA1 = C_algo.SHA1 = Hasher.extend({ - _doReset: function () { - this._hash = new WordArray.init([ - 0x67452301, 0xefcdab89, - 0x98badcfe, 0x10325476, - 0xc3d2e1f0 - ]); - }, - - _doProcessBlock: function (M, offset) { - // Shortcut - var H = this._hash.words; - - // Working variables - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; - - // Computation - for (var i = 0; i < 80; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = (n << 1) | (n >>> 31); - } + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function random(nBytes) { + var words = []; - var t = ((a << 5) | (a >>> 27)) + e + W[i]; - if (i < 20) { - t += ((b & c) | (~b & d)) + 0x5a827999; - } else if (i < 40) { - t += (b ^ c ^ d) + 0x6ed9eba1; - } else if (i < 60) { - t += ((b & c) | (b & d) | (c & d)) - 0x70e44324; - } else /* if (i < 80) */ { - t += (b ^ c ^ d) - 0x359d3e2a; - } + var r = function r(m_w) { + var m_w = m_w; + var m_z = 0x3ade68b1; + var mask = 0xffffffff; + return function () { + m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; + m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; + var result = (m_z << 0x10) + m_w & mask; + result /= 0x100000000; + result += 0.5; + return result * (Math.random() > .5 ? 1 : -1); + }; + }; - e = d; - d = c; - c = (b << 30) | (b >>> 2); - b = a; - a = t; - } + for (var i = 0, rcache; i < nBytes; i += 4) { + var _r = r((rcache || Math.random()) * 0x100000000); - // Intermediate hash value - H[0] = (H[0] + a) | 0; - H[1] = (H[1] + b) | 0; - H[2] = (H[2] + c) | 0; - H[3] = (H[3] + d) | 0; - H[4] = (H[4] + e) | 0; - }, + rcache = _r() * 0x3ade67b7; + words.push(_r() * 0x100000000 | 0); + } - _doFinalize: function () { - // Shortcuts - var data = this._data; - var dataWords = data.words; + return new WordArray.init(words, nBytes); + } + }); + /** + * Encoder namespace. + */ - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; + var C_enc = C.enc = {}; + /** + * Hex encoding strategy. + */ - // Add padding - dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert - // Hash final blocks - this._process(); + var hexChars = []; - // Return final computed hash - return this._hash; - }, + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } - clone: function () { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); + return hexChars.join(''); + }, - return clone; - } - }); + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function parse(hexStr) { + // Shortcut + var hexStrLength = hexStr.length; // Convert - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA1('message'); - * var hash = CryptoJS.SHA1(wordArray); - */ - C.SHA1 = Hasher._createHelper(SHA1); + var words = []; - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA1(message, key); - */ - C.HmacSHA1 = Hasher._createHmacHelper(SHA1); - }()); + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; + } + return new WordArray.init(words, hexStrLength / 2); + } + }; + /** + * Latin1 encoding strategy. + */ - return CryptoJS.SHA1; + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert - })); - }); + var latin1Chars = []; - var hmac = createCommonjsModule(function (module, exports) { - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - }(commonjsGlobal, function (CryptoJS) { + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var C_algo = C.algo; + return latin1Chars.join(''); + }, - /** - * HMAC algorithm. - */ - var HMAC = C_algo.HMAC = Base.extend({ - /** - * Initializes a newly created HMAC. - * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. - * - * @example - * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); - */ - init: function (hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function parse(latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; // Convert - // Convert string to WordArray, else assume WordArray already - if (typeof key == 'string') { - key = Utf8.parse(key); - } + var words = []; - // Shortcuts - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; + } - // Allow arbitrary length keys - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } + return new WordArray.init(words, latin1StrLength); + } + }; + /** + * UTF-8 encoding strategy. + */ - // Clamp excess bits - key.clamp(); + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, - // Clone key for inner and outer pads - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function parse(utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ - // Shortcuts - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function reset() { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, - // XOR keys with pad constants - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function _append(data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } // Append - // Set initial values - this.reset(); - }, - /** - * Resets this HMAC to its initial state. - * - * @example - * - * hmacHasher.reset(); - */ - reset: function () { - // Shortcut - var hasher = this._hasher; + this._data.concat(data); - // Reset - hasher.reset(); - hasher.update(this._iKey); - }, + this._nDataBytes += data.sigBytes; + }, - /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {HMAC} This HMAC instance. - * - * @example - * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); - */ - update: function (messageUpdate) { - this._hasher.update(messageUpdate); + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function _process(doFlush) { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; // Count blocks ready - // Chainable - return this; - }, + var nBlocksReady = dataSigBytes / blockSizeBytes; - /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. - * - * @example - * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); - */ - finalize: function (messageUpdate) { - // Shortcut - var hasher = this._hasher; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } // Count words ready - // Compute HMAC - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - return hmac; - } - }); - }()); + var nWordsReady = nBlocksReady * blockSize; // Count bytes ready + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks - })); - }); + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } // Remove processed words - var evpkdf = createCommonjsModule(function (module, exports) { - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, sha1, hmac); - } - }(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var C_algo = C.algo; - var MD5 = C_algo.MD5; + var processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } // Return processed words - /** - * This key derivation function is meant to conform with EVP_BytesToKey. - * www.openssl.org/docs/crypto/EVP_BytesToKey.html - */ - var EvpKDF = C_algo.EvpKDF = Base.extend({ - /** - * Configuration options. - * - * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) - * @property {Hasher} hasher The hash algorithm to use. Default: MD5 - * @property {number} iterations The number of iterations to perform. Default: 1 - */ - cfg: Base.extend({ - keySize: 128/32, - hasher: MD5, - iterations: 1 - }), - /** - * Initializes a newly created key derivation function. - * - * @param {Object} cfg (Optional) The configuration options to use for the derivation. - * - * @example - * - * var kdf = CryptoJS.algo.EvpKDF.create(); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); - */ - init: function (cfg) { - this.cfg = this.cfg.extend(cfg); - }, + return new WordArray.init(processedWords, nBytesReady); + }, - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * - * @return {WordArray} The derived key. - * - * @example - * - * var key = kdf.compute(password, salt); - */ - compute: function (password, salt) { - // Shortcut - var cfg = this.cfg; + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + return clone; + }, + _minBufferSize: 0 + }); + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ - // Init hasher - var hasher = cfg.hasher.create(); + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), - // Initial values - var derivedKey = WordArray.create(); + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function init(cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Set initial values - // Shortcuts - var derivedKeyWords = derivedKey.words; - var keySize = cfg.keySize; - var iterations = cfg.iterations; - - // Generate key - while (derivedKeyWords.length < keySize) { - if (block) { - hasher.update(block); - } - var block = hasher.update(password).finalize(salt); - hasher.reset(); + this.reset(); + }, - // Iterations - for (var i = 1; i < iterations; i++) { - block = hasher.finalize(block); - hasher.reset(); - } + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic - derivedKey.concat(block); - } - derivedKey.sigBytes = keySize * 4; + this._doReset(); + }, - return derivedKey; - } - }); + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function update(messageUpdate) { + // Append + this._append(messageUpdate); // Update the hash - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * @param {Object} cfg (Optional) The configuration options to use for this computation. - * - * @return {WordArray} The derived key. - * - * @static - * - * @example - * - * var key = CryptoJS.EvpKDF(password, salt); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); - */ - C.EvpKDF = function (password, salt, cfg) { - return EvpKDF.create(cfg).compute(password, salt); - }; - }()); + this._process(); // Chainable - return CryptoJS.EvpKDF; - })); - }); + return this; + }, - var cipherCore = createCommonjsModule(function (module, exports) { - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, evpkdf); - } - }(commonjsGlobal, function (CryptoJS) { + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } // Perform concrete-hasher logic - /** - * Cipher core components. - */ - CryptoJS.lib.Cipher || (function (undefined$1) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var Base64 = C_enc.Base64; - var C_algo = C.algo; - var EvpKDF = C_algo.EvpKDF; - /** - * Abstract base cipher template. - * - * @property {number} keySize This cipher's key size. Default: 4 (128 bits) - * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) - * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. - * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. - */ - var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - * - * @property {WordArray} iv The IV to use for this operation. - */ - cfg: Base.extend(), + var hash = this._doFinalize(); - /** - * Creates this cipher in encryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); - */ - createEncryptor: function (key, cfg) { - return this.create(this._ENC_XFORM_MODE, key, cfg); - }, - - /** - * Creates this cipher in decryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); - */ - createDecryptor: function (key, cfg) { - return this.create(this._DEC_XFORM_MODE, key, cfg); - }, - - /** - * Initializes a newly created cipher. - * - * @param {number} xformMode Either the encryption or decryption transormation mode constant. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @example - * - * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); - */ - init: function (xformMode, key, cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); - - // Store transform mode and key - this._xformMode = xformMode; - this._key = key; + return hash; + }, + blockSize: 512 / 32, - // Set initial values - this.reset(); - }, + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function _createHelper(hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, - /** - * Resets this cipher to its initial state. - * - * @example - * - * cipher.reset(); - */ - reset: function () { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function _createHmacHelper(hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + /** + * Algorithm namespace. + */ +>>>>>>> branch for npm and latest release - // Perform concrete-cipher logic - this._doReset(); - }, + var C_algo = C.algo = {}; + return C; + }(Math); - /** - * Adds data to be encrypted or decrypted. - * - * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. - * - * @return {WordArray} The data after processing. - * - * @example - * - * var encrypted = cipher.process('data'); - * var encrypted = cipher.process(wordArray); - */ - process: function (dataUpdate) { - // Append - this._append(dataUpdate); +<<<<<<< HEAD + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, - // Process available blocks - return this._process(); - }, + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function clone() { + return this.init.prototype.extend(this); + } + }; + }(); + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ - /** - * Finalizes the encryption or decryption process. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. - * - * @return {WordArray} The data after final processing. - * - * @example - * - * var encrypted = cipher.finalize(); - * var encrypted = cipher.finalize('data'); - * var encrypted = cipher.finalize(wordArray); - */ - finalize: function (dataUpdate) { - // Final data update - if (dataUpdate) { - this._append(dataUpdate); - } - // Perform concrete-cipher logic - var finalProcessedData = this._doFinalize(); + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function init(words, sigBytes) { + words = this.words = words || []; - return finalProcessedData; - }, + if (sigBytes != undefined$1) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, - keySize: 128/32, + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function toString(encoder) { + return (encoder || Hex).stringify(this); + }, - ivSize: 128/32, + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function concat(wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; // Clamp excess bits - _ENC_XFORM_MODE: 1, + this.clamp(); // Concat - _DEC_XFORM_MODE: 2, + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; + } + } else { + // Copy one word at a time + for (var i = 0; i < thatSigBytes; i += 4) { + thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; + } + } - /** - * Creates shortcut functions to a cipher's object interface. - * - * @param {Cipher} cipher The cipher to create a helper for. - * - * @return {Object} An object with encrypt and decrypt shortcut functions. - * - * @static - * - * @example - * - * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); - */ - _createHelper: (function () { - function selectCipherStrategy(key) { - if (typeof key == 'string') { - return PasswordBasedCipher; - } else { - return SerializableCipher; - } - } + this.sigBytes += thatSigBytes; // Chainable - return function (cipher) { - return { - encrypt: function (message, key, cfg) { - return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); - }, + return this; + }, - decrypt: function (ciphertext, key, cfg) { - return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); - } - }; - }; - }()) - }); + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function clamp() { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; // Clamp - /** - * Abstract base stream cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) - */ - var StreamCipher = C_lib.StreamCipher = Cipher.extend({ - _doFinalize: function () { - // Process partial blocks - var finalProcessedBlocks = this._process(!!'flush'); + words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; + words.length = Math.ceil(sigBytes / 4); + }, - return finalProcessedBlocks; - }, + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + return clone; + }, - blockSize: 1 - }); + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. +======= + return CryptoJS; + }); + }); - /** - * Mode namespace. - */ - var C_mode = C.mode = {}; + var encBase64 = createCommonjsModule(function (module, exports) { - /** - * Abstract base block cipher mode template. - */ - var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ - /** - * Creates this mode for encryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); - */ - createEncryptor: function (cipher, iv) { - return this.Encryptor.create(cipher, iv); - }, - - /** - * Creates this mode for decryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); - */ - createDecryptor: function (cipher, iv) { - return this.Decryptor.create(cipher, iv); - }, + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + /** + * Base64 encoding strategy. + */ - /** - * Initializes a newly created mode. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @example - * - * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); - */ - init: function (cipher, iv) { - this._cipher = cipher; - this._iv = iv; - } - }); + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. +>>>>>>> branch for npm and latest release + * + * @static + * + * @example + * +<<<<<<< HEAD + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function random(nBytes) { + var words = []; - /** - * Cipher Block Chaining mode. - */ - var CBC = C_mode.CBC = (function () { - /** - * Abstract base CBC mode. - */ - var CBC = BlockCipherMode.extend(); + var r = function r(m_w) { + var m_w = m_w; + var m_z = 0x3ade68b1; + var mask = 0xffffffff; + return function () { + m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; + m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; + var result = (m_z << 0x10) + m_w & mask; + result /= 0x100000000; + result += 0.5; + return result * (Math.random() > .5 ? 1 : -1); + }; + }; - /** - * CBC encryptor. - */ - CBC.Encryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function (words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; + for (var i = 0, rcache; i < nBytes; i += 4) { + var _r = r((rcache || Math.random()) * 0x100000000); - // XOR and encrypt - xorBlock.call(this, words, offset, blockSize); - cipher.encryptBlock(words, offset); + rcache = _r() * 0x3ade67b7; + words.push(_r() * 0x100000000 | 0); + } - // Remember this block to use with next block - this._prevBlock = words.slice(offset, offset + blockSize); - } - }); + return new WordArray.init(words, nBytes); + } + }); + /** + * Encoder namespace. + */ - /** - * CBC decryptor. - */ - CBC.Decryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function (words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; + var C_enc = C.enc = {}; + /** + * Hex encoding strategy. + */ - // Remember this block to use with next block - var thisBlock = words.slice(offset, offset + blockSize); + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert - // Decrypt and XOR - cipher.decryptBlock(words, offset); - xorBlock.call(this, words, offset, blockSize); + var hexChars = []; - // This block becomes the previous block - this._prevBlock = thisBlock; - } - }); + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } - function xorBlock(words, offset, blockSize) { - // Shortcut - var iv = this._iv; + return hexChars.join(''); + }, - // Choose mixing block - if (iv) { - var block = iv; + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. +======= + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; // Clamp excess bits - // Remove IV for subsequent blocks - this._iv = undefined$1; - } else { - var block = this._prevBlock; - } + wordArray.clamp(); // Convert - // XOR blocks - for (var i = 0; i < blockSize; i++) { - words[offset + i] ^= block[i]; - } - } + var base64Chars = []; - return CBC; - }()); + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; + var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; + var triplet = byte1 << 16 | byte2 << 8 | byte3; - /** - * Padding namespace. - */ - var C_pad = C.pad = {}; + for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { + base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); + } + } // Add padding - /** - * PKCS #5/7 padding strategy. - */ - var Pkcs7 = C_pad.Pkcs7 = { - /** - * Pads data using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to pad. - * @param {number} blockSize The multiple that the data should be padded to. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.pad(wordArray, 4); - */ - pad: function (data, blockSize) { - // Shortcut - var blockSizeBytes = blockSize * 4; - // Count padding bytes - var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; + var paddingChar = map.charAt(64); - // Create padding word - var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes; + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } - // Create padding - var paddingWords = []; - for (var i = 0; i < nPaddingBytes; i += 4) { - paddingWords.push(paddingWord); - } - var padding = WordArray.create(paddingWords, nPaddingBytes); + return base64Chars.join(''); + }, - // Add padding - data.concat(padding); - }, + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. +>>>>>>> branch for npm and latest release + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * +<<<<<<< HEAD + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function parse(hexStr) { + // Shortcut + var hexStrLength = hexStr.length; // Convert - /** - * Unpads data that had been padded using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to unpad. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.unpad(wordArray); - */ - unpad: function (data) { - // Get number of padding bytes from last byte - var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff; + var words = []; - // Remove padding - data.sigBytes -= nPaddingBytes; - } - }; + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; + } - /** - * Abstract base block cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) - */ - var BlockCipher = C_lib.BlockCipher = Cipher.extend({ - /** - * Configuration options. - * - * @property {Mode} mode The block mode to use. Default: CBC - * @property {Padding} padding The padding strategy to use. Default: Pkcs7 - */ - cfg: Cipher.cfg.extend({ - mode: CBC, - padding: Pkcs7 - }), + return new WordArray.init(words, hexStrLength / 2); + } + }; + /** + * Latin1 encoding strategy. + */ - reset: function () { - // Reset cipher - Cipher.reset.call(this); + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert - // Shortcuts - var cfg = this.cfg; - var iv = cfg.iv; - var mode = cfg.mode; - - // Reset block mode - if (this._xformMode == this._ENC_XFORM_MODE) { - var modeCreator = mode.createEncryptor; - } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { - var modeCreator = mode.createDecryptor; - // Keep at least one block in the buffer for unpadding - this._minBufferSize = 1; - } + var latin1Chars = []; - if (this._mode && this._mode.__creator == modeCreator) { - this._mode.init(this, iv && iv.words); - } else { - this._mode = modeCreator.call(mode, this, iv && iv.words); - this._mode.__creator = modeCreator; - } - }, + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } - _doProcessBlock: function (words, offset) { - this._mode.processBlock(words, offset); - }, + return latin1Chars.join(''); + }, - _doFinalize: function () { - // Shortcut - var padding = this.cfg.padding; + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function parse(latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; // Convert - // Finalize - if (this._xformMode == this._ENC_XFORM_MODE) { - // Pad data - padding.pad(this._data, this.blockSize); + var words = []; - // Process final blocks - var finalProcessedBlocks = this._process(!!'flush'); - } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ { - // Process final blocks - var finalProcessedBlocks = this._process(!!'flush'); + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; + } - // Unpad data - padding.unpad(finalProcessedBlocks); - } + return new WordArray.init(words, latin1StrLength); + } + }; + /** + * UTF-8 encoding strategy. + */ - return finalProcessedBlocks; - }, + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, - blockSize: 128/32 - }); + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function parse(utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ - /** - * A collection of cipher parameters. - * - * @property {WordArray} ciphertext The raw ciphertext. - * @property {WordArray} key The key to this ciphertext. - * @property {WordArray} iv The IV used in the ciphering operation. - * @property {WordArray} salt The salt used with a key derivation function. - * @property {Cipher} algorithm The cipher algorithm. - * @property {Mode} mode The block mode used in the ciphering operation. - * @property {Padding} padding The padding scheme used in the ciphering operation. - * @property {number} blockSize The block size of the cipher. - * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. - */ - var CipherParams = C_lib.CipherParams = Base.extend({ - /** - * Initializes a newly created cipher params object. - * - * @param {Object} cipherParams An object with any of the possible cipher parameters. - * - * @example - * - * var cipherParams = CryptoJS.lib.CipherParams.create({ - * ciphertext: ciphertextWordArray, - * key: keyWordArray, - * iv: ivWordArray, - * salt: saltWordArray, - * algorithm: CryptoJS.algo.AES, - * mode: CryptoJS.mode.CBC, - * padding: CryptoJS.pad.PKCS7, - * blockSize: 4, - * formatter: CryptoJS.format.OpenSSL - * }); - */ - init: function (cipherParams) { - this.mixIn(cipherParams); - }, + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function reset() { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, - /** - * Converts this cipher params object to a string. - * - * @param {Format} formatter (Optional) The formatting strategy to use. - * - * @return {string} The stringified cipher params. - * - * @throws Error If neither the formatter nor the default formatter is set. - * - * @example - * - * var string = cipherParams + ''; - * var string = cipherParams.toString(); - * var string = cipherParams.toString(CryptoJS.format.OpenSSL); - */ - toString: function (formatter) { - return (formatter || this.formatter).stringify(this); - } - }); + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function _append(data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } // Append - /** - * Format namespace. - */ - var C_format = C.format = {}; - /** - * OpenSSL formatting strategy. - */ - var OpenSSLFormatter = C_format.OpenSSL = { - /** - * Converts a cipher params object to an OpenSSL-compatible string. - * - * @param {CipherParams} cipherParams The cipher params object. - * - * @return {string} The OpenSSL-compatible string. - * - * @static - * - * @example - * - * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); - */ - stringify: function (cipherParams) { - // Shortcuts - var ciphertext = cipherParams.ciphertext; - var salt = cipherParams.salt; + this._data.concat(data); - // Format - if (salt) { - var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); - } else { - var wordArray = ciphertext; - } + this._nDataBytes += data.sigBytes; + }, - return wordArray.toString(Base64); - }, + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function _process(doFlush) { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; // Count blocks ready - /** - * Converts an OpenSSL-compatible string to a cipher params object. - * - * @param {string} openSSLStr The OpenSSL-compatible string. - * - * @return {CipherParams} The cipher params object. - * - * @static - * - * @example - * - * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); - */ - parse: function (openSSLStr) { - // Parse base64 - var ciphertext = Base64.parse(openSSLStr); + var nBlocksReady = dataSigBytes / blockSizeBytes; - // Shortcut - var ciphertextWords = ciphertext.words; + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } // Count words ready - // Test for salt - if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { - // Extract salt - var salt = WordArray.create(ciphertextWords.slice(2, 4)); - // Remove salt from ciphertext - ciphertextWords.splice(0, 4); - ciphertext.sigBytes -= 16; - } + var nWordsReady = nBlocksReady * blockSize; // Count bytes ready - return CipherParams.create({ ciphertext: ciphertext, salt: salt }); - } - }; + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks - /** - * A cipher wrapper that returns ciphertext as a serializable cipher params object. - */ - var SerializableCipher = C_lib.SerializableCipher = Base.extend({ - /** - * Configuration options. - * - * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL - */ - cfg: Base.extend({ - format: OpenSSLFormatter - }), + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } // Remove processed words - /** - * Encrypts a message. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - encrypt: function (cipher, message, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); - // Encrypt - var encryptor = cipher.createEncryptor(key, cfg); - var ciphertext = encryptor.finalize(message); + var processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } // Return processed words - // Shortcut - var cipherCfg = encryptor.cfg; - - // Create and return serializable cipher params - return CipherParams.create({ - ciphertext: ciphertext, - key: key, - iv: cipherCfg.iv, - algorithm: cipher, - mode: cipherCfg.mode, - padding: cipherCfg.padding, - blockSize: cipher.blockSize, - formatter: cfg.format - }); - }, - /** - * Decrypts serialized ciphertext. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - decrypt: function (cipher, ciphertext, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); + return new WordArray.init(processedWords, nBytesReady); + }, - // Convert string to CipherParams - ciphertext = this._parse(ciphertext, cfg.format); + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + return clone; + }, + _minBufferSize: 0 + }); + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ - // Decrypt - var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); - - return plaintext; - }, - - /** - * Converts serialized ciphertext to CipherParams, - * else assumed CipherParams already and returns ciphertext unchanged. - * - * @param {CipherParams|string} ciphertext The ciphertext. - * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. - * - * @return {CipherParams} The unserialized ciphertext. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); - */ - _parse: function (ciphertext, format) { - if (typeof ciphertext == 'string') { - return format.parse(ciphertext, this); - } else { - return ciphertext; - } - } - }); - - /** - * Key derivation function namespace. - */ - var C_kdf = C.kdf = {}; - - /** - * OpenSSL key derivation function. - */ - var OpenSSLKdf = C_kdf.OpenSSL = { - /** - * Derives a key and IV from a password. - * - * @param {string} password The password to derive from. - * @param {number} keySize The size in words of the key to generate. - * @param {number} ivSize The size in words of the IV to generate. - * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. - * - * @return {CipherParams} A cipher params object with the key, IV, and salt. - * - * @static - * - * @example - * - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); - */ - execute: function (password, keySize, ivSize, salt) { - // Generate random salt - if (!salt) { - salt = WordArray.random(64/8); - } - - // Derive key and IV - var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt); + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), - // Separate key and IV - var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); - key.sigBytes = keySize * 4; + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function init(cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Set initial values - // Return params - return CipherParams.create({ key: key, iv: iv, salt: salt }); - } - }; + this.reset(); + }, - /** - * A serializable cipher wrapper that derives the key from a password, - * and returns ciphertext as a serializable cipher params object. - */ - var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ - /** - * Configuration options. - * - * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL - */ - cfg: SerializableCipher.cfg.extend({ - kdf: OpenSSLKdf - }), + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic - /** - * Encrypts a message using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); - */ - encrypt: function (cipher, message, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); + this._doReset(); + }, - // Derive key and other params - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function update(messageUpdate) { + // Append + this._append(messageUpdate); // Update the hash - // Add IV to config - cfg.iv = derivedParams.iv; - // Encrypt - var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); + this._process(); // Chainable - // Mix in derived params - ciphertext.mixIn(derivedParams); - return ciphertext; - }, + return this; + }, - /** - * Decrypts serialized ciphertext using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); - */ - decrypt: function (cipher, ciphertext, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } // Perform concrete-hasher logic - // Convert string to CipherParams - ciphertext = this._parse(ciphertext, cfg.format); - // Derive key and other params - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); + var hash = this._doFinalize(); - // Add IV to config - cfg.iv = derivedParams.iv; + return hash; + }, + blockSize: 512 / 32, - // Decrypt - var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function _createHelper(hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, - return plaintext; - } - }); - }()); + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function _createHmacHelper(hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + /** + * Algorithm namespace. + */ + var C_algo = C.algo = {}; + return C; + }(Math); - })); + return CryptoJS; + }); }); - var aes = createCommonjsModule(function (module, exports) { - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); - } - }(commonjsGlobal, function (CryptoJS) { - - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var BlockCipher = C_lib.BlockCipher; - var C_algo = C.algo; - - // Lookup tables - var SBOX = []; - var INV_SBOX = []; - var SUB_MIX_0 = []; - var SUB_MIX_1 = []; - var SUB_MIX_2 = []; - var SUB_MIX_3 = []; - var INV_SUB_MIX_0 = []; - var INV_SUB_MIX_1 = []; - var INV_SUB_MIX_2 = []; - var INV_SUB_MIX_3 = []; - - // Compute lookup tables - (function () { - // Compute double table - var d = []; - for (var i = 0; i < 256; i++) { - if (i < 128) { - d[i] = i << 1; - } else { - d[i] = (i << 1) ^ 0x11b; - } - } - - // Walk GF(2^8) - var x = 0; - var xi = 0; - for (var i = 0; i < 256; i++) { - // Compute sbox - var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4); - sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63; - SBOX[x] = sx; - INV_SBOX[sx] = x; - - // Compute multiplication - var x2 = d[x]; - var x4 = d[x2]; - var x8 = d[x4]; - - // Compute sub bytes, mix columns tables - var t = (d[sx] * 0x101) ^ (sx * 0x1010100); - SUB_MIX_0[x] = (t << 24) | (t >>> 8); - SUB_MIX_1[x] = (t << 16) | (t >>> 16); - SUB_MIX_2[x] = (t << 8) | (t >>> 24); - SUB_MIX_3[x] = t; - - // Compute inv sub bytes, inv mix columns tables - var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100); - INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8); - INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16); - INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24); - INV_SUB_MIX_3[sx] = t; - - // Compute next counter - if (!x) { - x = xi = 1; - } else { - x = x2 ^ d[d[d[x8 ^ x2]]]; - xi ^= d[d[xi]]; - } - } - }()); + var encBase64 = createCommonjsModule(function (module, exports) { - // Precomputed Rcon lookup - var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; +======= + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function parse(base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; - /** - * AES block cipher algorithm. - */ - var AES = C_algo.AES = BlockCipher.extend({ - _doReset: function () { - // Skip reset of nRounds has been set before and key did not change - if (this._nRounds && this._keyPriorReset === this._key) { - return; - } + if (!reverseMap) { + reverseMap = this._reverseMap = []; - // Shortcuts - var key = this._keyPriorReset = this._key; - var keyWords = key.words; - var keySize = key.sigBytes / 4; - - // Compute number of rounds - var nRounds = this._nRounds = keySize + 6; - - // Compute number of key schedule rows - var ksRows = (nRounds + 1) * 4; - - // Compute key schedule - var keySchedule = this._keySchedule = []; - for (var ksRow = 0; ksRow < ksRows; ksRow++) { - if (ksRow < keySize) { - keySchedule[ksRow] = keyWords[ksRow]; - } else { - var t = keySchedule[ksRow - 1]; - - if (!(ksRow % keySize)) { - // Rot word - t = (t << 8) | (t >>> 24); - - // Sub word - t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; - - // Mix Rcon - t ^= RCON[(ksRow / keySize) | 0] << 24; - } else if (keySize > 6 && ksRow % keySize == 4) { - // Sub word - t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff]; - } + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } // Ignore padding - keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; - } - } - // Compute inv key schedule - var invKeySchedule = this._invKeySchedule = []; - for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { - var ksRow = ksRows - invKsRow; + var paddingChar = map.charAt(64); - if (invKsRow % 4) { - var t = keySchedule[ksRow]; - } else { - var t = keySchedule[ksRow - 4]; - } + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); - if (invKsRow < 4 || ksRow <= 4) { - invKeySchedule[invKsRow] = t; - } else { - invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^ - INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; - } - } - }, + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } // Convert - encryptBlock: function (M, offset) { - this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); - }, - decryptBlock: function (M, offset) { - // Swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; + return parseLoop(base64Str, base64StrLength, reverseMap); + }, + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; - this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; - // Inv swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - }, + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; + words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; + nBytes++; + } + } - _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { - // Shortcut - var nRounds = this._nRounds; - - // Get input, add round key - var s0 = M[offset] ^ keySchedule[0]; - var s1 = M[offset + 1] ^ keySchedule[1]; - var s2 = M[offset + 2] ^ keySchedule[2]; - var s3 = M[offset + 3] ^ keySchedule[3]; - - // Key schedule row counter - var ksRow = 4; - - // Rounds - for (var round = 1; round < nRounds; round++) { - // Shift rows, sub bytes, mix columns, add round key - var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; - var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; - var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; - var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; - - // Update state - s0 = t0; - s1 = t1; - s2 = t2; - s3 = t3; - } + return WordArray.create(words, nBytes); + } + })(); - // Shift rows, sub bytes, add round key - var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; - var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; - var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; - var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; - - // Set output - M[offset] = t0; - M[offset + 1] = t1; - M[offset + 2] = t2; - M[offset + 3] = t3; - }, + return CryptoJS.enc.Base64; + }); + }); - keySize: 256/32 - }); + var md5$1 = createCommonjsModule(function (module, exports) { - /** - * Shortcut functions to the cipher's object interface. - * - * @example - * - * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); - * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); - */ - C.AES = BlockCipher._createHelper(AES); - }()); + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Constants table + + var T = []; // Compute constants + + (function () { + for (var i = 0; i < 64; i++) { + T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; + } + })(); + /** + * MD5 hash algorithm. + */ + + + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; + } // Shortcuts + + + var H = this._hash.words; + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; // Working varialbes + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; // Computation + + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; + data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + + this._process(); // Shortcuts + + + var hash = this._hash; + var H = hash.words; // Swap endian + + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; + } // Return final computed hash + + + return hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return (n << s | n >>> 32 - s) + b; + } + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + + + C.MD5 = Hasher._createHelper(MD5); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + + C.HmacMD5 = Hasher._createHmacHelper(MD5); + })(Math); + + return CryptoJS.MD5; + }); + }); + + var sha1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Reusable object + + var W = []; + /** + * SHA-1 hash algorithm. + */ + + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Shortcut + var H = this._hash.words; // Working variables + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; // Computation + + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = n << 1 | n >>> 31; + } + + var t = (a << 5 | a >>> 27) + e + W[i]; + + if (i < 20) { + t += (b & c | ~b & d) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += (b & c | b & d | c & d) - 0x70e44324; + } else + /* if (i < 80) */ + { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = b << 30 | b >>> 2; + b = a; + a = t; + } // Intermediate hash value + + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + H[4] = H[4] + e | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; // Hash final blocks + + this._process(); // Return final computed hash + + + return this._hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + + C.SHA1 = Hasher._createHelper(SHA1); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + })(); + + return CryptoJS.SHA1; + }); + }); + + var hmac = createCommonjsModule(function (module, exports) { + +>>>>>>> branch for npm and latest release + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; +<<<<<<< HEAD + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + /** + * Base64 encoding strategy. + */ + + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. +======= + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + /** + * HMAC algorithm. + */ + + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function init(hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already + + if (typeof key == 'string') { + key = Utf8.parse(key); + } // Shortcuts + + + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys + + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } // Clamp excess bits + + + key.clamp(); // Clone key for inner and outer pads + + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); // Shortcuts + + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; // XOR keys with pad constants + + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function reset() { + // Shortcut + var hasher = this._hasher; // Reset + + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function update(messageUpdate) { + this._hasher.update(messageUpdate); // Chainable + + + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Shortcut + var hasher = this._hasher; // Compute HMAC + + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + return hmac; + } + }); + })(); + }); + }); + + var evpkdf = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, sha1, hmac); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128 / 32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function init(cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function compute(password, salt) { + // Shortcut + var cfg = this.cfg; // Init hasher + + var hasher = cfg.hasher.create(); // Initial values + + var derivedKey = WordArray.create(); // Shortcuts + + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; // Generate key + + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + + var block = hasher.update(password).finalize(salt); + hasher.reset(); // Iterations + + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + + derivedKey.sigBytes = keySize * 4; + return derivedKey; + } + }); + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + })(); + + return CryptoJS.EvpKDF; + }); + }); + + var cipherCore = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, evpkdf); + } + })(commonjsGlobal, function (CryptoJS) { + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || function (undefined$1) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. +>>>>>>> branch for npm and latest release + * + * @static + * + * @example + * +<<<<<<< HEAD + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; // Clamp excess bits + + wordArray.clamp(); // Convert + + var base64Chars = []; + + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; + var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; + var triplet = byte1 << 16 | byte2 << 8 | byte3; + + for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { + base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); + } + } // Add padding + + + var paddingChar = map.charAt(64); + + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function parse(base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } // Ignore padding + + + var paddingChar = map.charAt(64); + + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } // Convert + + + return parseLoop(base64Str, base64StrLength, reverseMap); + }, + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; + words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; + nBytes++; + } + } + + return WordArray.create(words, nBytes); + } + })(); + + return CryptoJS.enc.Base64; + }); + }); + + var md5$1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Constants table + + var T = []; // Compute constants + + (function () { + for (var i = 0; i < 64; i++) { + T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; + } + })(); + /** + * MD5 hash algorithm. + */ + + + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; + } // Shortcuts + + + var H = this._hash.words; + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; // Working varialbes + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; // Computation + + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; + data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + + this._process(); // Shortcuts + + + var hash = this._hash; + var H = hash.words; // Swap endian + + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; + } // Return final computed hash + + + return hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return (n << s | n >>> 32 - s) + b; + } + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + + + C.MD5 = Hasher._createHelper(MD5); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + + C.HmacMD5 = Hasher._createHmacHelper(MD5); + })(Math); + + return CryptoJS.MD5; + }); + }); + + var sha1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Reusable object + + var W = []; + /** + * SHA-1 hash algorithm. + */ + + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Shortcut + var H = this._hash.words; // Working variables + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; // Computation + + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = n << 1 | n >>> 31; + } + + var t = (a << 5 | a >>> 27) + e + W[i]; + + if (i < 20) { + t += (b & c | ~b & d) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += (b & c | b & d | c & d) - 0x70e44324; + } else + /* if (i < 80) */ + { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = b << 30 | b >>> 2; + b = a; + a = t; + } // Intermediate hash value + + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + H[4] = H[4] + e | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; // Hash final blocks + + this._process(); // Return final computed hash + + + return this._hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + + C.SHA1 = Hasher._createHelper(SHA1); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + })(); + + return CryptoJS.SHA1; + }); + }); + + var hmac = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + /** + * HMAC algorithm. + */ + + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function init(hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already + + if (typeof key == 'string') { + key = Utf8.parse(key); + } // Shortcuts + + + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys + + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } // Clamp excess bits + + + key.clamp(); // Clone key for inner and outer pads + + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); // Shortcuts + + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; // XOR keys with pad constants + + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function reset() { + // Shortcut + var hasher = this._hasher; // Reset + + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function update(messageUpdate) { + this._hasher.update(messageUpdate); // Chainable + + + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Shortcut + var hasher = this._hasher; // Compute HMAC + + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + return hmac; + } + }); + })(); + }); + }); + + var evpkdf = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, sha1, hmac); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128 / 32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function init(cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function compute(password, salt) { + // Shortcut + var cfg = this.cfg; // Init hasher + + var hasher = cfg.hasher.create(); // Initial values + + var derivedKey = WordArray.create(); // Shortcuts + + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; // Generate key + + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + + var block = hasher.update(password).finalize(salt); + hasher.reset(); // Iterations + + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + + derivedKey.sigBytes = keySize * 4; + return derivedKey; + } + }); + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + })(); + + return CryptoJS.EvpKDF; + }); + }); + + var cipherCore = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, evpkdf); + } + })(commonjsGlobal, function (CryptoJS) { + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || function (undefined$1) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function createEncryptor(key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function createDecryptor(key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function init(xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Store transform mode and key + + this._xformMode = xformMode; + this._key = key; // Set initial values + + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic + + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function process(dataUpdate) { + // Append + this._append(dataUpdate); // Process available blocks + + + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function finalize(dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } // Perform concrete-cipher logic + + + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + keySize: 128 / 32, + ivSize: 128 / 32, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function encrypt(message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + decrypt: function decrypt(ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }() + }); + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function _doFinalize() { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + blockSize: 1 + }); + /** + * Mode namespace. + */ + + var C_mode = C.mode = {}; + /** + * Abstract base block cipher mode template. + */ + + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function createEncryptor(cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function createDecryptor(cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function init(cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + /** + * Cipher Block Chaining mode. + */ + + var CBC = C_mode.CBC = function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + /** + * CBC encryptor. + */ + + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // XOR and encrypt + + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); // Remember this block to use with next block + + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + /** + * CBC decryptor. + */ + + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // Remember this block to use with next block + + var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR + + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block + + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + // Shortcut + var iv = this._iv; // Choose mixing block + + if (iv) { + var block = iv; // Remove IV for subsequent blocks + + this._iv = undefined$1; + } else { + var block = this._prevBlock; + } // XOR blocks + + + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }(); + /** + * Padding namespace. + */ + + + var C_pad = C.pad = {}; + /** + * PKCS #5/7 padding strategy. + */ + + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function pad(data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; // Count padding bytes + + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word + + var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding + + var paddingWords = []; + + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + + var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding + + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function unpad(data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding + + data.sigBytes -= nPaddingBytes; + } + }; + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + reset: function reset() { + // Reset cipher + Cipher.reset.call(this); // Shortcuts + + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; // Reset block mode + + if (this._xformMode == this._ENC_XFORM_MODE) { + var modeCreator = mode.createEncryptor; + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding + + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + _doProcessBlock: function _doProcessBlock(words, offset) { + this._mode.processBlock(words, offset); + }, + _doFinalize: function _doFinalize() { + // Shortcut + var padding = this.cfg.padding; // Finalize + + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); // Process final blocks + + var finalProcessedBlocks = this._process(!!'flush'); + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + // Process final blocks + var finalProcessedBlocks = this._process(!!'flush'); // Unpad data + + + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + blockSize: 128 / 32 + }); + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function init(cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function toString(formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + /** + * Format namespace. + */ + + var C_format = C.format = {}; + /** + * OpenSSL formatting strategy. + */ + + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function stringify(cipherParams) { + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; // Format + + if (salt) { + var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + var wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function parse(openSSLStr) { + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); // Shortcut + + var ciphertextWords = ciphertext.words; // Test for salt + + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext + + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ + ciphertext: ciphertext, + salt: salt + }); + } + }; + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Encrypt + + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); // Shortcut + + var cipherCfg = encryptor.cfg; // Create and return serializable cipher params + + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Decrypt + + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function _parse(ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + /** + * Key derivation function namespace. + */ + + var C_kdf = C.kdf = {}; + /** + * OpenSSL key derivation function. + */ + + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function execute(password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64 / 8); + } // Derive key and IV + + + var key = EvpKDF.create({ + keySize: keySize + ivSize + }).compute(password, salt); // Separate key and IV + + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; // Return params + + return CipherParams.create({ + key: key, + iv: iv, + salt: salt + }); + } + }; + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config + + cfg.iv = derivedParams.iv; // Encrypt + + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params + + ciphertext.mixIn(derivedParams); + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config + + cfg.iv = derivedParams.iv; // Decrypt + + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + return plaintext; + } + }); + }(); + }); +======= + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function createEncryptor(key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function createDecryptor(key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); + }, + + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function init(xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Store transform mode and key + + this._xformMode = xformMode; + this._key = key; // Set initial values + + this.reset(); + }, + + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic + + this._doReset(); + }, + + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function process(dataUpdate) { + // Append + this._append(dataUpdate); // Process available blocks + + + return this._process(); + }, + + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function finalize(dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } // Perform concrete-cipher logic + + + var finalProcessedData = this._doFinalize(); + + return finalProcessedData; + }, + keySize: 128 / 32, + ivSize: 128 / 32, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, + + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } + + return function (cipher) { + return { + encrypt: function encrypt(message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + decrypt: function decrypt(ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }() + }); + /** + * Abstract base stream cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) + */ + + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function _doFinalize() { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); + + return finalProcessedBlocks; + }, + blockSize: 1 + }); + /** + * Mode namespace. + */ + + var C_mode = C.mode = {}; + /** + * Abstract base block cipher mode template. + */ + + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function createEncryptor(cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, + + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function createDecryptor(cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, + + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function init(cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + /** + * Cipher Block Chaining mode. + */ + + var CBC = C_mode.CBC = function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + /** + * CBC encryptor. + */ + + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // XOR and encrypt + + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); // Remember this block to use with next block + + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + /** + * CBC decryptor. + */ + + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // Remember this block to use with next block + + var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR + + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block + + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + // Shortcut + var iv = this._iv; // Choose mixing block + + if (iv) { + var block = iv; // Remove IV for subsequent blocks + + this._iv = undefined$1; + } else { + var block = this._prevBlock; + } // XOR blocks + + + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }(); + /** + * Padding namespace. + */ + + + var C_pad = C.pad = {}; + /** + * PKCS #5/7 padding strategy. + */ + + var Pkcs7 = C_pad.Pkcs7 = { + /** + * Pads data using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); + */ + pad: function pad(data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; // Count padding bytes + + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word + + var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding + + var paddingWords = []; + + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + + var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding + + data.concat(padding); + }, + + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function unpad(data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding + + data.sigBytes -= nPaddingBytes; + } + }; + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ + + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + reset: function reset() { + // Reset cipher + Cipher.reset.call(this); // Shortcuts + + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; // Reset block mode + + if (this._xformMode == this._ENC_XFORM_MODE) { + var modeCreator = mode.createEncryptor; + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding + + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + _doProcessBlock: function _doProcessBlock(words, offset) { + this._mode.processBlock(words, offset); + }, + _doFinalize: function _doFinalize() { + // Shortcut + var padding = this.cfg.padding; // Finalize + + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); // Process final blocks + + var finalProcessedBlocks = this._process(!!'flush'); + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + // Process final blocks + var finalProcessedBlocks = this._process(!!'flush'); // Unpad data + + + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + blockSize: 128 / 32 + }); + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function init(cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function toString(formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + /** + * Format namespace. + */ + + var C_format = C.format = {}; + /** + * OpenSSL formatting strategy. + */ + + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function stringify(cipherParams) { + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; // Format + + if (salt) { + var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + var wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function parse(openSSLStr) { + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); // Shortcut + + var ciphertextWords = ciphertext.words; // Test for salt + + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext + + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ + ciphertext: ciphertext, + salt: salt + }); + } + }; + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Encrypt + + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); // Shortcut + + var cipherCfg = encryptor.cfg; // Create and return serializable cipher params + + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Decrypt + + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function _parse(ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + /** + * Key derivation function namespace. + */ + + var C_kdf = C.kdf = {}; + /** + * OpenSSL key derivation function. + */ + + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function execute(password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64 / 8); + } // Derive key and IV + + + var key = EvpKDF.create({ + keySize: keySize + ivSize + }).compute(password, salt); // Separate key and IV + + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; // Return params + + return CipherParams.create({ + key: key, + iv: iv, + salt: salt + }); + } + }; + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config + + cfg.iv = derivedParams.iv; // Encrypt + + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params + + ciphertext.mixIn(derivedParams); + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config + + cfg.iv = derivedParams.iv; // Decrypt + + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + return plaintext; + } + }); + }(); + }); + }); + + var aes = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; // Lookup tables + + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; // Compute lookup tables + + (function () { + // Compute double table + var d = []; + + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = i << 1 ^ 0x11b; + } + } // Walk GF(2^8) + + + var x = 0; + var xi = 0; + + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; + sx = sx >>> 8 ^ sx & 0xff ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; // Compute multiplication + + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; // Compute sub bytes, mix columns tables + + var t = d[sx] * 0x101 ^ sx * 0x1010100; + SUB_MIX_0[x] = t << 24 | t >>> 8; + SUB_MIX_1[x] = t << 16 | t >>> 16; + SUB_MIX_2[x] = t << 8 | t >>> 24; + SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables + + var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; + INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; + INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; + INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; + INV_SUB_MIX_3[sx] = t; // Compute next counter + + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + })(); // Precomputed Rcon lookup + + + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + /** + * AES block cipher algorithm. + */ + + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function _doReset() { + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } // Shortcuts + + + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; // Compute number of rounds + + var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows + + var ksRows = (nRounds + 1) * 4; // Compute key schedule + + var keySchedule = this._keySchedule = []; + + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + var t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = t << 8 | t >>> 24; // Sub word + + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon + + t ^= RCON[ksRow / keySize | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } // Compute inv key schedule + + + var invKeySchedule = this._invKeySchedule = []; + + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + encryptBlock: function encryptBlock(M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + decryptBlock: function decryptBlock(M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows + + + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; // Get input, add round key + + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter + + var ksRow = 4; // Rounds + + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state + + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } // Shift rows, sub bytes, add round key + + + var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output + + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + keySize: 256 / 32 + }); + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + + C.AES = BlockCipher._createHelper(AES); + })(); + + return CryptoJS.AES; + }); + }); + + var encUtf8 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + return CryptoJS.enc.Utf8; + }); + }); + + /** + * toString ref. + */ + var toString$1 = Object.prototype.toString; + /** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ + + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { + 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'; + } + + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + if (isBuffer$1(val)) return 'buffer'; + val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); + return _typeof(val); + }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js + + + function isBuffer$1(obj) { + return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + } + + /* + * Module dependencies. + */ + + /** + * Deeply clone an object. + * + * @param {*} obj Any object. + */ + + + var clone = function clone(obj) { + var t = componentType$1(obj); + + if (t === 'object') { + var copy = {}; + + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + copy[key] = clone(obj[key]); + } + } + + return copy; + } + + if (t === 'array') { + var copy = new Array(obj.length); + + for (var i = 0, l = obj.length; i < l; i++) { + copy[i] = clone(obj[i]); + } + + return copy; + } + + if (t === 'regexp') { + // from millermedeiros/amd-utils - MIT + var flags = ''; + flags += obj.multiline ? 'm' : ''; + flags += obj.global ? 'g' : ''; + flags += obj.ignoreCase ? 'i' : ''; + return new RegExp(obj.source, flags); + } + + if (t === 'date') { + return new Date(obj.getTime()); + } // string, number, boolean, etc. + + + return obj; + }; + /* + * Exports. + */ + + + var clone_1 = clone; + + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse(val); + return options["long"] ? _long(val) : _short(val); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse(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; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function _short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + + + function _long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } + /** + * Pluralization helper. + */ + + + function plural(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 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ + + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + + exports.formatters = {}; + /** + * Previously assigned color. + */ + + var prevColor = 0; + /** + * Previous log timestamp. + */ + + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ + + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + + function debug(namespace) { + // define the `disabled` version + function disabled() {} + + disabled.enabled = false; // define the `enabled` version + + function enabled() { + var self = enabled; // set `diff` timestamp + + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set + + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // 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 + */ - return CryptoJS.AES; + 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 - var encUtf8 = createCommonjsModule(function (module, exports) { - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - }(commonjsGlobal, function (CryptoJS) { + 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 + */ - return CryptoJS.enc.Utf8; - })); + 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; + } +>>>>>>> branch for npm and latest release }); - /** - * toString ref. - */ ->>>>>>> update npm module +<<<<<<< HEAD + var aes = createCommonjsModule(function (module, exports) { - (function (root, factory) { + (function (root, factory, undef) { { // CommonJS - module.exports = exports = factory(); + module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); } - })(commonjsGlobal, function () { - /** - * CryptoJS core components. - */ - var CryptoJS = CryptoJS || function (Math, undefined$1) { - /* - * Local polyfil of Object.create - */ - var create = Object.create || function () { - function F() {} - return function (obj) { - var subtype; - F.prototype = obj; - subtype = new F(); - F.prototype = null; - return subtype; - }; - }(); - /** - * CryptoJS namespace. - */ + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; // Lookup tables + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; // Compute lookup tables - var C = {}; - /** - * Library namespace. - */ + (function () { + // Compute double table + var d = []; - var C_lib = C.lib = {}; + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = i << 1 ^ 0x11b; + } + } // Walk GF(2^8) + + + var x = 0; + var xi = 0; + + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; + sx = sx >>> 8 ^ sx & 0xff ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; // Compute multiplication + + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; // Compute sub bytes, mix columns tables + + var t = d[sx] * 0x101 ^ sx * 0x1010100; + SUB_MIX_0[x] = t << 24 | t >>> 8; + SUB_MIX_1[x] = t << 16 | t >>> 16; + SUB_MIX_2[x] = t << 8 | t >>> 24; + SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables + + var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; + INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; + INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; + INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; + INV_SUB_MIX_3[sx] = t; // Compute next counter + + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + })(); // Precomputed Rcon lookup + + + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; /** - * Base object for prototypal inheritance. + * AES block cipher algorithm. */ - var Base = C_lib.Base = function () { - return { - /** - * Creates a new object that inherits from this object. - * - * @param {Object} overrides Properties to copy into the new object. - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * field: 'value', - * - * method: function () { - * } - * }); - */ - extend: function extend(overrides) { - // Spawn - var subtype = create(this); // Augment + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function _doReset() { + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } // Shortcuts - if (overrides) { - subtype.mixIn(overrides); - } // Create default initializer + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; // Compute number of rounds + + var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows + + var ksRows = (nRounds + 1) * 4; // Compute key schedule + + var keySchedule = this._keySchedule = []; + + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + var t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = t << 8 | t >>> 24; // Sub word + + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon + + t ^= RCON[ksRow / keySize | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } // Compute inv key schedule + + + var invKeySchedule = this._invKeySchedule = []; + + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + encryptBlock: function encryptBlock(M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + decryptBlock: function decryptBlock(M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; - if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { - subtype.init = function () { - subtype.$super.init.apply(this, arguments); - }; - } // Initializer's prototype is the subtype object + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows - subtype.init.prototype = subtype; // Reference supertype + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; // Get input, add round key - subtype.$super = this; - return subtype; - }, + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter - /** - * Extends this object and runs the init method. - * Arguments to create() will be passed to init(). - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var instance = MyType.create(); - */ - create: function create() { - var instance = this.extend(); - instance.init.apply(instance, arguments); - return instance; - }, + var ksRow = 4; // Rounds - /** - * Initializes a newly created object. - * Override this method to add some logic when your objects are created. - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * init: function () { - * // ... - * } - * }); - */ - init: function init() {}, + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state - /** - * Copies properties into this object. - * - * @param {Object} properties The properties to mix in. - * - * @example - * - * MyType.mixIn({ - * field: 'value' - * }); - */ - mixIn: function mixIn(properties) { - for (var propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - this[propertyName] = properties[propertyName]; - } - } // IE won't copy toString using the loop above + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } // Shift rows, sub bytes, add round key - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, + var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function clone() { - return this.init.prototype.extend(this); - } - }; - }(); + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + keySize: 256 / 32 + }); /** - * An array of 32-bit words. + * Shortcut functions to the cipher's object interface. * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); */ + C.AES = BlockCipher._createHelper(AES); + })(); - var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function init(words, sigBytes) { - words = this.words = words || []; + return CryptoJS.AES; + }); +======= + var browser = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug_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. + */ - if (sigBytes != undefined$1) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, + 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 + */ - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function toString(encoder) { - return (encoder || Hex).stringify(this); - }, + 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. + */ - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function concat(wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; // Clamp excess bits - this.clamp(); // Concat + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; + /** + * Colorize log arguments if enabled. + * + * @api public + */ - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; - } - } - this.sigBytes += thatSigBytes; // Chainable + 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++; - return this; - }, + 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 + */ - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function clamp() { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; // Clamp - words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; - words.length = Math.ceil(sigBytes / 4); - }, + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - return clone; - }, - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function random(nBytes) { - var words = []; + 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 + */ - var r = function r(m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - return function () { - m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; - m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; - var result = (m_z << 0x10) + m_w & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - }; - }; - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); + function load() { + var r; - rcache = _r() * 0x3ade67b7; - words.push(_r() * 0x100000000 | 0); - } + try { + r = exports.storage.debug; + } catch (e) {} - return new WordArray.init(words, nBytes); - } - }); - /** - * Encoder namespace. - */ + return r; + } + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ - var C_enc = C.enc = {}; - /** - * Hex encoding strategy. - */ - var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. - * - * @static - * - * @example - * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert + 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 + */ - var hexChars = []; + function localstorage() { + try { + return window.localStorage; + } catch (e) {} + } +>>>>>>> branch for npm and latest release + }); - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); - } + var encUtf8 = createCommonjsModule(function (module, exports) { - return hexChars.join(''); - }, +<<<<<<< HEAD + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + return CryptoJS.enc.Utf8; + }); + }); - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Hex.parse(hexString); - */ - parse: function parse(hexStr) { - // Shortcut - var hexStrLength = hexStr.length; // Convert +======= + var debug = browser('cookie'); +>>>>>>> branch for npm and latest release + /** + * toString ref. + */ + var toString$2 = Object.prototype.toString; + /** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ - var words = []; +<<<<<<< HEAD + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { + case '[object Date]': + return 'date'; - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; - } + case '[object RegExp]': + return 'regexp'; - return new WordArray.init(words, hexStrLength / 2); - } - }; - /** - * Latin1 encoding strategy. - */ + case '[object Arguments]': + return 'arguments'; - var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert + case '[object Array]': + return 'array'; + + case '[object Error]': + return 'error'; + } - var latin1Chars = []; + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + if (isBuffer$1(val)) return 'buffer'; + val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); + return _typeof(val); + }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } - return latin1Chars.join(''); - }, + function isBuffer$1(obj) { + return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + } - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function parse(latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; // Convert + /* + * Module dependencies. + */ - var words = []; +======= + var rudderComponentCookie = function rudderComponentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set(name, value, options); - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; - } + case 1: + return get$1(name); - return new WordArray.init(words, latin1StrLength); - } - }; - /** - * UTF-8 encoding strategy. - */ + default: + return all(); + } + }; + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ - var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function parse(utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); - } - }; - /** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 - */ + function set(name, value, options) { + options = options || {}; + var str = encode(name) + '=' + encode(value); + if (null == value) options.maxage = -1; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function reset() { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; - }, + if (options.maxage) { + options.expires = new Date(+new Date() + options.maxage); + } - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function _append(data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } // Append + 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; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ - this._data.concat(data); + function all() { + var str; - this._nDataBytes += data.sigBytes; - }, + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function _process(doFlush) { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; // Count blocks ready + return {}; + } - var nBlocksReady = dataSigBytes / blockSizeBytes; + return parse$1(str); + } +>>>>>>> branch for npm and latest release + /** + * Deeply clone an object. + * + * @param {*} obj Any object. + */ - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } // Count words ready +<<<<<<< HEAD + var clone = function clone(obj) { + var t = componentType$2(obj); - var nWordsReady = nBlocksReady * blockSize; // Count bytes ready + if (t === 'object') { + var copy = {}; - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + copy[key] = clone(obj[key]); + } + } - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } // Remove processed words + return copy; + } + if (t === 'array') { + var copy = new Array(obj.length); - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } // Return processed words + for (var i = 0, l = obj.length; i < l; i++) { + copy[i] = clone(obj[i]); + } + + return copy; + } + if (t === 'regexp') { + // from millermedeiros/amd-utils - MIT + var flags = ''; + flags += obj.multiline ? 'm' : ''; + flags += obj.global ? 'g' : ''; + flags += obj.ignoreCase ? 'i' : ''; + return new RegExp(obj.source, flags); + } + + if (t === 'date') { + return new Date(obj.getTime()); + } // string, number, boolean, etc. +======= + function get$1(name) { + return all()[name]; + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - return new WordArray.init(processedWords, nBytesReady); - }, - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); - return clone; - }, - _minBufferSize: 0 - }); - /** - * Abstract hasher template. - * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) - */ + function parse$1(str) { + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; - var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), + for (var i = 0; i < pairs.length; ++i) { + pair = pairs[i].split('='); + obj[decode(pair[0])] = decode(pair[1]); + } - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function init(cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Set initial values + return obj; + } + /** + * Encode. + */ - this.reset(); - }, - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic + function encode(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ - this._doReset(); - }, - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function update(messageUpdate) { - // Append - this._append(messageUpdate); // Update the hash + function decode(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); + } + } + var max = Math.max; + /** + * Produce a new array composed of all but the first `n` elements of an input `collection`. + * + * @name drop + * @api public + * @param {number} count The number of elements to drop. + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * drop(0, [1, 2, 3]); // => [1, 2, 3] + * drop(1, [1, 2, 3]); // => [2, 3] + * drop(2, [1, 2, 3]); // => [3] + * drop(3, [1, 2, 3]); // => [] + * drop(4, [1, 2, 3]); // => [] + */ - this._process(); // Chainable + var drop = function drop(count, collection) { + var length = collection ? collection.length : 0; + if (!length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - return this; - }, - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } // Perform concrete-hasher logic + var toDrop = max(Number(count) || 0, 0); + var resultsLength = max(length - toDrop, 0); + var results = new Array(resultsLength); +>>>>>>> branch for npm and latest release - var hash = this._doFinalize(); + return obj; + }; + /* + * Exports. + */ - return hash; - }, - blockSize: 512 / 32, +<<<<<<< HEAD - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function _createHelper(hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, + var clone_1 = clone; - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function _createHmacHelper(hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; - } - }); - /** - * Algorithm namespace. - */ +======= - var C_algo = C.algo = {}; - return C; - }(Math); + var drop_1 = drop; - return CryptoJS; - }); - }); + var max$1 = Math.max; +>>>>>>> branch for npm and latest release + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ +<<<<<<< HEAD +======= - var encBase64 = createCommonjsModule(function (module, exports) { + var rest = function rest(collection) { + if (collection == null || !collection.length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var C_enc = C.enc; - /** - * Base64 encoding strategy. - */ - var Base64 = C_enc.Base64 = { - /** - * Converts a word array to a Base64 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Base64 string. - * - * @static - * - * @example - * - * var base64String = CryptoJS.enc.Base64.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - var map = this._map; // Clamp excess bits + var results = new Array(max$1(collection.length - 2, 0)); - wordArray.clamp(); // Convert + for (var i = 1; i < collection.length; i += 1) { + results[i - 1] = collection[i]; + } +>>>>>>> branch for npm and latest release - var base64Chars = []; + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse$1(val); + return options["long"] ? _long(val) : _short(val); + }; +<<<<<<< HEAD + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ - for (var i = 0; i < sigBytes; i += 3) { - var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; - var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; - var triplet = byte1 << 16 | byte2 << 8 | byte3; +======= + /* + * Exports. + */ - for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { - base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); - } - } // Add padding + var rest_1 = rest; +>>>>>>> branch for npm and latest release - var paddingChar = map.charAt(64); + function parse$1(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(); - if (paddingChar) { - while (base64Chars.length % 4) { - base64Chars.push(paddingChar); - } - } + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; - return base64Chars.join(''); - }, + case 'days': + case 'day': + case 'd': + return n * d; - /** - * Converts a Base64 string to a word array. - * - * @param {string} base64Str The Base64 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Base64.parse(base64String); - */ - parse: function parse(base64Str) { - // Shortcuts - var base64StrLength = base64Str.length; - var map = this._map; - var reverseMap = this._reverseMap; +<<<<<<< HEAD + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; - if (!reverseMap) { - reverseMap = this._reverseMap = []; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; - for (var j = 0; j < map.length; j++) { - reverseMap[map.charCodeAt(j)] = j; - } - } // Ignore padding + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } + } +======= + var has$3 = Object.prototype.hasOwnProperty; + var objToString$1 = Object.prototype.toString; +>>>>>>> branch for npm and latest release + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ +<<<<<<< HEAD - var paddingChar = map.charAt(64); + function _short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; + } +======= + // TODO: Move to a library - if (paddingChar) { - var paddingIndex = base64Str.indexOf(paddingChar); + var isObject = function isObject(value) { + return Boolean(value) && _typeof(value) === 'object'; + }; +>>>>>>> branch for npm and latest release + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ +<<<<<<< HEAD - if (paddingIndex !== -1) { - base64StrLength = paddingIndex; - } - } // Convert + function _long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } +======= + // TODO: Move to a library - return parseLoop(base64Str, base64StrLength, reverseMap); - }, - _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' - }; - function parseLoop(base64Str, base64StrLength, reverseMap) { - var words = []; - var nBytes = 0; + var isPlainObject = function isPlainObject(value) { + return Boolean(value) && objToString$1.call(value) === '[object Object]'; + }; +>>>>>>> branch for npm and latest release + /** + * Pluralization helper. + */ - for (var i = 0; i < base64StrLength; i++) { - if (i % 4) { - var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; - var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; - words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; - nBytes++; - } - } +<<<<<<< HEAD - return WordArray.create(words, nBytes); - } - })(); + function plural(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'; + } - return CryptoJS.enc.Base64; - }); - }); + var debug_1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ +======= - var md5$1 = createCommonjsModule(function (module, exports) { + var shallowCombiner = function shallowCombiner(target, source, value, key) { + if (has$3.call(source, key) && target[key] === undefined) { + target[key] = value; + } - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function (Math) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Constants table + return source; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined; also merges objects recursively. + * + * @name deepCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + * @return {Object} + */ - var T = []; // Compute constants - (function () { - for (var i = 0; i < 64; i++) { - T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; - } - })(); - /** - * MD5 hash algorithm. - */ + var deepCombiner = function deepCombiner(target, source, value, key) { + if (has$3.call(source, key)) { + if (isPlainObject(target[key]) && isPlainObject(value)) { + target[key] = defaultsDeep(target[key], value); + } else if (target[key] === undefined) { + target[key] = value; + } + } + return source; + }; + /** + * TODO: Document + * + * @name defaultsWith + * @api private + * @param {Function} combiner + * @param {Object} target + * @param {...Object} sources + * @return {Object} Return the input `target`. + */ - var MD5 = C_algo.MD5 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Swap endian - for (var i = 0; i < 16; i++) { - // Shortcuts - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; - } // Shortcuts + var defaultsWith = function defaultsWith(combiner, target + /*, ...sources */ + ) { + if (!isObject(target)) { + return target; + } +>>>>>>> branch for npm and latest release - var H = this._hash.words; - var M_offset_0 = M[offset + 0]; - var M_offset_1 = M[offset + 1]; - var M_offset_2 = M[offset + 2]; - var M_offset_3 = M[offset + 3]; - var M_offset_4 = M[offset + 4]; - var M_offset_5 = M[offset + 5]; - var M_offset_6 = M[offset + 6]; - var M_offset_7 = M[offset + 7]; - var M_offset_8 = M[offset + 8]; - var M_offset_9 = M[offset + 9]; - var M_offset_10 = M[offset + 10]; - var M_offset_11 = M[offset + 11]; - var M_offset_12 = M[offset + 12]; - var M_offset_13 = M[offset + 13]; - var M_offset_14 = M[offset + 14]; - var M_offset_15 = M[offset + 15]; // Working varialbes + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; // Computation + exports.formatters = {}; + /** + * Previously assigned color. + */ - a = FF(a, b, c, d, M_offset_0, 7, T[0]); - d = FF(d, a, b, c, M_offset_1, 12, T[1]); - c = FF(c, d, a, b, M_offset_2, 17, T[2]); - b = FF(b, c, d, a, M_offset_3, 22, T[3]); - a = FF(a, b, c, d, M_offset_4, 7, T[4]); - d = FF(d, a, b, c, M_offset_5, 12, T[5]); - c = FF(c, d, a, b, M_offset_6, 17, T[6]); - b = FF(b, c, d, a, M_offset_7, 22, T[7]); - a = FF(a, b, c, d, M_offset_8, 7, T[8]); - d = FF(d, a, b, c, M_offset_9, 12, T[9]); - c = FF(c, d, a, b, M_offset_10, 17, T[10]); - b = FF(b, c, d, a, M_offset_11, 22, T[11]); - a = FF(a, b, c, d, M_offset_12, 7, T[12]); - d = FF(d, a, b, c, M_offset_13, 12, T[13]); - c = FF(c, d, a, b, M_offset_14, 17, T[14]); - b = FF(b, c, d, a, M_offset_15, 22, T[15]); - a = GG(a, b, c, d, M_offset_1, 5, T[16]); - d = GG(d, a, b, c, M_offset_6, 9, T[17]); - c = GG(c, d, a, b, M_offset_11, 14, T[18]); - b = GG(b, c, d, a, M_offset_0, 20, T[19]); - a = GG(a, b, c, d, M_offset_5, 5, T[20]); - d = GG(d, a, b, c, M_offset_10, 9, T[21]); - c = GG(c, d, a, b, M_offset_15, 14, T[22]); - b = GG(b, c, d, a, M_offset_4, 20, T[23]); - a = GG(a, b, c, d, M_offset_9, 5, T[24]); - d = GG(d, a, b, c, M_offset_14, 9, T[25]); - c = GG(c, d, a, b, M_offset_3, 14, T[26]); - b = GG(b, c, d, a, M_offset_8, 20, T[27]); - a = GG(a, b, c, d, M_offset_13, 5, T[28]); - d = GG(d, a, b, c, M_offset_2, 9, T[29]); - c = GG(c, d, a, b, M_offset_7, 14, T[30]); - b = GG(b, c, d, a, M_offset_12, 20, T[31]); - a = HH(a, b, c, d, M_offset_5, 4, T[32]); - d = HH(d, a, b, c, M_offset_8, 11, T[33]); - c = HH(c, d, a, b, M_offset_11, 16, T[34]); - b = HH(b, c, d, a, M_offset_14, 23, T[35]); - a = HH(a, b, c, d, M_offset_1, 4, T[36]); - d = HH(d, a, b, c, M_offset_4, 11, T[37]); - c = HH(c, d, a, b, M_offset_7, 16, T[38]); - b = HH(b, c, d, a, M_offset_10, 23, T[39]); - a = HH(a, b, c, d, M_offset_13, 4, T[40]); - d = HH(d, a, b, c, M_offset_0, 11, T[41]); - c = HH(c, d, a, b, M_offset_3, 16, T[42]); - b = HH(b, c, d, a, M_offset_6, 23, T[43]); - a = HH(a, b, c, d, M_offset_9, 4, T[44]); - d = HH(d, a, b, c, M_offset_12, 11, T[45]); - c = HH(c, d, a, b, M_offset_15, 16, T[46]); - b = HH(b, c, d, a, M_offset_2, 23, T[47]); - a = II(a, b, c, d, M_offset_0, 6, T[48]); - d = II(d, a, b, c, M_offset_7, 10, T[49]); - c = II(c, d, a, b, M_offset_14, 15, T[50]); - b = II(b, c, d, a, M_offset_5, 21, T[51]); - a = II(a, b, c, d, M_offset_12, 6, T[52]); - d = II(d, a, b, c, M_offset_3, 10, T[53]); - c = II(c, d, a, b, M_offset_10, 15, T[54]); - b = II(b, c, d, a, M_offset_1, 21, T[55]); - a = II(a, b, c, d, M_offset_8, 6, T[56]); - d = II(d, a, b, c, M_offset_15, 10, T[57]); - c = II(c, d, a, b, M_offset_6, 15, T[58]); - b = II(b, c, d, a, M_offset_13, 21, T[59]); - a = II(a, b, c, d, M_offset_4, 6, T[60]); - d = II(d, a, b, c, M_offset_11, 10, T[61]); - c = II(c, d, a, b, M_offset_2, 15, T[62]); - b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + var prevColor = 0; + /** + * Previous log timestamp. + */ - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); - var nBitsTotalL = nBitsTotal; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; - data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ - this._process(); // Shortcuts +<<<<<<< HEAD + function debug(namespace) { + // define the `disabled` version + function disabled() {} - var hash = this._hash; - var H = hash.words; // Swap endian + disabled.enabled = false; // define the `enabled` version - for (var i = 0; i < 4; i++) { - // Shortcut - var H_i = H[i]; - H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; - } // Return final computed hash + function enabled() { + var self = enabled; // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set - return hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); - function FF(a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + x + t; - return (n << s | n >>> 32 - s) + b; - } + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // apply any `formatters` transformations - function GG(a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - function HH(a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + x + t; - return (n << s | n >>> 32 - s) + b; - } + 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]; - function II(a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + x + t; - return (n << s | n >>> 32 - s) + b; - } - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.MD5('message'); - * var hash = CryptoJS.MD5(wordArray); - */ + 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--; + } - C.MD5 = Hasher._createHelper(MD5); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacMD5(message, key); - */ + return match; + }); - C.HmacMD5 = Hasher._createHmacHelper(MD5); - })(Math); + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } - return CryptoJS.MD5; - }); - }); + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } - var sha1 = createCommonjsModule(function (module, exports) { + 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 (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); + + 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 + '$')); + } } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Reusable object + } + /** + * Disable debug output. + * + * @api public + */ - var W = []; - /** - * SHA-1 hash algorithm. - */ - var SHA1 = C_algo.SHA1 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Shortcut - var H = this._hash.words; // Working variables + function disable() { + exports.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; // Computation - for (var i = 0; i < 80; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = n << 1 | n >>> 31; - } + function enabled(name) { + var i, len; - var t = (a << 5 | a >>> 27) + e + W[i]; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } - if (i < 20) { - t += (b & c | ~b & d) + 0x5a827999; - } else if (i < 40) { - t += (b ^ c ^ d) + 0x6ed9eba1; - } else if (i < 60) { - t += (b & c | b & d | c & d) - 0x70e44324; - } else - /* if (i < 80) */ - { - t += (b ^ c ^ d) - 0x359d3e2a; - } + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } - e = d; - d = c; - c = b << 30 | b >>> 2; - b = a; - a = t; - } // Intermediate hash value + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - H[4] = H[4] + e | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + }); + var debug_2 = debug_1.coerce; + var debug_3 = debug_1.disable; + var debug_4 = debug_1.enable; + var debug_5 = debug_1.enabled; + var debug_6 = debug_1.humanize; + var debug_7 = debug_1.names; + var debug_8 = debug_1.skips; + var debug_9 = debug_1.formatters; - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; // Hash final blocks + var browser = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug_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. + */ - this._process(); // Return final computed hash + 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. + */ - return this._hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA1('message'); - * var hash = CryptoJS.SHA1(wordArray); - */ - C.SHA1 = Hasher._createHelper(SHA1); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA1(message, key); - */ + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; + /** + * Colorize log arguments if enabled. + * + * @api public + */ - C.HmacSHA1 = Hasher._createHmacHelper(SHA1); - })(); - return CryptoJS.SHA1; - }); - }); + 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 hmac = createCommonjsModule(function (module, exports) { + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function (match) { + if ('%%' === match) return; + index++; - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var C_algo = C.algo; - /** - * HMAC algorithm. - */ + 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 + */ - var HMAC = C_algo.HMAC = Base.extend({ - /** - * Initializes a newly created HMAC. - * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. - * - * @example - * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); - */ - init: function init(hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already - if (typeof key == 'string') { - key = Utf8.parse(key); - } // Shortcuts + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys + 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 + */ - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } // Clamp excess bits + function load() { + var r; - key.clamp(); // Clone key for inner and outer pads + try { + r = exports.storage.debug; + } catch (e) {} - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); // Shortcuts + return r; + } + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; // XOR keys with pad constants - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } + 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 + */ - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + function localstorage() { + try { + return window.localStorage; + } catch (e) {} + } + }); + var browser_1 = browser.log; + var browser_2 = browser.formatArgs; + var browser_3 = browser.save; + var browser_4 = browser.load; + var browser_5 = browser.useColors; + var browser_6 = browser.storage; + var browser_7 = browser.colors; - this.reset(); - }, + /** + * Module dependencies. + */ - /** - * Resets this HMAC to its initial state. - * - * @example - * - * hmacHasher.reset(); - */ - reset: function reset() { - // Shortcut - var hasher = this._hasher; // Reset + var debug = browser('cookie'); +======= + return target; + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * Recurses on objects. + * + * @name defaultsDeep + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} The input `target`. + */ - hasher.reset(); - hasher.update(this._iKey); - }, - /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {HMAC} This HMAC instance. - * - * @example - * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); - */ - update: function update(messageUpdate) { - this._hasher.update(messageUpdate); // Chainable + var defaultsDeep = function defaultsDeep(target + /*, sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * + * @name defaults + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} + * @example + * var a = { a: 1 }; + * var b = { a: 2, b: 2 }; + * + * defaults(a, b); + * console.log(a); //=> { a: 1, b: 2 } + */ - return this; - }, + var defaults = function defaults(target + /*, ...sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); + }; + /* + * Exports. + */ - /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. - * - * @example - * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Shortcut - var hasher = this._hasher; // Compute HMAC - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - return hmac; - } - }); - })(); - }); - }); + var defaults_1 = defaults; + var deep = defaultsDeep; + defaults_1.deep = deep; - var evpkdf = createCommonjsModule(function (module, exports) { + var json3 = createCommonjsModule(function (module, exports) { + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, sha1, hmac); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var C_algo = C.algo; - var MD5 = C_algo.MD5; - /** - * This key derivation function is meant to conform with EVP_BytesToKey. - * www.openssl.org/docs/crypto/EVP_BytesToKey.html - */ + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. - var EvpKDF = C_algo.EvpKDF = Base.extend({ - /** - * Configuration options. - * - * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) - * @property {Hasher} hasher The hash algorithm to use. Default: MD5 - * @property {number} iterations The number of iterations to perform. Default: 1 - */ - cfg: Base.extend({ - keySize: 128 / 32, - hasher: MD5, - iterations: 1 - }), + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. - /** - * Initializes a newly created key derivation function. - * - * @param {Object} cfg (Optional) The configuration options to use for the derivation. - * - * @example - * - * var kdf = CryptoJS.algo.EvpKDF.create(); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); - */ - init: function init(cfg) { - this.cfg = this.cfg.extend(cfg); - }, + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * - * @return {WordArray} The derived key. - * - * @example - * - * var key = kdf.compute(password, salt); - */ - compute: function compute(password, salt) { - // Shortcut - var cfg = this.cfg; // Init hasher + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. - var hasher = cfg.hasher.create(); // Initial values - var derivedKey = WordArray.create(); // Shortcuts + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. - var derivedKeyWords = derivedKey.words; - var keySize = cfg.keySize; - var iterations = cfg.iterations; // Generate key + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - while (derivedKeyWords.length < keySize) { - if (block) { - hasher.update(block); - } + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. - var block = hasher.update(password).finalize(salt); - hasher.reset(); // Iterations - for (var i = 1; i < iterations; i++) { - block = hasher.finalize(block); - hasher.reset(); - } + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. - derivedKey.concat(block); + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); } + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - derivedKey.sigBytes = keySize * 4; - return derivedKey; + + var isExtended = new Date(-3509827334573292); + attempt(function () { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + }); // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. + + function has(name) { + if (has[name] != null) { + // Return cached feature test result. + return has[name]; } - }); - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * @param {Object} cfg (Optional) The configuration options to use for this computation. - * - * @return {WordArray} The derived key. - * - * @static - * - * @example - * - * var key = CryptoJS.EvpKDF(password, salt); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); - */ - C.EvpKDF = function (password, salt, cfg) { - return EvpKDF.create(cfg).compute(password, salt); - }; - })(); + var isSupported; - return CryptoJS.EvpKDF; - }); - }); + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); + } else if (name == "date-serialization") { + // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. + isSupported = has("json-stringify") && isExtended; - var cipherCore = createCommonjsModule(function (module, exports) { + if (isSupported) { + var stringify = exports.stringify; + attempt(function () { + isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + }); + } + } else { + var value, + serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, evpkdf); - } - })(commonjsGlobal, function (CryptoJS) { - /** - * Cipher core components. - */ - CryptoJS.lib.Cipher || function (undefined$1) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var Base64 = C_enc.Base64; - var C_algo = C.algo; - var EvpKDF = C_algo.EvpKDF; - /** - * Abstract base cipher template. - * - * @property {number} keySize This cipher's key size. Default: 4 (128 bits) - * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) - * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. - * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. - */ + if (name == "json-stringify") { + var stringify = exports.stringify, + stringifySupported = typeof stringify == "function"; + + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function value() { + return 1; + }).toJSON = value; + attempt(function () { + stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ + "a": [value, true, false, null, "\x00\b\n\f\r\t"] + }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; + }, function () { + stringifySupported = false; + }); + } - var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - * - * @property {WordArray} iv The IV to use for this operation. - */ - cfg: Base.extend(), + isSupported = stringifySupported; + } // Test `JSON.parse`. - /** - * Creates this cipher in encryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); - */ - createEncryptor: function createEncryptor(key, cfg) { - return this.create(this._ENC_XFORM_MODE, key, cfg); - }, - /** - * Creates this cipher in decryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); - */ - createDecryptor: function createDecryptor(key, cfg) { - return this.create(this._DEC_XFORM_MODE, key, cfg); - }, + if (name == "json-parse") { + var parse = exports.parse, + parseSupported; - /** - * Initializes a newly created cipher. - * - * @param {number} xformMode Either the encryption or decryption transormation mode constant. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @example - * - * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); - */ - init: function init(xformMode, key, cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Store transform mode and key + if (typeof parse == "function") { + attempt(function () { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + parseSupported = value["a"].length == 5 && value["a"][0] === 1; - this._xformMode = xformMode; - this._key = key; // Set initial values + if (parseSupported) { + attempt(function () { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + }); - this.reset(); - }, + if (parseSupported) { + attempt(function () { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + }); + } - /** - * Resets this cipher to its initial state. - * - * @example - * - * cipher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic + if (parseSupported) { + attempt(function () { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + }); + } + } + } + }, function () { + parseSupported = false; + }); + } - this._doReset(); - }, + isSupported = parseSupported; + } + } - /** - * Adds data to be encrypted or decrypted. - * - * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. - * - * @return {WordArray} The data after processing. - * - * @example - * - * var encrypted = cipher.process('data'); - * var encrypted = cipher.process(wordArray); - */ - process: function process(dataUpdate) { - // Append - this._append(dataUpdate); // Process available blocks + return has[name] = !!isSupported; + } + has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - return this._process(); - }, + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - /** - * Finalizes the encryption or decryption process. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. - * - * @return {WordArray} The data after final processing. - * - * @example - * - * var encrypted = cipher.finalize(); - * var encrypted = cipher.finalize('data'); - * var encrypted = cipher.finalize(wordArray); - */ - finalize: function finalize(dataUpdate) { - // Final data update - if (dataUpdate) { - this._append(dataUpdate); - } // Perform concrete-cipher logic + var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. + var _forOwn = function forOwn(object, callback) { + var size = 0, + Properties, + dontEnums, + property; // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - var finalProcessedData = this._doFinalize(); + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - return finalProcessedData; - }, - keySize: 128 / 32, - ivSize: 128 / 32, - _ENC_XFORM_MODE: 1, - _DEC_XFORM_MODE: 2, + dontEnums = new Properties(); - /** - * Creates shortcut functions to a cipher's object interface. - * - * @param {Cipher} cipher The cipher to create a helper for. - * - * @return {Object} An object with encrypt and decrypt shortcut functions. - * - * @static - * - * @example - * - * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); - */ - _createHelper: function () { - function selectCipherStrategy(key) { - if (typeof key == 'string') { - return PasswordBasedCipher; - } else { - return SerializableCipher; + for (property in dontEnums) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(dontEnums, property)) { + size++; } } - return function (cipher) { - return { - encrypt: function encrypt(message, key, cfg) { - return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); - }, - decrypt: function decrypt(ciphertext, key, cfg) { - return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + Properties = dontEnums = null; // Normalize the iteration algorithm. + + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. + + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } // Manually invoke the callback for each non-enumerable property. + + + for (length = dontEnums.length; property = dontEnums[--length];) { + if (hasProperty.call(object, property)) { + callback(property); + } } }; - }; - }() - }); - /** - * Abstract base stream cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) - */ + } else { + // No bugs detected; use the standard `for...in` algorithm. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + isConstructor; - var StreamCipher = C_lib.StreamCipher = Cipher.extend({ - _doFinalize: function _doFinalize() { - // Process partial blocks - var finalProcessedBlocks = this._process(!!'flush'); + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. - return finalProcessedBlocks; - }, - blockSize: 1 - }); - /** - * Mode namespace. - */ - var C_mode = C.mode = {}; - /** - * Abstract base block cipher mode template. - */ + if (isConstructor || isProperty.call(object, property = "constructor")) { + callback(property); + } + }; + } - var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ - /** - * Creates this mode for encryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); - */ - createEncryptor: function createEncryptor(cipher, iv) { - return this.Encryptor.create(cipher, iv); - }, + return _forOwn(object, callback); + }; // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. - /** - * Creates this mode for decryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); - */ - createDecryptor: function createDecryptor(cipher, iv) { - return this.Decryptor.create(cipher, iv); - }, - /** - * Initializes a newly created mode. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @example - * - * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); - */ - init: function init(cipher, iv) { - this._cipher = cipher; - this._iv = iv; - } - }); - /** - * Cipher Block Chaining mode. - */ + if (!has("json-stringify") && !has("date-serialization")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. - var CBC = C_mode.CBC = function () { - /** - * Abstract base CBC mode. - */ - var CBC = BlockCipherMode.extend(); - /** - * CBC encryptor. - */ + var leadingZeroes = "000000"; - CBC.Encryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // XOR and encrypt + var toPaddedString = function toPaddedString(width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; // Internal: Serializes a date object. - xorBlock.call(this, words, offset, blockSize); - cipher.encryptBlock(words, offset); // Remember this block to use with next block - this._prevBlock = words.slice(offset, offset + blockSize); - } - }); - /** - * CBC decryptor. - */ + var _serializeDate = function serializeDate(value) { + var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. - CBC.Decryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // Remember this block to use with next block + if (!isExtended) { + var floor = Math.floor; // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. - var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. - cipher.decryptBlock(words, offset); - xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block + var getDay = function getDay(year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; - this._prevBlock = thisBlock; - } - }); + getData = function getData(value) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); - function xorBlock(words, offset, blockSize) { - // Shortcut - var iv = this._iv; // Choose mixing block + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { + } - if (iv) { - var block = iv; // Remove IV for subsequent blocks + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { + } - this._iv = undefined$1; - } else { - var block = this._prevBlock; - } // XOR blocks + date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. + time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. - for (var i = 0; i < blockSize; i++) { - words[offset + i] ^= block[i]; - } - } + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + }; + } else { + getData = function getData(value) { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + }; + } - return CBC; - }(); - /** - * Padding namespace. - */ + _serializeDate = function serializeDate(value) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + getData(value); // Serialize extended years correctly. + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + year = month = date = hours = minutes = seconds = milliseconds = null; + } else { + value = null; + } - var C_pad = C.pad = {}; - /** - * PKCS #5/7 padding strategy. - */ + return value; + }; - var Pkcs7 = C_pad.Pkcs7 = { - /** - * Pads data using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to pad. - * @param {number} blockSize The multiple that the data should be padded to. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.pad(wordArray, 4); - */ - pad: function pad(data, blockSize) { - // Shortcut - var blockSizeBytes = blockSize * 4; // Count padding bytes + return _serializeDate(value); + }; // For environments with `JSON.stringify` but buggy date serialization, + // we override the native `Date#toJSON` implementation with a + // spec-compliant one. - var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word - var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding + if (has("json-stringify") && !has("date-serialization")) { + // Internal: the `Date#toJSON` implementation used to override the native one. + var dateToJSON = function dateToJSON(key) { + return _serializeDate(this); + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - var paddingWords = []; - for (var i = 0; i < nPaddingBytes; i += 4) { - paddingWords.push(paddingWord); - } + var nativeStringify = exports.stringify; - var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding + exports.stringify = function (source, filter, width) { + var nativeToJSON = Date.prototype.toJSON; + Date.prototype.toJSON = dateToJSON; + var result = nativeStringify(source, filter, width); + Date.prototype.toJSON = nativeToJSON; + return result; + }; + } else { + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; - data.concat(padding); - }, + var escapeChar = function escapeChar(character) { + var charCode = character.charCodeAt(0), + escaped = Escapes[charCode]; - /** - * Unpads data that had been padded using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to unpad. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.unpad(wordArray); - */ - unpad: function unpad(data) { - // Get number of padding bytes from last byte - var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding + if (escaped) { + return escaped; + } - data.sigBytes -= nPaddingBytes; - } - }; - /** - * Abstract base block cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) - */ + return unicodePrefix + toPaddedString(2, charCode.toString(16)); + }; - var BlockCipher = C_lib.BlockCipher = Cipher.extend({ - /** - * Configuration options. - * - * @property {Mode} mode The block mode to use. Default: CBC - * @property {Padding} padding The padding strategy to use. Default: Pkcs7 - */ - cfg: Cipher.cfg.extend({ - mode: CBC, - padding: Pkcs7 - }), - reset: function reset() { - // Reset cipher - Cipher.reset.call(this); // Shortcuts + var reEscape = /[\x00-\x1f\x22\x5c]/g; - var cfg = this.cfg; - var iv = cfg.iv; - var mode = cfg.mode; // Reset block mode + var quote = function quote(value) { + reEscape.lastIndex = 0; + return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; + }; // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - if (this._xformMode == this._ENC_XFORM_MODE) { - var modeCreator = mode.createEncryptor; - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding - this._minBufferSize = 1; - } + var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { + var value, type, className, results, element, index, length, prefix, result; + attempt(function () { + // Necessary for host object support. + value = object[property]; + }); - if (this._mode && this._mode.__creator == modeCreator) { - this._mode.init(this, iv && iv.words); - } else { - this._mode = modeCreator.call(mode, this, iv && iv.words); - this._mode.__creator = modeCreator; - } - }, - _doProcessBlock: function _doProcessBlock(words, offset) { - this._mode.processBlock(words, offset); - }, - _doFinalize: function _doFinalize() { - // Shortcut - var padding = this.cfg.padding; // Finalize + if (_typeof(value) == "object" && value) { + if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { + value = _serializeDate(value); + } else if (typeof value.toJSON == "function") { + value = value.toJSON(property); + } + } - if (this._xformMode == this._ENC_XFORM_MODE) { - // Pad data - padding.pad(this._data, this.blockSize); // Process final blocks + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } // Exit early if value is `undefined` or `null`. - var finalProcessedBlocks = this._process(!!'flush'); - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - // Process final blocks - var finalProcessedBlocks = this._process(!!'flush'); // Unpad data + if (value == undefined$1) { + return value === undefined$1 ? value : "null"; + } - padding.unpad(finalProcessedBlocks); - } + type = _typeof(value); // Only call `getClass` if the value is an object. - return finalProcessedBlocks; - }, - blockSize: 128 / 32 - }); - /** - * A collection of cipher parameters. - * - * @property {WordArray} ciphertext The raw ciphertext. - * @property {WordArray} key The key to this ciphertext. - * @property {WordArray} iv The IV used in the ciphering operation. - * @property {WordArray} salt The salt used with a key derivation function. - * @property {Cipher} algorithm The cipher algorithm. - * @property {Mode} mode The block mode used in the ciphering operation. - * @property {Padding} padding The padding scheme used in the ciphering operation. - * @property {number} blockSize The block size of the cipher. - * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. - */ + if (type == "object") { + className = getClass.call(value); + } - var CipherParams = C_lib.CipherParams = Base.extend({ - /** - * Initializes a newly created cipher params object. - * - * @param {Object} cipherParams An object with any of the possible cipher parameters. - * - * @example - * - * var cipherParams = CryptoJS.lib.CipherParams.create({ - * ciphertext: ciphertextWordArray, - * key: keyWordArray, - * iv: ivWordArray, - * salt: saltWordArray, - * algorithm: CryptoJS.algo.AES, - * mode: CryptoJS.mode.CBC, - * padding: CryptoJS.pad.PKCS7, - * blockSize: 4, - * formatter: CryptoJS.format.OpenSSL - * }); - */ - init: function init(cipherParams) { - this.mixIn(cipherParams); - }, + switch (className || type) { + case "boolean": + case booleanClass: + // Booleans are represented literally. + return "" + value; - /** - * Converts this cipher params object to a string. - * - * @param {Format} formatter (Optional) The formatting strategy to use. - * - * @return {string} The stringified cipher params. - * - * @throws Error If neither the formatter nor the default formatter is set. - * - * @example - * - * var string = cipherParams + ''; - * var string = cipherParams.toString(); - * var string = cipherParams.toString(CryptoJS.format.OpenSSL); - */ - toString: function toString(formatter) { - return (formatter || this.formatter).stringify(this); - } - }); - /** - * Format namespace. - */ + case "number": + case numberClass: + // JSON numbers must be finite. `Infinity` and `NaN` are serialized as + // `"null"`. + return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - var C_format = C.format = {}; - /** - * OpenSSL formatting strategy. - */ + case "string": + case stringClass: + // Strings are double-quoted and escaped. + return quote("" + value); + } // Recursively serialize objects and arrays. - var OpenSSLFormatter = C_format.OpenSSL = { - /** - * Converts a cipher params object to an OpenSSL-compatible string. - * - * @param {CipherParams} cipherParams The cipher params object. - * - * @return {string} The OpenSSL-compatible string. - * - * @static - * - * @example - * - * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); - */ - stringify: function stringify(cipherParams) { - // Shortcuts - var ciphertext = cipherParams.ciphertext; - var salt = cipherParams.salt; // Format - if (salt) { - var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); - } else { - var wordArray = ciphertext; - } + if (_typeof(value) == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } // Add the object to the stack of traversed objects. + + + stack.push(value); + results = []; // Save the current indentation level and indent one additional level. - return wordArray.toString(Base64); - }, + prefix = indentation; + indentation += whitespace; - /** - * Converts an OpenSSL-compatible string to a cipher params object. - * - * @param {string} openSSLStr The OpenSSL-compatible string. - * - * @return {CipherParams} The cipher params object. - * - * @static - * - * @example - * - * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); - */ - parse: function parse(openSSLStr) { - // Parse base64 - var ciphertext = Base64.parse(openSSLStr); // Shortcut + if (className == arrayClass) { + // Recursively serialize array elements. + for (index = 0, length = value.length; index < length; index++) { + element = serialize(index, value, callback, properties, whitespace, indentation, stack); + results.push(element === undefined$1 ? "null" : element); + } - var ciphertextWords = ciphertext.words; // Test for salt + result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; + } else { + // Recursively serialize object members. Members are selected from + // either a user-specified list of property names, or the object + // itself. + _forOwn(properties || value, function (property) { + var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { - // Extract salt - var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext + if (element !== undefined$1) { + // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} + // is not the empty string, let `member` {quote(property) + ":"} + // be the concatenation of `member` and the `space` character." + // The "`space` character" refers to the literal space + // character, not the `space` {width} argument provided to + // `JSON.stringify`. + results.push(quote(property) + ":" + (whitespace ? " " : "") + element); + } + }); - ciphertextWords.splice(0, 4); - ciphertext.sigBytes -= 16; - } + result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; + } // Remove the object from the traversed object stack. - return CipherParams.create({ - ciphertext: ciphertext, - salt: salt - }); - } - }; - /** - * A cipher wrapper that returns ciphertext as a serializable cipher params object. - */ - var SerializableCipher = C_lib.SerializableCipher = Base.extend({ - /** - * Configuration options. - * - * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL - */ - cfg: Base.extend({ - format: OpenSSLFormatter - }), + stack.pop(); + return result; + } + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - /** - * Encrypts a message. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Encrypt - var encryptor = cipher.createEncryptor(key, cfg); - var ciphertext = encryptor.finalize(message); // Shortcut + exports.stringify = function (source, filter, width) { + var whitespace, callback, properties, className; - var cipherCfg = encryptor.cfg; // Create and return serializable cipher params + if (objectTypes[_typeof(filter)] && filter) { + className = getClass.call(filter); - return CipherParams.create({ - ciphertext: ciphertext, - key: key, - iv: cipherCfg.iv, - algorithm: cipher, - mode: cipherCfg.mode, - padding: cipherCfg.padding, - blockSize: cipher.blockSize, - formatter: cfg.format - }); - }, + if (className == functionClass) { + callback = filter; + } else if (className == arrayClass) { + // Convert the property names array into a makeshift set. + properties = {}; - /** - * Decrypts serialized ciphertext. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams + for (var index = 0, length = filter.length, value; index < length;) { + value = filter[index++]; + className = getClass.call(value); - ciphertext = this._parse(ciphertext, cfg.format); // Decrypt + if (className == "[object String]" || className == "[object Number]") { + properties[value] = 1; + } + } + } + } - var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); - return plaintext; - }, + if (width) { + className = getClass.call(width); - /** - * Converts serialized ciphertext to CipherParams, - * else assumed CipherParams already and returns ciphertext unchanged. - * - * @param {CipherParams|string} ciphertext The ciphertext. - * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. - * - * @return {CipherParams} The unserialized ciphertext. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); - */ - _parse: function _parse(ciphertext, format) { - if (typeof ciphertext == 'string') { - return format.parse(ciphertext, this); - } else { - return ciphertext; - } - } - }); - /** - * Key derivation function namespace. - */ + if (className == numberClass) { + // Convert the `width` to an integer and create a string containing + // `width` number of space characters. + if ((width -= width % 1) > 0) { + if (width > 10) { + width = 10; + } - var C_kdf = C.kdf = {}; - /** - * OpenSSL key derivation function. - */ + for (whitespace = ""; whitespace.length < width;) { + whitespace += " "; + } + } + } else if (className == stringClass) { + whitespace = width.length <= 10 ? width : width.slice(0, 10); + } + } // Opera <= 7.54u2 discards the values associated with empty string keys + // (`""`) only if they are used directly within an object member list + // (e.g., `!("" in { "": 1})`). - var OpenSSLKdf = C_kdf.OpenSSL = { - /** - * Derives a key and IV from a password. - * - * @param {string} password The password to derive from. - * @param {number} keySize The size in words of the key to generate. - * @param {number} ivSize The size in words of the IV to generate. - * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. - * - * @return {CipherParams} A cipher params object with the key, IV, and salt. - * - * @static - * - * @example - * - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); - */ - execute: function execute(password, keySize, ivSize, salt) { - // Generate random salt - if (!salt) { - salt = WordArray.random(64 / 8); - } // Derive key and IV + return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); + }; + } + } // Public: Parses a JSON source string. - var key = EvpKDF.create({ - keySize: keySize + ivSize - }).compute(password, salt); // Separate key and IV - var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); - key.sigBytes = keySize * 4; // Return params + if (!has("json-parse")) { + var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped + // equivalents. - return CipherParams.create({ - key: key, - iv: iv, - salt: salt - }); - } - }; - /** - * A serializable cipher wrapper that derives the key from a password, - * and returns ciphertext as a serializable cipher params object. - */ + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" + }; // Internal: Stores the parser state. - var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ - /** - * Configuration options. - * - * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL - */ - cfg: SerializableCipher.cfg.extend({ - kdf: OpenSSLKdf - }), + var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. - /** - * Encrypts a message using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Derive key and other params + var abort = function abort() { + Index = Source = null; + throw SyntaxError(); + }; // Internal: Returns the next token, or `"$"` if the parser has reached + // the end of the source string. A token may be a string, number, `null` + // literal, or Boolean literal. - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config - cfg.iv = derivedParams.iv; // Encrypt + var lex = function lex() { + var source = Source, + length = source.length, + value, + begin, + position, + isSigned, + charCode; - var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params + while (Index < length) { + charCode = source.charCodeAt(Index); - ciphertext.mixIn(derivedParams); - return ciphertext; - }, + switch (charCode) { + case 9: + case 10: + case 13: + case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; - /** - * Decrypts serialized ciphertext using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams + case 123: + case 125: + case 91: + case 93: + case 58: + case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; + Index++; + return value; - ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); - cfg.iv = derivedParams.iv; // Decrypt + switch (charCode) { + case 92: + case 34: + case 47: + case 98: + case 116: + case 110: + case 102: + case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; - var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); - return plaintext; - } - }); - }(); - }); - }); + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; - var aes = createCommonjsModule(function (module, exports) { + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var BlockCipher = C_lib.BlockCipher; - var C_algo = C.algo; // Lookup tables + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } // Revive the escaped character. - var SBOX = []; - var INV_SBOX = []; - var SUB_MIX_0 = []; - var SUB_MIX_1 = []; - var SUB_MIX_2 = []; - var SUB_MIX_3 = []; - var INV_SUB_MIX_0 = []; - var INV_SUB_MIX_1 = []; - var INV_SUB_MIX_2 = []; - var INV_SUB_MIX_3 = []; // Compute lookup tables - (function () { - // Compute double table - var d = []; + value += fromCharCode("0x" + source.slice(begin, Index)); + break; - for (var i = 0; i < 256; i++) { - if (i < 128) { - d[i] = i << 1; - } else { - d[i] = i << 1 ^ 0x11b; - } - } // Walk GF(2^8) + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } + charCode = source.charCodeAt(Index); + begin = Index; // Optimize for the common case where a string is valid. - var x = 0; - var xi = 0; + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } // Append the string as-is. - for (var i = 0; i < 256; i++) { - // Compute sbox - var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; - sx = sx >>> 8 ^ sx & 0xff ^ 0x63; - SBOX[x] = sx; - INV_SBOX[sx] = x; // Compute multiplication - var x2 = d[x]; - var x4 = d[x2]; - var x8 = d[x4]; // Compute sub bytes, mix columns tables + value += source.slice(begin, Index); + } + } - var t = d[sx] * 0x101 ^ sx * 0x1010100; - SUB_MIX_0[x] = t << 24 | t >>> 8; - SUB_MIX_1[x] = t << 16 | t >>> 16; - SUB_MIX_2[x] = t << 8 | t >>> 24; - SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } // Unterminated string. - var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; - INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; - INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; - INV_SUB_MIX_3[sx] = t; // Compute next counter - if (!x) { - x = xi = 1; - } else { - x = x2 ^ d[d[d[x8 ^ x2]]]; - xi ^= d[d[xi]]; - } - } - })(); // Precomputed Rcon lookup + abort(); + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. - var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; - /** - * AES block cipher algorithm. - */ + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. - var AES = C_algo.AES = BlockCipher.extend({ - _doReset: function _doReset() { - // Skip reset of nRounds has been set before and key did not change - if (this._nRounds && this._keyPriorReset === this._key) { - return; - } // Shortcuts + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } + + isSigned = false; // Parse the integer component. - var key = this._keyPriorReset = this._key; - var keyWords = key.words; - var keySize = key.sigBytes / 4; // Compute number of rounds + for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { + } // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. - var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows - var ksRows = (nRounds + 1) * 4; // Compute key schedule + if (source.charCodeAt(Index) == 46) { + position = ++Index; // Parse the decimal component. - var keySchedule = this._keySchedule = []; + for (; position < length; position++) { + charCode = source.charCodeAt(position); - for (var ksRow = 0; ksRow < ksRows; ksRow++) { - if (ksRow < keySize) { - keySchedule[ksRow] = keyWords[ksRow]; - } else { - var t = keySchedule[ksRow - 1]; + if (charCode < 48 || charCode > 57) { + break; + } + } - if (!(ksRow % keySize)) { - // Rot word - t = t << 8 | t >>> 24; // Sub word + if (position == Index) { + // Illegal trailing decimal. + abort(); + } - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon + Index = position; + } // Parse exponents. The `e` denoting the exponent is + // case-insensitive. - t ^= RCON[ksRow / keySize | 0] << 24; - } else if (keySize > 6 && ksRow % keySize == 4) { - // Sub word - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; - } - keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; - } - } // Compute inv key schedule + charCode = source.charCodeAt(Index); + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is + // specified. - var invKeySchedule = this._invKeySchedule = []; + if (charCode == 43 || charCode == 45) { + Index++; + } // Parse the exponential component. - for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { - var ksRow = ksRows - invKsRow; - if (invKsRow % 4) { - var t = keySchedule[ksRow]; - } else { - var t = keySchedule[ksRow - 4]; - } + for (position = Index; position < length; position++) { + charCode = source.charCodeAt(position); - if (invKsRow < 4 || ksRow <= 4) { - invKeySchedule[invKsRow] = t; - } else { - invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; - } - } - }, - encryptBlock: function encryptBlock(M, offset) { - this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); - }, - decryptBlock: function decryptBlock(M, offset) { - // Swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; + if (charCode < 48 || charCode > 57) { + break; + } + } - this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows + if (position == Index) { + // Illegal empty exponent. + abort(); + } + Index = position; + } // Coerce the parsed value to a JavaScript number. - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - }, - _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { - // Shortcut - var nRounds = this._nRounds; // Get input, add round key - var s0 = M[offset] ^ keySchedule[0]; - var s1 = M[offset + 1] ^ keySchedule[1]; - var s2 = M[offset + 2] ^ keySchedule[2]; - var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter + return +source.slice(begin, Index); + } // A negative sign may only precede numbers. - var ksRow = 4; // Rounds - for (var round = 1; round < nRounds; round++) { - // Shift rows, sub bytes, mix columns, add round key - var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; - var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; - var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; - var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state + if (isSigned) { + abort(); + } // `true`, `false`, and `null` literals. - s0 = t0; - s1 = t1; - s2 = t2; - s3 = t3; - } // Shift rows, sub bytes, add round key + var temp = source.slice(Index, Index + 4); - var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; - var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; - var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; - var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output + if (temp == "true") { + Index += 4; + return true; + } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { + Index += 5; + return false; + } else if (temp == "null") { + Index += 4; + return null; + } // Unrecognized token. - M[offset] = t0; - M[offset + 1] = t1; - M[offset + 2] = t2; - M[offset + 3] = t3; - }, - keySize: 256 / 32 - }); - /** - * Shortcut functions to the cipher's object interface. - * - * @example - * - * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); - * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); - */ - C.AES = BlockCipher._createHelper(AES); - })(); + abort(); + } + } // Return the sentinel `$` character if the parser has reached the end + // of the source string. - return CryptoJS.AES; - }); - }); - var encUtf8 = createCommonjsModule(function (module, exports) { + return "$"; + }; // Internal: Parses a JSON `value` token. - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - return CryptoJS.enc.Utf8; - }); - }); - /** - * toString ref. - */ - var toString$2 = Object.prototype.toString; - /** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ + var get = function get(value) { + var results, hasMembers; - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { - case '[object Date]': - return 'date'; + if (value == "$") { + // Unexpected end of input. + abort(); + } - case '[object RegExp]': - return 'regexp'; + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } // Parse object and array literals. - case '[object Arguments]': - return 'arguments'; - case '[object Array]': - return 'array'; + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; - case '[object Error]': - return 'error'; - } + for (;;) { + value = lex(); // A closing square bracket marks the end of the array literal. - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - if (isBuffer$1(val)) return 'buffer'; - val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); - return _typeof(val); - }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js + if (value == "]") { + break; + } // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. - function isBuffer$1(obj) { - return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); - } + if (hasMembers) { + if (value == ",") { + value = lex(); - /* - * Module dependencies. - */ + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. + abort(); + } + } else { + hasMembers = true; + } // Elisions and leading commas are not permitted. - /** - * Deeply clone an object. - * - * @param {*} obj Any object. - */ + if (value == ",") { + abort(); + } - var clone = function clone(obj) { - var t = componentType$2(obj); + results.push(get(value)); + } - if (t === 'object') { - var copy = {}; + return results; + } else if (value == "{") { + // Parses a JSON object, returning a new JavaScript object. + results = {}; - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - copy[key] = clone(obj[key]); - } - } + for (;;) { + value = lex(); // A closing curly brace marks the end of the object literal. - return copy; - } + if (value == "}") { + break; + } // If the object literal contains members, the current token + // should be a comma separator. - if (t === 'array') { - var copy = new Array(obj.length); - for (var i = 0, l = obj.length; i < l; i++) { - copy[i] = clone(obj[i]); - } + if (hasMembers) { + if (value == ",") { + value = lex(); - return copy; - } + if (value == "}") { + // Unexpected trailing `,` in object literal. + abort(); + } + } else { + // A `,` must separate each object member. + abort(); + } + } else { + hasMembers = true; + } // Leading commas are not permitted, object property names must be + // double-quoted strings, and a `:` must separate each property + // name and value. - if (t === 'regexp') { - // from millermedeiros/amd-utils - MIT - var flags = ''; - flags += obj.multiline ? 'm' : ''; - flags += obj.global ? 'g' : ''; - flags += obj.ignoreCase ? 'i' : ''; - return new RegExp(obj.source, flags); - } - if (t === 'date') { - return new Date(obj.getTime()); - } // string, number, boolean, etc. + if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { + abort(); + } + results[value.slice(1)] = get(lex()); + } - return obj; - }; - /* - * Exports. - */ + return results; + } // Unexpected token encountered. - var clone_1 = clone; + abort(); + } - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ + return value; + }; // Internal: Updates a traversed object member. - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse$1(val); - return options["long"] ? _long(val) : _short(val); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ + var update = function update(source, property, callback) { + var element = walk(source, property, callback); - function parse$1(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(); + if (element === undefined$1) { + delete source[property]; + } else { + source[property] = element; + } + }; // Internal: Recursively traverses a parsed JSON object, invoking the + // `callback` function for each value. This is an implementation of the + // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - switch (type) { - case 'years': - case 'year': - case 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; + var walk = function walk(source, property, callback) { + var value = source[property], + length; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; + if (_typeof(value) == "object" && value) { + // `forOwn` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { + for (length = value.length; length--;) { + update(getClass, _forOwn, value, length, callback); + } + } else { + _forOwn(value, function (property) { + update(value, property, callback); + }); + } + } - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; + return callback.call(source, property, value); + }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ + exports.parse = function (source, callback) { + var result, value; + Index = 0; + Source = "" + source; + result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. + if (lex() != "$") { + abort(); + } // Reset the parser state. - function _short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ + Index = Source = null; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; + }; + } + } - function _long(ms) { - return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; - } - /** - * Pluralization helper. - */ + exports.runInContext = runInContext; + return exports; + } + if (freeExports && !isLoader) { + // Export for CommonJS environments. + runInContext(root, freeExports); + } else { + // Export for web browsers and JavaScript engines. + var nativeJSON = root.JSON, + previousJSON = root.JSON3, + isRestored = false; + var JSON3 = runInContext(root, root.JSON3 = { + // Public: Restores the original value of the global `JSON` object and + // returns a reference to the `JSON3` object. + "noConflict": function noConflict() { + if (!isRestored) { + isRestored = true; + root.JSON = nativeJSON; + root.JSON3 = previousJSON; + nativeJSON = previousJSON = null; + } - function plural(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'; - } + return JSON3; + } + }); + root.JSON = { + "parse": JSON3.parse, + "stringify": JSON3.stringify + }; + } // Export for asynchronous module loaders. + }).call(commonjsGlobal); + }); - var debug_1 = createCommonjsModule(function (module, exports) { + var debug_1$1 = createCommonjsModule(function (module, exports) { /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. @@ -11811,23 +14995,23 @@ if (val instanceof Error) return val.stack || val.message; return val; } - }); - var debug_2 = debug_1.coerce; - var debug_3 = debug_1.disable; - var debug_4 = debug_1.enable; - var debug_5 = debug_1.enabled; - var debug_6 = debug_1.humanize; - var debug_7 = debug_1.names; - var debug_8 = debug_1.skips; - var debug_9 = debug_1.formatters; + }); + 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 = createCommonjsModule(function (module, exports) { + 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; + exports = module.exports = debug_1$1; exports.log = log; exports.formatArgs = formatArgs; exports.save = save; @@ -11964,19 +15148,20 @@ } catch (e) {} } }); - var browser_1 = browser.log; - var browser_2 = browser.formatArgs; - var browser_3 = browser.save; - var browser_4 = browser.load; - var browser_5 = browser.useColors; - var browser_6 = browser.storage; - var browser_7 = browser.colors; + 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 = browser('cookie'); + var debug$1 = browser$1('cookie'); +>>>>>>> branch for npm and latest release /** * Set or get cookie `name` with `value` and `options` object. * @@ -11987,6 +15172,7 @@ * @api public */ +<<<<<<< HEAD var rudderComponentCookie = function rudderComponentCookie(name, value, options) { switch (arguments.length) { case 3: @@ -11995,6 +15181,16 @@ case 1: return get$1(name); +======= + var componentCookie = function componentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set$1(name, value, options); + + case 1: + return get$2(name); +>>>>>>> branch for npm and latest release default: return all(); @@ -12010,7 +15206,11 @@ */ +<<<<<<< HEAD function set(name, value, options) { +======= + function set$1(name, value, options) { +>>>>>>> branch for npm and latest release options = options || {}; var str = encode$1(name) + '=' + encode$1(value); if (null == value) options.maxage = -1; @@ -12034,7 +15234,11 @@ */ +<<<<<<< HEAD function all() { +======= + function all$1() { +>>>>>>> branch for npm and latest release var str; try { @@ -12058,8 +15262,13 @@ */ +<<<<<<< HEAD function get$1(name) { return all()[name]; +======= + function get$2(name) { + return all$1()[name]; +>>>>>>> branch for npm and latest release } /** * Parse cookie `str`. @@ -12108,6 +15317,7 @@ } } +<<<<<<< HEAD var max = Math.max; /** * Produce a new array composed of all but the first `n` elements of an input `collection`. @@ -13351,681 +16561,1179 @@ }; } } - - exports.runInContext = runInContext; - return exports; + + exports.runInContext = runInContext; + return exports; + } + + if (freeExports && !isLoader) { + // Export for CommonJS environments. + runInContext(root, freeExports); + } else { + // Export for web browsers and JavaScript engines. + var nativeJSON = root.JSON, + previousJSON = root.JSON3, + isRestored = false; + var JSON3 = runInContext(root, root.JSON3 = { + // Public: Restores the original value of the global `JSON` object and + // returns a reference to the `JSON3` object. + "noConflict": function noConflict() { + if (!isRestored) { + isRestored = true; + root.JSON = nativeJSON; + root.JSON3 = previousJSON; + nativeJSON = previousJSON = null; + } + + return JSON3; + } + }); + root.JSON = { + "parse": JSON3.parse, + "stringify": JSON3.stringify + }; + } // Export for asynchronous module loaders. + }).call(commonjsGlobal); + }); + + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ + + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + + exports.formatters = {}; + /** + * Previously assigned color. + */ + + var prevColor = 0; + /** + * Previous log timestamp. + */ + + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ + + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + + function debug(namespace) { + // define the `disabled` version + function disabled() {} + + disabled.enabled = false; // define the `enabled` version + + function enabled() { + var self = enabled; // set `diff` timestamp + + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set + + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // 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; + } } - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root.JSON3, - isRestored = false; - var JSON3 = runInContext(root, root.JSON3 = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function noConflict() { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root.JSON3 = previousJSON; - nativeJSON = previousJSON = null; - } + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ - return JSON3; - } - }); - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } // Export for asynchronous module loaders. - }).call(commonjsGlobal); + + 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 debug_1$1 = createCommonjsModule(function (module, exports) { + var browser$1 = createCommonjsModule(function (module, exports) { /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. + * This is the web browser implementation of `debug()`. * * Expose `debug()` as the module. */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; + 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(); /** - * The currently active debug mode names, and names to skip. + * Colors. */ - exports.names = []; - exports.skips = []; + exports.colors = ['lightseagreen', 'forestgreen', 'goldenrod', 'dodgerblue', 'darkorchid', 'crimson']; /** - * Map of special "%n" handling functions, for the debug "format" argument. + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. * - * Valid key names are a single, lowercased letter, i.e. "n". + * TODO: add a `localStorage` variable to explicitly enable/disable colors */ - exports.formatters = {}; + 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; + } /** - * Previously assigned color. + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ - var prevColor = 0; + + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; /** - * Previous log timestamp. + * Colorize log arguments if enabled. + * + * @api public */ - var prevTime; + + 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; + } /** - * Select a color. + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". * - * @return {Number} + * @api public + */ + + + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces * @api private */ - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; + + function save(namespaces) { + try { + if (null == namespaces) { + exports.storage.removeItem('debug'); + } else { + exports.storage.debug = namespaces; + } + } catch (e) {} } /** - * Create a debugger with the given `namespace`. + * Load `namespaces`. * - * @param {String} namespace - * @return {Function} - * @api public + * @return {String} returns the previously persisted debug modes + * @api private */ - function debug(namespace) { - // define the `disabled` version - function disabled() {} + function load() { + var r; - disabled.enabled = false; // define the `enabled` version + try { + r = exports.storage.debug; + } catch (e) {} - function enabled() { - var self = enabled; // set `diff` timestamp + return r; + } + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); + 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 componentCookie(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$2(name) + '=' + encode$2(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'; + document.cookie = str; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // apply any `formatters` transformations + function all$1() { + var str; - 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]; + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } - 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` + return {}; + } - args.splice(index, 1); - index--; - } + return parse$3(str); + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ - return match; - }); - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } + function get$2(name) { + return all$1()[name]; + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - 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; + 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$2(pair[0])] = decode$2(pair[1]); } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ + return obj; + } + /** + * Encode. + */ - 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 + function encode$2(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug$1('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ - namespaces = split[i].replace(/\*/g, '.*?'); - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } + function decode$2(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug$1('error `decode(%o)` - %o', value, e); } + } + +======= +>>>>>>> branch for npm and latest release + var lib = createCommonjsModule(function (module, exports) { /** - * Disable debug output. - * - * @api public + * Module dependencies. */ +<<<<<<< HEAD - - function disable() { - exports.enable(''); - } + var parse = componentUrl.parse; /** - * Returns true if the given mode name is enabled, false otherwise. + * Get the top domain. * - * @param {String} name - * @return {Boolean} + * 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. - 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 (var i = 0; i < levels.length; ++i) { + var cname = '__tld__'; + var domain = levels[i]; + var opts = { + domain: '.' + domain + }; + cookie(cname, 1, opts); - for (i = 0, len = exports.names.length; i < len; i++) { - if (exports.names[i].test(name)) { - return true; + if (cookie(cname)) { + cookie(cname, null, opts); + return domain; } } - return false; + return ''; } /** - * Coerce `val`. + * Levels returns all levels of the given url. * - * @param {Mixed} val - * @return {Mixed} - * @api private + * @param {string} url + * @return {Array} + * @api public */ - 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; + domain.levels = function (url) { + var host = parse(url).hostname; + var parts = host.split('.'); + var last = parts[parts.length - 1]; + var levels = []; // Ip address. - 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. - */ + if (parts.length === 4 && last === parseInt(last, 10)) { + return levels; + } // Localhost. - 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. - */ + if (parts.length <= 1) { + return levels; + } // Create levels. - exports.formatters.j = function (v) { - return JSON.stringify(v); + for (var i = parts.length - 2; i >= 0; --i) { + levels.push(parts.slice(i).join('.')); + } + + return levels; }; /** - * Colorize log arguments if enabled. - * - * @api public + * Expose cookie on domain. */ - 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 + domain.cookie = componentCookie; + /* + * Exports. + */ - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function (match) { - if ('%%' === match) return; - index++; + exports = module.exports = domain; + }); - 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 - */ + /** + * An object utility to persist values in cookies + */ + var CookieLocal = /*#__PURE__*/function () { + function CookieLocal(options) { + _classCallCheck(this, CookieLocal); - function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + this._options = {}; + this.options(options); } /** - * Save `namespaces`. * - * @param {String} namespaces - * @api private + * @param {*} options */ - function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; + _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 = ".".concat(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; } - } catch (e) {} - } - /** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ + this.remove("test_rudder"); + } + /** + * + * @param {*} key + * @param {*} value + */ - function load() { - var r; + }, { + key: "set", + value: function set(key, value) { + try { + rudderComponentCookie(key, value, clone_1(this._options)); + return true; + } catch (e) { + logger.error(e); + return false; + } + } + /** + * + * @param {*} key + */ - try { - r = exports.storage.debug; - } catch (e) {} + }, { + key: "get", + value: function get(key) { + return rudderComponentCookie(key); + } + /** + * + * @param {*} key + */ - return r; - } - /** - * Enable namespaces listed in `localStorage.debug` initially. - */ + }, { + key: "remove", + value: function remove(key) { + try { + rudderComponentCookie(key, null, clone_1(this._options)); + return true; + } catch (e) { + return false; + } + } + }]); + return CookieLocal; + }(); // Exporting only the instance - 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; + var Cookie = new CookieLocal({}); - /** - * Module dependencies. - */ + var store = function () { + // Store.js + var store = {}, + win = typeof window != 'undefined' ? window : commonjsGlobal, + doc = win.document, + localStorageName = 'localStorage', + scriptTag = 'script', + storage; + store.disabled = false; + store.version = '1.3.20'; - 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 - */ + store.set = function (key, value) {}; - var componentCookie = function componentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set$1(name, value, options); + store.get = function (key, defaultVal) {}; + + store.has = function (key) { + return store.get(key) !== undefined; + }; + + store.remove = function (key) {}; + + store.clear = function () {}; + + store.transact = function (key, defaultVal, transactionFn) { + if (transactionFn == null) { + transactionFn = defaultVal; + defaultVal = null; + } + + if (defaultVal == null) { + defaultVal = {}; + } + + var val = store.get(key, defaultVal); + transactionFn(val); + store.set(key, val); + }; + + store.getAll = function () { + var ret = {}; + store.forEach(function (key, val) { + ret[key] = val; + }); + return ret; + }; + + store.forEach = function () {}; + + store.serialize = function (value) { + return json3.stringify(value); + }; + + store.deserialize = function (value) { + if (typeof value != 'string') { + return undefined; + } + + try { + return json3.parse(value); + } catch (e) { + return value || undefined; + } + }; // Functions to encapsulate questionable FireFox 3.6.13 behavior + // when about.config::dom.storage.enabled === false + // See https://github.com/marcuswestin/store.js/issues#issue/13 - case 1: - return get$2(name); - default: - return all$1(); + function isLocalStorageNameSupported() { + try { + return localStorageName in win && win[localStorageName]; + } catch (err) { + return false; + } } - }; - /** - * Set cookie `name` to `value`. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @api private - */ + if (isLocalStorageNameSupported()) { + storage = win[localStorageName]; - function set$1(name, value, options) { - options = options || {}; - var str = encode$2(name) + '=' + encode$2(value); - if (null == value) options.maxage = -1; + store.set = function (key, val) { + if (val === undefined) { + return store.remove(key); + } - if (options.maxage) { - options.expires = new Date(+new Date() + options.maxage); - } + storage.setItem(key, store.serialize(val)); + return val; + }; - 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'; - document.cookie = str; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ + store.get = function (key, defaultVal) { + var val = store.deserialize(storage.getItem(key)); + return val === undefined ? defaultVal : val; + }; + store.remove = function (key) { + storage.removeItem(key); + }; - function all$1() { - var str; + store.clear = function () { + storage.clear(); + }; - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); + store.forEach = function (callback) { + for (var i = 0; i < storage.length; i++) { + var key = storage.key(i); + callback(key, store.get(key)); + } + }; + } else if (doc && doc.documentElement.addBehavior) { + var storageOwner, storageContainer; // Since #userData storage applies only to specific paths, we need to + // somehow link our data to a specific path. We choose /favicon.ico + // as a pretty safe option, since all browsers already make a request to + // this URL anyway and being a 404 will not hurt us here. We wrap an + // iframe pointing to the favicon in an ActiveXObject(htmlfile) object + // (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx) + // since the iframe access rules appear to allow direct access and + // manipulation of the document element, even for a 404 page. This + // document can be used instead of the current document (which would + // have been limited to the current path) to perform #userData storage. + + try { + storageContainer = new ActiveXObject('htmlfile'); + storageContainer.open(); + storageContainer.write('<' + scriptTag + '>document.w=window'); + storageContainer.close(); + storageOwner = storageContainer.w.frames[0].document; + storage = storageOwner.createElement('div'); + } catch (e) { + // somehow ActiveXObject instantiation failed (perhaps some special + // security settings or otherwse), fall back to per-path storage + storage = doc.createElement('div'); + storageOwner = doc.body; } - return {}; - } + var withIEStorage = function withIEStorage(storeFunction) { + return function () { + var args = Array.prototype.slice.call(arguments, 0); + args.unshift(storage); // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx + // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx - return parse$3(str); - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ + storageOwner.appendChild(storage); + storage.addBehavior('#default#userData'); + storage.load(localStorageName); + var result = storeFunction.apply(store, args); + storageOwner.removeChild(storage); + return result; + }; + }; // In IE7, keys cannot start with a digit or contain certain chars. + // See https://github.com/marcuswestin/store.js/issues/40 + // See https://github.com/marcuswestin/store.js/issues/83 - function get$2(name) { - return all$1()[name]; - } - /** - * Parse cookie `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ + var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g"); + var ieKeyFix = function ieKeyFix(key) { + return key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___'); + }; - function parse$3(str) { - var obj = {}; - var pairs = str.split(/ *; */); - var pair; - if ('' == pairs[0]) return obj; + store.set = withIEStorage(function (storage, key, val) { + key = ieKeyFix(key); - for (var i = 0; i < pairs.length; ++i) { - pair = pairs[i].split('='); - obj[decode$2(pair[0])] = decode$2(pair[1]); - } + if (val === undefined) { + return store.remove(key); + } - return obj; - } - /** - * Encode. - */ + storage.setAttribute(key, store.serialize(val)); + storage.save(localStorageName); + return val; + }); + store.get = withIEStorage(function (storage, key, defaultVal) { + key = ieKeyFix(key); + var val = store.deserialize(storage.getAttribute(key)); + return val === undefined ? defaultVal : val; + }); + store.remove = withIEStorage(function (storage, key) { + key = ieKeyFix(key); + storage.removeAttribute(key); + storage.save(localStorageName); + }); + store.clear = withIEStorage(function (storage) { + var attributes = storage.XMLDocument.documentElement.attributes; + storage.load(localStorageName); + for (var i = attributes.length - 1; i >= 0; i--) { + storage.removeAttribute(attributes[i].name); + } - function encode$2(value) { - try { - return encodeURIComponent(value); - } catch (e) { - debug$1('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ + storage.save(localStorageName); + }); + store.forEach = withIEStorage(function (storage, callback) { + var attributes = storage.XMLDocument.documentElement.attributes; + for (var i = 0, attr; attr = attributes[i]; ++i) { + callback(attr.name, store.deserialize(storage.getAttribute(attr.name))); + } + }); + } - function decode$2(value) { try { - return decodeURIComponent(value); - } catch (e) { - debug$1('error `decode(%o)` - %o', value, e); - } - } + var testKey = '__storejs__'; + store.set(testKey, testKey); - var lib = createCommonjsModule(function (module, exports) { - /** - * Module dependencies. - */ + if (store.get(testKey) != testKey) { + store.disabled = true; + } - 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 - */ + store.remove(testKey); + } catch (e) { + store.disabled = true; + } - function domain(url) { - var cookie = exports.cookie; - var levels = exports.levels(url); // Lookup the real top level one. + store.enabled = !store.disabled; + return store; + }(); - for (var i = 0; i < levels.length; ++i) { - var cname = '__tld__'; - var domain = levels[i]; - var opts = { - domain: '.' + domain - }; - cookie(cname, 1, opts); + /** + * An object utility to persist user and other values in localstorage + */ - if (cookie(cname)) { - cookie(cname, null, opts); - return domain; - } - } + var StoreLocal = /*#__PURE__*/function () { + function StoreLocal(options) { + _classCallCheck(this, StoreLocal); - return ''; + this._options = {}; + this.enabled = false; + this.options(options); } /** - * Levels returns all levels of the given url. * - * @param {string} url - * @return {Array} - * @api public + * @param {*} options */ - 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. - + _createClass(StoreLocal, [{ + key: "options", + value: function options() { + var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - if (parts.length <= 1) { - return levels; - } // Create levels. + if (arguments.length === 0) return this._options; + defaults_1(_options, { + enabled: true + }); + this.enabled = _options.enabled && store.enabled; + this._options = _options; + } + /** + * + * @param {*} key + * @param {*} value + */ + }, { + key: "set", + value: function set(key, value) { + if (!this.enabled) return false; + return store.set(key, value); + } + /** + * + * @param {*} key + */ - for (var i = parts.length - 2; i >= 0; --i) { - levels.push(parts.slice(i).join('.')); + }, { + key: "get", + value: function get(key) { + if (!this.enabled) return null; + return store.get(key); } + /** + * + * @param {*} key + */ - return levels; - }; - /** - * Expose cookie on domain. - */ + }, { + key: "remove", + value: function remove(key) { + if (!this.enabled) return false; + return store.remove(key); + } + }]); + return StoreLocal; + }(); // Exporting only the instance - domain.cookie = componentCookie; - /* - * Exports. - */ - exports = module.exports = domain; - }); + var Store = new StoreLocal({}); + var defaults$1 = { + user_storage_key: "rl_user_id", + user_storage_trait: "rl_trait", + user_storage_anonymousId: "rl_anonymous_id", + group_storage_key: "rl_group_id", + group_storage_trait: "rl_group_trait", + prefix: "RudderEncrypt:", + key: "Rudder" + }; /** - * An object utility to persist values in cookies + * An object that handles persisting key-val from Analytics */ - var CookieLocal = /*#__PURE__*/function () { - function CookieLocal(options) { - _classCallCheck(this, CookieLocal); + var Storage = /*#__PURE__*/function () { + function Storage() { + _classCallCheck(this, Storage); - this._options = {}; - this.options(options); + // First try setting the storage to cookie else to localstorage + Cookie.set("rudder_cookies", true); + + if (Cookie.get("rudder_cookies")) { + Cookie.remove("rudder_cookies"); + this.storage = Cookie; + return; + } // localStorage is enabled. + + + if (Store.enabled) { + this.storage = Store; + } } /** - * - * @param {*} options + * Json stringify the given value + * @param {*} value */ - _createClass(CookieLocal, [{ - key: "options", - value: function options() { - var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + _createClass(Storage, [{ + key: "stringify", + value: function stringify(value) { + return JSON.stringify(value); + } + /** + * JSON parse the value + * @param {*} value + */ - if (arguments.length === 0) return this._options; - var domain = ".".concat(lib(window.location.href)); - if (domain === ".") domain = null; // the default maxage and path + }, { + key: "parse", + value: function parse(value) { + // if not parseable, return as is without json parse + try { + return value ? JSON.parse(value) : null; + } catch (e) { + logger.error(e); + return value || null; + } + } + /** + * trim using regex for browser polyfill + * @param {*} value + */ - this._options = defaults_1(_options, { - maxage: 31536000000, - path: "/", - domain: domain, - samesite: "Lax" - }); // try setting a cookie first + }, { + key: "trim", + value: function trim(value) { + return value.replace(/^\s+|\s+$/gm, ""); + } + /** + * AES encrypt value with constant prefix + * @param {*} value + */ - this.set("test_rudder", true); + }, { + key: "encryptValue", + value: function encryptValue(value) { + if (this.trim(value) == "") { + return value; + } - if (!this.get("test_rudder")) { - this._options.domain = null; + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); + return prefixedVal; + } + /** + * decrypt value + * @param {*} value + */ + + }, { + key: "decryptValue", + value: function decryptValue(value) { + if (!value || typeof value === "string" && this.trim(value) == "") { + return value; } - this.remove("test_rudder"); + if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { + return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); + } + + return value; + } + /** + * + * @param {*} key + * @param {*} value + */ + + }, { + key: "setItem", + value: function setItem(key, value) { + this.storage.set(key, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ + + }, { + key: "setUserId", + value: function setUserId(value) { + if (typeof value !== "string") { + logger.error("[Storage] setUserId:: userId should be string"); + return; + } + + this.storage.set(defaults$1.user_storage_key, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ + + }, { + key: "setUserTraits", + value: function setUserTraits(value) { + this.storage.set(defaults$1.user_storage_trait, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ + + }, { + key: "setGroupId", + value: function setGroupId(value) { + if (typeof value !== "string") { + logger.error("[Storage] setGroupId:: groupId should be string"); + return; + } + + this.storage.set(defaults$1.group_storage_key, this.encryptValue(this.stringify(value))); + } + /** + * + * @param {*} value + */ + + }, { + key: "setGroupTraits", + value: function setGroupTraits(value) { + this.storage.set(defaults$1.group_storage_trait, this.encryptValue(this.stringify(value))); } /** * - * @param {*} key * @param {*} value */ }, { - key: "set", - value: function set(key, value) { - try { - rudderComponentCookie(key, value, clone_1(this._options)); - return true; - } catch (e) { - logger.error(e); - return false; + key: "setAnonymousId", + value: function setAnonymousId(value) { + if (typeof value !== "string") { + logger.error("[Storage] setAnonymousId:: anonymousId should be string"); + return; } + + this.storage.set(defaults$1.user_storage_anonymousId, this.encryptValue(this.stringify(value))); } /** * @@ -14033,766 +17741,627 @@ */ }, { - key: "get", - value: function get(key) { - return rudderComponentCookie(key); + key: "getItem", + value: function getItem(key) { + return this.parse(this.decryptValue(this.storage.get(key))); } /** - * - * @param {*} key + * get the stored userId */ }, { - key: "remove", - value: function remove(key) { - try { - rudderComponentCookie(key, null, clone_1(this._options)); - return true; - } catch (e) { - return false; - } + key: "getUserId", + value: function getUserId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_key))); } - }]); - - return CookieLocal; - }(); // Exporting only the instance - - - var Cookie = new CookieLocal({}); - - var store = function () { - // Store.js - var store = {}, - win = typeof window != 'undefined' ? window : commonjsGlobal, - doc = win.document, - localStorageName = 'localStorage', - scriptTag = 'script', - storage; - store.disabled = false; - store.version = '1.3.20'; - - store.set = function (key, value) {}; - - store.get = function (key, defaultVal) {}; - - store.has = function (key) { - return store.get(key) !== undefined; - }; - - store.remove = function (key) {}; - - store.clear = function () {}; + /** + * get the stored user traits + */ - store.transact = function (key, defaultVal, transactionFn) { - if (transactionFn == null) { - transactionFn = defaultVal; - defaultVal = null; + }, { + key: "getUserTraits", + value: function getUserTraits() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_trait))); } + /** + * get the stored userId + */ - if (defaultVal == null) { - defaultVal = {}; + }, { + key: "getGroupId", + value: function getGroupId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_key))); } + /** + * get the stored user traits + */ - var val = store.get(key, defaultVal); - transactionFn(val); - store.set(key, val); - }; - - store.getAll = function () { - var ret = {}; - store.forEach(function (key, val) { - ret[key] = val; - }); - return ret; - }; - - store.forEach = function () {}; - - store.serialize = function (value) { - return json3.stringify(value); - }; - - store.deserialize = function (value) { - if (typeof value != 'string') { - return undefined; + }, { + key: "getGroupTraits", + value: function getGroupTraits() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_trait))); } + /** + * get stored anonymous id + */ - try { - return json3.parse(value); - } catch (e) { - return value || undefined; + }, { + key: "getAnonymousId", + value: function getAnonymousId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_anonymousId))); } - }; // Functions to encapsulate questionable FireFox 3.6.13 behavior - // when about.config::dom.storage.enabled === false - // See https://github.com/marcuswestin/store.js/issues#issue/13 - + /** + * + * @param {*} key + */ - function isLocalStorageNameSupported() { - try { - return localStorageName in win && win[localStorageName]; - } catch (err) { - return false; + }, { + key: "removeItem", + value: function removeItem(key) { + return this.storage.remove(key); } - } - - if (isLocalStorageNameSupported()) { - storage = win[localStorageName]; - - store.set = function (key, val) { - if (val === undefined) { - return store.remove(key); - } - - storage.setItem(key, store.serialize(val)); - return val; - }; - - store.get = function (key, defaultVal) { - var val = store.deserialize(storage.getItem(key)); - return val === undefined ? defaultVal : val; - }; - - store.remove = function (key) { - storage.removeItem(key); - }; - - store.clear = function () { - storage.clear(); - }; - - store.forEach = function (callback) { - for (var i = 0; i < storage.length; i++) { - var key = storage.key(i); - callback(key, store.get(key)); - } - }; - } else if (doc && doc.documentElement.addBehavior) { - var storageOwner, storageContainer; // Since #userData storage applies only to specific paths, we need to - // somehow link our data to a specific path. We choose /favicon.ico - // as a pretty safe option, since all browsers already make a request to - // this URL anyway and being a 404 will not hurt us here. We wrap an - // iframe pointing to the favicon in an ActiveXObject(htmlfile) object - // (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx) - // since the iframe access rules appear to allow direct access and - // manipulation of the document element, even for a 404 page. This - // document can be used instead of the current document (which would - // have been limited to the current path) to perform #userData storage. + /** + * remove stored keys + */ - try { - storageContainer = new ActiveXObject('htmlfile'); - storageContainer.open(); - storageContainer.write('<' + scriptTag + '>document.w=window'); - storageContainer.close(); - storageOwner = storageContainer.w.frames[0].document; - storage = storageOwner.createElement('div'); - } catch (e) { - // somehow ActiveXObject instantiation failed (perhaps some special - // security settings or otherwse), fall back to per-path storage - storage = doc.createElement('div'); - storageOwner = doc.body; + }, { + key: "clear", + value: function clear() { + this.storage.remove(defaults$1.user_storage_key); + this.storage.remove(defaults$1.user_storage_trait); + this.storage.remove(defaults$1.group_storage_key); + this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); } + }]); - var withIEStorage = function withIEStorage(storeFunction) { - return function () { - var args = Array.prototype.slice.call(arguments, 0); - args.unshift(storage); // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx - // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx + return Storage; + }(); - storageOwner.appendChild(storage); - storage.addBehavior('#default#userData'); - storage.load(localStorageName); - var result = storeFunction.apply(store, args); - storageOwner.removeChild(storage); - return result; - }; - }; // In IE7, keys cannot start with a digit or contain certain chars. - // See https://github.com/marcuswestin/store.js/issues/40 - // See https://github.com/marcuswestin/store.js/issues/83 + var Storage$1 = new Storage(); + var defaults$2 = { + lotame_synch_time_key: "lt_synch_timestamp" + }; - var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g"); + var LotameStorage = /*#__PURE__*/function () { + function LotameStorage() { + _classCallCheck(this, LotameStorage); - var ieKeyFix = function ieKeyFix(key) { - return key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___'); - }; + this.storage = Storage$1; // new Storage(); + } - store.set = withIEStorage(function (storage, key, val) { - key = ieKeyFix(key); + _createClass(LotameStorage, [{ + key: "setLotameSynchTime", + value: function setLotameSynchTime(value) { + this.storage.setItem(defaults$2.lotame_synch_time_key, value); + } + }, { + key: "getLotameSynchTime", + value: function getLotameSynchTime() { + return this.storage.getItem(defaults$2.lotame_synch_time_key); + } + }]); - if (val === undefined) { - return store.remove(key); - } + return LotameStorage; + }(); - storage.setAttribute(key, store.serialize(val)); - storage.save(localStorageName); - return val; - }); - store.get = withIEStorage(function (storage, key, defaultVal) { - key = ieKeyFix(key); - var val = store.deserialize(storage.getAttribute(key)); - return val === undefined ? defaultVal : val; - }); - store.remove = withIEStorage(function (storage, key) { - key = ieKeyFix(key); - storage.removeAttribute(key); - storage.save(localStorageName); - }); - store.clear = withIEStorage(function (storage) { - var attributes = storage.XMLDocument.documentElement.attributes; - storage.load(localStorageName); + var lotameStorage = new LotameStorage(); - for (var i = attributes.length - 1; i >= 0; i--) { - storage.removeAttribute(attributes[i].name); - } + var Lotame = /*#__PURE__*/function () { + function Lotame(config, analytics) { + var _this = this; - storage.save(localStorageName); - }); - store.forEach = withIEStorage(function (storage, callback) { - var attributes = storage.XMLDocument.documentElement.attributes; + _classCallCheck(this, Lotame); - for (var i = 0, attr; attr = attributes[i]; ++i) { - callback(attr.name, store.deserialize(storage.getAttribute(attr.name))); - } + this.name = "LOTAME"; + this.analytics = analytics; + this.storage = lotameStorage; + this.bcpUrlSettingsPixel = config.bcpUrlSettingsPixel; + this.bcpUrlSettingsIframe = config.bcpUrlSettingsIframe; + this.dspUrlSettingsPixel = config.dspUrlSettingsPixel; + this.dspUrlSettingsIframe = config.dspUrlSettingsIframe; + this.mappings = {}; + config.mappings.forEach(function (mapping) { + var key = mapping.key; + var value = mapping.value; + _this.mappings[key] = value; }); } +======= - try { - var testKey = '__storejs__'; - store.set(testKey, testKey); + 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 + */ - if (store.get(testKey) != testKey) { - store.disabled = true; + 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; + } } - store.remove(testKey); - } catch (e) { - store.disabled = true; + return ''; } + /** + * Levels returns all levels of the given url. + * + * @param {string} url + * @return {Array} + * @api public + */ - store.enabled = !store.disabled; - return store; - }(); - /** - * An object utility to persist user and other values in localstorage - */ + domain.levels = function (url) { + var host = parse(url).hostname; + var parts = host.split('.'); + var last = parts[parts.length - 1]; + var levels = []; // Ip address. - var StoreLocal = /*#__PURE__*/function () { - function StoreLocal(options) { - _classCallCheck(this, StoreLocal); + if (parts.length === 4 && last === parseInt(last, 10)) { + return levels; + } // Localhost. - this._options = {}; - this.enabled = false; - this.options(options); - } + + 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; + }; /** - * - * @param {*} options + * Expose cookie on domain. */ - _createClass(StoreLocal, [{ - key: "options", - value: function options() { - var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + domain.cookie = componentCookie; + /* + * Exports. + */ - if (arguments.length === 0) return this._options; - defaults_1(_options, { - enabled: true - }); - this.enabled = _options.enabled && store.enabled; - this._options = _options; - } - /** - * - * @param {*} key - * @param {*} value - */ + exports = module.exports = domain; + }); +>>>>>>> branch for npm and latest release - }, { - key: "set", - value: function set(key, value) { - if (!this.enabled) return false; - return store.set(key, value); - } - /** - * - * @param {*} key - */ + _createClass(Lotame, [{ + key: "init", + value: function init() { + logger.debug("===in init Lotame==="); +<<<<<<< HEAD + window.LOTAME_SYNCH_CALLBACK = function () {}; + } }, { - key: "get", - value: function get(key) { - if (!this.enabled) return null; - return store.get(key); + key: "addPixel", + value: function addPixel(source, width, height) { + logger.debug("Adding pixel for :: ".concat(source)); + var image = document.createElement("img"); + image.src = source; + image.setAttribute("width", width); + image.setAttribute("height", height); + logger.debug("Image Pixel :: ".concat(image)); + document.getElementsByTagName("body")[0].appendChild(image); } - /** - * - * @param {*} key - */ - }, { - key: "remove", - value: function remove(key) { - if (!this.enabled) return false; - return store.remove(key); + key: "addIFrame", + value: function addIFrame(source) { + logger.debug("Adding iframe for :: ".concat(source)); + var iframe = document.createElement("iframe"); + iframe.src = source; + iframe.title = "empty"; + iframe.setAttribute("id", "LOTCCFrame"); + iframe.setAttribute("tabindex", "-1"); + iframe.setAttribute("role", "presentation"); + iframe.setAttribute("aria-hidden", "true"); + iframe.setAttribute("style", "border: 0px; width: 0px; height: 0px; display: block;"); + logger.debug("IFrame :: ".concat(iframe)); + document.getElementsByTagName("body")[0].appendChild(iframe); } - }]); - - return StoreLocal; - }(); // Exporting only the instance - - - var Store = new StoreLocal({}); + }, { + key: "syncPixel", + value: function syncPixel(userId) { + var _this2 = this; +======= + var CookieLocal = /*#__PURE__*/function () { + function CookieLocal(options) { + _classCallCheck(this, CookieLocal); +>>>>>>> branch for npm and latest release - var defaults$1 = { - user_storage_key: "rl_user_id", - user_storage_trait: "rl_trait", - user_storage_anonymousId: "rl_anonymous_id", - group_storage_key: "rl_group_id", - group_storage_trait: "rl_group_trait", - prefix: "RudderEncrypt:", - key: "Rudder" - }; - /** - * An object that handles persisting key-val from Analytics - */ + logger.debug("===== in syncPixel ======"); + logger.debug("Firing DSP Pixel URLs"); - var Storage = /*#__PURE__*/function () { - function Storage() { - _classCallCheck(this, Storage); + if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) { + var currentTime = Date.now(); + this.dspUrlSettingsPixel.forEach(function (urlSettings) { + var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { + userId: userId, + random: currentTime + }), urlSettings.dspUrlTemplate); - // First try setting the storage to cookie else to localstorage - Cookie.set("rudder_cookies", true); + _this2.addPixel(dspUrl, "1", "1"); + }); + } - if (Cookie.get("rudder_cookies")) { - Cookie.remove("rudder_cookies"); - this.storage = Cookie; - return; - } // localStorage is enabled. + logger.debug("Firing DSP IFrame URLs"); + if (this.dspUrlSettingsIframe && this.dspUrlSettingsIframe.length > 0) { + var _currentTime = Date.now(); - if (Store.enabled) { - this.storage = Store; - } - } - /** - * Json stringify the given value - * @param {*} value - */ + this.dspUrlSettingsIframe.forEach(function (urlSettings) { + var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { + userId: userId, + random: _currentTime + }), urlSettings.dspUrlTemplate); + _this2.addIFrame(dspUrl); + }); + } - _createClass(Storage, [{ - key: "stringify", - value: function stringify(value) { - return JSON.stringify(value); - } - /** - * JSON parse the value - * @param {*} value - */ + this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel +<<<<<<< HEAD + if (this.analytics.methodToCallbackMapping.syncPixel) { + this.analytics.emit("syncPixel", { + destination: this.name + }); +======= }, { - key: "parse", - value: function parse(value) { - // if not parseable, return as is without json parse + key: "set", + value: function set(key, value) { try { - return value ? JSON.parse(value) : null; + rudderComponentCookie(key, value, clone_1(this._options)); + return true; } catch (e) { logger.error(e); - return value || null; + return false; +>>>>>>> update npm module } } - /** - * trim using regex for browser polyfill - * @param {*} value - */ - +<<<<<<< HEAD }, { - key: "trim", - value: function trim(value) { - return value.replace(/^\s+|\s+$/gm, ""); +<<<<<<< HEAD + key: "compileUrl", + value: function compileUrl(map, url) { + Object.keys(map).forEach(function (key) { + if (map.hasOwnProperty(key)) { + var replaceKey = "{{".concat(key, "}}"); + var regex = new RegExp(replaceKey, "gi"); + url = url.replace(regex, map[key]); + } + }); + return url; +======= + key: "get", + value: function get(key) { + return rudderComponentCookie(key); +>>>>>>> update npm module } - /** - * AES encrypt value with constant prefix - * @param {*} value - */ - }, { - key: "encryptValue", - value: function encryptValue(value) { - if (this.trim(value) == "") { - return value; - } - - var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); - return prefixedVal; + key: "identify", + value: function identify(rudderElement) { + logger.debug("in Lotame identify"); + var userId = rudderElement.message.userId; + this.syncPixel(userId); } - /** - * decrypt value - * @param {*} value - */ - }, { - key: "decryptValue", - value: function decryptValue(value) { - if (!value || typeof value === "string" && this.trim(value) == "") { - return value; - } - - if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { - return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); - } - - return value; + key: "track", + value: function track(rudderElement) { + logger.debug("track not supported for lotame"); } - /** - * - * @param {*} key - * @param {*} value - */ - }, { - key: "setItem", - value: function setItem(key, value) { - this.storage.set(key, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ + key: "page", + value: function page(rudderElement) { + var _this3 = this; - }, { - key: "setUserId", - value: function setUserId(value) { - if (typeof value !== "string") { - logger.error("[Storage] setUserId:: userId should be string"); - return; - } + logger.debug("in Lotame page"); + logger.debug("Firing BCP Pixel URLs"); - this.storage.set(defaults$1.user_storage_key, this.encryptValue(this.stringify(value))); - } + if (this.bcpUrlSettingsPixel && this.bcpUrlSettingsPixel.length > 0) { + var currentTime = Date.now(); + this.bcpUrlSettingsPixel.forEach(function (urlSettings) { + var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { + random: currentTime + }), urlSettings.bcpUrlTemplate); +======= /** * - * @param {*} value + * @param {*} key */ }, { - key: "setUserTraits", - value: function setUserTraits(value) { - this.storage.set(defaults$1.user_storage_trait, this.encryptValue(this.stringify(value))); + key: "get", + value: function get(key) { + return rudderComponentCookie(key); } /** * - * @param {*} value + * @param {*} key */ }, { - key: "setGroupId", - value: function setGroupId(value) { - if (typeof value !== "string") { - logger.error("[Storage] setGroupId:: groupId should be string"); - return; + key: "remove", + value: function remove(key) { + try { + rudderComponentCookie(key, null, clone_1(this._options)); + return true; + } catch (e) { + return false; } - - this.storage.set(defaults$1.group_storage_key, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ - - }, { - key: "setGroupTraits", - value: function setGroupTraits(value) { - this.storage.set(defaults$1.group_storage_trait, this.encryptValue(this.stringify(value))); } - /** - * - * @param {*} value - */ + }]); - }, { - key: "setAnonymousId", - value: function setAnonymousId(value) { - if (typeof value !== "string") { - logger.error("[Storage] setAnonymousId:: anonymousId should be string"); - return; - } + return CookieLocal; + }(); // Exporting only the instance - this.storage.set(defaults$1.user_storage_anonymousId, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} key - */ - }, { - key: "getItem", - value: function getItem(key) { - return this.parse(this.decryptValue(this.storage.get(key))); - } - /** - * get the stored userId - */ + var Cookie = new CookieLocal({}); - }, { - key: "getUserId", - value: function getUserId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_key))); - } - /** - * get the stored user traits - */ + var store = function () { + // Store.js + var store = {}, + win = typeof window != 'undefined' ? window : commonjsGlobal, + doc = win.document, + localStorageName = 'localStorage', + scriptTag = 'script', + storage; + store.disabled = false; + store.version = '1.3.20'; - }, { - key: "getUserTraits", - value: function getUserTraits() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_trait))); - } - /** - * get the stored userId - */ + store.set = function (key, value) {}; - }, { - key: "getGroupId", - value: function getGroupId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_key))); - } - /** - * get the stored user traits - */ + store.get = function (key, defaultVal) {}; - }, { - key: "getGroupTraits", - value: function getGroupTraits() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_trait))); - } - /** - * get stored anonymous id - */ + store.has = function (key) { + return store.get(key) !== undefined; + }; - }, { - key: "getAnonymousId", - value: function getAnonymousId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_anonymousId))); - } - /** - * - * @param {*} key - */ + store.remove = function (key) {}; - }, { - key: "removeItem", - value: function removeItem(key) { - return this.storage.remove(key); + store.clear = function () {}; + + store.transact = function (key, defaultVal, transactionFn) { + if (transactionFn == null) { + transactionFn = defaultVal; + defaultVal = null; } - /** - * remove stored keys - */ - }, { - key: "clear", - value: function clear() { - this.storage.remove(defaults$1.user_storage_key); - this.storage.remove(defaults$1.user_storage_trait); - this.storage.remove(defaults$1.group_storage_key); - this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); + if (defaultVal == null) { + defaultVal = {}; } - }]); - return Storage; - }(); + var val = store.get(key, defaultVal); + transactionFn(val); + store.set(key, val); + }; - var Storage$1 = new Storage(); + store.getAll = function () { + var ret = {}; + store.forEach(function (key, val) { + ret[key] = val; + }); + return ret; + }; - var defaults$2 = { - lotame_synch_time_key: "lt_synch_timestamp" - }; + store.forEach = function () {}; - var LotameStorage = /*#__PURE__*/function () { - function LotameStorage() { - _classCallCheck(this, LotameStorage); + store.serialize = function (value) { + return json3.stringify(value); + }; - this.storage = Storage$1; // new Storage(); - } + store.deserialize = function (value) { + if (typeof value != 'string') { + return undefined; + } - _createClass(LotameStorage, [{ - key: "setLotameSynchTime", - value: function setLotameSynchTime(value) { - this.storage.setItem(defaults$2.lotame_synch_time_key, value); + try { + return json3.parse(value); + } catch (e) { + return value || undefined; } - }, { - key: "getLotameSynchTime", - value: function getLotameSynchTime() { - return this.storage.getItem(defaults$2.lotame_synch_time_key); + }; // Functions to encapsulate questionable FireFox 3.6.13 behavior + // when about.config::dom.storage.enabled === false + // See https://github.com/marcuswestin/store.js/issues#issue/13 + + + function isLocalStorageNameSupported() { + try { + return localStorageName in win && win[localStorageName]; + } catch (err) { + return false; } - }]); + } - return LotameStorage; - }(); + if (isLocalStorageNameSupported()) { + storage = win[localStorageName]; - var lotameStorage = new LotameStorage(); + store.set = function (key, val) { + if (val === undefined) { + return store.remove(key); + } - var Lotame = /*#__PURE__*/function () { - function Lotame(config, analytics) { - var _this = this; + storage.setItem(key, store.serialize(val)); + return val; + }; - _classCallCheck(this, Lotame); + store.get = function (key, defaultVal) { + var val = store.deserialize(storage.getItem(key)); + return val === undefined ? defaultVal : val; + }; - this.name = "LOTAME"; - this.analytics = analytics; - this.storage = lotameStorage; - this.bcpUrlSettingsPixel = config.bcpUrlSettingsPixel; - this.bcpUrlSettingsIframe = config.bcpUrlSettingsIframe; - this.dspUrlSettingsPixel = config.dspUrlSettingsPixel; - this.dspUrlSettingsIframe = config.dspUrlSettingsIframe; - this.mappings = {}; - config.mappings.forEach(function (mapping) { - var key = mapping.key; - var value = mapping.value; - _this.mappings[key] = value; - }); - } + store.remove = function (key) { + storage.removeItem(key); + }; - _createClass(Lotame, [{ - key: "init", - value: function init() { - logger.debug("===in init Lotame==="); + store.clear = function () { + storage.clear(); + }; - window.LOTAME_SYNCH_CALLBACK = function () {}; - } - }, { - key: "addPixel", - value: function addPixel(source, width, height) { - logger.debug("Adding pixel for :: ".concat(source)); - var image = document.createElement("img"); - image.src = source; - image.setAttribute("width", width); - image.setAttribute("height", height); - logger.debug("Image Pixel :: ".concat(image)); - document.getElementsByTagName("body")[0].appendChild(image); - } - }, { - key: "addIFrame", - value: function addIFrame(source) { - logger.debug("Adding iframe for :: ".concat(source)); - var iframe = document.createElement("iframe"); - iframe.src = source; - iframe.title = "empty"; - iframe.setAttribute("id", "LOTCCFrame"); - iframe.setAttribute("tabindex", "-1"); - iframe.setAttribute("role", "presentation"); - iframe.setAttribute("aria-hidden", "true"); - iframe.setAttribute("style", "border: 0px; width: 0px; height: 0px; display: block;"); - logger.debug("IFrame :: ".concat(iframe)); - document.getElementsByTagName("body")[0].appendChild(iframe); + store.forEach = function (callback) { + for (var i = 0; i < storage.length; i++) { + var key = storage.key(i); + callback(key, store.get(key)); + } + }; + } else if (doc && doc.documentElement.addBehavior) { + var storageOwner, storageContainer; // Since #userData storage applies only to specific paths, we need to + // somehow link our data to a specific path. We choose /favicon.ico + // as a pretty safe option, since all browsers already make a request to + // this URL anyway and being a 404 will not hurt us here. We wrap an + // iframe pointing to the favicon in an ActiveXObject(htmlfile) object + // (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx) + // since the iframe access rules appear to allow direct access and + // manipulation of the document element, even for a 404 page. This + // document can be used instead of the current document (which would + // have been limited to the current path) to perform #userData storage. + + try { + storageContainer = new ActiveXObject('htmlfile'); + storageContainer.open(); + storageContainer.write('<' + scriptTag + '>document.w=window'); + storageContainer.close(); + storageOwner = storageContainer.w.frames[0].document; + storage = storageOwner.createElement('div'); + } catch (e) { + // somehow ActiveXObject instantiation failed (perhaps some special + // security settings or otherwse), fall back to per-path storage + storage = doc.createElement('div'); + storageOwner = doc.body; } - }, { - key: "syncPixel", - value: function syncPixel(userId) { - var _this2 = this; - logger.debug("===== in syncPixel ======"); - logger.debug("Firing DSP Pixel URLs"); + var withIEStorage = function withIEStorage(storeFunction) { + return function () { + var args = Array.prototype.slice.call(arguments, 0); + args.unshift(storage); // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx + // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx - if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) { - var currentTime = Date.now(); - this.dspUrlSettingsPixel.forEach(function (urlSettings) { - var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { - userId: userId, - random: currentTime - }), urlSettings.dspUrlTemplate); + storageOwner.appendChild(storage); + storage.addBehavior('#default#userData'); + storage.load(localStorageName); + var result = storeFunction.apply(store, args); + storageOwner.removeChild(storage); + return result; + }; + }; // In IE7, keys cannot start with a digit or contain certain chars. + // See https://github.com/marcuswestin/store.js/issues/40 + // See https://github.com/marcuswestin/store.js/issues/83 - _this2.addPixel(dspUrl, "1", "1"); - }); + + var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g"); + + var ieKeyFix = function ieKeyFix(key) { + return key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___'); + }; + + store.set = withIEStorage(function (storage, key, val) { + key = ieKeyFix(key); + + if (val === undefined) { + return store.remove(key); } - logger.debug("Firing DSP IFrame URLs"); + storage.setAttribute(key, store.serialize(val)); + storage.save(localStorageName); + return val; + }); + store.get = withIEStorage(function (storage, key, defaultVal) { + key = ieKeyFix(key); + var val = store.deserialize(storage.getAttribute(key)); + return val === undefined ? defaultVal : val; + }); + store.remove = withIEStorage(function (storage, key) { + key = ieKeyFix(key); + storage.removeAttribute(key); + storage.save(localStorageName); + }); + store.clear = withIEStorage(function (storage) { + var attributes = storage.XMLDocument.documentElement.attributes; + storage.load(localStorageName); - if (this.dspUrlSettingsIframe && this.dspUrlSettingsIframe.length > 0) { - var _currentTime = Date.now(); + for (var i = attributes.length - 1; i >= 0; i--) { + storage.removeAttribute(attributes[i].name); + } - this.dspUrlSettingsIframe.forEach(function (urlSettings) { - var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { - userId: userId, - random: _currentTime - }), urlSettings.dspUrlTemplate); + storage.save(localStorageName); + }); + store.forEach = withIEStorage(function (storage, callback) { + var attributes = storage.XMLDocument.documentElement.attributes; - _this2.addIFrame(dspUrl); - }); + for (var i = 0, attr; attr = attributes[i]; ++i) { + callback(attr.name, store.deserialize(storage.getAttribute(attr.name))); } + }); + } - this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel + try { + var testKey = '__storejs__'; + store.set(testKey, testKey); -<<<<<<< HEAD - if (this.analytics.methodToCallbackMapping.syncPixel) { - this.analytics.emit("syncPixel", { - destination: this.name - }); -======= - }, { - key: "set", - value: function set(key, value) { - try { - rudderComponentCookie(key, value, clone_1(this._options)); - return true; - } catch (e) { - logger.error(e); - return false; ->>>>>>> update npm module - } - } - }, { -<<<<<<< HEAD - key: "compileUrl", - value: function compileUrl(map, url) { - Object.keys(map).forEach(function (key) { - if (map.hasOwnProperty(key)) { - var replaceKey = "{{".concat(key, "}}"); - var regex = new RegExp(replaceKey, "gi"); - url = url.replace(regex, map[key]); - } - }); - return url; -======= - key: "get", - value: function get(key) { - return rudderComponentCookie(key); ->>>>>>> update npm module - } - }, { - key: "identify", - value: function identify(rudderElement) { - logger.debug("in Lotame identify"); - var userId = rudderElement.message.userId; - this.syncPixel(userId); - } - }, { - key: "track", - value: function track(rudderElement) { - logger.debug("track not supported for lotame"); + if (store.get(testKey) != testKey) { + store.disabled = true; } - }, { - key: "page", - value: function page(rudderElement) { - var _this3 = this; - logger.debug("in Lotame page"); - logger.debug("Firing BCP Pixel URLs"); + store.remove(testKey); + } catch (e) { + store.disabled = true; + } - if (this.bcpUrlSettingsPixel && this.bcpUrlSettingsPixel.length > 0) { - var currentTime = Date.now(); - this.bcpUrlSettingsPixel.forEach(function (urlSettings) { - var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { - random: currentTime - }), urlSettings.bcpUrlTemplate); + store.enabled = !store.disabled; + return store; + }(); +>>>>>>> branch for npm and latest release _this3.addPixel(bcpUrl, "1", "1"); }); } +<<<<<<< HEAD logger.debug("Firing BCP IFrame URLs"); +======= + var StoreLocal = /*#__PURE__*/function () { + function StoreLocal(options) { + _classCallCheck(this, StoreLocal); +>>>>>>> branch for npm and latest release if (this.bcpUrlSettingsIframe && this.bcpUrlSettingsIframe.length > 0) { var _currentTime2 = Date.now(); @@ -14866,8 +18435,14 @@ */ >>>>>>> update npm module +<<<<<<< HEAD return undefined; }; +======= + var Storage = /*#__PURE__*/function () { + function Storage() { + _classCallCheck(this, Storage); +>>>>>>> branch for npm and latest release this.sendDataToRudder = function (campaignState) { logger.debug(campaignState); @@ -15274,12 +18849,18 @@ }; */ // categorized pages +<<<<<<< HEAD if (category && this.trackCategorizedPages) { // this.analytics.track(`Viewed ${category} page`, {}, contextOptimizely); rudderElement.message.event = "Viewed ".concat(category, " page"); rudderElement.message.type = "track"; this.track(rudderElement); } // named pages +======= + var LotameStorage = /*#__PURE__*/function () { + function LotameStorage() { + _classCallCheck(this, LotameStorage); +>>>>>>> branch for npm and latest release if (name && this.trackNamedPages) { @@ -15385,8 +18966,14 @@ } } +<<<<<<< HEAD return string; }; +======= + var Lotame = /*#__PURE__*/function () { + function Lotame(config, analytics) { + var _this = this; +>>>>>>> branch for npm and latest release var camelCase = function camelCase(input, options) { if (!(typeof input === 'string' || Array.isArray(input))) { @@ -15466,9 +19053,19 @@ return; } +<<<<<<< HEAD g = m[e] = function (a, b, s) { g.q ? g.q.push([a, b, s]) : g._api(a, b, s); }; +======= + if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) { + var currentTime = Date.now(); + this.dspUrlSettingsPixel.forEach(function (urlSettings) { + var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { + userId: userId, + random: currentTime + }), urlSettings.dspUrlTemplate); +>>>>>>> branch for npm and latest release g.q = []; o = n.createElement(t); @@ -15489,12 +19086,20 @@ g(l, v, s); }; +<<<<<<< HEAD g.event = function (i, v, s) { g("event", { n: i, p: v }, s); }; +======= + this.dspUrlSettingsIframe.forEach(function (urlSettings) { + var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { + userId: userId, + random: _currentTime + }), urlSettings.dspUrlTemplate); +>>>>>>> branch for npm and latest release g.shutdown = function () { g("rec", !1); @@ -15560,6 +19165,7 @@ window.FS.event(rudderElement.message.event, Fullstory.getFSProperties(rudderElement.message.properties)); } }, { +<<<<<<< HEAD key: "isLoaded", value: function isLoaded() { logger.debug("in FULLSTORY isLoaded"); @@ -15582,6 +19188,35 @@ if (parts.length > 1) { var typeSuffix = parts.pop(); +======= + key: "page", + value: function page(rudderElement) { + var _this3 = this; + + logger.debug("in Lotame page"); + logger.debug("Firing BCP Pixel URLs"); + + if (this.bcpUrlSettingsPixel && this.bcpUrlSettingsPixel.length > 0) { + var currentTime = Date.now(); + this.bcpUrlSettingsPixel.forEach(function (urlSettings) { + var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { + random: currentTime + }), urlSettings.bcpUrlTemplate); + + _this3.addPixel(bcpUrl, "1", "1"); + }); + } + + logger.debug("Firing BCP IFrame URLs"); + + if (this.bcpUrlSettingsIframe && this.bcpUrlSettingsIframe.length > 0) { + var _currentTime2 = Date.now(); + + this.bcpUrlSettingsIframe.forEach(function (urlSettings) { + var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { + random: _currentTime2 + }), urlSettings.bcpUrlTemplate); +>>>>>>> branch for npm and latest release switch (typeSuffix) { case "str": @@ -15607,9 +19242,7 @@ return Fullstory; }(); - var Optimizely = - /*#__PURE__*/ - function () { + var Optimizely = /*#__PURE__*/function () { function Optimizely(config, analytics) { var _this = this; @@ -15859,9 +19492,7 @@ return Optimizely; }(); - var Bugsnag = - /*#__PURE__*/ - function () { + var Bugsnag = /*#__PURE__*/function () { function Bugsnag(config) { _classCallCheck(this, Bugsnag); @@ -15916,86 +19547,86 @@ return Bugsnag; }(); - const preserveCamelCase = string => { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < string.length; i++) { - const character = string[i]; - - if (isLastCharLower && /[\p{Lu}]/u.test(character)) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[\p{Ll}]/u.test(character)) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character; - } - } + var preserveCamelCase = function preserveCamelCase(string) { + var isLastCharLower = false; + var isLastCharUpper = false; + var isLastLastCharUpper = false; - return string; - }; + for (var i = 0; i < string.length; i++) { + var character = string[i]; - const camelCase = (input, options) => { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } + if (isLastCharLower && /(?:[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C2\uA7C4-\uA7C7\uA7C9\uA7F5\uFF21-\uFF3A]|\uD801[\uDC00-\uDC27\uDCB0-\uDCD3]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD81B[\uDE40-\uDE5F]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21])/.test(character)) { + string = string.slice(0, i) + '-' + string.slice(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && /(?:[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F\u1E31\u1E33\u1E35\u1E37\u1E39\u1E3B\u1E3D\u1E3F\u1E41\u1E43\u1E45\u1E47\u1E49\u1E4B\u1E4D\u1E4F\u1E51\u1E53\u1E55\u1E57\u1E59\u1E5B\u1E5D\u1E5F\u1E61\u1E63\u1E65\u1E67\u1E69\u1E6B\u1E6D\u1E6F\u1E71\u1E73\u1E75\u1E77\u1E79\u1E7B\u1E7D\u1E7F\u1E81\u1E83\u1E85\u1E87\u1E89\u1E8B\u1E8D\u1E8F\u1E91\u1E93\u1E95-\u1E9D\u1E9F\u1EA1\u1EA3\u1EA5\u1EA7\u1EA9\u1EAB\u1EAD\u1EAF\u1EB1\u1EB3\u1EB5\u1EB7\u1EB9\u1EBB\u1EBD\u1EBF\u1EC1\u1EC3\u1EC5\u1EC7\u1EC9\u1ECB\u1ECD\u1ECF\u1ED1\u1ED3\u1ED5\u1ED7\u1ED9\u1EDB\u1EDD\u1EDF\u1EE1\u1EE3\u1EE5\u1EE7\u1EE9\u1EEB\u1EED\u1EEF\u1EF1\u1EF3\u1EF5\u1EF7\u1EF9\u1EFB\u1EFD\u1EFF-\u1F07\u1F10-\u1F15\u1F20-\u1F27\u1F30-\u1F37\u1F40-\u1F45\u1F50-\u1F57\u1F60-\u1F67\u1F70-\u1F7D\u1F80-\u1F87\u1F90-\u1F97\u1FA0-\u1FA7\u1FB0-\u1FB4\u1FB6\u1FB7\u1FBE\u1FC2-\u1FC4\u1FC6\u1FC7\u1FD0-\u1FD3\u1FD6\u1FD7\u1FE0-\u1FE7\u1FF2-\u1FF4\u1FF6\u1FF7\u210A\u210E\u210F\u2113\u212F\u2134\u2139\u213C\u213D\u2146-\u2149\u214E\u2184\u2C30-\u2C5E\u2C61\u2C65\u2C66\u2C68\u2C6A\u2C6C\u2C71\u2C73\u2C74\u2C76-\u2C7B\u2C81\u2C83\u2C85\u2C87\u2C89\u2C8B\u2C8D\u2C8F\u2C91\u2C93\u2C95\u2C97\u2C99\u2C9B\u2C9D\u2C9F\u2CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C3\uA7C8\uA7CA\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]|\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43])/.test(character)) { + string = string.slice(0, i - 1) + '-' + string.slice(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character; + } + } - options = { - ...{pascalCase: false}, - ...options - }; + return string; + }; + + var camelCase = function camelCase(input, options) { + if (!(typeof input === 'string' || Array.isArray(input))) { + throw new TypeError('Expected the input to be `string | string[]`'); + } - const postProcess = x => options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x; + options = _objectSpread2(_objectSpread2({}, { + pascalCase: false + }), options); - if (Array.isArray(input)) { - input = input.map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - input = input.trim(); - } + var postProcess = function postProcess(x) { + return options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x; + }; - if (input.length === 0) { - return ''; - } + if (Array.isArray(input)) { + input = input.map(function (x) { + return x.trim(); + }).filter(function (x) { + return x.length; + }).join('-'); + } else { + input = input.trim(); + } - if (input.length === 1) { - return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase(); - } + if (input.length === 0) { + return ''; + } - const hasUpperCase = input !== input.toLocaleLowerCase(); + if (input.length === 1) { + return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase(); + } - if (hasUpperCase) { - input = preserveCamelCase(input); - } + var hasUpperCase = input !== input.toLocaleLowerCase(); - input = input - .replace(/^[_.\- ]+/, '') - .toLocaleLowerCase() - .replace(/[_.\- ]+([\p{Alpha}\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase()) - .replace(/\d+([\p{Alpha}\p{N}_]|$)/gu, m => m.toLocaleUpperCase()); + if (hasUpperCase) { + input = preserveCamelCase(input); + } - return postProcess(input); + input = input.replace(/^[_.\- ]+/, '').toLocaleLowerCase().replace(/[ \x2D\._]+((?:[0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u0669\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFC\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7E\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D54-\u0D63\u0D66-\u0D78\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1713\u1720-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1ABF\u1AC0\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4B\u1B50-\u1B59\u1B80-\u1BA9\u1BAC-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2189\u2150-\u2182\u2460-\u249B\u24B6-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA805\uA807-\uA827\uA830-\uA835\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-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DD8E\uDD90\uDD91\uDD93-\uDD96\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD47\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])|$)/g, function (_, p1) { + return p1.toLocaleUpperCase(); + }).replace(/[0-9]+((?:[0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u0669\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFC\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-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250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1713\u1720-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1ABF\u1AC0\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4B\u1B50-\u1B59\u1B80-\u1BA9\u1BAC-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2189\u2150-\u2182\u2460-\u249B\u24B6-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA805\uA807-\uA827\uA830-\uA835\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABF0-\uABF9\u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DA-\uDDDF\uDDE1\uDDE3\uDDE4\uDE00-\uDE32\uDE35-\uDE3E\uDE50-\uDE97\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC3E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD41\uDD43\uDD46\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD96\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\u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uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])|$)/g, function (m) { + return m.toLocaleUpperCase(); + }); + return postProcess(input); }; - var camelcase = camelCase; - // TODO: Remove this for the next major release + var camelcase = camelCase; // TODO: Remove this for the next major release + var default_1 = camelCase; - camelcase.default = default_1; + camelcase["default"] = default_1; - var Fullstory = - /*#__PURE__*/ - function () { + var Fullstory = /*#__PURE__*/function () { function Fullstory(config) { _classCallCheck(this, Fullstory); @@ -16153,8 +19784,6 @@ case "bools": return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); - default: // passthrough - } } // No type suffix found. Camel case the whole field name. @@ -16196,11 +19825,15 @@ this.build = "1.0.0"; this.name = "RudderLabs JavaScript SDK"; this.namespace = "com.rudderlabs.javascript"; +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= this.version = "1.0.8"; >>>>>>> update npm module +======= + this.version = "1.0.9"; +>>>>>>> branch for npm and latest release }; // Library information class @@ -16208,11 +19841,15 @@ _classCallCheck(this, RudderLibraryInfo); this.name = "RudderLabs JavaScript SDK"; +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= this.version = "1.0.8"; >>>>>>> update npm module +======= + this.version = "1.0.9"; +>>>>>>> branch for npm and latest release }; // Operating System information class @@ -16624,9 +20261,15 @@ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) +<<<<<<< HEAD b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` +======= + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + +>>>>>>> branch for npm and latest release b[i++] = clockseq & 0xff; // `node` for (var n = 0; n < 6; ++n) { @@ -16790,8 +20433,13 @@ /** * Get original engine */ +<<<<<<< HEAD + + +======= +>>>>>>> branch for npm and latest release Store$1.prototype.getOriginalEngine = function () { return this.originalEngine; }; @@ -17046,6 +20694,7 @@ try { if (window.localStorage) debug$2.enable(localStorage.debug); } catch (e) {} +<<<<<<< HEAD var componentEmitter$1 = createCommonjsModule(function (module) { /** @@ -17222,6 +20871,8 @@ return !! this.listeners(event).length; }; }); +======= +>>>>>>> branch for npm and latest release var uuid$2 = uuid_1.v4; var debug$3 = debug_1$2('localstorage-retry'); // Some browsers don't support Function.prototype.bind, so just including a simplified version here @@ -17294,10 +20945,13 @@ * Mix in event emitter */ +<<<<<<< HEAD <<<<<<< HEAD ======= componentEmitter$1(Queue.prototype); >>>>>>> update npm module +======= +>>>>>>> branch for npm and latest release componentEmitter(Queue.prototype); /** @@ -17478,8 +21132,13 @@ this._processId = this._schedule.run(this._processHead, queue[0].time - now); } }; // Ack continuously to prevent other tabs from claiming our queue +<<<<<<< HEAD + + +======= +>>>>>>> branch for npm and latest release Queue.prototype._ack = function () { this._store.set(this.keys.ACK, this._schedule.now()); From 0d127b5a78fc19e018c0b1941be955474edc57fb Mon Sep 17 00:00:00 2001 From: Arnab Date: Thu, 10 Sep 2020 21:51:31 +0530 Subject: [PATCH 09/20] NPM release version 1.0.11 --- __tests__/prodsdk.js | 7961 +----------------------------- dist/rudder-analytics.min.js | 7072 +------------------------- dist/rudder-analytics.min.js.map | 2 +- dist/rudder-sdk-js/index.js | 287 +- dist/rudder-sdk-js/package.json | 2 +- 5 files changed, 289 insertions(+), 15035 deletions(-) diff --git a/__tests__/prodsdk.js b/__tests__/prodsdk.js index 18b5ba1ff0..a7298ed925 100644 --- a/__tests__/prodsdk.js +++ b/__tests__/prodsdk.js @@ -1,7959 +1,2 @@ -rudderanalytics = (function (e) { - function t(e) { - return (t = - typeof Symbol === "function" && typeof Symbol.iterator === "symbol" - ? function (e) { - return typeof e; - } - : function (e) { - return e && - typeof Symbol === "function" && - 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 (let n = 0; n < t.length; n++) { - const r = t[n]; - (r.enumerable = r.enumerable || !1), - (r.configurable = !0), - "value" in r && (r.writable = !0), - Object.defineProperty(e, r.key, r); - } - } - function i(e, t, n) { - return t && r(e.prototype, t), n && r(e, n), e; - } - function o(e, t, n) { - return ( - t in e - ? Object.defineProperty(e, t, { - value: n, - enumerable: !0, - configurable: !0, - writable: !0, - }) - : (e[t] = n), - e - ); - } - function s(e, t) { - const n = Object.keys(e); - if (Object.getOwnPropertySymbols) { - let r = Object.getOwnPropertySymbols(e); - t && - (r = r.filter(function (t) { - return Object.getOwnPropertyDescriptor(e, t).enumerable; - })), - n.push.apply(n, r); - } - return n; - } - function a(e) { - for (let t = 1; t < arguments.length; t++) { - var n = arguments[t] != null ? arguments[t] : {}; - t % 2 - ? s(n, !0).forEach(function (t) { - o(e, t, n[t]); - }) - : Object.getOwnPropertyDescriptors - ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) - : s(n).forEach(function (t) { - Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t)); - }); - } - return e; - } - function c(e) { - return ( - (function (e) { - if (Array.isArray(e)) { - for (var t = 0, n = new Array(e.length); t < e.length; t++) - n[t] = e[t]; - return n; - } - })(e) || - (function (e) { - if ( - Symbol.iterator in Object(e) || - Object.prototype.toString.call(e) === "[object Arguments]" - ) - return Array.from(e); - })(e) || - (function () { - throw new TypeError("Invalid attempt to spread non-iterable instance"); - })() - ); - } - const u = - typeof globalThis !== "undefined" - ? globalThis - : typeof window !== "undefined" - ? window - : typeof global !== "undefined" - ? global - : typeof self !== "undefined" - ? self - : {}; - function l(e, t) { - return e((t = { exports: {} }), t.exports), t.exports; - } - const d = l(function (e) { - function t(e) { - if (e) - return (function (e) { - for (const n in t.prototype) e[n] = t.prototype[n]; - return e; - })(e); - } - (e.exports = t), - (t.prototype.on = t.prototype.addEventListener = function (e, t) { - return ( - (this._callbacks = this._callbacks || {}), - (this._callbacks[`$${e}`] = this._callbacks[`$${e}`] || []).push(t), - this - ); - }), - (t.prototype.once = function (e, t) { - function n() { - this.off(e, n), t.apply(this, arguments); - } - return (n.fn = t), this.on(e, n), this; - }), - (t.prototype.off = t.prototype.removeListener = t.prototype.removeAllListeners = t.prototype.removeEventListener = function ( - e, - t - ) { - if (((this._callbacks = this._callbacks || {}), arguments.length == 0)) - return (this._callbacks = {}), this; - let n; - const r = this._callbacks[`$${e}`]; - if (!r) return this; - if (arguments.length == 1) return delete this._callbacks[`$${e}`], this; - for (let i = 0; i < r.length; i++) - if ((n = r[i]) === t || n.fn === t) { - r.splice(i, 1); - break; - } - return r.length === 0 && delete this._callbacks[`$${e}`], this; - }), - (t.prototype.emit = function (e) { - this._callbacks = this._callbacks || {}; - for ( - var t = new Array(arguments.length - 1), - n = this._callbacks[`$${e}`], - r = 1; - r < arguments.length; - r++ - ) - t[r - 1] = arguments[r]; - if (n) { - r = 0; - for (let i = (n = n.slice(0)).length; r < i; ++r) n[r].apply(this, t); - } - return this; - }), - (t.prototype.listeners = function (e) { - return ( - (this._callbacks = this._callbacks || {}), - this._callbacks[`$${e}`] || [] - ); - }), - (t.prototype.hasListeners = function (e) { - return !!this.listeners(e).length; - }); - }); - const p = function (e, t, n) { - let r = !1; - return (n = n || h), (i.count = e), e === 0 ? 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)) : i.count !== 0 || r || t(null, o); - } - }; - function h() {} - let f = 4; - const g = { - setLogLevel(e) { - switch (e.toUpperCase()) { - case "INFO": - return void (f = 1); - case "DEBUG": - return void (f = 2); - case "WARN": - return void (f = 3); - } - }, - info() { - let e; - f <= 1 && (e = console).info.apply(e, arguments); - }, - debug() { - let e; - f <= 2 && (e = console).debug.apply(e, arguments); - }, - warn() { - let e; - f <= 3 && (e = console).warn.apply(e, arguments); - }, - error() { - let e; - f <= 4 && (e = console).error.apply(e, arguments); - }, - }; - const m = { - All: "All", - "Google Analytics": "GA", - GoogleAnalytics: "GA", - GA: "GA", - "Google Ads": "GOOGLEADS", - GoogleAds: "GOOGLEADS", - GOOGLEADS: "GOOGLEADS", - Braze: "BRAZE", - BRAZE: "BRAZE", - Chartbeat: "CHARTBEAT", - CHARTBEAT: "CHARTBEAT", - Comscore: "COMSCORE", - COMSCORE: "COMSCORE", - Customerio: "CUSTOMERIO", - "Customer.io": "CUSTOMERIO", - "FB Pixel": "FACEBOOK_PIXEL", - "Facebook Pixel": "FACEBOOK_PIXEL", - FB_PIXEL: "FACEBOOK_PIXEL", - "Google Tag Manager": "GOOGLETAGMANAGER", - GTM: "GTM", - Hotjar: "HOTJAR", - hotjar: "HOTJAR", - HOTJAR: "HOTJAR", - Hubspot: "HS", - HUBSPOT: "HS", - Intercom: "INTERCOM", - INTERCOM: "INTERCOM", - Keen: "KEEN", - "Keen.io": "KEEN", - KEEN: "KEEN", - Kissmetrics: "KISSMETRICS", - KISSMETRICS: "KISSMETRICS", - Lotame: "LOTAME", - LOTAME: "LOTAME", - "Visual Website Optimizer": "VWO", - VWO: "VWO", - }; - const y = { - All: "All", - GA: "Google Analytics", - GOOGLEADS: "Google Ads", - BRAZE: "Braze", - CHARTBEAT: "Chartbeat", - COMSCORE: "Comscore", - CUSTOMERIO: "Customer IO", - FACEBOOK_PIXEL: "Facebook Pixel", - GTM: "Google Tag Manager", - HOTJAR: "Hotjar", - HS: "HubSpot", - INTERCOM: "Intercom", - KEEN: "Keen", - KISSMETRICS: "Kiss Metrics", - LOTAME: "Lotame", - VWO: "VWO", - }; - function v(e, t) { - return t == null ? void 0 : t; - } - function b() { - let e = new Date().getTime(); - return ( - typeof performance !== "undefined" && - typeof performance.now === "function" && - (e += performance.now()), - "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (t) { - const n = (e + 16 * Math.random()) % 16 | 0; - return ( - (e = Math.floor(e / 16)), (t === "x" ? n : (3 & n) | 8).toString(16) - ); - }) - ); - } - function w() { - return new Date().toISOString(); - } - function k(e, t) { - let n = e.message ? e.message : void 0; - let r = void 0; - try { - e instanceof Event && - e.target && - e.target.localName == "script" && - ((n = `error in script loading:: src:: ${e.target.src} id:: ${e.target.id}`), - t && - e.target.src.includes("adsbygoogle") && - ((r = !0), - t.page( - "RudderJS-Initiated", - "ad-block page request", - { path: "/ad-blocked", title: n }, - t.sendAdblockPageOptions - ))), - n && !r && g.error("[Util] handleError:: ", n); - } catch (e) { - g.error("[Util] handleError:: ", e); - } - } - function E() { - const e = I(); - const t = e ? e.pathname : window.location.pathname; - const n = document.referrer; - const r = window.location.search; - return { - path: t, - referrer: n, - search: r, - title: document.title, - url: (function (e) { - const t = I(); - const n = t ? (t.indexOf("?") > -1 ? t : t + e) : window.location.href; - const r = n.indexOf("#"); - return r > -1 ? n.slice(0, r) : n; - })(r), - }; - } - function I() { - for ( - var e, t = document.getElementsByTagName("link"), n = 0; - (e = t[n]); - n++ - ) - if (e.getAttribute("rel") === "canonical") return e.getAttribute("href"); - } - function _(e, t) { - let n = e.revenue; - return ( - !n && - t && - t.match( - /^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i - ) && - (n = e.total), - (function (e) { - if (e) { - if (typeof e === "number") return e; - if (typeof e === "string") - return ( - (e = e.replace(/\$/g, "")), - (e = parseFloat(e)), - isNaN(e) ? void 0 : e - ); - } - })(n) - ); - } - function A(e) { - Object.keys(e).forEach(function (t) { - e.hasOwnProperty(t) && - (m[t] && (e[m[t]] = e[t]), - t != "All" && m[t] != null && m[t] != t && delete e[t]); - }); - } - function C(e, n) { - const r = []; - if (!n || n.length == 0) return r; - let i = !0; - return typeof n[0] === "string" - ? (e.All != null && (i = e.All), - n.forEach(function (t) { - if (i) { - let n = !0; - e[t] != null && e[t] == 0 && (n = !1), n && r.push(t); - } else e[t] != null && e[t] == 1 && r.push(t); - }), - r) - : t(n[0]) == "object" - ? (e.All != null && (i = e.All), - n.forEach(function (t) { - if (i) { - let n = !0; - e[t.name] != null && e[t.name] == 0 && (n = !1), n && r.push(t); - } else e[t.name] != null && e[t.name] == 1 && r.push(t); - }), - r) - : void 0; - } - function T(e, n) { - return ( - (n = n || S), - (function (e) { - switch (toString.call(e)) { - case "[object Function]": - return "function"; - case "[object Date]": - return "date"; - case "[object RegExp]": - return "regexp"; - case "[object Arguments]": - return "arguments"; - case "[object Array]": - return "array"; - } - return e === null - ? "null" - : void 0 === e - ? "undefined" - : e === Object(e) - ? "object" - : t(e); - })(e) == "array" - ? O(e, n) - : P(e, n) - ); - } - var O = function (e, t) { - for (var n = [], r = 0; r < e.length; ++r) - t(e[r], r) || (n[n.length] = e[r]); - return n; - }; - var P = function (e, t) { - const n = {}; - for (const r in e) e.hasOwnProperty(r) && !t(e[r], r) && (n[r] = e[r]); - return n; - }; - function S(e) { - return e == null; - } - const x = { TRACK: "track", PAGE: "page", IDENTIFY: "identify" }; - const R = { - 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", - }; - const j = "https://hosted.rudderlabs.com"; - function L(e, t) { - g.debug(`in script loader=== ${e}`); - const n = document.createElement("script"); - (n.src = t), (n.async = !0), (n.type = "text/javascript"), (n.id = e); - const r = document.getElementsByTagName("script")[0]; - g.debug("==script==", r), r.parentNode.insertBefore(n, r); - } - let D; - let M; - const U = (function () { - function e(t) { - n(this, e), (this.hubId = t.hubID), (this.name = "HS"); - } - return ( - i(e, [ - { - key: "init", - value() { - L( - "hubspot-integration", - `http://js.hs-scripts.com/${this.hubId}.js` - ), - g.debug("===in init HS==="); - }, - }, - { - key: "identify", - value(e) { - g.debug("in HubspotAnalyticsManager identify"); - const n = e.message.context.traits; - const r = {}; - for (const i in n) - if (Object.getOwnPropertyDescriptor(n, i) && n[i]) { - const o = i; - toString.call(n[i]) == "[object Date]" - ? (r[o] = n[i].getTime()) - : (r[o] = n[i]); - } - const s = e.message.context.user_properties; - for (const a in s) { - if (Object.getOwnPropertyDescriptor(s, a) && s[a]) r[a] = s[a]; - } - (g.debug(r), - void 0 !== - (typeof window === "undefined" ? "undefined" : t(window))) && - (window._hsq = window._hsq || []).push(["identify", r]); - }, - }, - { - key: "track", - value(e) { - g.debug("in HubspotAnalyticsManager track"); - const t = (window._hsq = window._hsq || []); - const 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(e) { - g.debug("in HubspotAnalyticsManager page"); - const 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() { - return ( - g.debug("in hubspot isLoaded"), - !(!window._hsq || window._hsq.push === Array.prototype.push) - ); - }, - }, - { - key: "isReady", - value() { - return !(!window._hsq || window._hsq.push === Array.prototype.push); - }, - }, - ]), - e - ); - })(); - const N = Object.prototype; - const q = N.hasOwnProperty; - const B = N.toString; - typeof Symbol === "function" && (D = Symbol.prototype.valueOf), - typeof BigInt === "function" && (M = BigInt.prototype.valueOf); - const F = function (e) { - return e != e; - }; - const G = { boolean: 1, number: 1, string: 1, undefined: 1 }; - const K = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/; - const V = /^[A-Fa-f0-9]+$/; - const H = {}; - (H.a = H.type = function (e, t) { - return typeof e === t; - }), - (H.defined = function (e) { - return void 0 !== e; - }), - (H.empty = function (e) { - let t; - const n = B.call(e); - if ( - n === "[object Array]" || - n === "[object Arguments]" || - n === "[object String]" - ) - return e.length === 0; - if (n === "[object Object]") { - for (t in e) if (q.call(e, t)) return !1; - return !0; - } - return !e; - }), - (H.equal = function (e, t) { - if (e === t) return !0; - let n; - const r = B.call(e); - if (r !== B.call(t)) return !1; - if (r === "[object Object]") { - for (n in e) if (!(H.equal(e[n], t[n]) && n in t)) return !1; - for (n in t) if (!(H.equal(e[n], t[n]) && n in e)) return !1; - return !0; - } - if (r === "[object Array]") { - if ((n = e.length) !== t.length) return !1; - for (; n--; ) if (!H.equal(e[n], t[n])) return !1; - return !0; - } - return r === "[object Function]" - ? e.prototype === t.prototype - : r === "[object Date]" && e.getTime() === t.getTime(); - }), - (H.hosted = function (e, t) { - const n = typeof t[e]; - return n === "object" ? !!t[e] : !G[n]; - }), - (H.instance = H.instanceof = function (e, t) { - return e instanceof t; - }), - (H.nil = H.null = function (e) { - return e === null; - }), - (H.undef = H.undefined = function (e) { - return void 0 === e; - }), - (H.args = H.arguments = function (e) { - const t = B.call(e) === "[object Arguments]"; - const n = !H.array(e) && H.arraylike(e) && H.object(e) && H.fn(e.callee); - return t || n; - }), - (H.array = - Array.isArray || - function (e) { - return B.call(e) === "[object Array]"; - }), - (H.args.empty = function (e) { - return H.args(e) && e.length === 0; - }), - (H.array.empty = function (e) { - return H.array(e) && e.length === 0; - }), - (H.arraylike = function (e) { - return ( - !!e && - !H.bool(e) && - q.call(e, "length") && - isFinite(e.length) && - H.number(e.length) && - e.length >= 0 - ); - }), - (H.bool = H.boolean = function (e) { - return B.call(e) === "[object Boolean]"; - }), - (H.false = function (e) { - return H.bool(e) && !1 === Boolean(Number(e)); - }), - (H.true = function (e) { - return H.bool(e) && !0 === Boolean(Number(e)); - }), - (H.date = function (e) { - return B.call(e) === "[object Date]"; - }), - (H.date.valid = function (e) { - return H.date(e) && !isNaN(Number(e)); - }), - (H.element = function (e) { - return ( - void 0 !== e && - typeof HTMLElement !== "undefined" && - e instanceof HTMLElement && - e.nodeType === 1 - ); - }), - (H.error = function (e) { - return B.call(e) === "[object Error]"; - }), - (H.fn = H.function = function (e) { - if (typeof window !== "undefined" && e === window.alert) return !0; - const t = B.call(e); - return ( - t === "[object Function]" || - t === "[object GeneratorFunction]" || - t === "[object AsyncFunction]" - ); - }), - (H.number = function (e) { - return B.call(e) === "[object Number]"; - }), - (H.infinite = function (e) { - return e === 1 / 0 || e === -1 / 0; - }), - (H.decimal = function (e) { - return H.number(e) && !F(e) && !H.infinite(e) && e % 1 != 0; - }), - (H.divisibleBy = function (e, t) { - const n = H.infinite(e); - const r = H.infinite(t); - const i = H.number(e) && !F(e) && H.number(t) && !F(t) && t !== 0; - return n || r || (i && e % t == 0); - }), - (H.integer = H.int = function (e) { - return H.number(e) && !F(e) && e % 1 == 0; - }), - (H.maximum = function (e, t) { - if (F(e)) throw new TypeError("NaN is not a valid value"); - if (!H.arraylike(t)) - throw new TypeError("second argument must be array-like"); - for (let n = t.length; --n >= 0; ) if (e < t[n]) return !1; - return !0; - }), - (H.minimum = function (e, t) { - if (F(e)) throw new TypeError("NaN is not a valid value"); - if (!H.arraylike(t)) - throw new TypeError("second argument must be array-like"); - for (let n = t.length; --n >= 0; ) if (e > t[n]) return !1; - return !0; - }), - (H.nan = function (e) { - return !H.number(e) || e != e; - }), - (H.even = function (e) { - return H.infinite(e) || (H.number(e) && e == e && e % 2 == 0); - }), - (H.odd = function (e) { - return H.infinite(e) || (H.number(e) && e == e && e % 2 != 0); - }), - (H.ge = function (e, t) { - if (F(e) || F(t)) throw new TypeError("NaN is not a valid value"); - return !H.infinite(e) && !H.infinite(t) && e >= t; - }), - (H.gt = function (e, t) { - if (F(e) || F(t)) throw new TypeError("NaN is not a valid value"); - return !H.infinite(e) && !H.infinite(t) && e > t; - }), - (H.le = function (e, t) { - if (F(e) || F(t)) throw new TypeError("NaN is not a valid value"); - return !H.infinite(e) && !H.infinite(t) && e <= t; - }), - (H.lt = function (e, t) { - if (F(e) || F(t)) throw new TypeError("NaN is not a valid value"); - return !H.infinite(e) && !H.infinite(t) && e < t; - }), - (H.within = function (e, t, n) { - if (F(e) || F(t) || F(n)) throw new TypeError("NaN is not a valid value"); - if (!H.number(e) || !H.number(t) || !H.number(n)) - throw new TypeError("all arguments must be numbers"); - return ( - H.infinite(e) || H.infinite(t) || H.infinite(n) || (e >= t && e <= n) - ); - }), - (H.object = function (e) { - return B.call(e) === "[object Object]"; - }), - (H.primitive = function (e) { - return ( - !e || !(typeof e === "object" || H.object(e) || H.fn(e) || H.array(e)) - ); - }), - (H.hash = function (e) { - return ( - H.object(e) && e.constructor === Object && !e.nodeType && !e.setInterval - ); - }), - (H.regexp = function (e) { - return B.call(e) === "[object RegExp]"; - }), - (H.string = function (e) { - return B.call(e) === "[object String]"; - }), - (H.base64 = function (e) { - return H.string(e) && (!e.length || K.test(e)); - }), - (H.hex = function (e) { - return H.string(e) && (!e.length || V.test(e)); - }), - (H.symbol = function (e) { - return ( - typeof Symbol === "function" && - B.call(e) === "[object Symbol]" && - typeof D.call(e) === "symbol" - ); - }), - (H.bigint = function (e) { - return ( - typeof BigInt === "function" && - B.call(e) === "[object BigInt]" && - typeof M.call(e) === "bigint" - ); - }); - let z; - const J = H; - const W = Object.prototype.toString; - const $ = function (e) { - switch (W.call(e)) { - case "[object Function]": - return "function"; - case "[object Date]": - return "date"; - case "[object RegExp]": - return "regexp"; - case "[object Arguments]": - return "arguments"; - case "[object Array]": - return "array"; - case "[object String]": - return "string"; - } - return e === null - ? "null" - : void 0 === e - ? "undefined" - : e && e.nodeType === 1 - ? "element" - : e === Object(e) - ? "object" - : typeof e; - }; - const Y = /\b(Array|Date|Object|Math|JSON)\b/g; - const Q = function (e, t) { - const n = (function (e) { - for (var t = [], n = 0; n < e.length; n++) - ~t.indexOf(e[n]) || t.push(e[n]); - return t; - })( - (function (e) { - return ( - e - .replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, "") - .replace(Y, "") - .match(/[a-zA-Z_]\w*/g) || [] - ); - })(e) - ); - return ( - t && - typeof t === "string" && - (t = (function (e) { - return function (t) { - return e + t; - }; - })(t)), - t - ? (function (e, t, n) { - return e.replace( - /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g, - function (e) { - return e[e.length - 1] == "(" ? n(e) : ~t.indexOf(e) ? n(e) : e; - } - ); - })(e, n, t) - : n - ); - }; - try { - z = Q; - } catch (e) { - z = Q; - } - const Z = X; - function X(e) { - switch ({}.toString.call(e)) { - case "[object Object]": - return (function (e) { - const t = {}; - for (const n in e) - t[n] = typeof e[n] === "string" ? ee(e[n]) : X(e[n]); - return function (e) { - if (typeof e !== "object") return !1; - for (const n in t) { - if (!(n in e)) return !1; - if (!t[n](e[n])) return !1; - } - return !0; - }; - })(e); - case "[object Function]": - return e; - case "[object String]": - return /^ *\W+/.test((n = e)) - ? new Function("_", `return _ ${n}`) - : new Function( - "_", - `return ${(function (e) { - let t; - let n; - let r; - const i = z(e); - if (!i.length) return `_.${e}`; - for (n = 0; n < i.length; n++) - (r = i[n]), - (e = te( - r, - e, - (t = `('function' == typeof ${(t = `_.${r}`)} ? ${t}() : ${t})`) - )); - return e; - })(n)}` - ); - case "[object RegExp]": - return ( - (t = e), - function (e) { - return t.test(e); - } - ); - default: - return ee(e); - } - let t; - let n; - } - function ee(e) { - return function (t) { - return e === t; - }; - } - function te(e, t, n) { - return t.replace(new RegExp(`(\\.)?${e}`, "g"), function (e, t) { - return t ? e : n; - }); - } - try { - var ne = $; - } catch (e) { - ne = $; - } - const re = Object.prototype.hasOwnProperty; - const ie = function (e, t, n) { - switch (((t = Z(t)), (n = n || this), ne(e))) { - case "array": - return oe(e, t, n); - case "object": - return typeof e.length === "number" - ? oe(e, t, n) - : (function (e, t, n) { - for (const r in e) re.call(e, r) && t.call(n, r, e[r]); - })(e, t, n); - case "string": - return (function (e, t, n) { - for (let r = 0; r < e.length; ++r) t.call(n, e.charAt(r), r); - })(e, t, n); - } - }; - function oe(e, t, n) { - for (let r = 0; r < e.length; ++r) t.call(n, e[r], r); - } - const se = Math.max; - const ae = function (e, t) { - const n = t ? t.length : 0; - if (!n) return []; - for ( - var r = se(Number(e) || 0, 0), i = se(n - r, 0), o = new Array(i), s = 0; - s < i; - s += 1 - ) - o[s] = t[s + r]; - return o; - }; - const ce = Math.max; - const ue = function (e) { - if (e == null || !e.length) return []; - for (var t = new Array(ce(e.length - 2, 0)), n = 1; n < e.length; n += 1) - t[n - 1] = e[n]; - return t; - }; - const le = Object.prototype.hasOwnProperty; - const de = Object.prototype.toString; - const pe = function (e) { - return Boolean(e) && typeof e === "object"; - }; - const he = function (e) { - return Boolean(e) && de.call(e) === "[object Object]"; - }; - const fe = function (e, t, n, r) { - return le.call(t, r) && void 0 === e[r] && (e[r] = n), t; - }; - const ge = function (e, t, n, r) { - return ( - le.call(t, r) && - (he(e[r]) && he(n) - ? (e[r] = ye(e[r], n)) - : void 0 === e[r] && (e[r] = n)), - t - ); - }; - const me = function (e, t) { - if (!pe(t)) return t; - e = e || fe; - for (let n = ae(2, arguments), r = 0; r < n.length; r += 1) - for (const i in n[r]) e(t, n[r], n[r][i], i); - return t; - }; - var ye = function (e) { - return me.apply(null, [ge, e].concat(ue(arguments))); - }; - const ve = function (e) { - return me.apply(null, [null, e].concat(ue(arguments))); - }; - const be = ye; - ve.deep = be; - const we = (function () { - function e(t) { - n(this, e), - (this.trackingID = t.trackingID), - (this.sendUserId = t.sendUserId || !1), - (this.dimensions = t.dimensions || []), - (this.metrics = t.metrics || []), - (this.contentGroupings = t.contentGroupings || []), - (this.nonInteraction = t.nonInteraction || !1), - (this.anonymizeIp = t.anonymizeIp || !1), - (this.useGoogleAmpClientId = t.useGoogleAmpClientId || !1), - (this.domain = t.domain || "auto"), - (this.doubleClick = t.doubleClick || !1), - (this.enhancedEcommerce = t.enhancedEcommerce || !1), - (this.enhancedLinkAttribution = t.enhancedLinkAttribution || !1), - (this.includeSearch = t.includeSearch || !1), - (this.setAllMappedProps = t.setAllMappedProps || !0), - (this.siteSpeedSampleRate = t.siteSpeedSampleRate || 1), - (this.sampleRate = t.sampleRate || 100), - (this.trackCategorizedPages = t.trackCategorizedPages || !0), - (this.trackNamedPages = t.trackNamedPages || !0), - (this.optimizeContainerId = t.optimize || ""), - (this.resetCustomDimensionsOnPage = - t.resetCustomDimensionsOnPage || []), - (this.inputs = t), - (this.enhancedEcommerceLoaded = 0), - (this.name = "GA"), - (this.eventWithCategoryFieldProductScoped = [ - "product clicked", - "product added", - "product viewed", - "product removed", - ]); - } - return ( - i(e, [ - { - key: "loadScript", - value() { - L( - "google-analytics", - "https://www.google-analytics.com/analytics.js" - ); - }, - }, - { - key: "init", - value() { - (this.pageCalled = !1), (this.dimensionsArray = {}); - let e = !0; - let t = !1; - let n = void 0; - try { - for ( - var r, i = this.dimensions[Symbol.iterator](); - !(e = (r = i.next()).done); - e = !0 - ) { - const o = r.value; - this.dimensionsArray[o.from] = o.to; - } - } catch (e) { - (t = !0), (n = e); - } finally { - try { - e || i.return == null || i.return(); - } finally { - if (t) throw n; - } - } - this.metricsArray = {}; - let s = !0; - let a = !1; - let c = void 0; - try { - for ( - var u, l = this.metrics[Symbol.iterator](); - !(s = (u = l.next()).done); - s = !0 - ) { - const d = u.value; - this.metricsArray[d.from] = d.to; - } - } catch (e) { - (a = !0), (c = e); - } finally { - try { - s || l.return == null || l.return(); - } finally { - if (a) throw c; - } - } - this.contentGroupingsArray = {}; - let p = !0; - let h = !1; - let f = void 0; - try { - for ( - var m, y = this.contentGroupings[Symbol.iterator](); - !(p = (m = y.next()).done); - p = !0 - ) { - const v = m.value; - this.contentGroupingsArray[v.from] = v.to; - } - } catch (e) { - (h = !0), (f = e); - } finally { - try { - p || y.return == null || y.return(); - } finally { - if (h) throw f; - } - } - (window.GoogleAnalyticsObject = "ga"), - (window.ga = - window.ga || - function () { - (window.ga.q = window.ga.q || []), - window.ga.q.push(arguments); - }), - (window.ga.l = new Date().getTime()); - const b = { - cookieDomain: this.domain, - siteSpeedSampleRate: this.siteSpeedSampleRate, - sampleRate: this.sampleRate, - allowLinker: !0, - useAmpClientId: this.useGoogleAmpClientId, - }; - window.ga("create", this.trackingID, b), - this.optimizeContainerId && - window.ga("require", this.optimizeContainerId), - this.ecommerce || - (window.ga("require", "ecommerce"), (this.ecommerce = !0)), - this.doubleClick && window.ga("require", "displayfeatures"), - this.enhancedLinkAttribution && window.ga("require", "linkid"), - this.anonymizeIp && window.ga("set", "anonymizeIp", !0), - g.debug("===in init GA==="); - }, - }, - { - key: "identify", - value(e) { - this.sendUserId && - e.message.userId && - window.ga("set", "userId", e.message.userId); - const t = this.metricsFunction( - e.message.context.traits, - this.dimensionsArray, - this.metricsArray, - this.contentGroupingsArray - ); - console.log(Object.keys(t).length), - Object.keys(t).length && window.ga("set", t), - g.debug("in GoogleAnalyticsManager identify"); - }, - }, - { - key: "track", - value(e, t) { - const n = this; - const r = e.message.event; - if (r !== "Order Completed" || this.enhancedEcommerce) - if (this.enhancedEcommerce) - switch (r) { - case "Checkout Started": - case "Checkout Step Viewed": - case "Order Updated": - (E = (b = e.message.properties).products), - (t = this.extractCheckoutOptions(e)); - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - ie(E, function (t) { - let r = n.createProductTrack(e, t); - (r = { message: r }), - n.enhancedEcommerceTrackProduct(r, n.inputs); - }), - window.ga("ec:setAction", "checkout", { - step: b.step || 1, - option: t || void 0, - }), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Checkout Step Completed": - var i = e.message.properties; - t = this.extractCheckoutOptions(e); - if (!i.step) return; - var o = { step: i.step || 1, option: t || void 0 }; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - window.ga("ec:setAction", "checkout_option", o), - window.ga("send", "event", "Checkout", "Option"); - break; - case "Order Completed": - (w = - e.message.properties.total || - e.message.properties.revenue || - 0), - (k = e.message.properties.orderId), - (E = e.message.properties.products), - (i = e.message.properties); - if (!k) return; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - ie(E, function (t) { - let r = n.createProductTrack(e, t); - (r = { message: r }), - n.enhancedEcommerceTrackProduct(r, n.inputs); - }), - window.ga("ec:setAction", "purchase", { - id: k, - affiliation: i.affiliation, - revenue: w, - tax: i.tax, - shipping: i.shipping, - coupon: i.coupon, - }), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Order Refunded": - (k = (i = e.message.properties).orderId), (E = i.products); - if (!k) return; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - ie(E, function (e) { - const t = { properties: e }; - window.ga("ec:addProduct", { - id: - t.properties.product_id || - t.properties.id || - t.properties.sku, - quantity: t.properties.quantity, - }); - }), - window.ga("ec:setAction", "refund", { id: k }), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Product Added": - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - this.enhancedEcommerceTrackProductAction( - e, - "add", - null, - this.inputs - ), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Product Removed": - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - this.enhancedEcommerceTrackProductAction( - e, - "remove", - null, - this.inputs - ), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Product Viewed": - i = e.message.properties; - var s = {}; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - i.list && (s.list = i.list), - this.enhancedEcommerceTrackProductAction( - e, - "detail", - s, - this.inputs - ), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Product Clicked": - (i = e.message.properties), (s = {}); - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - i.list && (s.list = i.list), - this.enhancedEcommerceTrackProductAction( - e, - "click", - s, - this.inputs - ), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Promotion Viewed": - i = e.message.properties; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - window.ga("ec:addPromo", { - id: i.promotionId || i.id, - name: i.name, - creative: i.creative, - position: i.position, - }), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Promotion Clicked": - i = e.message.properties; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - window.ga("ec:addPromo", { - id: i.promotionId || i.id, - name: i.name, - creative: i.creative, - position: i.position, - }), - window.ga("ec:setAction", "promo_click", {}), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Product List Viewed": - E = (i = e.message.properties).products; - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - ie(E, function (e) { - const t = { properties: e }; - if ( - t.properties.product_id || - t.properties.sku || - t.properties.name - ) { - let r = { - id: t.properties.productId || t.properties.sku, - name: t.properties.name, - category: t.properties.category || i.category, - list: i.list_id || i.category || "products", - brand: t.properties.band, - variant: t.properties.variant, - price: t.properties.price, - position: n.getProductPosition(t, E), - }; - for (const o in (r = a( - { impressionObj: r }, - n.metricsFunction( - t.properties, - n.dimensionsArray, - n.metricsArray, - n.contentGroupingsArray - ) - ))) - void 0 === r[o] && delete r[o]; - window.ga("ec:addImpression", r); - } - }), - this.pushEnhancedEcommerce(e, this.inputs); - break; - case "Product List Filtered": - E = (i = e.message.properties).products; - (i.filters = i.filters || []), - (i.sorters = i.sorters || []); - var c = i.filters - .map(function (e) { - return "".concat(e.type, ":").concat(e.value); - }) - .join(); - var u = i.sorters - .map(function (e) { - return "".concat(e.type, ":").concat(e.value); - }) - .join(); - (this.enhancedEcommerceLoaded = this.loadEnhancedEcommerce( - e, - this.enhancedEcommerceLoaded - )), - ie(E, function (e) { - const t = { properties: e }; - if ( - t.properties.product_id || - t.properties.sku || - t.properties.name - ) { - let r = { - id: t.properties.product_id || t.sku, - name: t.name, - category: t.category || i.category, - list: i.list_id || i.category || "search results", - brand: i.brand, - variant: "".concat(c, "::").concat(u), - price: t.price, - position: n.getProductPosition(t, E), - }; - for (const o in (r = a( - { impressionObj: r }, - n.metricsFunction( - t.properties, - n.dimensionsArray, - n.metricsArray, - n.contentGroupingsArray - ) - ))) - void 0 === r[o] && delete r[o]; - window.ga("ec:addImpression", r); - } - }), - this.pushEnhancedEcommerce(e, this.inputs); - break; - default: - var l = this.inputs; - y = ve((y = t || {}), l); - var d = e.message.properties.category; - var p = e.message.event; - var h = e.message.properties.label; - var f = ""; - e.message.properties && - (f = e.message.properties.value - ? e.message.properties.value - : e.message.properties.revenue); - var m = { - eventCategory: d || "All", - eventAction: p, - eventLabel: h, - eventValue: this.formatValue(f), - nonInteraction: - void 0 !== e.message.properties.nonInteraction - ? !!e.message.properties.nonInteraction - : !!y.nonInteraction, - }; - (v = e.message.context.campaign) && - (v.name && (m.campaignName = v.name), - v.source && (m.campaignSource = v.source), - v.medium && (m.campaignMedium = v.medium), - v.content && (m.campaignContent = v.content), - v.term && (m.campaignKeyword = v.term)), - (m = a( - { payload: m }, - this.setCustomDimenionsAndMetrics( - e.message.properties, - this.inputs - ) - )), - window.ga("send", "event", m), - g.debug("in GoogleAnalyticsManager track"); - } - else { - l = this.inputs; - var y = ve(t || {}, void 0); - y = ve(y, l); - (d = e.message.properties.category), - (p = e.message.event), - (h = e.message.properties.label), - (f = ""); - e.message.properties && - (f = e.message.properties.value - ? e.message.properties.value - : e.message.properties.revenue); - var v; - m = { - eventCategory: d || "All", - eventAction: p, - eventLabel: h, - eventValue: this.formatValue(f), - nonInteraction: - void 0 !== e.message.properties.nonInteraction - ? !!e.message.properties.nonInteraction - : !!y.nonInteraction, - }; - (v = e.message.context.campaign) && - (v.name && (m.campaignName = v.name), - v.source && (m.campaignSource = v.source), - v.medium && (m.campaignMedium = v.medium), - v.content && (m.campaignContent = v.content), - v.term && (m.campaignKeyword = v.term)), - (m = a( - { payload: m }, - this.setCustomDimenionsAndMetrics( - e.message.properties, - this.inputs - ) - )), - window.ga("send", "event", m), - g.debug("in GoogleAnalyticsManager track"); - } - else { - var b; - var w = (b = e.message.properties).total; - var k = b.orderId; - var E = b.products; - if (!k) return; - window.ga("ecommerce:addTransaction", { - affiliation: b.affiliation, - shipping: b.shipping, - revenue: w, - tax: b.tax, - id: k, - currency: b.currency, - }), - ie(E, function (t) { - const r = n.createProductTrack(e, t); - window.ga("ecommerce:addItem", { - category: r.category, - quantity: r.quantity, - price: r.price, - name: r.name, - sku: r.sku, - id: k, - currency: r.currency, - }); - }), - window.ga("ecommerce:send"); - } - }, - }, - { - key: "page", - value(e) { - g.debug("in GoogleAnalyticsManager page"); - let t; - const n = e.message.properties.category; - const r = e.message.properties; - const i = "" - .concat(e.message.properties.category, " ") - .concat(e.message.name); - const o = e.message.context.campaign | {}; - let s = {}; - const c = this.path(r, this.includeSearch); - const u = e.message.properties.referrer || ""; - (t = - e.message.properties.category || e.message.name - ? e.message.properties.category - ? e.message.name - ? i - : e.message.properties.category - : e.message.name - : r.title), - (s.page = c), - (s.title = t), - (s.location = r.url), - o && - (o.name && (s.campaignName = o.name), - o.source && (s.campaignSource = o.source), - o.medium && (s.campaignMedium = o.medium), - o.content && (s.campaignContent = o.content), - o.term && (s.campaignKeyword = o.term)); - for ( - var l = {}, d = 0; - d < this.resetCustomDimensionsOnPage.length; - d++ - ) { - const p = this.resetCustomDimensionsOnPage[d]; - this.dimensionsArray[p] && (l[this.dimensionsArray[p]] = null); - } - window.ga("set", l), - (s = a( - { pageview: s }, - this.setCustomDimenionsAndMetrics(r, this.inputs) - )); - const h = { page: c, title: t }; - u !== document.referrer && (h.referrer = u), - window.ga("set", h), - this.pageCalled && delete s.location, - window.ga("send", "pageview", s), - n && - this.trackCategorizedPages && - this.track(e, { nonInteraction: 1 }), - i && this.trackNamedPages && this.track(e, { nonInteraction: 1 }), - (this.pageCalled = !0); - }, - }, - { - key: "isLoaded", - value() { - return g.debug("in GA isLoaded"), !!window.gaplugins; - }, - }, - { - key: "isReady", - value() { - return !!window.gaplugins; - }, - }, - { - key: "metricsFunction", - value(e, t, n, r) { - const i = {}; - return ( - ie([n, t, r], function (t) { - ie(t, function (t, n) { - let r = e[t]; - J.boolean(r) && (r = r.toString()), - (r || r === 0) && (i[n] = r); - }); - }), - i - ); - }, - }, - { - key: "formatValue", - value(e) { - return !e || e < 0 ? 0 : Math.round(e); - }, - }, - { - key: "setCustomDimenionsAndMetrics", - value(e, t) { - const n = {}; - const r = {}; - let i = !0; - let o = !1; - let s = void 0; - try { - for ( - var a, c = t.dimensions[Symbol.iterator](); - !(i = (a = c.next()).done); - i = !0 - ) { - const u = a.value; - r[u.from] = u.to; - } - } catch (e) { - (o = !0), (s = e); - } finally { - try { - i || c.return == null || c.return(); - } finally { - if (o) throw s; - } - } - const l = {}; - let d = !0; - let p = !1; - let h = void 0; - try { - for ( - var f, g = t.metrics[Symbol.iterator](); - !(d = (f = g.next()).done); - d = !0 - ) { - const m = f.value; - l[m.from] = m.to; - } - } catch (e) { - (p = !0), (h = e); - } finally { - try { - d || g.return == null || g.return(); - } finally { - if (p) throw h; - } - } - const y = {}; - let v = !0; - let b = !1; - let w = void 0; - try { - for ( - var k, E = t.contentGroupings[Symbol.iterator](); - !(v = (k = E.next()).done); - v = !0 - ) { - const I = k.value; - y[I.from] = I.to; - } - } catch (e) { - (b = !0), (w = e); - } finally { - try { - v || E.return == null || E.return(); - } finally { - if (b) throw w; - } - } - const _ = this.metricsFunction(e, r, l, y); - if (Object.keys(_).length) { - if (!t.setAllMappedProps) - return ( - ie(_, function (e, t) { - n[e] = t; - }), - n - ); - window.ga("set", _); - } - }, - }, - { - key: "path", - value(e, t) { - if (e) { - let n = e.path; - return t && e.search && (n += e.search), n; - } - }, - }, - { - key: "createProductTrack", - value(e, t) { - const n = t || {}; - return ( - (n.currency = t.currency || e.message.properties.currency), - { properties: n } - ); - }, - }, - { - key: "loadEnhancedEcommerce", - value(e, t) { - return ( - t === 0 && (window.ga("require", "ec"), (t = 1)), - window.ga("set", "&cu", e.message.properties.currency), - t - ); - }, - }, - { - key: "enhancedEcommerceTrackProduct", - value(e, t) { - const n = {}; - let r = !0; - let i = !1; - let o = void 0; - try { - for ( - var s, c = t.dimensions[Symbol.iterator](); - !(r = (s = c.next()).done); - r = !0 - ) { - const u = s.value; - n[u.from] = u.to; - } - } catch (e) { - (i = !0), (o = e); - } finally { - try { - r || c.return == null || c.return(); - } finally { - if (i) throw o; - } - } - const l = {}; - let d = !0; - let p = !1; - let h = void 0; - try { - for ( - var f, g = t.metrics[Symbol.iterator](); - !(d = (f = g.next()).done); - d = !0 - ) { - const m = f.value; - l[m.from] = m.to; - } - } catch (e) { - (p = !0), (h = e); - } finally { - try { - d || g.return == null || g.return(); - } finally { - if (p) throw h; - } - } - const y = {}; - let v = !0; - let b = !1; - let w = void 0; - try { - for ( - var k, E = t.contentGroupings[Symbol.iterator](); - !(v = (k = E.next()).done); - v = !0 - ) { - const I = k.value; - y[I.from] = I.to; - } - } catch (e) { - (b = !0), (w = e); - } finally { - try { - v || E.return == null || E.return(); - } finally { - if (b) throw w; - } - } - const _ = e.message.properties; - let A = { - id: _.productId || _.id || _.sku, - name: _.name, - category: _.category, - quantity: _.quantity, - price: _.price, - brand: _.brand, - variant: _.variant, - currency: _.currency, - }; - _.position != null && (A.position = Math.round(_.position)); - const C = _.coupon; - C && (A.coupon = C), - (A = a({ product: A }, this.metricsFunction(_, n, l, y))), - window.ga("ec:addProduct", A); - }, - }, - { - key: "enhancedEcommerceTrackProductAction", - value(e, t, n, r) { - this.enhancedEcommerceTrackProduct(e, r), - window.ga("ec:setAction", t, n || {}); - }, - }, - { - key: "pushEnhancedEcommerce", - value(e, t) { - const n = T([ - "send", - "event", - e.message.properties.category || "EnhancedEcommerce", - e.message.event || "Action not defined", - e.message.properties.label, - a( - { nonInteraction: 1 }, - this.setCustomDimenionsAndMetrics(e.message.properties, t) - ), - ]); - let r = e.message.event; - (r = r.toLowerCase()), - this.eventWithCategoryFieldProductScoped.includes(r) && - (n[2] = "EnhancedEcommerce"), - ga.apply(window, n); - }, - }, - { - key: "getProductPosition", - value(e, t) { - const n = e.properties.position; - return void 0 !== n && !Number.isNaN(Number(n)) && Number(n) > -1 - ? n - : t - .map(function (e) { - return e.product_id; - }) - .indexOf(e.properties.product_id) + 1; - }, - }, - { - key: "extractCheckoutOptions", - value(e) { - const t = T([ - e.message.properties.paymentMethod, - e.message.properties.shippingMethod, - ]); - return t.length > 0 ? t.join(", ") : null; - }, - }, - ]), - e - ); - })(); - const ke = (function () { - function e(t) { - n(this, e), - (this.siteId = t.siteID), - (this.name = "HOTJAR"), - (this._ready = !1); - } - return ( - i(e, [ - { - key: "init", - value() { - (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), - g.debug("===in init Hotjar==="); - }, - }, - { - key: "identify", - value(e) { - if (e.message.userId || e.message.anonymousId) { - const t = e.message.context.traits; - window.hj("identify", e.message.userId, t); - } else g.debug("[Hotjar] identify:: user id is required"); - }, - }, - { - key: "track", - value(e) { - g.debug("[Hotjar] track:: method not supported"); - }, - }, - { - key: "page", - value(e) { - g.debug("[Hotjar] page:: method not supported"); - }, - }, - { - key: "isLoaded", - value() { - return this._ready; - }, - }, - { - key: "isReady", - value() { - return this._ready; - }, - }, - ]), - e - ); - })(); - const Ee = (function () { - function e(t) { - n(this, e), - (this.conversionId = t.conversionID), - (this.pageLoadConversions = t.pageLoadConversions), - (this.clickEventConversions = t.clickEventConversions), - (this.defaultPageConversion = t.defaultPageConversion), - (this.name = "GOOGLEADS"); - } - return ( - i(e, [ - { - key: "init", - value() { - !(function (e, t, n) { - g.debug(`in script loader=== ${e}`); - const r = n.createElement("script"); - (r.src = t), - (r.async = 1), - (r.type = "text/javascript"), - (r.id = e); - const i = n.getElementsByTagName("head")[0]; - g.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), - g.debug("===in init Google Ads==="); - }, - }, - { - key: "identify", - value(e) { - g.debug("[GoogleAds] identify:: method not supported"); - }, - }, - { - key: "track", - value(e) { - g.debug("in GoogleAdsAnalyticsManager track"); - const t = this.getConversionData( - this.clickEventConversions, - e.message.event - ); - if (t.conversionLabel) { - const n = t.conversionLabel; - const r = t.eventName; - const i = `${this.conversionId}/${n}`; - const 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(e) { - g.debug("in GoogleAdsAnalyticsManager page"); - const t = this.getConversionData( - this.pageLoadConversions, - e.message.name - ); - if (t.conversionLabel) { - const n = t.conversionLabel; - const r = t.eventName; - window.gtag("event", r, { - send_to: `${this.conversionId}/${n}`, - }); - } - }, - }, - { - key: "getConversionData", - value(e, t) { - const n = {}; - return ( - e && - (t - ? e.forEach(function (e) { - if (e.name.toLowerCase() === t.toLowerCase()) - return ( - (n.conversionLabel = e.conversionLabel), - void (n.eventName = e.name) - ); - }) - : this.defaultPageConversion && - ((n.conversionLabel = this.defaultPageConversion), - (n.eventName = "Viewed a Page"))), - n - ); - }, - }, - { - key: "isLoaded", - value() { - return window.dataLayer.push !== Array.prototype.push; - }, - }, - { - key: "isReady", - value() { - return window.dataLayer.push !== Array.prototype.push; - }, - }, - ]), - e - ); - })(); - const Ie = (function () { - function e(t, r) { - 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"), - (this.analytics = r), - g.debug("Config ", t); - } - return ( - i(e, [ - { - key: "init", - value() { - g.debug("===in init VWO==="); - const e = this.accountId; - const t = this.settingsTolerance; - const n = this.libraryTolerance; - const r = this.useExistingJquery; - const i = this.isSPA; - (window._vwo_code = (function () { - let o = !1; - const s = document; - return { - use_existing_jquery() { - return r; - }, - library_tolerance() { - return n; - }, - finish() { - if (!o) { - o = !0; - const e = s.getElementById("_vis_opt_path_hides"); - e && e.parentNode.removeChild(e); - } - }, - finished() { - return o; - }, - load(e) { - const 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() { - const n = setTimeout("_vwo_code.finish()", t); - const r = s.createElement("style"); - const o = - "body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}"; - const 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() { - const e = this; - window.VWO = window.VWO || []; - const t = this; - window.VWO.push([ - "onVariationApplied", - function (n) { - if (n) { - g.debug("Variation Applied"); - const r = n[1]; - const i = n[2]; - if ( - (g.debug( - "experiment id:", - r, - "Variation Name:", - _vwo_exp[r].comb_n[i] - ), - void 0 !== _vwo_exp[r].comb_n[i] && - ["VISUAL_AB", "VISUAL", "SPLIT_URL", "SURVEY"].indexOf( - _vwo_exp[r].type - ) > -1) - ) { - try { - t.sendExperimentTrack && - (g.debug("Tracking..."), - e.analytics.track("Experiment Viewed", { - experimentId: r, - variationName: _vwo_exp[r].comb_n[i], - })); - } catch (e) { - g.error("[VWO] experimentViewed:: ", e); - } - try { - t.sendExperimentIdentify && - (g.debug("Identifying..."), - e.analytics.identify( - o({}, "Experiment: ".concat(r), _vwo_exp[r].comb_n[i]) - )); - } catch (e) { - g.error("[VWO] experimentViewed:: ", e); - } - } - } - }, - ]); - }, - }, - { - key: "identify", - value(e) { - g.debug("method not supported"); - }, - }, - { - key: "track", - value(e) { - if (e.message.event === "Order Completed") { - const t = e.message.properties - ? e.message.properties.total || e.message.properties.revenue - : 0; - g.debug("Revenue", t), - (window.VWO = window.VWO || []), - window.VWO.push(["track.revenueConversion", t]); - } - }, - }, - { - key: "page", - value(e) { - g.debug("method not supported"); - }, - }, - { - key: "isLoaded", - value() { - return !!window._vwo_code; - }, - }, - { - key: "isReady", - value() { - return !!window._vwo_code; - }, - }, - ]), - e - ); - })(); - const _e = (function () { - function e(t) { - n(this, e), - (this.containerID = t.containerID), - (this.name = "GOOGLETAGMANAGER"); - } - return ( - i(e, [ - { - key: "init", - value() { - g.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", - }); - const o = t.getElementsByTagName(n)[0]; - const 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(e) { - g.debug("[GTM] identify:: method not supported"); - }, - }, - { - key: "track", - value(e) { - g.debug("===in track GoogleTagManager==="); - const t = e.message; - const n = a( - { - event: t.event, - userId: t.userId, - anonymousId: t.anonymousId, - }, - t.properties - ); - this.sendToGTMDatalayer(n); - }, - }, - { - key: "page", - value(e) { - g.debug("===in page GoogleTagManager==="); - let t; - const n = e.message; - const r = n.name; - const i = n.properties ? n.properties.category : void 0; - r && (t = `Viewed ${r} page`), - i && r && (t = `Viewed ${i} ${r} page`), - t || (t = "Viewed a Page"); - const o = a( - { event: t, userId: n.userId, anonymousId: n.anonymousId }, - n.properties - ); - this.sendToGTMDatalayer(o); - }, - }, - { - key: "isLoaded", - value() { - return !( - !window.dataLayer || - Array.prototype.push === window.dataLayer.push - ); - }, - }, - { - key: "sendToGTMDatalayer", - value(e) { - window.dataLayer.push(e); - }, - }, - { - key: "isReady", - value() { - return !( - !window.dataLayer || - Array.prototype.push === window.dataLayer.push - ); - }, - }, - ]), - e - ); - })(); - const Ae = (function () { - function e(t, r) { - if ( - (n(this, e), - (this.analytics = r), - (this.appKey = t.appKey), - t.appKey || (this.appKey = ""), - (this.endPoint = ""), - t.dataCenter) - ) { - const i = t.dataCenter.trim().split("-"); - i[0].toLowerCase() === "eu" - ? (this.endPoint = "sdk.fra-01.braze.eu") - : (this.endPoint = `sdk.iad-${i[1]}.braze.com`); - } - (this.name = "BRAZE"), g.debug("Config ", t); - } - return ( - i(e, [ - { - key: "formatGender", - value(e) { - if (e && typeof e === "string") { - 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() { - g.debug("===in init Braze==="), - (function (e, t, n, r, i) { - (e.appboy = {}), (e.appboyQueue = []); - for ( - let 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 < o.length; - s++ - ) { - for ( - var a = o[s], c = e.appboy, u = a.split("."), l = 0; - l < u.length - 1; - l++ - ) - c = c[u[l]]; - c[u[l]] = new Function( - `return function ${a.replace( - /\./g, - "_" - )}(){window.appboyQueue.push(arguments); return true}` - )(); - } - (window.appboy.getUser = function () { - return new window.appboy.ab.User(); - }), - (window.appboy.getCachedFeed = function () { - return new window.appboy.ab.Feed(); - }), - (window.appboy.getCachedContentCards = function () { - return new window.appboy.ab.ContentCards(); - }), - ((i = t.createElement(n)).type = "text/javascript"), - (i.src = - "https://js.appboycdn.com/web-sdk/2.4/appboy.min.js"), - (i.async = 1), - (r = t.getElementsByTagName(n)[0]).parentNode.insertBefore( - i, - r - ); - })(window, document, "script"), - window.appboy.initialize(this.appKey, { - enableLogging: !0, - baseUrl: this.endPoint, - }), - window.appboy.display.automaticallyShowNewInAppMessages(); - const e = this.analytics.userId; - e && appboy.changeUser(e), window.appboy.openSession(); - }, - }, - { - key: "handleReservedProperties", - value(e) { - return ( - [ - "time", - "product_id", - "quantity", - "event_name", - "price", - "currency", - ].forEach(function (t) { - delete e[t]; - }), - e - ); - }, - }, - { - key: "identify", - value(e) { - const t = e.message.userId; - const n = e.message.context.traits.address; - const r = e.message.context.traits.avatar; - const i = e.message.context.traits.birthday; - const o = e.message.context.traits.email; - const s = e.message.context.traits.firstname; - const a = e.message.context.traits.gender; - const c = e.message.context.traits.lastname; - const u = e.message.context.traits.phone; - const l = JSON.parse(JSON.stringify(e.message.context.traits)); - window.appboy.changeUser(t), - window.appboy.getUser().setAvatarImageUrl(r), - o && window.appboy.getUser().setEmail(o), - s && window.appboy.getUser().setFirstName(s), - a && window.appboy.getUser().setGender(this.formatGender(a)), - c && window.appboy.getUser().setLastName(c), - u && window.appboy.getUser().setPhoneNumber(u), - n && - (window.appboy.getUser().setCountry(n.country), - window.appboy.getUser().setHomeCity(n.city)), - i && - window.appboy - .getUser() - .setDateOfBirth( - i.getUTCFullYear(), - i.getUTCMonth() + 1, - i.getUTCDate() - ); - [ - "avatar", - "address", - "birthday", - "email", - "id", - "firstname", - "gender", - "lastname", - "phone", - "facebook", - "twitter", - "first_name", - "last_name", - "dob", - "external_id", - "country", - "home_city", - "bio", - "gender", - "phone", - "email_subscribe", - "push_subscribe", - ].forEach(function (e) { - delete l[e]; - }), - Object.keys(l).forEach(function (e) { - window.appboy.getUser().setCustomUserAttribute(e, l[e]); - }); - }, - }, - { - key: "handlePurchase", - value(e, t) { - const n = e.products; - const r = e.currency; - window.appboy.changeUser(t), - del(e, "products"), - del(e, "currency"), - n.forEach(function (t) { - const n = t.product_id; - const i = t.price; - const o = t.quantity; - o && i && n && window.appboy.logPurchase(n, i, r, o, e); - }); - }, - }, - { - key: "track", - value(e) { - const t = e.message.userId; - const n = e.message.event; - let r = e.message.properties; - window.appboy.changeUser(t), - n.toLowerCase() === "order completed" - ? this.handlePurchase(r, t) - : ((r = this.handleReservedProperties(r)), - window.appboy.logCustomEvent(n, r)); - }, - }, - { - key: "page", - value(e) { - const t = e.message.userId; - const n = e.message.name; - let r = e.message.properties; - (r = this.handleReservedProperties(r)), - window.appboy.changeUser(t), - window.appboy.logCustomEvent(n, r); - }, - }, - { - key: "isLoaded", - value() { - return window.appboyQueue === null; - }, - }, - { - key: "isReady", - value() { - return window.appboyQueue === null; - }, - }, - ]), - e - ); - })(); - const Ce = l(function (e) { - !(function () { - const t = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var n = { - rotl(e, t) { - return (e << t) | (e >>> (32 - t)); - }, - rotr(e, t) { - return (e << (32 - t)) | (e >>> t); - }, - endian(e) { - if (e.constructor == Number) - return (16711935 & n.rotl(e, 8)) | (4278255360 & n.rotl(e, 24)); - for (let t = 0; t < e.length; t++) e[t] = n.endian(e[t]); - return e; - }, - randomBytes(e) { - for (var t = []; e > 0; e--) t.push(Math.floor(256 * Math.random())); - return t; - }, - bytesToWords(e) { - for (var t = [], n = 0, r = 0; n < e.length; n++, r += 8) - t[r >>> 5] |= e[n] << (24 - (r % 32)); - return t; - }, - wordsToBytes(e) { - for (var t = [], n = 0; n < 32 * e.length; n += 8) - t.push((e[n >>> 5] >>> (24 - (n % 32))) & 255); - return t; - }, - bytesToHex(e) { - for (var t = [], n = 0; n < e.length; n++) - t.push((e[n] >>> 4).toString(16)), t.push((15 & e[n]).toString(16)); - return t.join(""); - }, - hexToBytes(e) { - for (var t = [], n = 0; n < e.length; n += 2) - t.push(parseInt(e.substr(n, 2), 16)); - return t; - }, - bytesToBase64(e) { - for (var n = [], r = 0; r < e.length; r += 3) - for ( - let i = (e[r] << 16) | (e[r + 1] << 8) | e[r + 2], o = 0; - o < 4; - o++ - ) - 8 * r + 6 * o <= 8 * e.length - ? n.push(t.charAt((i >>> (6 * (3 - o))) & 63)) - : n.push("="); - return n.join(""); - }, - base64ToBytes(e) { - e = e.replace(/[^A-Z0-9+\/]/gi, ""); - for (var n = [], r = 0, i = 0; r < e.length; i = ++r % 4) - i != 0 && - n.push( - ((t.indexOf(e.charAt(r - 1)) & (Math.pow(2, -2 * i + 8) - 1)) << - (2 * i)) | - (t.indexOf(e.charAt(r)) >>> (6 - 2 * i)) - ); - return n; - }, - }; - e.exports = n; - })(); - }); - var Te = { - utf8: { - stringToBytes(e) { - return Te.bin.stringToBytes(unescape(encodeURIComponent(e))); - }, - bytesToString(e) { - return decodeURIComponent(escape(Te.bin.bytesToString(e))); - }, - }, - bin: { - stringToBytes(e) { - for (var t = [], n = 0; n < e.length; n++) - t.push(255 & e.charCodeAt(n)); - return t; - }, - bytesToString(e) { - for (var t = [], n = 0; n < e.length; n++) - t.push(String.fromCharCode(e[n])); - return t.join(""); - }, - }, - }; - const Oe = Te; - const Pe = function (e) { - return ( - e != null && - (Se(e) || - (function (e) { - return ( - typeof e.readFloatLE === "function" && - typeof e.slice === "function" && - Se(e.slice(0, 0)) - ); - })(e) || - !!e._isBuffer) - ); - }; - function Se(e) { - return ( - !!e.constructor && - typeof e.constructor.isBuffer === "function" && - e.constructor.isBuffer(e) - ); - } - const xe = l(function (e) { - !(function () { - const t = Ce; - const n = Oe.utf8; - const r = Pe; - const i = Oe.bin; - var o = function (e, s) { - e.constructor == String - ? (e = - s && s.encoding === "binary" - ? i.stringToBytes(e) - : n.stringToBytes(e)) - : r(e) - ? (e = Array.prototype.slice.call(e, 0)) - : Array.isArray(e) || (e = e.toString()); - for ( - var a = t.bytesToWords(e), - c = 8 * e.length, - u = 1732584193, - l = -271733879, - d = -1732584194, - p = 271733878, - h = 0; - h < a.length; - h++ - ) - a[h] = - (16711935 & ((a[h] << 8) | (a[h] >>> 24))) | - (4278255360 & ((a[h] << 24) | (a[h] >>> 8))); - (a[c >>> 5] |= 128 << c % 32), (a[14 + (((c + 64) >>> 9) << 4)] = c); - const f = o._ff; - const g = o._gg; - const m = o._hh; - const y = o._ii; - for (h = 0; h < a.length; h += 16) { - const v = u; - const b = l; - const w = d; - const k = p; - (u = f(u, l, d, p, a[h + 0], 7, -680876936)), - (p = f(p, u, l, d, a[h + 1], 12, -389564586)), - (d = f(d, p, u, l, a[h + 2], 17, 606105819)), - (l = f(l, d, p, u, a[h + 3], 22, -1044525330)), - (u = f(u, l, d, p, a[h + 4], 7, -176418897)), - (p = f(p, u, l, d, a[h + 5], 12, 1200080426)), - (d = f(d, p, u, l, a[h + 6], 17, -1473231341)), - (l = f(l, d, p, u, a[h + 7], 22, -45705983)), - (u = f(u, l, d, p, a[h + 8], 7, 1770035416)), - (p = f(p, u, l, d, a[h + 9], 12, -1958414417)), - (d = f(d, p, u, l, a[h + 10], 17, -42063)), - (l = f(l, d, p, u, a[h + 11], 22, -1990404162)), - (u = f(u, l, d, p, a[h + 12], 7, 1804603682)), - (p = f(p, u, l, d, a[h + 13], 12, -40341101)), - (d = f(d, p, u, l, a[h + 14], 17, -1502002290)), - (u = g( - u, - (l = f(l, d, p, u, a[h + 15], 22, 1236535329)), - d, - p, - a[h + 1], - 5, - -165796510 - )), - (p = g(p, u, l, d, a[h + 6], 9, -1069501632)), - (d = g(d, p, u, l, a[h + 11], 14, 643717713)), - (l = g(l, d, p, u, a[h + 0], 20, -373897302)), - (u = g(u, l, d, p, a[h + 5], 5, -701558691)), - (p = g(p, u, l, d, a[h + 10], 9, 38016083)), - (d = g(d, p, u, l, a[h + 15], 14, -660478335)), - (l = g(l, d, p, u, a[h + 4], 20, -405537848)), - (u = g(u, l, d, p, a[h + 9], 5, 568446438)), - (p = g(p, u, l, d, a[h + 14], 9, -1019803690)), - (d = g(d, p, u, l, a[h + 3], 14, -187363961)), - (l = g(l, d, p, u, a[h + 8], 20, 1163531501)), - (u = g(u, l, d, p, a[h + 13], 5, -1444681467)), - (p = g(p, u, l, d, a[h + 2], 9, -51403784)), - (d = g(d, p, u, l, a[h + 7], 14, 1735328473)), - (u = m( - u, - (l = g(l, d, p, u, a[h + 12], 20, -1926607734)), - d, - p, - a[h + 5], - 4, - -378558 - )), - (p = m(p, u, l, d, a[h + 8], 11, -2022574463)), - (d = m(d, p, u, l, a[h + 11], 16, 1839030562)), - (l = m(l, d, p, u, a[h + 14], 23, -35309556)), - (u = m(u, l, d, p, a[h + 1], 4, -1530992060)), - (p = m(p, u, l, d, a[h + 4], 11, 1272893353)), - (d = m(d, p, u, l, a[h + 7], 16, -155497632)), - (l = m(l, d, p, u, a[h + 10], 23, -1094730640)), - (u = m(u, l, d, p, a[h + 13], 4, 681279174)), - (p = m(p, u, l, d, a[h + 0], 11, -358537222)), - (d = m(d, p, u, l, a[h + 3], 16, -722521979)), - (l = m(l, d, p, u, a[h + 6], 23, 76029189)), - (u = m(u, l, d, p, a[h + 9], 4, -640364487)), - (p = m(p, u, l, d, a[h + 12], 11, -421815835)), - (d = m(d, p, u, l, a[h + 15], 16, 530742520)), - (u = y( - u, - (l = m(l, d, p, u, a[h + 2], 23, -995338651)), - d, - p, - a[h + 0], - 6, - -198630844 - )), - (p = y(p, u, l, d, a[h + 7], 10, 1126891415)), - (d = y(d, p, u, l, a[h + 14], 15, -1416354905)), - (l = y(l, d, p, u, a[h + 5], 21, -57434055)), - (u = y(u, l, d, p, a[h + 12], 6, 1700485571)), - (p = y(p, u, l, d, a[h + 3], 10, -1894986606)), - (d = y(d, p, u, l, a[h + 10], 15, -1051523)), - (l = y(l, d, p, u, a[h + 1], 21, -2054922799)), - (u = y(u, l, d, p, a[h + 8], 6, 1873313359)), - (p = y(p, u, l, d, a[h + 15], 10, -30611744)), - (d = y(d, p, u, l, a[h + 6], 15, -1560198380)), - (l = y(l, d, p, u, a[h + 13], 21, 1309151649)), - (u = y(u, l, d, p, a[h + 4], 6, -145523070)), - (p = y(p, u, l, d, a[h + 11], 10, -1120210379)), - (d = y(d, p, u, l, a[h + 2], 15, 718787259)), - (l = y(l, d, p, u, a[h + 9], 21, -343485551)), - (u = (u + v) >>> 0), - (l = (l + b) >>> 0), - (d = (d + w) >>> 0), - (p = (p + k) >>> 0); - } - return t.endian([u, l, d, p]); - }; - (o._ff = function (e, t, n, r, i, o, s) { - const a = e + ((t & n) | (~t & r)) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._gg = function (e, t, n, r, i, o, s) { - const a = e + ((t & r) | (n & ~r)) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._hh = function (e, t, n, r, i, o, s) { - const a = e + (t ^ n ^ r) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._ii = function (e, t, n, r, i, o, s) { - const a = e + (n ^ (t | ~r)) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._blocksize = 16), - (o._digestsize = 16), - (e.exports = function (e, n) { - if (e == null) throw new Error(`Illegal argument ${e}`); - const r = t.wordsToBytes(o(e, n)); - return n && n.asBytes - ? r - : n && n.asString - ? i.bytesToString(r) - : t.bytesToHex(r); - }); - })(); - }); - const Re = (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), - g.debug("Config ", t); - } - return ( - i(e, [ - { - key: "init", - value() { - (window.intercomSettings = { app_id: this.APP_ID }), - (function () { - const e = window; - const t = e.Intercom; - if (typeof t === "function") - t("reattach_activator"), t("update", e.intercomSettings); - else { - const n = document; - const r = function e() { - e.c(arguments); - }; - (r.q = []), - (r.c = function (e) { - r.q.push(e); - }), - (e.Intercom = r); - const i = function () { - const e = n.createElement("script"); - (e.type = "text/javascript"), - (e.async = !0), - (e.src = `https://widget.intercom.io/widget/${window.intercomSettings.app_id}`); - const t = n.getElementsByTagName("script")[0]; - t.parentNode.insertBefore(e, t); - }; - document.readyState === "complete" - ? (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() { - window.Intercom("update"); - }, - }, - { - key: "identify", - value(e) { - const n = {}; - const r = e.message.context; - if ((r.Intercom ? r.Intercom : null) != null) { - const i = r.Intercom.user_hash ? r.Intercom.user_hash : null; - i != null && (n.user_hash = i); - const o = r.Intercom.hideDefaultLauncher - ? r.Intercom.hideDefaultLauncher - : null; - o != null && (n.hide_default_launcher = o); - } - Object.keys(r.traits).forEach(function (e) { - if (r.traits.hasOwnProperty(e)) { - const i = r.traits[e]; - if (e === "company") { - const o = []; - const s = {}; - typeof r.traits[e] === "string" && - (s.company_id = xe(r.traits[e])); - const a = - (t(r.traits[e]) == "object" && Object.keys(r.traits[e])) || - []; - a.forEach(function (t) { - a.hasOwnProperty(t) && - (t != "id" - ? (s[t] = r.traits[e][t]) - : (s.company_id = r.traits[e][t])); - }), - t(r.traits[e]) != "object" || - a.includes("id") || - (s.company_id = xe(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(e) { - const t = {}; - const n = e.message; - (n.properties ? Object.keys(n.properties) : null).forEach(function ( - e - ) { - const 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() { - return !!window.intercom_code; - }, - }, - { - key: "isReady", - value() { - return !!window.intercom_code; - }, - }, - ]), - e - ); - })(); - const je = (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() { - g.debug("===in init Keen==="), - L( - "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(e) { - g.debug("in Keen identify"); - const t = e.message.context.traits; - const n = e.message.userId - ? e.message.userId - : e.message.anonymousId; - var 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(e) { - g.debug("in Keen track"); - const t = e.message.event; - let n = e.message.properties; - (n = this.getAddOn(n)), this.client.recordEvent(t, n); - }, - }, - { - key: "page", - value(e) { - g.debug("in Keen page"); - const t = e.message.name; - const n = e.message.properties - ? e.message.properties.category - : void 0; - let r = "Loaded a Page"; - t && (r = `Viewed ${t} page`), - n && t && (r = `Viewed ${n} ${t} page`); - let i = e.message.properties; - (i = this.getAddOn(i)), this.client.recordEvent(r, i); - }, - }, - { - key: "isLoaded", - value() { - return g.debug("in Keen isLoaded"), !(this.client == null); - }, - }, - { - key: "isReady", - value() { - return !(this.client == null); - }, - }, - { - key: "getAddOn", - value(e) { - const 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 - ); - })(); - const Le = Object.prototype.hasOwnProperty; - const De = function (e) { - for ( - let t = Array.prototype.slice.call(arguments, 1), n = 0; - n < t.length; - n += 1 - ) - for (const r in t[n]) Le.call(t[n], r) && (e[r] = t[n][r]); - return e; - }; - const Me = l(function (e) { - function t(e) { - return function (t, n, r, o) { - let s; - (normalize = - o && - (function (e) { - return typeof e === "function"; - })(o.normalizer) - ? o.normalizer - : i), - (n = normalize(n)); - for (var a = !1; !a; ) c(); - function c() { - for (s in t) { - const e = normalize(s); - if (n.indexOf(e) === 0) { - const r = n.substr(e.length); - if (r.charAt(0) === "." || r.length === 0) { - n = r.substr(1); - const i = t[s]; - return i == null - ? void (a = !0) - : n.length - ? void (t = i) - : void (a = !0); - } - } - } - (s = void 0), (a = !0); - } - if (s) return t == null ? t : e(t, s, r); - }; - } - function n(e, t) { - return e.hasOwnProperty(t) && delete e[t], e; - } - function r(e, t, n) { - return e.hasOwnProperty(t) && (e[t] = n), e; - } - function i(e) { - return e.replace(/[^a-zA-Z0-9\.]+/g, "").toLowerCase(); - } - (e.exports = t(function (e, t) { - if (e.hasOwnProperty(t)) return e[t]; - })), - (e.exports.find = e.exports), - (e.exports.replace = function (e, n, i, o) { - return t(r).call(this, e, n, i, o), e; - }), - (e.exports.del = function (e, r, i) { - return t(n).call(this, e, r, null, i), e; - }); - }); - const Ue = - (Me.find, - Me.replace, - Me.del, - (function () { - function e(t) { - n(this, e), - (this.apiKey = t.apiKey), - (this.prefixProperties = t.prefixProperties), - (this.name = "KISSMETRICS"); - } - return ( - i(e, [ - { - key: "init", - value() { - g.debug("===in init Kissmetrics==="), - (window._kmq = window._kmq || []); - const e = window._kmk || this.apiKey; - function t(e) { - setTimeout(function () { - const t = document; - const n = t.getElementsByTagName("script")[0]; - const r = t.createElement("script"); - (r.type = "text/javascript"), - (r.async = !0), - (r.src = e), - n.parentNode.insertBefore(r, n); - }, 1); - } - t("//i.kissmetrics.com/i.js"), - t(`//scripts.kissmetrics.com/${e}.2.js`), - this.isEnvMobile() && - window._kmq.push(["set", { "Mobile Session": "Yes" }]); - }, - }, - { - key: "isEnvMobile", - value() { - return ( - navigator.userAgent.match(/Android/i) || - navigator.userAgent.match(/BlackBerry/i) || - navigator.userAgent.match(/IEMobile/i) || - navigator.userAgent.match(/Opera Mini/i) || - navigator.userAgent.match(/iPad/i) || - navigator.userAgent.match(/iPhone|iPod/i) - ); - }, - }, - { - key: "toUnixTimestamp", - value(e) { - return (e = new Date(e)), Math.floor(e.getTime() / 1e3); - }, - }, - { - key: "clean", - value(e) { - let t = {}; - for (const n in e) - if (e.hasOwnProperty(n)) { - const r = e[n]; - if (r == null) continue; - if (J.date(r)) { - t[n] = this.toUnixTimestamp(r); - continue; - } - if (J.bool(r)) { - t[n] = r; - continue; - } - if (J.number(r)) { - t[n] = r; - continue; - } - if ( - (g.debug(r.toString()), r.toString() !== "[object Object]") - ) { - t[n] = r.toString(); - continue; - } - const i = {}; - i[n] = r; - const o = this.flatten(i, { safe: !0 }); - for (const s in o) J.array(o[s]) && (o[s] = o[s].toString()); - delete (t = De(t, o))[n]; - } - return t; - }, - }, - { - key: "flatten", - value(e, t) { - const n = (t = t || {}).delimiter || "."; - let r = t.maxDepth; - let i = 1; - const o = {}; - return ( - (function e(s, a) { - for (const c in s) - if (s.hasOwnProperty(c)) { - const u = s[c]; - const l = t.safe && J.array(u); - const d = Object.prototype.toString.call(u); - const p = - d === "[object Object]" || d === "[object Array]"; - const h = []; - const f = a ? a + n + c : c; - for (const g in (t.maxDepth || (r = i + 1), u)) - u.hasOwnProperty(g) && h.push(g); - if (!l && p && h.length && i < r) return ++i, e(u, f); - o[f] = u; - } - })(e), - o - ); - }, - }, - { - key: "prefix", - value(e, t) { - const n = {}; - return ( - ie(t, function (t, r) { - t === "Billing Amount" - ? (n[t] = r) - : t === "revenue" - ? ((n[`${e} - ${t}`] = r), (n["Billing Amount"] = r)) - : (n[`${e} - ${t}`] = r); - }), - n - ); - }, - }, - { - key: "identify", - value(e) { - g.debug("in Kissmetrics identify"); - const t = this.clean(e.message.context.traits); - const n = - e.message.userId && e.message.userId != "" - ? e.message.userId - : void 0; - n && window._kmq.push(["identify", n]), - t && window._kmq.push(["set", t]); - }, - }, - { - key: "track", - value(e) { - g.debug("in Kissmetrics track"); - const t = e.message.event; - let n = JSON.parse(JSON.stringify(e.message.properties)); - const r = this.toUnixTimestamp(new Date()); - const i = _(n); - i && (n.revenue = i); - const o = n.products; - o && delete n.products, - (n = this.clean(n)), - g.debug(JSON.stringify(n)), - this.prefixProperties && (n = this.prefix(t, n)), - window._kmq.push(["record", t, n]); - const s = function (e, n) { - let i = e; - this.prefixProperties && (i = this.prefix(t, i)), - (i._t = r + n), - (i._d = 1), - window.KM.set(i); - }.bind(this); - o && - window._kmq.push(function () { - ie(o, s); - }); - }, - }, - { - key: "page", - value(e) { - g.debug("in Kissmetrics page"); - const t = e.message.name; - const n = e.message.properties - ? e.message.properties.category - : void 0; - let r = "Loaded a Page"; - t && (r = `Viewed ${t} page`), - n && t && (r = `Viewed ${n} ${t} page`); - let i = e.message.properties; - this.prefixProperties && (i = this.prefix("Page", i)), - window._kmq.push(["record", r, i]); - }, - }, - { - key: "alias", - value(e) { - const t = e.message.previousId; - const n = e.message.userId; - window._kmq.push(["alias", n, t]); - }, - }, - { - key: "group", - value(e) { - const t = e.message.groupId; - let n = e.message.traits; - (n = this.prefix("Group", n)), - t && (n["Group - id"] = t), - window._kmq.push(["set", n]), - g.debug("in Kissmetrics group"); - }, - }, - { - key: "isLoaded", - value() { - return J.object(window.KM); - }, - }, - { - key: "isReady", - value() { - return J.object(window.KM); - }, - }, - ]), - e - ); - })()); - const Ne = (function () { - function e(t) { - n(this, e), - (this.siteID = t.siteID), - (this.apiKey = t.apiKey), - (this.name = "CUSTOMERIO"); - } - return ( - i(e, [ - { - key: "init", - value() { - g.debug("===in init Customer IO init==="), - (window._cio = window._cio || []); - const e = this.siteID; - !(function () { - let t; - let n; - let r; - for ( - t = function (e) { - return function () { - window._cio.push( - [e].concat(Array.prototype.slice.call(arguments, 0)) - ); - }; - }, - n = ["load", "identify", "sidentify", "track", "page"], - r = 0; - r < n.length; - r++ - ) - window._cio[n[r]] = t(n[r]); - const i = document.createElement("script"); - const o = document.getElementsByTagName("script")[0]; - (i.async = !0), - (i.id = "cio-tracker"), - i.setAttribute("data-site-id", e), - (i.src = "https://assets.customer.io/assets/track.js"), - o.parentNode.insertBefore(i, o); - })(); - }, - }, - { - key: "identify", - value(e) { - g.debug("in Customer IO identify"); - const t = e.message.userId - ? e.message.userId - : e.message.anonymousId; - const n = e.message.context.traits ? e.message.context.traits : {}; - n.created_at || - (n.created_at = Math.floor(new Date().getTime() / 1e3)), - (n.id = t), - window._cio.identify(n); - }, - }, - { - key: "track", - value(e) { - g.debug("in Customer IO track"); - const t = e.message.event; - const n = e.message.properties; - window._cio.track(t, n); - }, - }, - { - key: "page", - value(e) { - g.debug("in Customer IO page"); - const t = e.message.name || e.message.properties.url; - window._cio.page(t, e.message.properties); - }, - }, - { - key: "isLoaded", - value() { - return !(!window._cio || window._cio.push === Array.prototype.push); - }, - }, - { - key: "isReady", - value() { - return !(!window._cio || window._cio.push === Array.prototype.push); - }, - }, - ]), - e - ); - })(); - let qe = !1; - const Be = []; - var Fe = setInterval(function () { - document.body && ((qe = !0), ie(Be, Ge), clearInterval(Fe)); - }, 5); - function Ge(e) { - e(document.body); - } - const Ke = (function () { - function e(t, r) { - n(this, e), - (this.analytics = r), - (this._sf_async_config = window._sf_async_config = - window._sf_async_config || {}), - (window._sf_async_config.useCanonical = !0), - (window._sf_async_config.uid = t.uid), - (window._sf_async_config.domain = t.domain), - (this.isVideo = !!t.video), - (this.sendNameAndCategoryAsTitle = t.sendNameAndCategoryAsTitle || !0), - (this.subscriberEngagementKeys = t.subscriberEngagementKeys || []), - (this.replayEvents = []), - (this.failed = !1), - (this.isFirstPageCallMade = !1), - (this.name = "CHARTBEAT"); - } - return ( - i(e, [ - { - key: "init", - value() { - g.debug("===in init Chartbeat==="); - }, - }, - { - key: "identify", - value(e) { - g.debug("in Chartbeat identify"); - }, - }, - { - key: "track", - value(e) { - g.debug("in Chartbeat track"); - }, - }, - { - key: "page", - value(e) { - if ( - (g.debug("in Chartbeat page"), - this.loadConfig(e), - this.isFirstPageCallMade) - ) { - if (this.failed) - return ( - g.debug("===ignoring cause failed integration==="), - void (this.replayEvents = []) - ); - if (!this.isLoaded() && !this.failed) - return ( - g.debug("===pushing to replay queue for chartbeat==="), - void this.replayEvents.push(["page", e]) - ); - g.debug("===processing page event in chartbeat==="); - const t = e.message.properties; - window.pSUPERFLY.virtualPage(t.path); - } else (this.isFirstPageCallMade = !0), this.initAfterPage(); - }, - }, - { - key: "isLoaded", - value() { - return ( - g.debug("in Chartbeat isLoaded"), - !this.isFirstPageCallMade || !!window.pSUPERFLY - ); - }, - }, - { - key: "isFailed", - value() { - return this.failed; - }, - }, - { - key: "isReady", - value() { - return !!window.pSUPERFLY; - }, - }, - { - key: "loadConfig", - value(e) { - let t; - const n = e.message.properties; - const r = n ? n.category : void 0; - const i = e.message.name; - const o = n ? n.author : void 0; - this.sendNameAndCategoryAsTitle && (t = r && i ? `${r} ${i}` : i), - r && (window._sf_async_config.sections = r), - o && (window._sf_async_config.authors = o), - t && (window._sf_async_config.title = t); - const s = (window._cbq = window._cbq || []); - for (const a in n) - n.hasOwnProperty(a) && - this.subscriberEngagementKeys.indexOf(a) > -1 && - s.push([a, n[a]]); - }, - }, - { - key: "initAfterPage", - value() { - let e; - const t = this; - (e = function () { - let e; - let n; - const 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); - }), - qe ? Ge(e) : Be.push(e), - this._isReady(this).then(function (e) { - g.debug("===replaying on chartbeat==="), - e.replayEvents.forEach(function (t) { - e[t[0]](t[1]); - }); - }); - }, - }, - { - key: "pause", - value(e) { - return new Promise(function (t) { - setTimeout(t, e); - }); - }, - }, - { - key: "_isReady", - value(e) { - const t = this; - const n = - arguments.length > 1 && void 0 !== arguments[1] - ? arguments[1] - : 0; - return new Promise(function (r) { - return t.isLoaded() - ? ((t.failed = !1), - g.debug("===chartbeat loaded successfully==="), - e.analytics.emit("ready"), - r(e)) - : n >= 1e4 - ? ((t.failed = !0), g.debug("===chartbeat failed==="), r(e)) - : void t.pause(1e3).then(function () { - return t._isReady(e, n + 1e3).then(r); - }); - }); - }, - }, - ]), - e - ); - })(); - const Ve = (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() { - g.debug("===in init Comscore init==="); - }, - }, - { - key: "identify", - value(e) { - g.debug("in Comscore identify"); - }, - }, - { - key: "track", - value(e) { - g.debug("in Comscore track"); - }, - }, - { - key: "page", - value(e) { - if ( - (g.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(e) { - g.debug("=====in loadConfig====="), - (this.comScoreParams = this.mapComscoreParams( - e.message.properties - )), - (window._comscore = window._comscore || []), - window._comscore.push(this.comScoreParams); - }, - }, - { - key: "initAfterPage", - value() { - g.debug("=====in initAfterPage====="), - (function () { - const e = document.createElement("script"); - const t = document.getElementsByTagName("script")[0]; - (e.async = !0), - (e.src = `${ - document.location.protocol == "https:" - ? "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(e) { - return new Promise(function (t) { - setTimeout(t, e); - }); - }, - }, - { - key: "_isReady", - value(e) { - const t = this; - const 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(e) { - g.debug("=====in mapComscoreParams====="); - const t = this.comScoreBeaconParam; - const n = {}; - return ( - Object.keys(t).forEach(function (r) { - if (r in e) { - const i = t[r]; - const o = e[r]; - n[i] = o; - } - }), - (n.c1 = "2"), - (n.c2 = this.c2ID), - g.debug("=====in mapComscoreParams=====", n), - n - ); - }, - }, - { - key: "isLoaded", - value() { - return ( - g.debug("in Comscore isLoaded"), - !this.isFirstPageCallMade || !!window.COMSCORE - ); - }, - }, - { - key: "isReady", - value() { - return !!window.COMSCORE; - }, - }, - ]), - e - ); - })(); - const He = Object.prototype.hasOwnProperty; - const ze = String.prototype.charAt; - const Je = Object.prototype.toString; - const We = function (e, t) { - return ze.call(e, t); - }; - const $e = function (e, t) { - return He.call(e, t); - }; - const Ye = function (e, t) { - t = t || $e; - for (var n = [], r = 0, i = e.length; r < i; r += 1) - t(e, r) && n.push(String(r)); - return n; - }; - const Qe = function (e) { - return e == null - ? [] - : ((t = e), - Je.call(t) === "[object String]" - ? Ye(e, We) - : (function (e) { - return ( - e != null && - typeof e !== "function" && - typeof e.length === "number" - ); - })(e) - ? Ye(e, $e) - : (function (e, t) { - t = t || $e; - const n = []; - for (const r in e) t(e, r) && n.push(String(r)); - return n; - })(e)); - let t; - }; - const Ze = Object.prototype.toString; - const Xe = - typeof Array.isArray === "function" - ? Array.isArray - : function (e) { - return Ze.call(e) === "[object Array]"; - }; - const et = function (e) { - return ( - e != null && - (Xe(e) || - (e !== "function" && - (function (e) { - const t = typeof e; - return ( - t === "number" || - (t === "object" && Ze.call(e) === "[object Number]") - ); - })(e.length))) - ); - }; - const tt = function (e, t) { - for (let n = 0; n < t.length && !1 !== e(t[n], n, t); n += 1); - }; - const nt = function (e, t) { - for ( - let n = Qe(t), r = 0; - r < n.length && !1 !== e(t[n[r]], n[r], t); - r += 1 - ); - }; - const rt = function (e, t) { - return (et(t) ? tt : nt).call(this, e, t); - }; - const it = (function () { - function e(t) { - n(this, e), - (this.blacklistPiiProperties = t.blacklistPiiProperties), - (this.categoryToContent = t.categoryToContent), - (this.pixelId = t.pixelId), - (this.eventsToEvents = t.eventsToEvents), - (this.eventCustomProperties = t.eventCustomProperties), - (this.valueFieldIdentifier = t.valueFieldIdentifier), - (this.advancedMapping = t.advancedMapping), - (this.traitKeyToExternalId = t.traitKeyToExternalId), - (this.legacyConversionPixelId = t.legacyConversionPixelId), - (this.userIdAsPixelId = t.userIdAsPixelId), - (this.whitelistPiiProperties = t.whitelistPiiProperties), - (this.name = "FB_PIXEL"); - } - return ( - i(e, [ - { - key: "init", - value() { - void 0 === this.categoryToContent && (this.categoryToContent = []), - void 0 === this.legacyConversionPixelId && - (this.legacyConversionPixelId = []), - void 0 === this.userIdAsPixelId && (this.userIdAsPixelId = []), - g.debug("===in init FbPixel==="), - (window._fbq = function () { - window.fbq.callMethod - ? window.fbq.callMethod.apply(window.fbq, arguments) - : window.fbq.queue.push(arguments); - }), - (window.fbq = window.fbq || window._fbq), - (window.fbq.push = window.fbq), - (window.fbq.loaded = !0), - (window.fbq.disablePushState = !0), - (window.fbq.allowDuplicatePageViews = !0), - (window.fbq.version = "2.0"), - (window.fbq.queue = []), - window.fbq("init", this.pixelId), - L( - "fbpixel-integration", - "//connect.facebook.net/en_US/fbevents.js" - ); - }, - }, - { - key: "isLoaded", - value() { - return ( - g.debug("in FBPixel isLoaded"), - !(!window.fbq || !window.fbq.callMethod) - ); - }, - }, - { - key: "isReady", - value() { - return ( - g.debug("in FBPixel isReady"), - !(!window.fbq || !window.fbq.callMethod) - ); - }, - }, - { - key: "page", - value(e) { - window.fbq("track", "PageView"); - }, - }, - { - key: "identify", - value(e) { - this.advancedMapping && - window.fbq("init", this.pixelId, e.message.context.traits); - }, - }, - { - key: "track", - value(e) { - const t = this; - const n = this; - const r = e.message.event; - let i = this.formatRevenue(e.message.properties.revenue); - const o = this.buildPayLoad(e, !0); - void 0 === this.categoryToContent && (this.categoryToContent = []), - void 0 === this.legacyConversionPixelId && - (this.legacyConversionPixelId = []), - void 0 === this.userIdAsPixelId && (this.userIdAsPixelId = []), - (o.value = i); - let s; - let a; - const c = this.eventsToEvents; - const u = this.legacyConversionPixelId; - if ( - ((s = c.reduce(function (e, t) { - return t.from === r && e.push(t.to), e; - }, [])), - (a = u.reduce(function (e, t) { - return t.from === r && e.push(t.to), e; - }, [])), - rt(function (t) { - (o.currency = e.message.properties.currency || "USD"), - window.fbq("trackSingle", n.pixelId, t, o, { - eventID: e.message.messageId, - }); - }, s), - rt(function (t) { - window.fbq( - "trackSingle", - n.pixelId, - t, - { currency: e.message.properties.currency, value: i }, - { eventID: e.message.messageId } - ); - }, a), - r === "Product List Viewed") - ) { - var l = []; - var d = e.message.properties.products; - var p = this.buildPayLoad(e, !0); - Array.isArray(d) && - d.forEach(function (t) { - const n = t.product_id; - n && - (g.push(n), - l.push({ - id: n, - quantity: e.message.properties.quantity, - })); - }), - g.length - ? (f = ["product"]) - : (g.push(e.message.properties.category || ""), - l.push({ - id: e.message.properties.category || "", - quantity: 1, - }), - (f = ["product_group"])), - window.fbq( - "trackSingle", - n.pixelId, - "ViewContent", - this.merge( - { - content_ids: g, - content_type: this.getContentType(e, f), - contents: l, - }, - p - ), - { eventID: e.message.messageId } - ), - rt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: t.formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Product Viewed") { - var h = this.valueFieldIdentifier === "properties.value"; - p = this.buildPayLoad(e, !0); - window.fbq( - "trackSingle", - n.pixelId, - "ViewContent", - this.merge( - { - content_ids: [ - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - ], - content_type: this.getContentType(e, ["product"]), - content_name: e.message.properties.product_name || "", - content_category: e.message.properties.category || "", - currency: e.message.properties.currency, - value: h - ? this.formatRevenue(e.message.properties.value) - : this.formatRevenue(e.message.properties.price), - contents: [ - { - id: - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }, - ], - }, - p - ), - { eventID: e.message.messageId } - ), - rt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: h - ? t.formatRevenue(e.message.properties.value) - : t.formatRevenue(e.message.properties.price), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Product Added") { - (h = this.valueFieldIdentifier === "properties.value"), - (p = this.buildPayLoad(e, !0)); - window.fbq( - "trackSingle", - n.pixelId, - "AddToCart", - this.merge( - { - content_ids: [ - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - ], - content_type: this.getContentType(e, ["product"]), - content_name: e.message.properties.product_name || "", - content_category: e.message.properties.category || "", - currency: e.message.properties.currency, - value: h - ? this.formatRevenue(e.message.properties.value) - : this.formatRevenue(e.message.properties.price), - contents: [ - { - id: - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }, - ], - }, - p - ), - { eventID: e.message.messageId } - ), - rt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: h - ? t.formatRevenue(e.message.properties.value) - : t.formatRevenue(e.message.properties.price), - }, - { eventID: e.message.messageId } - ); - }, a), - this.merge( - { - content_ids: [ - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - ], - content_type: this.getContentType(e, ["product"]), - content_name: e.message.properties.product_name || "", - content_category: e.message.properties.category || "", - currency: e.message.properties.currency, - value: h - ? this.formatRevenue(e.message.properties.value) - : this.formatRevenue(e.message.properties.price), - contents: [ - { - id: - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }, - ], - }, - p - ); - } else if (r === "Order Completed") { - (d = e.message.properties.products), - (p = this.buildPayLoad(e, !0)), - (i = this.formatRevenue(e.message.properties.revenue)); - for ( - var f = this.getContentType(e, ["product"]), - g = [], - m = ((l = []), 0); - m < d.length; - m++ - ) { - var y = product.product_id; - g.push(y); - var v = { id: y, quantity: e.message.properties.quantity }; - e.message.properties.price && - (v.item_price = e.message.properties.price), - l.push(v); - } - window.fbq( - "trackSingle", - n.pixelId, - "Purchase", - this.merge( - { - content_ids: g, - content_type: f, - currency: e.message.properties.currency, - value: i, - contents: l, - num_items: g.length, - }, - p - ), - { eventID: e.message.messageId } - ), - rt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: t.formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Products Searched") { - p = this.buildPayLoad(e, !0); - window.fbq( - "trackSingle", - n.pixelId, - "Search", - this.merge({ search_string: e.message.properties.query }, p), - { eventID: e.message.messageId } - ), - rt(function (t) { - window.fbq( - "trackSingle", - n.pixelId, - t, - { - currency: e.message.properties.currency, - value: formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Checkout Started") { - (d = e.message.properties.products), - (p = this.buildPayLoad(e, !0)), - (i = this.formatRevenue(e.message.properties.revenue)); - let b = e.message.properties.category; - for (g = [], l = [], m = 0; m < d.length; m++) { - y = d[m].product_id; - g.push(y); - v = { - id: y, - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }; - e.message.properties.price && - (v.item_price = e.message.properties.price), - l.push(v); - } - !b && d[0] && d[0].category && (b = d[0].category), - window.fbq( - "trackSingle", - n.pixelId, - "InitiateCheckout", - this.merge( - { - content_category: b, - content_ids: g, - content_type: this.getContentType(e, ["product"]), - currency: e.message.properties.currency, - value: i, - contents: l, - num_items: g.length, - }, - p - ), - { eventID: e.message.messageId } - ), - rt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: t.formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } - }, - }, - { - key: "getContentType", - value(e, t) { - const n = e.message.options; - if (n && n.contentType) return [n.contentType]; - let r; - let i = e.message.properties.category; - if (!i) { - const o = e.message.properties.products; - o && o.length && (i = o[0].category); - } - if ( - i && - (r = this.categoryToContent.reduce(function (e, t) { - return t.from == i && e.push(t.to), e; - }, [])).length - ) - return r; - return t; - }, - }, - { - key: "merge", - value(e, t) { - const n = {}; - for (const r in e) e.hasOwnProperty(r) && (n[r] = e[r]); - for (const i in t) - t.hasOwnProperty(i) && !n.hasOwnProperty(i) && (n[i] = t[i]); - return n; - }, - }, - { - key: "formatRevenue", - value(e) { - return Number(e || 0).toFixed(2); - }, - }, - { - key: "buildPayLoad", - value(e, t) { - for ( - var n = [ - "checkinDate", - "checkoutDate", - "departingArrivalDate", - "departingDepartureDate", - "returningArrivalDate", - "returningDepartureDate", - "travelEnd", - "travelStart", - ], - r = [ - "email", - "firstName", - "lastName", - "gender", - "city", - "country", - "phone", - "state", - "zip", - "birthday", - ], - i = this.whitelistPiiProperties || [], - o = this.blacklistPiiProperties || [], - s = this.eventCustomProperties || [], - a = {}, - c = 0; - c < o[c]; - c++ - ) { - const u = o[c]; - a[u.blacklistPiiProperties] = u.blacklistPiiHash; - } - const l = {}; - const d = e.message.properties; - for (const p in d) - if (d.hasOwnProperty(p) && !(t && s.indexOf(p) < 0)) { - const h = d[p]; - if (n.indexOf(d) >= 0 && J.date(h)) - l[p] = h.toISOTring().split("T")[0]; - else if (a.hasOwnProperty(p)) - a[p] && typeof h === "string" && (l[p] = sha256(h)); - else { - const f = r.indexOf(p) >= 0; - const g = i.indexOf(p) >= 0; - (f && !g) || (l[p] = h); - } - } - return l; - }, - }, - ]), - e - ); - })(); - const ot = Object.prototype.toString; - const st = function e(t) { - const n = (function (e) { - switch (ot.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 e === null - ? "null" - : void 0 === e - ? "undefined" - : e != e - ? "nan" - : e && e.nodeType === 1 - ? "element" - : (t = e) != null && - (t._isBuffer || - (t.constructor && - typeof t.constructor.isBuffer === "function" && - t.constructor.isBuffer(t))) - ? "buffer" - : typeof (e = e.valueOf - ? e.valueOf() - : Object.prototype.valueOf.apply(e)); - let t; - })(t); - if (n === "object") { - var r = {}; - for (const i in t) t.hasOwnProperty(i) && (r[i] = e(t[i])); - return r; - } - if (n === "array") { - r = new Array(t.length); - for (let o = 0, s = t.length; o < s; o++) r[o] = e(t[o]); - return r; - } - if (n === "regexp") { - let a = ""; - return ( - (a += t.multiline ? "m" : ""), - (a += t.global ? "g" : ""), - (a += t.ignoreCase ? "i" : ""), - new RegExp(t.source, a) - ); - } - return n === "date" ? new Date(t.getTime()) : t; - }; - const at = 1e3; - const ct = 60 * at; - const ut = 60 * ct; - const lt = 24 * ut; - const dt = 365.25 * lt; - const pt = function (e, t) { - return ( - (t = t || {}), - typeof e === "string" - ? (function (e) { - if ((e = `${e}`).length > 1e4) return; - const 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; - const n = parseFloat(t[1]); - switch ((t[2] || "ms").toLowerCase()) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return n * dt; - case "days": - case "day": - case "d": - return n * lt; - 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 * ct; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * at; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - } - })(e) - : t.long - ? (function (e) { - return ( - ht(e, lt, "day") || - ht(e, ut, "hour") || - ht(e, ct, "minute") || - ht(e, at, "second") || - `${e} ms` - ); - })(e) - : (function (e) { - return e >= lt - ? `${Math.round(e / lt)}d` - : e >= ut - ? `${Math.round(e / ut)}h` - : e >= ct - ? `${Math.round(e / ct)}m` - : e >= at - ? `${Math.round(e / at)}s` - : `${e}ms`; - })(e) - ); - }; - function ht(e, t, n) { - if (!(e < t)) - return e < 1.5 * t - ? `${Math.floor(e / t)} ${n}` - : `${Math.ceil(e / t)} ${n}s`; - } - const ft = l(function (e, t) { - ((t = e.exports = function (e) { - function i() {} - function o() { - const e = o; - const i = +new Date(); - const s = i - (n || i); - (e.diff = s), - (e.prev = n), - (e.curr = i), - (n = i), - e.useColors == null && (e.useColors = t.useColors()), - e.color == null && - e.useColors && - (e.color = t.colors[r++ % t.colors.length]); - let a = Array.prototype.slice.call(arguments); - (a[0] = t.coerce(a[0])), - typeof a[0] !== "string" && (a = ["%o"].concat(a)); - let c = 0; - (a[0] = a[0].replace(/%([a-z%])/g, function (n, r) { - if (n === "%%") return n; - c++; - const i = t.formatters[r]; - if (typeof i === "function") { - const o = a[c]; - (n = i.call(e, o)), a.splice(c, 1), c--; - } - return n; - })), - typeof t.formatArgs === "function" && (a = t.formatArgs.apply(e, a)), - (o.log || t.log || console.log.bind(console)).apply(e, a); - } - (i.enabled = !1), (o.enabled = !0); - const s = t.enabled(e) ? o : i; - return (s.namespace = e), s; - }).coerce = function (e) { - return e instanceof Error ? e.stack || e.message : e; - }), - (t.disable = function () { - t.enable(""); - }), - (t.enable = function (e) { - t.save(e); - for (let n = (e || "").split(/[\s,]+/), r = n.length, i = 0; i < r; i++) - n[i] && - ((e = n[i].replace(/\*/g, ".*?"))[0] === "-" - ? t.skips.push(new RegExp(`^${e.substr(1)}$`)) - : t.names.push(new RegExp(`^${e}$`))); - }), - (t.enabled = function (e) { - let n; - let r; - for (n = 0, r = t.skips.length; n < r; n++) - if (t.skips[n].test(e)) return !1; - for (n = 0, r = t.names.length; n < r; n++) - if (t.names[n].test(e)) return !0; - return !1; - }), - (t.humanize = pt), - (t.names = []), - (t.skips = []), - (t.formatters = {}); - let n; - var r = 0; - }); - const gt = - (ft.coerce, - ft.disable, - ft.enable, - ft.enabled, - ft.humanize, - ft.names, - ft.skips, - ft.formatters, - l(function (e, t) { - function n() { - let e; - try { - e = t.storage.debug; - } catch (e) {} - return e; - } - ((t = e.exports = ft).log = function () { - return ( - typeof console === "object" && - console.log && - Function.prototype.apply.call(console.log, console, arguments) - ); - }), - (t.formatArgs = function () { - let e = arguments; - const n = this.useColors; - if ( - ((e[0] = `${ - (n ? "%c" : "") + - this.namespace + - (n ? " %c" : " ") + - e[0] + - (n ? "%c " : " ") - }+${t.humanize(this.diff)}`), - !n) - ) - return e; - const r = `color: ${this.color}`; - e = [e[0], r, "color: inherit"].concat( - Array.prototype.slice.call(e, 1) - ); - let i = 0; - let o = 0; - return ( - e[0].replace(/%[a-z%]/g, function (e) { - e !== "%%" && (i++, e === "%c" && (o = i)); - }), - e.splice(o, 0, r), - e - ); - }), - (t.save = function (e) { - try { - e == null ? t.storage.removeItem("debug") : (t.storage.debug = e); - } catch (e) {} - }), - (t.load = n), - (t.useColors = function () { - return ( - "WebkitAppearance" in document.documentElement.style || - (window.console && - (console.firebug || (console.exception && console.table))) || - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && - parseInt(RegExp.$1, 10) >= 31) - ); - }), - (t.storage = - typeof chrome !== "undefined" && 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()); - })); - const mt = - (gt.log, - gt.formatArgs, - gt.save, - gt.load, - gt.useColors, - gt.storage, - gt.colors, - gt("cookie")); - const yt = function (e, t, n) { - switch (arguments.length) { - case 3: - case 2: - return vt(e, t, n); - case 1: - return wt(e); - default: - return bt(); - } - }; - function vt(e, t, n) { - n = n || {}; - let r = `${kt(e)}=${kt(t)}`; - t == null && (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 bt() { - let e; - try { - e = document.cookie; - } catch (e) { - return ( - typeof console !== "undefined" && - typeof console.error === "function" && - console.error(e.stack || e), - {} - ); - } - return (function (e) { - let t; - const n = {}; - const r = e.split(/ *; */); - if (r[0] == "") return n; - for (let i = 0; i < r.length; ++i) - (t = r[i].split("=")), (n[Et(t[0])] = Et(t[1])); - return n; - })(e); - } - function wt(e) { - return bt()[e]; - } - function kt(e) { - try { - return encodeURIComponent(e); - } catch (t) { - mt("error `encode(%o)` - %o", e, t); - } - } - function Et(e) { - try { - return decodeURIComponent(e); - } catch (t) { - mt("error `decode(%o)` - %o", e, t); - } - } - const It = l(function (e, t) { - (function () { - const n = { function: !0, object: !0 }; - const r = t && !t.nodeType && t; - let i = (n[typeof window] && window) || this; - const o = r && n.object && e && !e.nodeType && typeof u === "object" && u; - function s(e, t) { - e || (e = i.Object()), t || (t = i.Object()); - const r = e.Number || i.Number; - const o = e.String || i.String; - const a = e.Object || i.Object; - const c = e.Date || i.Date; - const u = e.SyntaxError || i.SyntaxError; - const l = e.TypeError || i.TypeError; - const d = e.Math || i.Math; - const p = e.JSON || i.JSON; - typeof p === "object" && - p && - ((t.stringify = p.stringify), (t.parse = p.parse)); - let h; - const f = a.prototype; - const g = f.toString; - const m = f.hasOwnProperty; - function y(e, t) { - try { - e(); - } catch (e) { - t && t(); - } - } - let v = new c(-0xc782b5b800cec); - function b(e) { - if (b[e] != null) return b[e]; - let n; - if (e == "bug-string-char-index") n = "a"[0] != "a"; - else if (e == "json") - n = - b("json-stringify") && b("date-serialization") && b("json-parse"); - else if (e == "date-serialization") { - if ((n = b("json-stringify") && v)) { - var i = t.stringify; - y(function () { - n = - i(new c(-864e13)) == '"-271821-04-20T00:00:00.000Z"' && - i(new c(864e13)) == '"+275760-09-13T00:00:00.000Z"' && - i(new c(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && - i(new c(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - let s; - const a = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; - if (e == "json-stringify") { - let u = typeof (i = t.stringify) === "function"; - u && - (((s = function () { - return 1; - }).toJSON = s), - y( - function () { - u = - i(0) === "0" && - i(new r()) === "0" && - i(new o()) == '""' && - i(g) === h && - i(h) === h && - i() === h && - i(s) === "1" && - i([s]) == "[1]" && - i([h]) == "[null]" && - i(null) == "null" && - i([h, g, null]) == "[null,null,null]" && - i({ a: [s, !0, !1, null, "\0\b\n\f\r\t"] }) == a && - i(null, s) === "1" && - i([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, - function () { - u = !1; - } - )), - (n = u); - } - if (e == "json-parse") { - let l; - const d = t.parse; - typeof d === "function" && - y( - function () { - d("0") !== 0 || - d(!1) || - ((s = d(a)), - (l = s.a.length == 5 && s.a[0] === 1) && - (y(function () { - l = !d('"\t"'); - }), - l && - y(function () { - l = d("01") !== 1; - }), - l && - y(function () { - l = d("1.") !== 1; - }))); - }, - function () { - l = !1; - } - ), - (n = l); - } - } - return (b[e] = !!n); - } - if ( - (y(function () { - v = - v.getUTCFullYear() == -109252 && - v.getUTCMonth() === 0 && - v.getUTCDate() === 1 && - v.getUTCHours() == 10 && - v.getUTCMinutes() == 37 && - v.getUTCSeconds() == 6 && - v.getUTCMilliseconds() == 708; - }), - (b["bug-string-char-index"] = b["date-serialization"] = b.json = b[ - "json-stringify" - ] = b["json-parse"] = null), - !b("json")) - ) { - const w = b("bug-string-char-index"); - var k = function (e, t) { - let r; - let i; - let o; - let s = 0; - for (o in (((r = function () { - this.valueOf = 0; - }).prototype.valueOf = 0), - (i = new r()))) - m.call(i, o) && s++; - return ( - (r = i = null), - s - ? (k = function (e, t) { - let n; - let r; - const i = g.call(e) == "[object Function]"; - for (n in e) - (i && n == "prototype") || - !m.call(e, n) || - (r = n === "constructor") || - t(n); - (r || m.call(e, (n = "constructor"))) && t(n); - }) - : ((i = [ - "valueOf", - "toString", - "toLocaleString", - "propertyIsEnumerable", - "isPrototypeOf", - "hasOwnProperty", - "constructor", - ]), - (k = function (e, t) { - let r; - let o; - const s = g.call(e) == "[object Function]"; - const a = - (!s && - typeof e.constructor !== "function" && - n[typeof e.hasOwnProperty] && - e.hasOwnProperty) || - m; - for (r in e) - (s && r == "prototype") || !a.call(e, r) || t(r); - for (o = i.length; (r = i[--o]); ) a.call(e, r) && t(r); - })), - k(e, t) - ); - }; - if (!b("json-stringify") && !b("date-serialization")) { - const E = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t", - }; - const I = function (e, t) { - return `000000${t || 0}`.slice(-e); - }; - var _ = function (e) { - let t; - let n; - let r; - let i; - let o; - let s; - let a; - let c; - let u; - if (v) - t = function (e) { - (n = e.getUTCFullYear()), - (r = e.getUTCMonth()), - (i = e.getUTCDate()), - (s = e.getUTCHours()), - (a = e.getUTCMinutes()), - (c = e.getUTCSeconds()), - (u = e.getUTCMilliseconds()); - }; - else { - const l = d.floor; - const p = [ - 0, - 31, - 59, - 90, - 120, - 151, - 181, - 212, - 243, - 273, - 304, - 334, - ]; - const h = function (e, t) { - return ( - p[t] + - 365 * (e - 1970) + - l((e - 1969 + (t = +(t > 1))) / 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; - h(n + 1, 0) <= i; - n++ - ); - for (r = l((i - h(n, 0)) / 30.42); h(n, r + 1) <= i; r++); - (i = 1 + i - h(n, r)), - (s = l((o = ((e % 864e5) + 864e5) % 864e5) / 36e5) % 24), - (a = l(o / 6e4) % 60), - (c = l(o / 1e3) % 60), - (u = o % 1e3); - }; - } - return (_ = function (e) { - return ( - e > -1 / 0 && e < 1 / 0 - ? (t(e), - (e = `${ - n <= 0 || n >= 1e4 - ? (n < 0 ? "-" : "+") + I(6, n < 0 ? -n : n) - : I(4, n) - }-${I(2, r + 1)}-${I(2, i)}T${I(2, s)}:${I(2, a)}:${I( - 2, - c - )}.${I(3, u)}Z`), - (n = r = i = s = a = c = u = null)) - : (e = null), - e - ); - })(e); - }; - if (b("json-stringify") && !b("date-serialization")) { - function A(e) { - return _(this); - } - const C = t.stringify; - t.stringify = function (e, t, n) { - const r = c.prototype.toJSON; - c.prototype.toJSON = A; - const i = C(e, t, n); - return (c.prototype.toJSON = r), i; - }; - } else { - const T = function (e) { - const t = e.charCodeAt(0); - const n = E[t]; - return n || `\\u00${I(2, t.toString(16))}`; - }; - const O = /[\x00-\x1f\x22\x5c]/g; - const P = function (e) { - return ( - (O.lastIndex = 0), `"${O.test(e) ? e.replace(O, T) : e}"` - ); - }; - var S = function (e, t, n, r, i, o, s) { - let a; - let u; - let d; - let p; - let f; - let m; - let v; - let b; - let w; - if ( - (y(function () { - a = t[e]; - }), - typeof a === "object" && - a && - (a.getUTCFullYear && - g.call(a) == "[object Date]" && - a.toJSON === c.prototype.toJSON - ? (a = _(a)) - : typeof a.toJSON === "function" && (a = a.toJSON(e))), - n && (a = n.call(t, e, a)), - a == h) - ) - return a === h ? a : "null"; - switch ( - ((u = typeof a) == "object" && (d = g.call(a)), d || u) - ) { - 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 P(`${a}`); - } - if (typeof a === "object") { - for (v = s.length; v--; ) if (s[v] === a) throw l(); - if ( - (s.push(a), - (p = []), - (b = o), - (o += i), - d == "[object Array]") - ) { - for (m = 0, v = a.length; m < v; m++) - (f = S(m, a, n, r, i, o, s)), - p.push(f === h ? "null" : f); - w = p.length - ? i - ? `[\n${o}${p.join(`,\n${o}`)}\n${b}]` - : `[${p.join(",")}]` - : "[]"; - } else - k(r || a, function (e) { - const t = S(e, a, n, r, i, o, s); - t !== h && p.push(`${P(e)}:${i ? " " : ""}${t}`); - }), - (w = p.length - ? i - ? `{\n${o}${p.join(`,\n${o}`)}\n${b}}` - : `{${p.join(",")}}` - : "{}"); - return s.pop(), w; - } - }; - t.stringify = function (e, t, r) { - let i; - let o; - let s; - let a; - if (n[typeof t] && t) - if ((a = g.call(t)) == "[object Function]") o = t; - else if (a == "[object Array]") { - s = {}; - for (var c, u = 0, l = t.length; u < l; ) - (c = t[u++]), - ((a = g.call(c)) != "[object String]" && - a != "[object Number]") || - (s[c] = 1); - } - if (r) - if ((a = g.call(r)) == "[object Number]") { - if ((r -= r % 1) > 0) - for (r > 10 && (r = 10), i = ""; i.length < r; ) i += " "; - } else - a == "[object String]" && - (i = r.length <= 10 ? r : r.slice(0, 10)); - return S("", (((c = {})[""] = e), c), o, s, i, "", []); - }; - } - } - if (!b("json-parse")) { - let x; - let R; - const j = o.fromCharCode; - const L = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r", - }; - const D = function () { - throw ((x = R = null), u()); - }; - const M = function () { - for (var e, t, n, r, i, o = R, s = o.length; x < s; ) - switch ((i = o.charCodeAt(x))) { - case 9: - case 10: - case 13: - case 32: - x++; - break; - case 123: - case 125: - case 91: - case 93: - case 58: - case 44: - return (e = w ? o.charAt(x) : o[x]), x++, e; - case 34: - for (e = "@", x++; x < s; ) - if ((i = o.charCodeAt(x)) < 32) D(); - else if (i == 92) - switch ((i = o.charCodeAt(++x))) { - case 92: - case 34: - case 47: - case 98: - case 116: - case 110: - case 102: - case 114: - (e += L[i]), x++; - break; - case 117: - for (t = ++x, n = x + 4; x < n; x++) - ((i = o.charCodeAt(x)) >= 48 && i <= 57) || - (i >= 97 && i <= 102) || - (i >= 65 && i <= 70) || - D(); - e += j(`0x${o.slice(t, x)}`); - break; - default: - D(); - } - else { - if (i == 34) break; - for ( - i = o.charCodeAt(x), t = x; - i >= 32 && i != 92 && i != 34; - - ) - i = o.charCodeAt(++x); - e += o.slice(t, x); - } - if (o.charCodeAt(x) == 34) return x++, e; - D(); - default: - if ( - ((t = x), - i == 45 && ((r = !0), (i = o.charCodeAt(++x))), - i >= 48 && i <= 57) - ) { - for ( - i == 48 && - (i = o.charCodeAt(x + 1)) >= 48 && - i <= 57 && - D(), - r = !1; - x < s && (i = o.charCodeAt(x)) >= 48 && i <= 57; - x++ - ); - if (o.charCodeAt(x) == 46) { - for ( - n = ++x; - n < s && !((i = o.charCodeAt(n)) < 48 || i > 57); - n++ - ); - n == x && D(), (x = n); - } - if ((i = o.charCodeAt(x)) == 101 || i == 69) { - for ( - ((i = o.charCodeAt(++x)) != 43 && i != 45) || x++, - n = x; - n < s && !((i = o.charCodeAt(n)) < 48 || i > 57); - n++ - ); - n == x && D(), (x = n); - } - return +o.slice(t, x); - } - r && D(); - var a = o.slice(x, x + 4); - if (a == "true") return (x += 4), !0; - if (a == "fals" && o.charCodeAt(x + 4) == 101) - return (x += 5), !1; - if (a == "null") return (x += 4), null; - D(); - } - return "$"; - }; - var U = function (e) { - let t; - let n; - if ((e == "$" && D(), typeof e === "string")) { - if ((w ? e.charAt(0) : e[0]) == "@") return e.slice(1); - if (e == "[") { - for (t = []; (e = M()) != "]"; ) - n ? (e == "," ? (e = M()) == "]" && D() : D()) : (n = !0), - e == "," && D(), - t.push(U(e)); - return t; - } - if (e == "{") { - for (t = {}; (e = M()) != "}"; ) - n ? (e == "," ? (e = M()) == "}" && D() : D()) : (n = !0), - (e != "," && - typeof e === "string" && - (w ? e.charAt(0) : e[0]) == "@" && - M() == ":") || - D(), - (t[e.slice(1)] = U(M())); - return t; - } - D(); - } - return e; - }; - const N = function (e, t, n) { - const r = q(e, t, n); - r === h ? delete e[t] : (e[t] = r); - }; - var q = function (e, t, n) { - let r; - const i = e[t]; - if (typeof i === "object" && i) - if (g.call(i) == "[object Array]") - for (r = i.length; r--; ) N(g, k, i); - else - k(i, function (e) { - N(i, e, n); - }); - return n.call(e, t, i); - }; - t.parse = function (e, t) { - let n; - let r; - return ( - (x = 0), - (R = `${e}`), - (n = U(M())), - M() != "$" && D(), - (x = R = null), - t && g.call(t) == "[object Function]" - ? q((((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 { - let a = i.JSON; - let c = i.JSON3; - let l = !1; - var d = s( - i, - (i.JSON3 = { - noConflict() { - return ( - l || ((l = !0), (i.JSON = a), (i.JSON3 = c), (a = c = null)), d - ); - }, - }) - ); - i.JSON = { parse: d.parse, stringify: d.stringify }; - } - }.call(u)); - }); - const _t = l(function (e, t) { - function n(e) { - switch (e) { - case "http:": - return 80; - case "https:": - return 443; - default: - return location.port; - } - } - (t.parse = function (e) { - const t = document.createElement("a"); - return ( - (t.href = e), - { - href: t.href, - host: t.host || location.host, - port: t.port === "0" || 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 e.indexOf("//") == 0 || !!~e.indexOf("://"); - }), - (t.isRelative = function (e) { - return !t.isAbsolute(e); - }), - (t.isCrossDomain = function (e) { - e = t.parse(e); - const n = t.parse(window.location.href); - return ( - e.hostname !== n.hostname || - e.port !== n.port || - e.protocol !== n.protocol - ); - }); - }); - const At = (_t.parse, _t.isAbsolute, _t.isRelative, _t.isCrossDomain, 1e3); - const Ct = 60 * At; - const Tt = 60 * Ct; - const Ot = 24 * Tt; - const Pt = 365.25 * Ot; - const St = function (e, t) { - return ( - (t = t || {}), - typeof e === "string" - ? (function (e) { - if ((e = `${e}`).length > 1e4) return; - const 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; - const n = parseFloat(t[1]); - switch ((t[2] || "ms").toLowerCase()) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return n * Pt; - case "days": - case "day": - case "d": - return n * Ot; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return n * Tt; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return n * Ct; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * At; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - } - })(e) - : t.long - ? (function (e) { - return ( - xt(e, Ot, "day") || - xt(e, Tt, "hour") || - xt(e, Ct, "minute") || - xt(e, At, "second") || - `${e} ms` - ); - })(e) - : (function (e) { - return e >= Ot - ? `${Math.round(e / Ot)}d` - : e >= Tt - ? `${Math.round(e / Tt)}h` - : e >= Ct - ? `${Math.round(e / Ct)}m` - : e >= At - ? `${Math.round(e / At)}s` - : `${e}ms`; - })(e) - ); - }; - function xt(e, t, n) { - if (!(e < t)) - return e < 1.5 * t - ? `${Math.floor(e / t)} ${n}` - : `${Math.ceil(e / t)} ${n}s`; - } - const Rt = l(function (e, t) { - ((t = e.exports = function (e) { - function i() {} - function o() { - const e = o; - const i = +new Date(); - const s = i - (n || i); - (e.diff = s), - (e.prev = n), - (e.curr = i), - (n = i), - e.useColors == null && (e.useColors = t.useColors()), - e.color == null && - e.useColors && - (e.color = t.colors[r++ % t.colors.length]); - let a = Array.prototype.slice.call(arguments); - (a[0] = t.coerce(a[0])), - typeof a[0] !== "string" && (a = ["%o"].concat(a)); - let c = 0; - (a[0] = a[0].replace(/%([a-z%])/g, function (n, r) { - if (n === "%%") return n; - c++; - const i = t.formatters[r]; - if (typeof i === "function") { - const o = a[c]; - (n = i.call(e, o)), a.splice(c, 1), c--; - } - return n; - })), - typeof t.formatArgs === "function" && (a = t.formatArgs.apply(e, a)), - (o.log || t.log || console.log.bind(console)).apply(e, a); - } - (i.enabled = !1), (o.enabled = !0); - const s = t.enabled(e) ? o : i; - return (s.namespace = e), s; - }).coerce = function (e) { - return e instanceof Error ? e.stack || e.message : e; - }), - (t.disable = function () { - t.enable(""); - }), - (t.enable = function (e) { - t.save(e); - for (let n = (e || "").split(/[\s,]+/), r = n.length, i = 0; i < r; i++) - n[i] && - ((e = n[i].replace(/\*/g, ".*?"))[0] === "-" - ? t.skips.push(new RegExp(`^${e.substr(1)}$`)) - : t.names.push(new RegExp(`^${e}$`))); - }), - (t.enabled = function (e) { - let n; - let r; - for (n = 0, r = t.skips.length; n < r; n++) - if (t.skips[n].test(e)) return !1; - for (n = 0, r = t.names.length; n < r; n++) - if (t.names[n].test(e)) return !0; - return !1; - }), - (t.humanize = St), - (t.names = []), - (t.skips = []), - (t.formatters = {}); - let n; - var r = 0; - }); - const jt = - (Rt.coerce, - Rt.disable, - Rt.enable, - Rt.enabled, - Rt.humanize, - Rt.names, - Rt.skips, - Rt.formatters, - l(function (e, t) { - function n() { - let e; - try { - e = t.storage.debug; - } catch (e) {} - return e; - } - ((t = e.exports = Rt).log = function () { - return ( - typeof console === "object" && - console.log && - Function.prototype.apply.call(console.log, console, arguments) - ); - }), - (t.formatArgs = function () { - let e = arguments; - const n = this.useColors; - if ( - ((e[0] = `${ - (n ? "%c" : "") + - this.namespace + - (n ? " %c" : " ") + - e[0] + - (n ? "%c " : " ") - }+${t.humanize(this.diff)}`), - !n) - ) - return e; - const r = `color: ${this.color}`; - e = [e[0], r, "color: inherit"].concat( - Array.prototype.slice.call(e, 1) - ); - let i = 0; - let o = 0; - return ( - e[0].replace(/%[a-z%]/g, function (e) { - e !== "%%" && (i++, e === "%c" && (o = i)); - }), - e.splice(o, 0, r), - e - ); - }), - (t.save = function (e) { - try { - e == null ? t.storage.removeItem("debug") : (t.storage.debug = e); - } catch (e) {} - }), - (t.load = n), - (t.useColors = function () { - return ( - "WebkitAppearance" in document.documentElement.style || - (window.console && - (console.firebug || (console.exception && console.table))) || - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && - parseInt(RegExp.$1, 10) >= 31) - ); - }), - (t.storage = - typeof chrome !== "undefined" && 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()); - })); - const Lt = - (jt.log, - jt.formatArgs, - jt.save, - jt.load, - jt.useColors, - jt.storage, - jt.colors, - jt("cookie")); - const Dt = function (e, t, n) { - switch (arguments.length) { - case 3: - case 2: - return Mt(e, t, n); - case 1: - return Nt(e); - default: - return Ut(); - } - }; - function Mt(e, t, n) { - n = n || {}; - let r = `${qt(e)}=${qt(t)}`; - t == null && (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"), - (document.cookie = r); - } - function Ut() { - let e; - try { - e = document.cookie; - } catch (e) { - return ( - typeof console !== "undefined" && - typeof console.error === "function" && - console.error(e.stack || e), - {} - ); - } - return (function (e) { - let t; - const n = {}; - const r = e.split(/ *; */); - if (r[0] == "") return n; - for (let i = 0; i < r.length; ++i) - (t = r[i].split("=")), (n[Bt(t[0])] = Bt(t[1])); - return n; - })(e); - } - function Nt(e) { - return Ut()[e]; - } - function qt(e) { - try { - return encodeURIComponent(e); - } catch (t) { - Lt("error `encode(%o)` - %o", e, t); - } - } - function Bt(e) { - try { - return decodeURIComponent(e); - } catch (t) { - Lt("error `decode(%o)` - %o", e, t); - } - } - for ( - var Ft = l(function (e, t) { - const n = _t.parse; - function r(e) { - for (let n = t.cookie, r = t.levels(e), i = 0; i < r.length; ++i) { - const o = r[i]; - const s = { domain: `.${o}` }; - if ((n("__tld__", 1, s), n("__tld__"))) - return n("__tld__", null, s), o; - } - return ""; - } - (r.levels = function (e) { - const t = n(e).hostname.split("."); - const r = t[t.length - 1]; - const i = []; - if (t.length === 4 && r === parseInt(r, 10)) return i; - if (t.length <= 1) return i; - for (let o = t.length - 2; o >= 0; --o) i.push(t.slice(o).join(".")); - return i; - }), - (r.cookie = Dt), - (t = e.exports = r); - }), - Gt = new ((function () { - function e(t) { - n(this, e), (this._options = {}), this.options(t); - } - return ( - i(e, [ - { - key: "options", - value() { - const e = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : {}; - if (arguments.length === 0) return this._options; - let t = `.${Ft(window.location.href)}`; - t === "." && (t = null), - (this._options = ve(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(e, t) { - try { - return (t = It.stringify(t)), yt(e, t, st(this._options)), !0; - } catch (e) { - return !1; - } - }, - }, - { - key: "get", - value(e) { - let t; - try { - return (t = (t = yt(e)) ? It.parse(t) : null); - } catch (e) { - return t || null; - } - }, - }, - { - key: "remove", - value(e) { - try { - return yt(e, null, st(this._options)), !0; - } catch (e) { - return !1; - } - }, - }, - ]), - e - ); - })())({}), - Kt = (function () { - let e; - const t = {}; - const n = typeof window !== "undefined" ? window : u; - const r = n.document; - const 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) { - r == null && ((r = n), (n = null)), n == null && (n = {}); - const i = t.get(e, n); - r(i), t.set(e, i); - }), - (t.getAll = function () { - const 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 (typeof e === "string") - 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) { - const 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 (let r = 0; r < e.length; r++) { - const i = e.key(r); - n(i, t.get(i)); - } - }); - else if (r && r.documentElement.addBehavior) { - let o; - let s; - try { - (s = new ActiveXObject("htmlfile")).open(), - s.write( - '' - ), - s.close(), - (o = s.w.frames[0].document), - (e = o.createElement("div")); - } catch (t) { - (e = r.createElement("div")), (o = r.body); - } - const a = function (n) { - return function () { - const r = Array.prototype.slice.call(arguments, 0); - r.unshift(e), - o.appendChild(e), - e.addBehavior("#default#userData"), - e.load(i); - const s = n.apply(t, r); - return o.removeChild(e), s; - }; - }; - const c = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g"); - const l = function (e) { - return e.replace(/^d/, "___$&").replace(c, "___"); - }; - (t.set = a(function (e, n, r) { - return ( - (n = l(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 = l(n); - const i = t.deserialize(e.getAttribute(n)); - return void 0 === i ? r : i; - })), - (t.remove = a(function (e, t) { - (t = l(t)), e.removeAttribute(t), e.save(i); - })), - (t.clear = a(function (e) { - const t = e.XMLDocument.documentElement.attributes; - e.load(i); - for (let 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 { - const d = "__storejs__"; - t.set(d, d), t.get(d) != d && (t.disabled = !0), t.remove(d); - } catch (e) { - t.disabled = !0; - } - return (t.enabled = !t.disabled), t; - })(), - Vt = new ((function () { - function e(t) { - n(this, e), - (this._options = {}), - (this.enabled = !1), - this.options(t); - } - return ( - i(e, [ - { - key: "options", - value() { - const e = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : {}; - if (arguments.length === 0) return this._options; - ve(e, { enabled: !0 }), - (this.enabled = e.enabled && Kt.enabled), - (this._options = e); - }, - }, - { - key: "set", - value(e, t) { - return !!this.enabled && Kt.set(e, t); - }, - }, - { - key: "get", - value(e) { - return this.enabled ? Kt.get(e) : null; - }, - }, - { - key: "remove", - value(e) { - return !!this.enabled && Kt.remove(e); - }, - }, - ]), - e - ); - })())({}), - Ht = "rl_user_id", - zt = "rl_trait", - Jt = "rl_anonymous_id", - Wt = "rl_group_id", - $t = "rl_group_trait", - Yt = new ((function () { - function e() { - if ( - (n(this, e), Gt.set("rudder_cookies", !0), Gt.get("rudder_cookies")) - ) - return Gt.remove("rudder_cookies"), void (this.storage = Gt); - Vt.enabled && (this.storage = Vt); - } - return ( - i(e, [ - { - key: "setItem", - value(e, t) { - this.storage.set(e, t); - }, - }, - { - key: "setUserId", - value(e) { - typeof e === "string" - ? this.storage.set(Ht, e) - : g.error("[Storage] setUserId:: userId should be string"); - }, - }, - { - key: "setUserTraits", - value(e) { - this.storage.set(zt, e); - }, - }, - { - key: "setGroupId", - value(e) { - typeof e === "string" - ? this.storage.set(Wt, e) - : g.error("[Storage] setGroupId:: groupId should be string"); - }, - }, - { - key: "setGroupTraits", - value(e) { - this.storage.set($t, e); - }, - }, - { - key: "setAnonymousId", - value(e) { - typeof e === "string" - ? this.storage.set(Jt, e) - : g.error( - "[Storage] setAnonymousId:: anonymousId should be string" - ); - }, - }, - { - key: "getItem", - value(e) { - return this.storage.get(e); - }, - }, - { - key: "getUserId", - value() { - return this.storage.get(Ht); - }, - }, - { - key: "getUserTraits", - value() { - return this.storage.get(zt); - }, - }, - { - key: "getGroupId", - value() { - return this.storage.get(Wt); - }, - }, - { - key: "getGroupTraits", - value() { - return this.storage.get($t); - }, - }, - { - key: "getAnonymousId", - value() { - return this.storage.get(Jt); - }, - }, - { - key: "removeItem", - value(e) { - return this.storage.remove(e); - }, - }, - { - key: "clear", - value() { - this.storage.remove(Ht), this.storage.remove(zt); - }, - }, - ]), - e - ); - })())(), - Qt = "lt_synch_timestamp", - Zt = new ((function () { - function e() { - n(this, e), (this.storage = Yt); - } - return ( - i(e, [ - { - key: "setLotameSynchTime", - value(e) { - this.storage.setItem(Qt, e); - }, - }, - { - key: "getLotameSynchTime", - value() { - return this.storage.getItem(Qt); - }, - }, - ]), - e - ); - })())(), - Xt = { - HS: U, - GA: we, - HOTJAR: ke, - GOOGLEADS: Ee, - VWO: Ie, - GTM: _e, - BRAZE: Ae, - INTERCOM: Re, - KEEN: je, - KISSMETRICS: Ue, - CUSTOMERIO: Ne, - CHARTBEAT: Ke, - COMSCORE: Ve, - FACEBOOK_PIXEL: it, - LOTAME: (function () { - function e(t, r) { - const i = this; - n(this, e), - (this.name = "LOTAME"), - (this.analytics = r), - (this.storage = Zt), - (this.bcpUrlSettingsPixel = t.bcpUrlSettingsPixel), - (this.bcpUrlSettingsIframe = t.bcpUrlSettingsIframe), - (this.dspUrlSettingsPixel = t.dspUrlSettingsPixel), - (this.dspUrlSettingsIframe = t.dspUrlSettingsIframe), - (this.mappings = {}), - t.mappings.forEach(function (e) { - const t = e.key; - const n = e.value; - i.mappings[t] = n; - }); - } - return ( - i(e, [ - { - key: "init", - value() { - g.debug("===in init Lotame==="), - (window.LOTAME_SYNCH_CALLBACK = function () {}); - }, - }, - { - key: "addPixel", - value(e, t, n) { - g.debug(`Adding pixel for :: ${e}`); - const r = document.createElement("img"); - (r.src = e), - r.setAttribute("width", t), - r.setAttribute("height", n), - g.debug(`Image Pixel :: ${r}`), - document.getElementsByTagName("body")[0].appendChild(r); - }, - }, - { - key: "addIFrame", - value(e) { - g.debug(`Adding iframe for :: ${e}`); - const t = document.createElement("iframe"); - (t.src = e), - (t.title = "empty"), - t.setAttribute("id", "LOTCCFrame"), - t.setAttribute("tabindex", "-1"), - t.setAttribute("role", "presentation"), - t.setAttribute("aria-hidden", "true"), - t.setAttribute( - "style", - "border: 0px; width: 0px; height: 0px; display: block;" - ), - g.debug(`IFrame :: ${t}`), - document.getElementsByTagName("body")[0].appendChild(t); - }, - }, - { - key: "syncPixel", - value(e) { - const t = this; - if ( - (g.debug("===== in syncPixel ======"), - g.debug("Firing DSP Pixel URLs"), - this.dspUrlSettingsPixel && - this.dspUrlSettingsPixel.length > 0) - ) { - const n = Date.now(); - this.dspUrlSettingsPixel.forEach(function (r) { - const i = t.compileUrl( - a({}, t.mappings, { userId: e, random: n }), - r.dspUrlTemplate - ); - t.addPixel(i, "1", "1"); - }); - } - if ( - (g.debug("Firing DSP IFrame URLs"), - this.dspUrlSettingsIframe && - this.dspUrlSettingsIframe.length > 0) - ) { - const r = Date.now(); - this.dspUrlSettingsIframe.forEach(function (n) { - const i = t.compileUrl( - a({}, t.mappings, { userId: e, random: r }), - n.dspUrlTemplate - ); - t.addIFrame(i); - }); - } - this.storage.setLotameSynchTime(Date.now()), - this.analytics.methodToCallbackMapping.syncPixel && - this.analytics.emit("syncPixel", { - destination: this.name, - }); - }, - }, - { - key: "compileUrl", - value(e, t) { - return ( - Object.keys(e).forEach(function (n) { - if (e.hasOwnProperty(n)) { - const r = new RegExp(`{{${n}}}`, "gi"); - t = t.replace(r, e[n]); - } - }), - t - ); - }, - }, - { - key: "identify", - value(e) { - g.debug("in Lotame identify"); - const t = e.message.userId; - this.syncPixel(t); - }, - }, - { - key: "track", - value(e) { - g.debug("track not supported for lotame"); - }, - }, - { - key: "page", - value(e) { - const t = this; - if ( - (g.debug("in Lotame page"), - g.debug("Firing BCP Pixel URLs"), - this.bcpUrlSettingsPixel && - this.bcpUrlSettingsPixel.length > 0) - ) { - const n = Date.now(); - this.bcpUrlSettingsPixel.forEach(function (e) { - const r = t.compileUrl( - a({}, t.mappings, { random: n }), - e.bcpUrlTemplate - ); - t.addPixel(r, "1", "1"); - }); - } - if ( - (g.debug("Firing BCP IFrame URLs"), - this.bcpUrlSettingsIframe && - this.bcpUrlSettingsIframe.length > 0) - ) { - const r = Date.now(); - this.bcpUrlSettingsIframe.forEach(function (e) { - const n = t.compileUrl( - a({}, t.mappings, { random: r }), - e.bcpUrlTemplate - ); - t.addIFrame(n); - }); - } - e.message.userId && - this.isPixelToBeSynched() && - this.syncPixel(e.message.userId); - }, - }, - { - key: "isPixelToBeSynched", - value() { - const e = this.storage.getLotameSynchTime(); - const t = Date.now(); - return !e || Math.floor((t - e) / 864e5) >= 7; - }, - }, - { - key: "isLoaded", - value() { - return g.debug("in Lotame isLoaded"), !0; - }, - }, - { - key: "isReady", - value() { - return !0; - }, - }, - ]), - e - ); - })(), - }, - en = function e() { - n(this, e), - (this.build = "1.0.0"), - (this.name = "RudderLabs JavaScript SDK"), - (this.namespace = "com.rudderlabs.javascript"), - (this.version = "1.1.2"); - }, - tn = function e() { - n(this, e), - (this.name = "RudderLabs JavaScript SDK"), - (this.version = "1.1.2"); - }, - nn = function e() { - n(this, e), (this.name = ""), (this.version = ""); - }, - rn = function e() { - n(this, e), (this.density = 0), (this.width = 0), (this.height = 0); - }, - on = function e() { - n(this, e), - (this.app = new en()), - (this.traits = null), - (this.library = new tn()); - const t = new nn(); - t.version = ""; - const r = new rn(); - (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); - }, - sn = (function () { - function e() { - n(this, e), - (this.channel = "web"), - (this.context = new on()), - (this.type = null), - (this.action = null), - (this.messageId = b().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(e) { - return this.properties[e]; - }, - }, - { - key: "addProperty", - value(e, t) { - this.properties[e] = t; - }, - }, - { - key: "validateFor", - value(e) { - if (!this.properties) - throw new Error("Key properties is required"); - switch (e) { - case x.TRACK: - if (!this.event) - throw new Error("Key event is required for track event"); - if ((this.event in Object.values(R))) - switch (this.event) { - case R.CHECKOUT_STEP_VIEWED: - case R.CHECKOUT_STEP_COMPLETED: - case R.PAYMENT_INFO_ENTERED: - this.checkForKey("checkout_id"), - this.checkForKey("step"); - break; - case R.PROMOTION_VIEWED: - case R.PROMOTION_CLICKED: - this.checkForKey("promotion_id"); - break; - case R.ORDER_REFUNDED: - this.checkForKey("order_id"); - } - else - this.properties.category || - (this.properties.category = this.event); - break; - case x.PAGE: - break; - case x.SCREEN: - if (!this.properties.name) - throw new Error("Key 'name' is required in properties"); - } - }, - }, - { - key: "checkForKey", - value(e) { - if (!this.properties[e]) - throw new Error(`Key '${e}' is required in properties`); - }, - }, - ]), - e - ); - })(), - an = (function () { - function e() { - n(this, e), (this.message = new sn()); - } - return ( - i(e, [ - { - key: "setType", - value(e) { - this.message.type = e; - }, - }, - { - key: "setProperty", - value(e) { - this.message.properties = e; - }, - }, - { - key: "setUserProperty", - value(e) { - this.message.user_properties = e; - }, - }, - { - key: "setUserId", - value(e) { - this.message.userId = e; - }, - }, - { - key: "setEventName", - value(e) { - this.message.event = e; - }, - }, - { - key: "updateTraits", - value(e) { - this.message.context.traits = e; - }, - }, - { - key: "getElementContent", - value() { - return this.message; - }, - }, - ]), - e - ); - })(), - cn = (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(e) { - return (this.rudderProperty = e), this; - }, - }, - { - key: "setPropertyBuilder", - value(e) { - return (this.rudderProperty = e.build()), this; - }, - }, - { - key: "setUserProperty", - value(e) { - return (this.rudderUserProperty = e), this; - }, - }, - { - key: "setUserPropertyBuilder", - value(e) { - return (this.rudderUserProperty = e.build()), this; - }, - }, - { - key: "setEvent", - value(e) { - return (this.event = e), this; - }, - }, - { - key: "setUserId", - value(e) { - return (this.userId = e), this; - }, - }, - { - key: "setChannel", - value(e) { - return (this.channel = e), this; - }, - }, - { - key: "setType", - value(e) { - return (this.type = e), this; - }, - }, - { - key: "build", - value() { - const e = new an(); - return ( - e.setUserId(this.userId), - e.setType(this.type), - e.setEventName(this.event), - e.setProperty(this.rudderProperty), - e.setUserProperty(this.rudderUserProperty), - e - ); - }, - }, - ]), - e - ); - })(), - un = function e() { - n(this, e), (this.batch = null), (this.writeKey = null); - }, - ln = l(function (e) { - const t = - (typeof crypto !== "undefined" && - crypto.getRandomValues && - crypto.getRandomValues.bind(crypto)) || - (typeof msCrypto !== "undefined" && - typeof window.msCrypto.getRandomValues === "function" && - msCrypto.getRandomValues.bind(msCrypto)); - if (t) { - const n = new Uint8Array(16); - e.exports = function () { - return t(n), n; - }; - } else { - const r = new Array(16); - e.exports = function () { - for (var e, t = 0; t < 16; t++) - (3 & t) == 0 && (e = 4294967296 * Math.random()), - (r[t] = (e >>> ((3 & t) << 3)) & 255); - return r; - }; - } - }), - dn = [], - pn = 0; - pn < 256; - ++pn - ) - dn[pn] = (pn + 256).toString(16).substr(1); - let hn; - let fn; - const gn = function (e, t) { - let n = t || 0; - const r = dn; - 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(""); - }; - let mn = 0; - let yn = 0; - const vn = function (e, t, n) { - let r = (t && n) || 0; - const i = t || []; - let o = (e = e || {}).node || hn; - let s = void 0 !== e.clockseq ? e.clockseq : fn; - if (o == null || s == null) { - const a = ln(); - o == null && (o = hn = [1 | a[0], a[1], a[2], a[3], a[4], a[5]]), - s == null && (s = fn = 16383 & ((a[6] << 8) | a[7])); - } - let c = void 0 !== e.msecs ? e.msecs : new Date().getTime(); - let u = void 0 !== e.nsecs ? e.nsecs : yn + 1; - const l = c - mn + (u - yn) / 1e4; - if ( - (l < 0 && void 0 === e.clockseq && (s = (s + 1) & 16383), - (l < 0 || c > mn) && void 0 === e.nsecs && (u = 0), - u >= 1e4) - ) - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - (mn = c), (yn = u), (fn = s); - const d = (1e4 * (268435455 & (c += 122192928e5)) + u) % 4294967296; - (i[r++] = (d >>> 24) & 255), - (i[r++] = (d >>> 16) & 255), - (i[r++] = (d >>> 8) & 255), - (i[r++] = 255 & d); - const p = ((c / 4294967296) * 1e4) & 268435455; - (i[r++] = (p >>> 8) & 255), - (i[r++] = 255 & p), - (i[r++] = ((p >>> 24) & 15) | 16), - (i[r++] = (p >>> 16) & 255), - (i[r++] = (s >>> 8) | 128), - (i[r++] = 255 & s); - for (let h = 0; h < 6; ++h) i[r + h] = o[h]; - return t || gn(i); - }; - const bn = function (e, t, n) { - const r = (t && n) || 0; - typeof e === "string" && - ((t = e === "binary" ? new Array(16) : null), (e = null)); - const i = (e = e || {}).random || (e.rng || ln)(); - if (((i[6] = (15 & i[6]) | 64), (i[8] = (63 & i[8]) | 128), t)) - for (let o = 0; o < 16; ++o) t[r + o] = i[o]; - return t || gn(i); - }; - const wn = bn; - (wn.v1 = vn), (wn.v4 = bn); - const kn = wn; - const En = kn.v4; - const In = { - _data: {}, - length: 0, - setItem(e, t) { - return (this._data[e] = t), (this.length = Qe(this._data).length), t; - }, - getItem(e) { - return e in this._data ? this._data[e] : null; - }, - removeItem(e) { - return ( - e in this._data && delete this._data[e], - (this.length = Qe(this._data).length), - null - ); - }, - clear() { - (this._data = {}), (this.length = 0); - }, - key(e) { - return Qe(this._data)[e]; - }, - }; - const _n = { - defaultEngine: (function () { - try { - if (!window.localStorage) return !1; - const e = En(); - window.localStorage.setItem(e, "test_value"); - const t = window.localStorage.getItem(e); - return window.localStorage.removeItem(e), t === "test_value"; - } catch (e) { - return !1; - } - })() - ? window.localStorage - : In, - inMemoryEngine: In, - }; - const An = _n.defaultEngine; - const Cn = _n.inMemoryEngine; - function Tn(e, t, n, r) { - (this.id = t), - (this.name = e), - (this.keys = n || {}), - (this.engine = r || An); - } - (Tn.prototype.set = function (e, t) { - const n = this._createValidKey(e); - if (n) - try { - this.engine.setItem(n, It.stringify(t)); - } catch (n) { - (function (e) { - let t = !1; - if (e.code) - switch (e.code) { - case 22: - t = !0; - break; - case 1014: - e.name === "NS_ERROR_DOM_QUOTA_REACHED" && (t = !0); - } - else e.number === -2147024882 && (t = !0); - return t; - })(n) && (this._swapEngine(), this.set(e, t)); - } - }), - (Tn.prototype.get = function (e) { - try { - const t = this.engine.getItem(this._createValidKey(e)); - return t === null ? null : It.parse(t); - } catch (e) { - return null; - } - }), - (Tn.prototype.remove = function (e) { - this.engine.removeItem(this._createValidKey(e)); - }), - (Tn.prototype._createValidKey = function (e) { - let t; - const n = this.name; - const r = this.id; - return Qe(this.keys).length - ? (rt(function (i) { - i === e && (t = [n, r, e].join(".")); - }, this.keys), - t) - : [n, r, e].join("."); - }), - (Tn.prototype._swapEngine = function () { - const e = this; - rt(function (t) { - const n = e.get(t); - Cn.setItem([e.name, e.id, t].join("."), n), e.remove(t); - }, this.keys), - (this.engine = Cn); - }); - const On = Tn; - const Pn = { - setTimeout(e, t) { - return window.setTimeout(e, t); - }, - clearTimeout(e) { - return window.clearTimeout(e); - }, - Date: window.Date, - }; - let Sn = Pn; - function xn() { - (this.tasks = {}), (this.nextId = 1); - } - (xn.prototype.now = function () { - return +new Sn.Date(); - }), - (xn.prototype.run = function (e, t) { - const n = this.nextId++; - return (this.tasks[n] = Sn.setTimeout(this._handle(n, e), t)), n; - }), - (xn.prototype.cancel = function (e) { - this.tasks[e] && (Sn.clearTimeout(this.tasks[e]), delete this.tasks[e]); - }), - (xn.prototype.cancelAll = function () { - rt(Sn.clearTimeout, this.tasks), (this.tasks = {}); - }), - (xn.prototype._handle = function (e, t) { - const n = this; - return function () { - return delete n.tasks[e], t(); - }; - }), - (xn.setClock = function (e) { - Sn = e; - }), - (xn.resetClock = function () { - Sn = Pn; - }); - const Rn = xn; - const jn = Ln; - function Ln(e) { - return Ln.enabled(e) - ? function (t) { - t = Dn(t); - const n = new Date(); - const r = n - (Ln[e] || n); - (Ln[e] = n), - (t = `${e} ${t} +${Ln.humanize(r)}`), - window.console && - console.log && - Function.prototype.apply.call(console.log, console, arguments); - } - : function () {}; - } - function Dn(e) { - return e instanceof Error ? e.stack || e.message : e; - } - (Ln.names = []), - (Ln.skips = []), - (Ln.enable = function (e) { - try { - localStorage.debug = e; - } catch (e) {} - for (let t = (e || "").split(/[\s,]+/), n = t.length, r = 0; r < n; r++) - (e = t[r].replace("*", ".*?"))[0] === "-" - ? Ln.skips.push(new RegExp(`^${e.substr(1)}$`)) - : Ln.names.push(new RegExp(`^${e}$`)); - }), - (Ln.disable = function () { - Ln.enable(""); - }), - (Ln.humanize = function (e) { - return e >= 36e5 - ? `${(e / 36e5).toFixed(1)}h` - : e >= 6e4 - ? `${(e / 6e4).toFixed(1)}m` - : e >= 1e3 - ? `${(e / 1e3) | 0}s` - : `${e}ms`; - }), - (Ln.enabled = function (e) { - for (var t = 0, n = Ln.skips.length; t < n; t++) - if (Ln.skips[t].test(e)) return !1; - for (t = 0, n = Ln.names.length; t < n; t++) - if (Ln.names[t].test(e)) return !0; - return !1; - }); - try { - window.localStorage && Ln.enable(localStorage.debug); - } catch (e) {} - const Mn = kn.v4; - const Un = jn("localstorage-retry"); - function Nn(e, t) { - return function () { - return e.apply(t, arguments); - }; - } - function qn(e, t, n) { - typeof t === "function" && (n = t), - (this.name = e), - (this.id = Mn()), - (this.fn = n), - (this.maxItems = t.maxItems || 1 / 0), - (this.maxAttempts = t.maxAttempts || 1 / 0), - (this.backoff = { - MIN_RETRY_DELAY: t.minRetryDelay || 1e3, - MAX_RETRY_DELAY: t.maxRetryDelay || 3e4, - FACTOR: t.backoffFactor || 2, - JITTER: t.backoffJitter || 0, - }), - (this.timeouts = { - ACK_TIMER: 1e3, - RECLAIM_TIMER: 3e3, - RECLAIM_TIMEOUT: 1e4, - RECLAIM_WAIT: 500, - }), - (this.keys = { - IN_PROGRESS: "inProgress", - QUEUE: "queue", - ACK: "ack", - RECLAIM_START: "reclaimStart", - RECLAIM_END: "reclaimEnd", - }), - (this._schedule = new Rn()), - (this._processId = 0), - (this._store = new On(this.name, this.id, this.keys)), - this._store.set(this.keys.IN_PROGRESS, {}), - this._store.set(this.keys.QUEUE, []), - (this._ack = Nn(this._ack, this)), - (this._checkReclaim = Nn(this._checkReclaim, this)), - (this._processHead = Nn(this._processHead, this)), - (this._running = !1); - } - d(qn.prototype), - (qn.prototype.start = function () { - this._running && this.stop(), - (this._running = !0), - this._ack(), - this._checkReclaim(), - this._processHead(); - }), - (qn.prototype.stop = function () { - this._schedule.cancelAll(), (this._running = !1); - }), - (qn.prototype.shouldRetry = function (e, t) { - return !(t > this.maxAttempts); - }), - (qn.prototype.getDelay = function (e) { - let t = this.backoff.MIN_RETRY_DELAY * Math.pow(this.backoff.FACTOR, e); - if (this.backoff.JITTER) { - const n = Math.random(); - const 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)); - }), - (qn.prototype.addItem = function (e) { - this._enqueue({ item: e, attemptNumber: 0, time: this._schedule.now() }); - }), - (qn.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); - }), - (qn.prototype._enqueue = function (e) { - let 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(); - }), - (qn.prototype._processHead = function () { - const e = this; - const t = this._store; - this._schedule.cancel(this._processId); - let n = t.get(this.keys.QUEUE) || []; - const r = t.get(this.keys.IN_PROGRESS) || {}; - const i = this._schedule.now(); - const o = []; - function s(n, r) { - o.push({ - item: n.item, - done(i, o) { - const 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 ( - let a = Object.keys(r).length; - n.length && n[0].time <= i && a++ < e.maxItems; - - ) { - const c = n.shift(); - const u = Mn(); - (r[u] = { - item: c.item, - attemptNumber: c.attemptNumber, - time: e._schedule.now(), - }), - s(c, u); - } - t.set(this.keys.QUEUE, n), - t.set(this.keys.IN_PROGRESS, r), - rt(function (t) { - try { - e.fn(t.item, t.done); - } catch (e) { - Un(`Process function threw error: ${e}`); - } - }, o), - (n = t.get(this.keys.QUEUE) || []), - this._schedule.cancel(this._processId), - n.length > 0 && - (this._processId = this._schedule.run( - this._processHead, - n[0].time - i - )); - }), - (qn.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); - }), - (qn.prototype._checkReclaim = function () { - const e = this; - rt( - function (t) { - t.id !== e.id && - (e._schedule.now() - t.get(e.keys.ACK) < - e.timeouts.RECLAIM_TIMEOUT || - (function (t) { - t.set(e.keys.RECLAIM_START, e.id), - t.set(e.keys.ACK, e._schedule.now()), - e._schedule.run(function () { - t.get(e.keys.RECLAIM_START) === e.id && - (t.set(e.keys.RECLAIM_END, e.id), - e._schedule.run(function () { - t.get(e.keys.RECLAIM_END) === e.id && - t.get(e.keys.RECLAIM_START) === e.id && - e._reclaim(t.id); - }, e.timeouts.RECLAIM_WAIT)); - }, e.timeouts.RECLAIM_WAIT); - })(t)); - }, - (function (t) { - for (var n = [], r = e._store.engine, i = 0; i < r.length; i++) { - const o = r.key(i).split("."); - o.length === 3 && - o[0] === t && - o[2] === "ack" && - n.push(new On(t, o[1], e.keys)); - } - return n; - })(this.name) - ), - this._schedule.run(this._checkReclaim, this.timeouts.RECLAIM_TIMER); - }), - (qn.prototype._reclaim = function (e) { - const t = this; - const n = new On(this.name, e, this.keys); - const r = { queue: this._store.get(this.keys.QUEUE) || [] }; - const i = { - inProgress: n.get(this.keys.IN_PROGRESS) || {}, - queue: n.get(this.keys.QUEUE) || [], - }; - rt(function (e) { - r.queue.push({ - item: e.item, - attemptNumber: e.attemptNumber, - time: t._schedule.now(), - }); - }, i.queue), - rt(function (e) { - r.queue.push({ - item: e.item, - attemptNumber: e.attemptNumber + 1, - time: t._schedule.now(), - }); - }, i.inProgress), - (r.queue = r.queue.sort(function (e, t) { - return e.time - t.time; - })), - this._store.set(this.keys.QUEUE, r.queue), - n.remove(this.keys.ACK), - n.remove(this.keys.RECLAIM_START), - n.remove(this.keys.RECLAIM_END), - n.remove(this.keys.IN_PROGRESS), - n.remove(this.keys.QUEUE), - this._processHead(); - }); - const Bn = qn; - const Fn = { - maxRetryDelay: 36e4, - minRetryDelay: 1e3, - backoffFactor: 2, - maxAttempts: 10, - maxItems: 100, - }; - var Gn = new ((function () { - function e() { - n(this, e), - (this.eventsBuffer = []), - (this.writeKey = ""), - (this.url = j), - (this.state = "READY"), - (this.batchSize = 0), - (this.payloadQueue = new Bn("rudder", Fn, function (e, t) { - (e.message.sentAt = w()), - Gn.processQueueElement(e.url, e.headers, e.message, 1e4, function ( - e, - n - ) { - if (e) return t(e); - t(null, n); - }); - })), - this.payloadQueue.start(); - } - return ( - i(e, [ - { - key: "preaparePayloadAndFlush", - value(e) { - if ( - (g.debug( - `==== in preaparePayloadAndFlush with state: ${e.state}` - ), - g.debug(e.eventsBuffer), - e.eventsBuffer.length != 0 && e.state !== "PROCESSING") - ) { - const t = e.eventsBuffer; - const n = new un(); - (n.batch = t), - (n.writeKey = e.writeKey), - (n.sentAt = w()), - n.batch.forEach(function (e) { - e.sentAt = n.sentAt; - }), - (e.batchSize = e.eventsBuffer.length); - const r = new XMLHttpRequest(); - g.debug("==== in flush sending to Rudder BE ===="), - g.debug(JSON.stringify(n, v)), - r.open("POST", e.url, !0), - r.setRequestHeader("Content-Type", "application/json"), - r.setRequestHeader( - "Authorization", - `Basic ${btoa(`${n.writeKey}:`)}` - ), - (r.onreadystatechange = function () { - r.readyState === 4 && r.status === 200 - ? (g.debug( - `====== request processed successfully: ${r.status}` - ), - (e.eventsBuffer = e.eventsBuffer.slice(e.batchSize)), - g.debug(e.eventsBuffer.length)) - : r.readyState === 4 && - r.status !== 200 && - k( - new Error( - `request failed with status: ${r.status} for url: ${e.url}` - ) - ), - (e.state = "READY"); - }), - r.send(JSON.stringify(n, v)), - (e.state = "PROCESSING"); - } - }, - }, - { - key: "processQueueElement", - value(e, t, n, r, i) { - try { - const o = new XMLHttpRequest(); - for (const s in (o.open("POST", e, !0), t)) - o.setRequestHeader(s, t[s]); - (o.timeout = r), - (o.ontimeout = i), - (o.onerror = i), - (o.onreadystatechange = function () { - o.readyState === 4 && - (o.status === 429 || (o.status >= 500 && o.status < 600) - ? (k( - 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}` - ) - )) - : (g.debug( - `====== request processed successfully: ${o.status}` - ), - i(null, o.status))); - }), - o.send(JSON.stringify(n, v)); - } catch (e) { - i(e); - } - }, - }, - { - key: "enqueue", - value(e, t) { - const n = e.getElementContent(); - const r = { - "Content-Type": "application/json", - Authorization: `Basic ${btoa(`${this.writeKey}:`)}`, - AnonymousId: btoa(n.anonymousId), - }; - (n.originalTimestamp = w()), - (n.sentAt = w()), - JSON.stringify(n).length > 32e3 && - g.error( - "[EventRepository] enqueue:: message length greater 32 Kb ", - n - ); - const i = - this.url.slice(-1) == "/" ? this.url.slice(0, -1) : this.url; - this.payloadQueue.addItem({ - url: `${i}/v1/${t}`, - headers: r, - message: n, - }); - }, - }, - ]), - e - ); - })())(); - function Kn(e) { - const t = function (t) { - let n = (t = t || window.event).target || t.srcElement; - Wn(n) && (n = n.parentNode), - Hn(n, t) - ? g.debug("to be tracked ", t.type) - : g.debug("not to be tracked ", t.type), - (function (e, t) { - let n = e.target || e.srcElement; - let r = void 0; - Wn(n) && (n = n.parentNode); - if (Hn(n, e)) { - if (n.tagName.toLowerCase() == "form") { - r = {}; - for (let i = 0; i < n.elements.length; i++) { - const o = n.elements[i]; - if (Qn(o) && Yn(o, t.trackValues)) { - const s = o.id ? o.id : o.name; - if (s && typeof s === "string") { - const a = o.id ? o.id : o.name; - let c = o.id - ? document.getElementById(o.id).value - : document.getElementsByName(o.name)[0].value; - (o.type !== "checkbox" && o.type !== "radio") || - (c = o.checked), - a.trim() !== "" && - (r[encodeURIComponent(a)] = encodeURIComponent(c)); - } - } - } - } - for (var u = [n], l = n; l.parentNode && !zn(l, "body"); ) - u.push(l.parentNode), (l = l.parentNode); - let d; - const p = []; - let h = !1; - if ( - (u.forEach(function (e) { - const n = (function (e) { - return !(!e.parentNode || zn(e, "body")); - })(e); - e.tagName.toLowerCase() === "a" && - ((d = e.getAttribute("href")), (d = n && d)), - (h = h || !Qn(e)), - p.push( - (function (e, t) { - for ( - var n = { - classes: $n(e).split(" "), - tag_name: e.tagName.toLowerCase(), - }, - r = e.attributes.length, - i = 0; - i < r; - i++ - ) { - const o = e.attributes[i].name; - const s = e.attributes[i].value; - s && (n[`attr__${o}`] = s), - (o != "name" && o != "id") || - !Yn(e, t.trackValues) || - ((n.field_value = - o == "id" - ? document.getElementById(s).value - : document.getElementsByName(s)[0].value), - (e.type !== "checkbox" && e.type !== "radio") || - (n.field_value = e.checked)); - } - let a = 1; - let c = 1; - let u = e; - for (; (u = Zn(u)); ) a++, u.tagName === e.tagName && c++; - return (n.nth_child = a), (n.nth_of_type = c), n; - })(e, t) - ); - }), - h) - ) - return !1; - let f = ""; - const m = (function (e) { - let t = ""; - return ( - e.childNodes.forEach(function (e) { - e.nodeType === Node.TEXT_NODE && (t += e.nodeValue); - }), - t.trim() - ); - })(n); - m && m.length && (f = m); - const y = { - event_type: e.type, - page: E(), - elements: p, - el_attr_href: d, - el_text: f, - }; - r && (y.form_values = r), - g.debug("web_event", y), - t.track("autotrack", y); - } - })(t, e); - }; - Vn(document, "submit", t, !0), - Vn(document, "change", t, !0), - Vn(document, "click", t, !0), - e.page(); - } - function Vn(e, t, n, r) { - e - ? e.addEventListener(t, n, !!r) - : g.error( - "[Autotrack] register_event:: No valid element provided to register_event" - ); - } - function Hn(e, t) { - if (!e || zn(e, "html") || !Jn(e)) return !1; - switch (e.tagName.toLowerCase()) { - case "html": - return !1; - case "form": - return t.type === "submit"; - case "input": - return ["button", "submit"].indexOf(e.getAttribute("type")) === -1 - ? t.type === "change" - : t.type === "click"; - case "select": - case "textarea": - return t.type === "change"; - default: - return t.type === "click"; - } - } - function zn(e, t) { - return e && e.tagName && e.tagName.toLowerCase() === t.toLowerCase(); - } - function Jn(e) { - return e && e.nodeType === 1; - } - function Wn(e) { - return e && e.nodeType === 3; - } - function $n(e) { - switch (t(e.className)) { - case "string": - return e.className; - case "object": - return e.className.baseVal || e.getAttribute("class") || ""; - default: - return ""; - } - } - function Yn(e, t) { - for (let n = e.attributes.length, r = 0; r < n; r++) { - const i = e.attributes[r].value; - if (t.indexOf(i) > -1) return !0; - } - return !1; - } - function Qn(e) { - return !($n(e).split(" ").indexOf("rudder-no-track") >= 0); - } - function Zn(e) { - if (e.previousElementSibling) return e.previousElementSibling; - do { - e = e.previousSibling; - } while (e && !Jn(e)); - return e; - } - function Xn(e, t) { - this.eventRepository || (this.eventRepository = Gn), - this.eventRepository.enqueue(e, t); - } - var er = new ((function () { - function e() { - n(this, e), - (this.autoTrackHandlersRegistered = !1), - (this.autoTrackFeatureEnabled = !1), - (this.initialized = !1), - (this.trackValues = []), - (this.eventsBuffer = []), - (this.clientIntegrations = []), - (this.loadOnlyIntegrations = {}), - (this.clientIntegrationObjects = void 0), - (this.successfullyLoadedIntegration = []), - (this.failedToBeLoadedIntegration = []), - (this.toBeProcessedArray = []), - (this.toBeProcessedByIntegrationArray = []), - (this.storage = Yt), - (this.userId = - this.storage.getUserId() != null ? this.storage.getUserId() : ""), - (this.userTraits = - this.storage.getUserTraits() != null - ? this.storage.getUserTraits() - : {}), - (this.groupId = - this.storage.getGroupId() != null ? this.storage.getGroupId() : ""), - (this.groupTraits = - this.storage.getGroupTraits() != null - ? this.storage.getGroupTraits() - : {}), - (this.anonymousId = this.getAnonymousId()), - this.storage.setUserId(this.userId), - (this.eventRepository = Gn), - (this.sendAdblockPage = !1), - (this.sendAdblockPageOptions = {}), - (this.clientSuppliedCallbacks = {}), - (this.readyCallback = function () {}), - (this.executeReadyCallback = void 0), - (this.methodToCallbackMapping = { syncPixel: "syncPixelCallback" }); - } - return ( - i(e, [ - { - key: "processResponse", - value(e, t) { - try { - g.debug("===in process response=== ".concat(e)), - (t = JSON.parse(t)).source.useAutoTracking && - !this.autoTrackHandlersRegistered && - ((this.autoTrackFeatureEnabled = !0), - Kn(this), - (this.autoTrackHandlersRegistered = !0)), - t.source.destinations.forEach(function (e, t) { - g.debug( - "Destination " - .concat(t, " Enabled? ") - .concat(e.enabled, " Type: ") - .concat(e.destinationDefinition.name, " Use Native SDK? ") - .concat(e.config.useNativeSDK) - ), - e.enabled && - this.clientIntegrations.push({ - name: e.destinationDefinition.name, - config: e.config, - }); - }, this), - console.log( - "this.clientIntegrations: ", - this.clientIntegrations - ), - (this.clientIntegrations = C( - this.loadOnlyIntegrations, - this.clientIntegrations - )), - (this.clientIntegrations = this.clientIntegrations.filter( - function (e) { - return Xt[e.name] != null; - } - )), - this.init(this.clientIntegrations); - } catch (e) { - k(e), - g.debug("===handling config BE response processing error==="), - g.debug( - "autoTrackHandlersRegistered", - this.autoTrackHandlersRegistered - ), - this.autoTrackFeatureEnabled && - !this.autoTrackHandlersRegistered && - (Kn(this), (this.autoTrackHandlersRegistered = !0)); - } - }, - }, - { - key: "init", - value(e) { - const t = this; - const n = this; - if ((g.debug("supported intgs ", Xt), !e || e.length == 0)) - return ( - this.readyCallback && this.readyCallback(), - void (this.toBeProcessedByIntegrationArray = []) - ); - e.forEach(function (e) { - try { - g.debug( - "[Analytics] init :: trying to initialize integration name:: ", - e.name - ); - const r = new (0, Xt[e.name])(e.config, n); - r.init(), - g.debug("initializing destination: ", e), - t.isInitialized(r).then(t.replayEvents); - } catch (t) { - g.error( - "[Analytics] initialize integration (integration.init()) failed :: ", - e.name - ); - } - }); - }, - }, - { - key: "replayEvents", - value(e) { - e.successfullyLoadedIntegration.length + - e.failedToBeLoadedIntegration.length == - e.clientIntegrations.length && - e.toBeProcessedByIntegrationArray.length > 0 && - (g.debug( - "===replay events called====", - e.successfullyLoadedIntegration.length, - e.failedToBeLoadedIntegration.length - ), - (e.clientIntegrationObjects = []), - (e.clientIntegrationObjects = e.successfullyLoadedIntegration), - g.debug( - "==registering after callback===", - e.clientIntegrationObjects.length - ), - (e.executeReadyCallback = p( - e.clientIntegrationObjects.length, - e.readyCallback - )), - g.debug("==registering ready callback==="), - e.on("ready", e.executeReadyCallback), - e.clientIntegrationObjects.forEach(function (t) { - g.debug("===looping over each successful integration===="), - (t.isReady && !t.isReady()) || - (g.debug("===letting know I am ready=====", t.name), - e.emit("ready")); - }), - e.toBeProcessedByIntegrationArray.forEach(function (t) { - const n = t[0]; - t.shift(), - Object.keys(t[0].message.integrations).length > 0 && - A(t[0].message.integrations); - for ( - let r = C( - t[0].message.integrations, - e.clientIntegrationObjects - ), - i = 0; - i < r.length; - i++ - ) - try { - var o; - if (!r[i].isFailed || !r[i].isFailed()) - if (r[i][n]) (o = r[i])[n].apply(o, c(t)); - } catch (e) { - k(e); - } - }), - (e.toBeProcessedByIntegrationArray = [])); - }, - }, - { - key: "pause", - value(e) { - return new Promise(function (t) { - setTimeout(t, e); - }); - }, - }, - { - key: "isInitialized", - value(e) { - const t = this; - const n = - arguments.length > 1 && void 0 !== arguments[1] - ? arguments[1] - : 0; - return new Promise(function (r) { - return e.isLoaded() - ? (g.debug("===integration loaded successfully====", e.name), - t.successfullyLoadedIntegration.push(e), - r(t)) - : n >= 1e4 - ? (g.debug("====max wait over===="), - t.failedToBeLoadedIntegration.push(e), - r(t)) - : void t.pause(1e3).then(function () { - return ( - g.debug("====after pause, again checking===="), - t.isInitialized(e, n + 1e3).then(r) - ); - }); - }); - }, - }, - { - key: "page", - value(e, n, r, i, o) { - typeof i === "function" && ((o = i), (i = null)), - typeof r === "function" && ((o = r), (i = r = null)), - typeof n === "function" && ((o = n), (i = r = n = null)), - t(e) === "object" && ((i = n), (r = e), (n = e = null)), - t(n) === "object" && ((i = r), (r = n), (n = null)), - typeof e === "string" && - typeof n !== "string" && - ((n = e), (e = null)), - this.sendAdblockPage && - e != "RudderJS-Initiated" && - this.sendSampleRequest(), - this.processPage(e, n, r, i, o); - }, - }, - { - key: "track", - value(e, t, n, r) { - typeof n === "function" && ((r = n), (n = null)), - typeof t === "function" && ((r = t), (n = null), (t = null)), - this.processTrack(e, t, n, r); - }, - }, - { - key: "identify", - value(e, n, r, i) { - typeof r === "function" && ((i = r), (r = null)), - typeof n === "function" && ((i = n), (r = null), (n = null)), - t(e) === "object" && ((r = n), (n = e), (e = this.userId)), - this.processIdentify(e, n, r, i); - }, - }, - { - key: "alias", - value(e, n, r, i) { - typeof r === "function" && ((i = r), (r = null)), - typeof n === "function" && ((i = n), (r = null), (n = null)), - t(n) === "object" && ((r = n), (n = null)); - const o = new cn().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(e, n, r, i) { - if (arguments.length) { - typeof r === "function" && ((i = r), (r = null)), - typeof n === "function" && ((i = n), (r = null), (n = null)), - t(e) === "object" && ((r = n), (n = e), (e = this.groupId)), - (this.groupId = e), - this.storage.setGroupId(this.groupId); - const o = new cn().setType("group").build(); - if (n) for (const 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(e, t, n, r, i) { - const o = new cn().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(e, t, n, r) { - const i = new cn().setType("track").build(); - e && i.setEventName(e), - t ? i.setProperty(t) : i.setProperty({}), - this.trackEvent(i, n, r); - }, - }, - { - key: "processIdentify", - value(e, t, n, r) { - e && this.userId && e !== this.userId && this.reset(), - (this.userId = e), - this.storage.setUserId(this.userId); - const i = new cn().setType("identify").build(); - if (t) { - for (const o in t) this.userTraits[o] = t[o]; - this.storage.setUserTraits(this.userTraits); - } - this.identifyUser(i, n, r); - }, - }, - { - key: "identifyUser", - value(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 = a({}, e.message.context.traits)), - this.storage.setUserTraits(this.userTraits)), - this.processAndSendDataToDestinations("identify", e, t, n); - }, - }, - { - key: "trackPage", - value(e, t, n) { - this.processAndSendDataToDestinations("page", e, t, n); - }, - }, - { - key: "trackEvent", - value(e, t, n) { - this.processAndSendDataToDestinations("track", e, t, n); - }, - }, - { - key: "processAndSendDataToDestinations", - value(e, t, n, r) { - try { - this.anonymousId || this.setAnonymousId(), - (t.message.context.page = E()), - (t.message.context.traits = a({}, this.userTraits)), - g.debug("anonymousId: ", this.anonymousId), - (t.message.anonymousId = this.anonymousId), - (t.message.userId = t.message.userId - ? t.message.userId - : this.userId), - e == "group" && - (this.groupId && (t.message.groupId = this.groupId), - this.groupTraits && - (t.message.traits = a({}, this.groupTraits))), - n && this.processOptionsParam(t, n), - g.debug(JSON.stringify(t)), - Object.keys(t.message.integrations).length > 0 && - A(t.message.integrations), - C( - t.message.integrations, - this.clientIntegrationObjects - ).forEach(function (n) { - (n.isFailed && n.isFailed()) || (n[e] && n[e](t)); - }), - this.clientIntegrationObjects || - (g.debug("pushing in replay queue"), - this.toBeProcessedByIntegrationArray.push([e, t])), - (i = t.message.integrations), - Object.keys(i).forEach(function (e) { - i.hasOwnProperty(e) && - (y[e] && (i[y[e]] = i[e]), - e != "All" && y[e] != null && y[e] != e && delete i[e]); - }), - Xn.call(this, t, e), - g.debug("".concat(e, " is called ")), - r && r(); - } catch (e) { - k(e); - } - let i; - }, - }, - { - key: "processOptionsParam", - value(e, t) { - const n = ["integrations", "anonymousId", "originalTimestamp"]; - for (const r in t) - if (n.includes(r)) e.message[r] = t[r]; - else if (r !== "context") e.message.context[r] = t[r]; - else for (const i in t[r]) e.message.context[i] = t[r][i]; - }, - }, - { - key: "getPageProperties", - value(e) { - const t = E(); - for (const n in t) void 0 === e[n] && (e[n] = t[n]); - return e; - }, - }, - { - key: "reset", - value() { - (this.userId = ""), (this.userTraits = {}), this.storage.clear(); - }, - }, - { - key: "getAnonymousId", - value() { - return ( - (this.anonymousId = this.storage.getAnonymousId()), - this.anonymousId || this.setAnonymousId(), - this.anonymousId - ); - }, - }, - { - key: "setAnonymousId", - value(e) { - (this.anonymousId = e || b()), - this.storage.setAnonymousId(this.anonymousId); - }, - }, - { - key: "load", - value(e, n, r) { - const i = this; - g.debug("inside load "); - let o = "https://api.rudderlabs.com/sourceConfig/?p=web&v=1.1.2"; - if (!e || !n || n.length == 0) - throw ( - (k({ - message: - "[Analytics] load:: Unable to load due to wrong writeKey or serverUrl", - }), - Error("failed to initialize")) - ); - if ( - (r && r.logLevel && g.setLogLevel(r.logLevel), - r && - r.integrations && - (Object.assign(this.loadOnlyIntegrations, r.integrations), - A(this.loadOnlyIntegrations)), - r && r.configUrl && (o = r.configUrl), - r && r.sendAdblockPage && (this.sendAdblockPage = !0), - r && - r.sendAdblockPageOptions && - t(r.sendAdblockPageOptions) === "object" && - (this.sendAdblockPageOptions = r.sendAdblockPageOptions), - r && r.clientSuppliedCallbacks) - ) { - const s = {}; - Object.keys(this.methodToCallbackMapping).forEach(function (e) { - i.methodToCallbackMapping.hasOwnProperty(e) && - r.clientSuppliedCallbacks[i.methodToCallbackMapping[e]] && - (s[e] = - r.clientSuppliedCallbacks[i.methodToCallbackMapping[e]]); - }), - Object.assign(this.clientSuppliedCallbacks, s), - this.registerCallbacks(!0); - } - (this.eventRepository.writeKey = e), - n && (this.eventRepository.url = n), - r && - r.valTrackingList && - r.valTrackingList.push == Array.prototype.push && - (this.trackValues = r.valTrackingList), - r && - r.useAutoTracking && - ((this.autoTrackFeatureEnabled = !0), - this.autoTrackFeatureEnabled && - !this.autoTrackHandlersRegistered && - (Kn(this), - (this.autoTrackHandlersRegistered = !0), - g.debug( - "autoTrackHandlersRegistered", - this.autoTrackHandlersRegistered - ))); - try { - !(function (e, t, n, r) { - let i; - const o = r.bind(e); - (i = new XMLHttpRequest()).open("GET", t, !0), - i.setRequestHeader("Authorization", `Basic ${btoa(`${n}:`)}`), - (i.onload = function () { - const e = i.status; - e == 200 - ? (g.debug("status 200 calling callback"), - o(200, i.responseText)) - : (k( - new Error( - `request failed with status: ${i.status} for url: ${t}` - ) - ), - o(e)); - }), - i.send(); - })(this, o, e, this.processResponse); - } catch (e) { - k(e), - this.autoTrackFeatureEnabled && - !this.autoTrackHandlersRegistered && - Kn(er); - } - }, - }, - { - key: "ready", - value(e) { - typeof e !== "function" - ? g.error("ready callback is not a function") - : (this.readyCallback = e); - }, - }, - { - key: "initializeCallbacks", - value() { - const e = this; - Object.keys(this.methodToCallbackMapping).forEach(function (t) { - e.methodToCallbackMapping.hasOwnProperty(t) && - e.on(t, function () {}); - }); - }, - }, - { - key: "registerCallbacks", - value(e) { - const t = this; - e || - Object.keys(this.methodToCallbackMapping).forEach(function (e) { - t.methodToCallbackMapping.hasOwnProperty(e) && - window.rudderanalytics && - typeof window.rudderanalytics[ - t.methodToCallbackMapping[e] - ] === "function" && - (t.clientSuppliedCallbacks[e] = - window.rudderanalytics[t.methodToCallbackMapping[e]]); - }), - Object.keys(this.clientSuppliedCallbacks).forEach(function (e) { - t.clientSuppliedCallbacks.hasOwnProperty(e) && - (g.debug( - "registerCallbacks", - e, - t.clientSuppliedCallbacks[e] - ), - t.on(e, t.clientSuppliedCallbacks[e])); - }); - }, - }, - { - key: "sendSampleRequest", - value() { - L( - "ad-block", - "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" - ); - }, - }, - ]), - e - ); - })())(); - console.log("====instance formed======="), - d(er), - window.addEventListener( - "error", - function (e) { - k(e, er); - }, - !0 - ), - er.initializeCallbacks(), - er.registerCallbacks(!1); - const tr = - !!window.rudderanalytics && - window.rudderanalytics.push == Array.prototype.push; - const nr = window.rudderanalytics ? window.rudderanalytics[0] : []; - if (nr.length > 0 && nr[0] == "load") { - const rr = nr[0]; - nr.shift(), - g.debug("=====from init, calling method:: ", rr), - er[rr].apply(er, c(nr)); - } - if (tr) { - for (let ir = 1; ir < window.rudderanalytics.length; ir++) - er.toBeProcessedArray.push(window.rudderanalytics[ir]); - for (let or = 0; or < er.toBeProcessedArray.length; or++) { - const sr = c(er.toBeProcessedArray[or]); - const ar = sr[0]; - sr.shift(), - g.debug("=====from init, calling method:: ", ar), - er[ar].apply(er, c(sr)); - } - er.toBeProcessedArray = []; - } - const cr = er.ready.bind(er); - const ur = er.identify.bind(er); - const lr = er.page.bind(er); - const dr = er.track.bind(er); - const pr = er.alias.bind(er); - const hr = er.group.bind(er); - const fr = er.reset.bind(er); - const gr = er.load.bind(er); - const mr = (er.initialized = !0); - const yr = er.getAnonymousId.bind(er); - const vr = er.setAnonymousId.bind(er); - return ( - (e.alias = pr), - (e.getAnonymousId = yr), - (e.group = hr), - (e.identify = ur), - (e.initialized = mr), - (e.load = gr), - (e.page = lr), - (e.ready = cr), - (e.reset = fr), - (e.setAnonymousId = vr), - (e.track = dr), - e - ); -})({}); -// # sourceMappingURL=rudder-analytics.min.js.map +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 u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var u=0;ue.length)&&(t=e.length);for(var u=0,n=new Array(t);u-1?t:t+e:window.location.href,n=u.indexOf("#");return n>-1?u.slice(0,n):u}(n)}}function R(){for(var e,t=document.getElementsByTagName("link"),u=0;e=t[u];u++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}function j(e,t){var u=e.revenue;return!u&&t&&t.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(u=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}}(u)}function L(e){Object.keys(e).forEach((function(t){e.hasOwnProperty(t)&&(b[t]&&(e[b[t]]=e[t]),"All"!=t&&null!=b[t]&&b[t]!=t&&delete e[t])}))}function U(e,u){var n=[];if(!u||0==u.length)return n;var r=!0;return"string"==typeof u[0]?(null!=e.All&&(r=e.All),u.forEach((function(t){if(r){var u=!0;null!=e[t]&&0==e[t]&&(u=!1),u&&n.push(t)}else null!=e[t]&&1==e[t]&&n.push(t)})),n):"object"===t(u[0])?(null!=e.All&&(r=e.All),u.forEach((function(t){if(r){var u=!0;null!=e[t.name]&&0==e[t.name]&&(u=!1),u&&n.push(t)}else null!=e[t.name]&&1==e[t.name]&&n.push(t)})),n):void 0}function M(e,u){return u=u||z,"array"==function(e){switch(Object.prototype.toString.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array"}return null===e?"null":void 0===e?"undefined":e===Object(e)?"object":t(e)}(e)?N(e,u):q(e,u)}var N=function(e,t){for(var u=[],n=0;n=0},ee.bool=ee.boolean=function(e){return"[object Boolean]"===Y.call(e)},ee.false=function(e){return ee.bool(e)&&!1===Boolean(Number(e))},ee.true=function(e){return ee.bool(e)&&!0===Boolean(Number(e))},ee.date=function(e){return"[object Date]"===Y.call(e)},ee.date.valid=function(e){return ee.date(e)&&!isNaN(Number(e))},ee.element=function(e){return void 0!==e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&1===e.nodeType},ee.error=function(e){return"[object Error]"===Y.call(e)},ee.fn=ee.function=function(e){if("undefined"!=typeof window&&e===window.alert)return!0;var t=Y.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t||"[object AsyncFunction]"===t},ee.number=function(e){return"[object Number]"===Y.call(e)},ee.infinite=function(e){return e===1/0||e===-1/0},ee.decimal=function(e){return ee.number(e)&&!$(e)&&!ee.infinite(e)&&e%1!=0},ee.divisibleBy=function(e,t){var u=ee.infinite(e),n=ee.infinite(t),r=ee.number(e)&&!$(e)&&ee.number(t)&&!$(t)&&0!==t;return u||n||r&&e%t==0},ee.integer=ee.int=function(e){return ee.number(e)&&!$(e)&&e%1==0},ee.maximum=function(e,t){if($(e))throw new TypeError("NaN is not a valid value");if(!ee.arraylike(t))throw new TypeError("second argument must be array-like");for(var u=t.length;--u>=0;)if(e=0;)if(e>t[u])return!1;return!0},ee.nan=function(e){return!ee.number(e)||e!=e},ee.even=function(e){return ee.infinite(e)||ee.number(e)&&e==e&&e%2==0},ee.odd=function(e){return ee.infinite(e)||ee.number(e)&&e==e&&e%2!=0},ee.ge=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e>=t},ee.gt=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e>t},ee.le=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e<=t},ee.lt=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e=t&&e<=u},ee.object=function(e){return"[object Object]"===Y.call(e)},ee.primitive=function(e){return!e||!("object"===t(e)||ee.object(e)||ee.fn(e)||ee.array(e))},ee.hash=function(e){return ee.object(e)&&e.constructor===Object&&!e.nodeType&&!e.setInterval},ee.regexp=function(e){return"[object RegExp]"===Y.call(e)},ee.string=function(e){return"[object String]"===Y.call(e)},ee.base64=function(e){return ee.string(e)&&(!e.length||Q.test(e))},ee.hex=function(e){return ee.string(e)&&(!e.length||X.test(e))},ee.symbol=function(e){return"function"==typeof Symbol&&"[object Symbol]"===Y.call(e)&&"symbol"===t(G.call(e))},ee.bigint=function(e){return"function"==typeof BigInt&&"[object BigInt]"===Y.call(e)&&"bigint"==typeof K.call(e)};var te,ue=ee,ne=Object.prototype.toString,re=function(e){switch(ne.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":t(e)},ie=/\b(Array|Date|Object|Math|JSON)\b/g,oe=function(e,t){var u=function(e){for(var t=[],u=0;u-1?u:t.map((function(e){return e.product_id})).indexOf(e.properties.product_id)+1}},{key:"extractCheckoutOptions",value:function(e){var t=M([e.message.properties.paymentMethod,e.message.properties.shippingMethod]);return t.length>0?t.join(", "):null}}]),e}(),ge=function(){function e(t){u(this,e),this.siteId=t.siteID,this.name="HOTJAR",this._ready=!1}return r(e,[{key:"init",value:function(){window.hotjarSiteId=this.siteId,function(e,t,u,n,r,i){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:e.hotjarSiteId,hjsv:6},r=t.getElementsByTagName("head")[0],(i=t.createElement("script")).async=1,i.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,r.appendChild(i)}(window,document),this._ready=!0,F("===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 F("[Hotjar] identify:: user id is required")}},{key:"track",value:function(e){F("[Hotjar] track:: method not supported")}},{key:"page",value:function(e){F("[Hotjar] page:: method not supported")}},{key:"isLoaded",value:function(){return this._ready}},{key:"isReady",value:function(){return this._ready}}]),e}(),me=function(){function e(t){u(this,e),this.conversionId=t.conversionID,this.pageLoadConversions=t.pageLoadConversions,this.clickEventConversions=t.clickEventConversions,this.defaultPageConversion=t.defaultPageConversion,this.name="GOOGLEADS"}return r(e,[{key:"init",value:function(){!function(e,t,u){F("in script loader=== ".concat(e));var n=u.createElement("script");n.src=t,n.async=1,n.type="text/javascript",n.id=e;var r=u.getElementsByTagName("head")[0];F("==script==",r),r.appendChild(n)}("googleAds-integration","https://www.googletagmanager.com/gtag/js?id=".concat(this.conversionId),document),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",this.conversionId),F("===in init Google Ads===")}},{key:"identify",value:function(e){F("[GoogleAds] identify:: method not supported")}},{key:"track",value:function(e){F("in GoogleAdsAnalyticsManager track");var t=this.getConversionData(this.clickEventConversions,e.message.event);if(t.conversionLabel){var u=t.conversionLabel,n=t.eventName,r="".concat(this.conversionId,"/").concat(u),i={};e.properties&&(i.value=e.properties.revenue,i.currency=e.properties.currency,i.transaction_id=e.properties.order_id),i.send_to=r,window.gtag("event",n,i)}}},{key:"page",value:function(e){F("in GoogleAdsAnalyticsManager page");var t=this.getConversionData(this.pageLoadConversions,e.message.name);if(t.conversionLabel){var u=t.conversionLabel,n=t.eventName;window.gtag("event",n,{send_to:"".concat(this.conversionId,"/").concat(u)})}}},{key:"getConversionData",value:function(e,t){var u={};return e&&(t?e.forEach((function(e){e.name.toLowerCase()===t.toLowerCase()&&(u.conversionLabel=e.conversionLabel,u.eventName=e.name)})):this.defaultPageConversion&&(u.conversionLabel=this.defaultPageConversion,u.eventName="Viewed a Page")),u}},{key:"isLoaded",value:function(){return window.dataLayer.push!==Array.prototype.push}},{key:"isReady",value:function(){return window.dataLayer.push!==Array.prototype.push}}]),e}(),ye=function(){function e(t,n){u(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",this.analytics=n,F("Config ",t)}return r(e,[{key:"init",value:function(){F("===in init VWO===");var e=this.accountId,t=this.settingsTolerance,u=this.libraryTolerance,n=this.useExistingJquery,r=this.isSPA;window._vwo_code=function(){var i=!1,o=document;return{use_existing_jquery:function(){return n},library_tolerance:function(){return u},finish:function(){if(!i){i=!0;var e=o.getElementById("_vis_opt_path_hides");e&&e.parentNode.removeChild(e)}},finished:function(){return i},load:function(e){var t=o.createElement("script");t.src=e,t.type="text/javascript",t.innerText,t.onerror=function(){_vwo_code.finish()},o.getElementsByTagName("head")[0].appendChild(t)},init:function(){var u=setTimeout("_vwo_code.finish()",t),n=o.createElement("style"),i="body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}",s=o.getElementsByTagName("head")[0];return n.setAttribute("id","_vis_opt_path_hides"),n.setAttribute("type","text/css"),n.styleSheet?n.styleSheet.cssText=i:n.appendChild(o.createTextNode(i)),s.appendChild(n),this.load("//dev.visualwebsiteoptimizer.com/j.php?a=".concat(e,"&u=").concat(encodeURIComponent(o.URL),"&r=").concat(Math.random(),"&f=").concat(+r)),u}}}(),window._vwo_settings_timer=window._vwo_code.init(),(this.sendExperimentTrack||this.experimentViewedIdentify)&&this.experimentViewed()}},{key:"experimentViewed",value:function(){var e=this;window.VWO=window.VWO||[];var t=this;window.VWO.push(["onVariationApplied",function(u){if(u){F("Variation Applied");var n=u[1],r=u[2];if(F("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{t.sendExperimentTrack&&(F("Tracking..."),e.analytics.track("Experiment Viewed",{experimentId:n,variationName:_vwo_exp[n].comb_n[r]}))}catch(e){w("[VWO] experimentViewed:: ",e)}try{t.sendExperimentIdentify&&(F("Identifying..."),e.analytics.identify(i({},"Experiment: ".concat(n),_vwo_exp[n].comb_n[r])))}catch(e){w("[VWO] experimentViewed:: ",e)}}}}])}},{key:"identify",value:function(e){F("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;F("Revenue",t),window.VWO=window.VWO||[],window.VWO.push(["track.revenueConversion",t])}}},{key:"page",value:function(e){F("method not supported")}},{key:"isLoaded",value:function(){return!!window._vwo_code}},{key:"isReady",value:function(){return!!window._vwo_code}}]),e}(),Ce=function(){function e(t){u(this,e),this.containerID=t.containerID,this.name="GOOGLETAGMANAGER"}return r(e,[{key:"init",value:function(){F("===in init GoogleTagManager==="),function(e,t,u,n,r){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var i=t.getElementsByTagName(u)[0],o=t.createElement(u);o.async=!0,o.src="https://www.googletagmanager.com/gtm.js?id=".concat(r).concat(""),i.parentNode.insertBefore(o,i)}(window,document,"script","dataLayer",this.containerID)}},{key:"identify",value:function(e){F("[GTM] identify:: method not supported")}},{key:"track",value:function(e){F("===in track GoogleTagManager===");var t=e.message,u=s({event:t.event,userId:t.userId,anonymousId:t.anonymousId},t.properties);this.sendToGTMDatalayer(u)}},{key:"page",value:function(e){F("===in page GoogleTagManager===");var t,u=e.message,n=u.name,r=u.properties?u.properties.category:void 0;n&&(t="Viewed ".concat(n," page")),r&&n&&(t="Viewed ".concat(r," ").concat(n," page")),t||(t="Viewed a Page");var i=s({event:t,userId:u.userId,anonymousId:u.anonymousId},u.properties);this.sendToGTMDatalayer(i)}},{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}(),Ee=function(){function e(t,n){if(u(this,e),this.analytics=n,this.appKey=t.appKey,t.appKey||(this.appKey=""),this.endPoint="",t.dataCenter){var r=t.dataCenter.trim().split("-");"eu"===r[0].toLowerCase()?this.endPoint="sdk.fra-01.braze.eu":this.endPoint="sdk.iad-".concat(r[1],".braze.com")}this.name="BRAZE",F("Config ",t)}return r(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(){F("===in init Braze==="),function(e,t,u,n,r){e.appboy={},e.appboyQueue=[];for(var i="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(" "),o=0;o>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&u.rotl(e,8)|4278255360&u.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],u=0,n=0;u>>5]|=e[u]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],u=0;u<32*e.length;u+=8)t.push(e[u>>>5]>>>24-u%32&255);return t},bytesToHex:function(e){for(var t=[],u=0;u>>4).toString(16)),t.push((15&e[u]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],u=0;u>>6*(3-i)&63)):u.push("=");return u.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var u=[],n=0,r=0;n>>6-2*r);return u}};e.exports=u}()})),ve={utf8:{stringToBytes:function(e){return ve.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(ve.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],u=0;u>>24)|4278255360&(s[D]<<24|s[D]>>>8);s[a>>>5]|=128<>>9<<4)]=a;var f=e._ff,h=e._gg,g=e._hh,m=e._ii;for(D=0;D>>0,l=l+C>>>0,d=d+E>>>0,p=p+A>>>0}return t.endian([c,l,d,p])};i._ff=function(e,t,u,n,r,i,o){var s=e+(t&u|~t&n)+(r>>>0)+o;return(s<>>32-i)+t},i._gg=function(e,t,u,n,r,i,o){var s=e+(t&n|u&~n)+(r>>>0)+o;return(s<>>32-i)+t},i._hh=function(e,t,u,n,r,i,o){var s=e+(t^u^n)+(r>>>0)+o;return(s<>>32-i)+t},i._ii=function(e,t,u,n,r,i,o){var s=e+(u^(t|~n))+(r>>>0)+o;return(s<>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,u){if(null==e)throw new Error("Illegal argument "+e);var n=t.wordsToBytes(i(e,u));return u&&u.asBytes?n:u&&u.asString?r.bytesToString(n):t.bytesToHex(n)}}()})),ke=function(){function e(t){u(this,e),this.NAME="INTERCOM",this.API_KEY=t.apiKey,this.APP_ID=t.appId,this.MOBILE_APP_ID=t.mobileAppId,F("Config ",t)}return r(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 u=document,n=function e(){e.c(arguments)};n.q=[],n.c=function(e){n.q.push(e)},e.Intercom=n;var r=function(){var e=u.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.intercom.io/widget/".concat(window.intercomSettings.app_id);var t=u.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};"complete"===document.readyState?(r(),window.intercom_code=!0):e.attachEvent?(e.attachEvent("onload",r),window.intercom_code=!0):(e.addEventListener("load",r,!1),window.intercom_code=!0)}}()}},{key:"page",value:function(){window.Intercom("update")}},{key:"identify",value:function(e){var u={},n=e.message.context;if(null!=(n.Intercom?n.Intercom:null)){var r=n.Intercom.user_hash?n.Intercom.user_hash:null;null!=r&&(u.user_hash=r);var i=n.Intercom.hideDefaultLauncher?n.Intercom.hideDefaultLauncher:null;null!=i&&(u.hide_default_launcher=i)}Object.keys(n.traits).forEach((function(e){if(n.traits.hasOwnProperty(e)){var r=n.traits[e];if("company"===e){var i=[],o={};"string"==typeof n.traits[e]&&(o.company_id=Be(n.traits[e]));var s="object"===t(n.traits[e])&&Object.keys(n.traits[e])||[];s.forEach((function(t){s.hasOwnProperty(t)&&("id"!=t?o[t]=n.traits[e][t]:o.company_id=n.traits[e][t])})),"object"!==t(n.traits[e])||s.includes("id")||(o.company_id=Be(o.name)),i.push(o),u.companies=i}else u[e]=n.traits[e];switch(e){case"createdAt":u.created_at=r;break;case"anonymousId":u.user_id=r}}})),u.user_id=e.message.userId,window.Intercom("update",u)}},{key:"track",value:function(e){var t={},u=e.message;(u.properties?Object.keys(u.properties):null).forEach((function(e){var n=u.properties[e];t[e]=n})),u.event&&(t.event_name=u.event),t.user_id=u.userId?u.userId:u.anonymousId,t.created_at=Math.floor(new Date(u.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}(),_e=function(){function e(t){u(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 r(e,[{key:"init",value:function(){F("===in init Keen==="),V("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){F("in Keen identify");var t=e.message.context.traits,u=e.message.userId?e.message.userId:e.message.anonymousId,n=e.message.properties?Object.assign(n,e.message.properties):{};n.user={userId:u,traits:t},n=this.getAddOn(n),this.client.extendEvents(n)}},{key:"track",value:function(e){F("in Keen track");var t=e.message.event,u=e.message.properties;u=this.getAddOn(u),this.client.recordEvent(t,u)}},{key:"page",value:function(e){F("in Keen page");var t=e.message.name,u=e.message.properties?e.message.properties.category:void 0,n="Loaded a Page";t&&(n="Viewed ".concat(t," page")),u&&t&&(n="Viewed ".concat(u," ").concat(t," page"));var r=e.message.properties;r=this.getAddOn(r),this.client.recordEvent(n,r)}},{key:"isLoaded",value:function(){return F("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}(),Ie=Object.prototype.hasOwnProperty,Te=function(e){for(var t=Array.prototype.slice.call(arguments,1),u=0;u-1&&o.push([s,u[s]])}},{key:"initAfterPage",value:function(){var e,t=this;e=function(){var e,u,n=t.isVideo?"chartbeat_video.js":"chartbeat.js";e=document.createElement("script"),u=document.getElementsByTagName("script")[0],e.type="text/javascript",e.async=!0,e.src="//static.chartbeat.com/js/".concat(n),u.parentNode.insertBefore(e,u)},Pe?Le(e):Re.push(e),this._isReady(this).then((function(e){F("===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,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(n){return t.isLoaded()?(t.failed=!1,F("===chartbeat loaded successfully==="),e.analytics.emit("ready"),n(e)):u>=1e4?(t.failed=!0,F("===chartbeat failed==="),n(e)):void t.pause(1e3).then((function(){return t._isReady(e,u+1e3).then(n)}))}))}}]),e}(),Me=function(){function e(t,n){u(this,e),this.c2ID=t.c2ID,this.analytics=n,this.comScoreBeaconParam=t.comScoreBeaconParam?t.comScoreBeaconParam:{},this.isFirstPageCallMade=!1,this.failed=!1,this.comScoreParams={},this.replayEvents=[],this.name="COMSCORE"}return r(e,[{key:"init",value:function(){F("===in init Comscore init===")}},{key:"identify",value:function(e){F("in Comscore identify")}},{key:"track",value:function(e){F("in Comscore track")}},{key:"page",value:function(e){if(F("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){F("=====in loadConfig====="),this.comScoreParams=this.mapComscoreParams(e.message.properties),window._comscore=window._comscore||[],window._comscore.push(this.comScoreParams)}},{key:"initAfterPage",value:function(){F("=====in initAfterPage====="),function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.async=!0,e.src="".concat("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,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(n){return t.isLoaded()?(t.failed=!1,e.analytics.emit("ready"),n(e)):u>=1e4?(t.failed=!0,n(e)):void t.pause(1e3).then((function(){return t._isReady(e,u+1e3).then(n)}))}))}},{key:"mapComscoreParams",value:function(e){F("=====in mapComscoreParams=====");var t=this.comScoreBeaconParam,u={};return Object.keys(t).forEach((function(n){if(n in e){var r=t[n],i=e[n];u[r]=i}})),u.c1="2",u.c2=this.c2ID,F("=====in mapComscoreParams=====",u),u}},{key:"isLoaded",value:function(){return F("in Comscore isLoaded"),!this.isFirstPageCallMade||!!window.COMSCORE}},{key:"isReady",value:function(){return!!window.COMSCORE}}]),e}(),Ne=Object.prototype.hasOwnProperty,qe=String.prototype.charAt,ze=Object.prototype.toString,Ge=function(e,t){return qe.call(e,t)},Ke=function(e,t){return Ne.call(e,t)},Ve=function(e,t){t=t||Ke;for(var u=[],n=0,r=e.length;n=0&&ue.date(D))l[p]=D.toISOTring().split("T")[0];else if(s.hasOwnProperty(p))s[p]&&"string"==typeof D&&(l[p]=sha256(D));else{var f=n.indexOf(p)>=0,h=r.indexOf(p)>=0;f&&!h||(l[p]=D)}}return l}}]),e}(),et=d((function(e,t){var u;e.exports=(u=u||function(e,t){var u=Object.create||function(){function e(){}return function(t){var u;return e.prototype=t,u=new e,e.prototype=null,u}}(),n={},r=n.lib={},i=r.Base={extend:function(e){var t=u(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,u=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i>>2]>>>24-i%4*8&255;t[n+i>>>2]|=o<<24-(n+i)%4*8}else for(i=0;i>>2]=u[i>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,u=this.sigBytes;t[u>>>2]&=4294967295<<32-u%4*8,t.length=e.ceil(u/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var u,n=[],r=function(t){t=t;var u=987654321,n=4294967295;return function(){var r=((u=36969*(65535&u)+(u>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},i=0;i>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,u=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(u,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,u=e.sigBytes,n=[],r=0;r>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,u=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(u,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var u=this._data,n=u.words,r=u.sigBytes,i=this.blockSize,s=r/(4*i),a=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,c=e.min(4*a,r);if(a){for(var l=0;l>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var a=n.charAt(64);if(a)for(;r.length%4;)r.push(a);return r.join("")},parse:function(e){var t=e.length,u=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i>>6-o%4*2;r[i>>>2]|=(s|a)<<24-i%4*8,i++}return n.create(r,i)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)})),d((function(e,t){var u;e.exports=(u=et,function(e){var t=u,n=t.lib,r=n.WordArray,i=n.Hasher,o=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var a=o.MD5=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var u=0;u<16;u++){var n=t+u,r=e[n];e[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var i=this._hash.words,o=e[t+0],a=e[t+1],D=e[t+2],f=e[t+3],h=e[t+4],g=e[t+5],m=e[t+6],y=e[t+7],C=e[t+8],E=e[t+9],A=e[t+10],v=e[t+11],F=e[t+12],w=e[t+13],b=e[t+14],B=e[t+15],k=i[0],_=i[1],I=i[2],T=i[3];k=c(k,_,I,T,o,7,s[0]),T=c(T,k,_,I,a,12,s[1]),I=c(I,T,k,_,D,17,s[2]),_=c(_,I,T,k,f,22,s[3]),k=c(k,_,I,T,h,7,s[4]),T=c(T,k,_,I,g,12,s[5]),I=c(I,T,k,_,m,17,s[6]),_=c(_,I,T,k,y,22,s[7]),k=c(k,_,I,T,C,7,s[8]),T=c(T,k,_,I,E,12,s[9]),I=c(I,T,k,_,A,17,s[10]),_=c(_,I,T,k,v,22,s[11]),k=c(k,_,I,T,F,7,s[12]),T=c(T,k,_,I,w,12,s[13]),I=c(I,T,k,_,b,17,s[14]),k=l(k,_=c(_,I,T,k,B,22,s[15]),I,T,a,5,s[16]),T=l(T,k,_,I,m,9,s[17]),I=l(I,T,k,_,v,14,s[18]),_=l(_,I,T,k,o,20,s[19]),k=l(k,_,I,T,g,5,s[20]),T=l(T,k,_,I,A,9,s[21]),I=l(I,T,k,_,B,14,s[22]),_=l(_,I,T,k,h,20,s[23]),k=l(k,_,I,T,E,5,s[24]),T=l(T,k,_,I,b,9,s[25]),I=l(I,T,k,_,f,14,s[26]),_=l(_,I,T,k,C,20,s[27]),k=l(k,_,I,T,w,5,s[28]),T=l(T,k,_,I,D,9,s[29]),I=l(I,T,k,_,y,14,s[30]),k=d(k,_=l(_,I,T,k,F,20,s[31]),I,T,g,4,s[32]),T=d(T,k,_,I,C,11,s[33]),I=d(I,T,k,_,v,16,s[34]),_=d(_,I,T,k,b,23,s[35]),k=d(k,_,I,T,a,4,s[36]),T=d(T,k,_,I,h,11,s[37]),I=d(I,T,k,_,y,16,s[38]),_=d(_,I,T,k,A,23,s[39]),k=d(k,_,I,T,w,4,s[40]),T=d(T,k,_,I,o,11,s[41]),I=d(I,T,k,_,f,16,s[42]),_=d(_,I,T,k,m,23,s[43]),k=d(k,_,I,T,E,4,s[44]),T=d(T,k,_,I,F,11,s[45]),I=d(I,T,k,_,B,16,s[46]),k=p(k,_=d(_,I,T,k,D,23,s[47]),I,T,o,6,s[48]),T=p(T,k,_,I,y,10,s[49]),I=p(I,T,k,_,b,15,s[50]),_=p(_,I,T,k,g,21,s[51]),k=p(k,_,I,T,F,6,s[52]),T=p(T,k,_,I,f,10,s[53]),I=p(I,T,k,_,A,15,s[54]),_=p(_,I,T,k,a,21,s[55]),k=p(k,_,I,T,C,6,s[56]),T=p(T,k,_,I,B,10,s[57]),I=p(I,T,k,_,m,15,s[58]),_=p(_,I,T,k,w,21,s[59]),k=p(k,_,I,T,h,6,s[60]),T=p(T,k,_,I,v,10,s[61]),I=p(I,T,k,_,D,15,s[62]),_=p(_,I,T,k,E,21,s[63]),i[0]=i[0]+k|0,i[1]=i[1]+_|0,i[2]=i[2]+I|0,i[3]=i[3]+T|0},_doFinalize:function(){var t=this._data,u=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;u[r>>>5]|=128<<24-r%32;var i=e.floor(n/4294967296),o=n;u[15+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(u.length+1),this._process();for(var s=this._hash,a=s.words,c=0;c<4;c++){var l=a[c];a[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,u,n,r,i,o){var s=e+(t&u|~t&n)+r+o;return(s<>>32-i)+t}function l(e,t,u,n,r,i,o){var s=e+(t&n|u&~n)+r+o;return(s<>>32-i)+t}function d(e,t,u,n,r,i,o){var s=e+(t^u^n)+r+o;return(s<>>32-i)+t}function p(e,t,u,n,r,i,o){var s=e+(u^(t|~n))+r+o;return(s<>>32-i)+t}t.MD5=i._createHelper(a),t.HmacMD5=i._createHmacHelper(a)}(Math),u.MD5)})),d((function(e,t){var u,n,r,i,o,s,a,c;e.exports=(n=(u=c=et).lib,r=n.WordArray,i=n.Hasher,o=u.algo,s=[],a=o.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var u=this._hash.words,n=u[0],r=u[1],i=u[2],o=u[3],a=u[4],c=0;c<80;c++){if(c<16)s[c]=0|e[t+c];else{var l=s[c-3]^s[c-8]^s[c-14]^s[c-16];s[c]=l<<1|l>>>31}var d=(n<<5|n>>>27)+a+s[c];d+=c<20?1518500249+(r&i|~r&o):c<40?1859775393+(r^i^o):c<60?(r&i|r&o|i&o)-1894007588:(r^i^o)-899497514,a=o,o=i,i=r<<30|r>>>2,r=n,n=d}u[0]=u[0]+n|0,u[1]=u[1]+r|0,u[2]=u[2]+i|0,u[3]=u[3]+o|0,u[4]=u[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,u=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(u/4294967296),t[15+(n+64>>>9<<4)]=u,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),u.SHA1=i._createHelper(a),u.HmacSHA1=i._createHmacHelper(a),c.SHA1)})),d((function(e,t){var u,n,r;e.exports=(n=(u=et).lib.Base,r=u.enc.Utf8,void(u.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var u=e.blockSize,n=4*u;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,a=o.words,c=0;c>>2];e.sigBytes-=t}},r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:f,padding:h}),reset:function(){d.reset.call(this);var e=this.cfg,t=e.iv,u=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=u.createEncryptor;else n=u.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(u,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4}),g=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,u=e.salt;if(u)var n=o.create([1398893684,1701076831]).concat(u).concat(t);else n=t;return n.toString(c)},parse:function(e){var t=c.parse(e),u=t.words;if(1398893684==u[0]&&1701076831==u[1]){var n=o.create(u.slice(2,4));u.splice(0,4),t.sigBytes-=16}return g.create({ciphertext:t,salt:n})}},y=r.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(e,t,u,n){n=this.cfg.extend(n);var r=e.createEncryptor(u,n),i=r.finalize(t),o=r.cfg;return g.create({ciphertext:i,key:u,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,u,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(u,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),C=(n.kdf={}).OpenSSL={execute:function(e,t,u,n){n||(n=o.random(8));var r=l.create({keySize:t+u}).compute(e,n),i=o.create(r.words.slice(t),4*u);return r.sigBytes=4*t,g.create({key:r,iv:i,salt:n})}},E=r.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:C}),encrypt:function(e,t,u,n){var r=(n=this.cfg.extend(n)).kdf.execute(u,e.keySize,e.ivSize);n.iv=r.iv;var i=y.encrypt.call(this,e,t,r.key,n);return i.mixIn(r),i},decrypt:function(e,t,u,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var r=n.kdf.execute(u,e.keySize,e.ivSize,t.salt);return n.iv=r.iv,y.decrypt.call(this,e,t,r.key,n)}})))})),d((function(e,t){var u;e.exports=(u=et,function(){var e=u,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],s=[],a=[],c=[],l=[],d=[],p=[],D=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var u=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,r[u]=f,i[f]=u;var h=e[u],g=e[h],m=e[g],y=257*e[f]^16843008*f;o[u]=y<<24|y>>>8,s[u]=y<<16|y>>>16,a[u]=y<<8|y>>>24,c[u]=y,y=16843009*m^65537*g^257*h^16843008*u,l[f]=y<<24|y>>>8,d[f]=y<<16|y>>>16,p[f]=y<<8|y>>>24,D[f]=y,u?(u=h^e[e[e[m^h]]],n^=e[e[n]]):u=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],h=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,u=e.sigBytes/4,n=4*((this._nRounds=u+6)+1),i=this._keySchedule=[],o=0;o6&&o%u==4&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=f[o/u|0]<<24),i[o]=i[o-u]^s}for(var a=this._invKeySchedule=[],c=0;c>>24]]^d[r[s>>>16&255]]^p[r[s>>>8&255]]^D[r[255&s]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,c,r)},decryptBlock:function(e,t){var u=e[t+1];e[t+1]=e[t+3],e[t+3]=u,this._doCryptBlock(e,t,this._invKeySchedule,l,d,p,D,i),u=e[t+1],e[t+1]=e[t+3],e[t+3]=u},_doCryptBlock:function(e,t,u,n,r,i,o,s){for(var a=this._nRounds,c=e[t]^u[0],l=e[t+1]^u[1],d=e[t+2]^u[2],p=e[t+3]^u[3],D=4,f=1;f>>24]^r[l>>>16&255]^i[d>>>8&255]^o[255&p]^u[D++],g=n[l>>>24]^r[d>>>16&255]^i[p>>>8&255]^o[255&c]^u[D++],m=n[d>>>24]^r[p>>>16&255]^i[c>>>8&255]^o[255&l]^u[D++],y=n[p>>>24]^r[c>>>16&255]^i[l>>>8&255]^o[255&d]^u[D++];c=h,l=g,d=m,p=y}h=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&p])^u[D++],g=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[p>>>8&255]<<8|s[255&c])^u[D++],m=(s[d>>>24]<<24|s[p>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^u[D++],y=(s[p>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^u[D++],e[t]=h,e[t+1]=g,e[t+2]=m,e[t+3]=y},keySize:8});e.AES=t._createHelper(h)}(),u.AES)}))),ut=d((function(e,t){e.exports=et.enc.Utf8})),nt=Object.prototype.toString;var rt=function e(u){var n=function(e){switch(nt.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!=(u=e)&&(u._isBuffer||u.constructor&&"function"==typeof u.constructor.isBuffer&&u.constructor.isBuffer(u))?"buffer":t(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e));var u}(u);if("object"===n){var r={};for(var i in u)u.hasOwnProperty(i)&&(r[i]=e(u[i]));return r}if("array"===n){r=new Array(u.length);for(var o=0,s=u.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 u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*u;case"days":case"day":case"d":return u*at;case"hours":case"hour":case"hrs":case"hr":case"h":return u*st;case"minutes":case"minute":case"mins":case"min":case"m":return u*ot;case"seconds":case"second":case"secs":case"sec":case"s":return u*it;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u}}(e):t.long?function(e){return lt(e,at,"day")||lt(e,st,"hour")||lt(e,ot,"minute")||lt(e,it,"second")||e+" ms"}(e):function(e){return e>=at?Math.round(e/at)+"d":e>=st?Math.round(e/st)+"h":e>=ot?Math.round(e/ot)+"m":e>=it?Math.round(e/it)+"s":e+"ms"}(e)};function lt(e,t,u){if(!(e=31},u.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),u.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],u.formatters.j=function(e){return JSON.stringify(e)},u.enable(n())}))),Dt=(pt.log,pt.formatArgs,pt.save,pt.load,pt.useColors,pt.storage,pt.colors,pt("cookie")),ft=function(e,t,u){switch(arguments.length){case 3:case 2:return ht(e,t,u);case 1:return mt(e);default:return gt()}};function ht(e,t,u){u=u||{};var n=yt(e)+"="+yt(t);null==t&&(u.maxage=-1),u.maxage&&(u.expires=new Date(+new Date+u.maxage)),u.path&&(n+="; path="+u.path),u.domain&&(n+="; domain="+u.domain),u.expires&&(n+="; expires="+u.expires.toUTCString()),u.samesite&&(n+="; samesite="+u.samesite),u.secure&&(n+="; secure"),document.cookie=n}function gt(){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,u={},n=e.split(/ *; */);if(""==n[0])return u;for(var r=0;r1)))/4)-l((e-1901+t)/100)+l((e-1601+t)/400)};t=function(e){for(r=l(e/864e5),u=l(r/365.2425)+1970-1;D(u+1,0)<=r;u++);for(n=l((r-D(u,0))/30.42);D(u,n+1)<=r;n++);r=1+r-D(u,n),o=l((i=(e%864e5+864e5)%864e5)/36e5)%24,s=l(i/6e4)%60,a=l(i/1e3)%60,c=i%1e3}}return(w=function(e){return e>-1/0&&e<1/0?(t(e),e=(u<=0||u>=1e4?(u<0?"-":"+")+F(6,u<0?-u:u):F(4,u))+"-"+F(2,n+1)+"-"+F(2,r)+"T"+F(2,o)+":"+F(2,s)+":"+F(2,a)+"."+F(3,c)+"Z",u=n=r=o=s=a=c=null):e=null,e})(e)};if(C("json-stringify")&&!C("date-serialization")){var b=function(e){return w(this)},B=u.stringify;u.stringify=function(e,t,u){var n=c.prototype.toJSON;c.prototype.toJSON=b;var r=B(e,t,u);return c.prototype.toJSON=n,r}}else{var k=function(e){var t=e.charCodeAt(0),u=v[t];return u||"\\u00"+F(2,t.toString(16))},_=/[\x00-\x1f\x22\x5c]/g,I=function(e){return _.lastIndex=0,'"'+(_.test(e)?e.replace(_,k):e)+'"'};u.stringify=function(e,u,r){var i,o,s,a;if(n[t(u)]&&u)if("[object Function]"==(a=h.call(u)))o=u;else if("[object Array]"==a){s={};for(var l,p=0,D=u.length;p0)for(r>10&&(r=10),i="";i.length-1/0&&l<1/0?""+l:"null";case"string":case"[object String]":return I(""+l)}if("object"==t(l)){for(C=a.length;C--;)if(a[C]===l)throw d();if(a.push(l),f=[],E=s,s+=o,"[object Array]"==D){for(y=0,C=l.length;y=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70||P();e+=O("0x"+i.slice(t,T));break;default:P()}else{if(34==r)break;for(r=i.charCodeAt(T),t=T;r>=32&&92!=r&&34!=r;)r=i.charCodeAt(++T);e+=i.slice(t,T)}if(34==i.charCodeAt(T))return T++,e;P();default:if(t=T,45==r&&(n=!0,r=i.charCodeAt(++T)),r>=48&&r<=57){for(48==r&&((r=i.charCodeAt(T+1))>=48&&r<=57)&&P(),n=!1;T=48&&r<=57);T++);if(46==i.charCodeAt(T)){for(u=++T;u57);u++);u==T&&P(),T=u}if(101==(r=i.charCodeAt(T))||69==r){for(43!=(r=i.charCodeAt(++T))&&45!=r||T++,u=T;u57);u++);u==T&&P(),T=u}return+i.slice(t,T)}n&&P();var s=i.slice(T,T+4);if("true"==s)return T+=4,!0;if("fals"==s&&101==i.charCodeAt(T+4))return T+=5,!1;if("null"==s)return T+=4,null;P()}return"$"},j=function(e,t,u){var n=L(e,t,u);void 0===n?delete e[t]:e[t]=n},L=function(e,u,n){var r,i=e[u];if("object"==t(i)&&i)if("[object Array]"==h.call(i))for(r=i.length;r--;)j(h,A,i);else A(i,(function(e){j(i,e,n)}));return n.call(e,u,i)};u.parse=function(e,t){var u,n;return T=0,S=""+e,u=function e(t){var u,n;if("$"==t&&P(),"string"==typeof t){if("@"==(E?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(u=[];"]"!=(t=R());)n?","==t?"]"==(t=R())&&P():P():n=!0,","==t&&P(),u.push(e(t));return u}if("{"==t){for(u={};"}"!=(t=R());)n?","==t?"}"==(t=R())&&P():P():n=!0,","!=t&&"string"==typeof t&&"@"==(E?t.charAt(0):t[0])&&":"==R()||P(),u[t.slice(1)]=e(R());return u}P()}return t}(R()),"$"!=R()&&P(),T=S=null,t&&"[object Function]"==h.call(t)?L(((n={})[""]=u,n),"",t):u}}}return u.runInContext=s,u}if(!o||o.global!==o&&o.window!==o&&o.self!==o||(i=o),r)s(i,r);else{var a=i.JSON,c=i.JSON3,d=!1,p=s(i,i.JSON3={noConflict:function(){return d||(d=!0,i.JSON=a,i.JSON3=c,a=c=null),p}});i.JSON={parse:p.parse,stringify:p.stringify}}}).call(l)})),Rt=d((function(e,t){(t=e.exports=function(e){function n(){}function i(){var e=i,n=+new Date,o=n-(u||n);e.diff=o,e.prev=u,e.curr=n,u=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var s=Array.prototype.slice.call(arguments);s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,(function(u,n){if("%%"===u)return u;a++;var r=t.formatters[n];if("function"==typeof r){var i=s[a];u=r.call(e,i),s.splice(a,1),a--}return u})),"function"==typeof t.formatArgs&&(s=t.formatArgs.apply(e,s));var c=i.log||t.log||console.log.bind(console);c.apply(e,s)}n.enabled=!1,i.enabled=!0;var o=t.enabled(e)?i:n;return o.namespace=e,o}).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e);for(var u=(e||"").split(/[\s,]+/),n=u.length,r=0;r=31},u.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),u.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],u.formatters.j=function(e){return JSON.stringify(e)},u.enable(n())}))),Lt=(jt.log,jt.formatArgs,jt.save,jt.load,jt.useColors,jt.storage,jt.colors,jt("cookie")),Ut=function(e,t,u){switch(arguments.length){case 3:case 2:return Mt(e,t,u);case 1:return qt(e);default:return Nt()}};function Mt(e,t,u){u=u||{};var n=zt(e)+"="+zt(t);null==t&&(u.maxage=-1),u.maxage&&(u.expires=new Date(+new Date+u.maxage)),u.path&&(n+="; path="+u.path),u.domain&&(n+="; domain="+u.domain),u.expires&&(n+="; expires="+u.expires.toUTCString()),u.secure&&(n+="; secure"),document.cookie=n}function Nt(){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,u={},n=e.split(/ *; */);if(""==n[0])return u;for(var r=0;r=0;--i)r.push(t.slice(i).join("."));return r},n.cookie=Ut,t=e.exports=n})),Vt=new(function(){function e(t){u(this,e),this._options={},this.options(t)}return r(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=".".concat(Kt(window.location.href));"."===t&&(t=null),this._options=Ot(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 ft(e,t,rt(this._options)),!0}catch(e){return w(e),!1}}},{key:"get",value:function(e){return ft(e)}},{key:"remove",value:function(e){try{return ft(e,null,rt(this._options)),!0}catch(e){return!1}}}]),e}())({}),Ht=function(){var e,t={},u="undefined"!=typeof window?window:l,n=u.document;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,u,n){null==n&&(n=u,u=null),null==u&&(u={});var r=t.get(e,u);n(r),t.set(e,r)},t.getAll=function(){var e={};return t.forEach((function(t,u){e[t]=u})),e},t.forEach=function(){},t.serialize=function(e){return Pt.stringify(e)},t.deserialize=function(e){if("string"==typeof e)try{return Pt.parse(e)}catch(t){return e||void 0}},function(){try{return"localStorage"in u&&u.localStorage}catch(e){return!1}}())e=u.localStorage,t.set=function(u,n){return void 0===n?t.remove(u):(e.setItem(u,t.serialize(n)),n)},t.get=function(u,n){var r=t.deserialize(e.getItem(u));return void 0===r?n:r},t.remove=function(t){e.removeItem(t)},t.clear=function(){e.clear()},t.forEach=function(u){for(var n=0;ndocument.w=window<\/script>'),i.close(),r=i.w.frames[0].document,e=r.createElement("div")}catch(t){e=n.createElement("div"),r=n.body}var o=function(u){return function(){var n=Array.prototype.slice.call(arguments,0);n.unshift(e),r.appendChild(e),e.addBehavior("#default#userData"),e.load("localStorage");var i=u.apply(t,n);return r.removeChild(e),i}},s=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),a=function(e){return e.replace(/^d/,"___$&").replace(s,"___")};t.set=o((function(e,u,n){return u=a(u),void 0===n?t.remove(u):(e.setAttribute(u,t.serialize(n)),e.save("localStorage"),n)})),t.get=o((function(e,u,n){u=a(u);var r=t.deserialize(e.getAttribute(u));return void 0===r?n:r})),t.remove=o((function(e,t){t=a(t),e.removeAttribute(t),e.save("localStorage")})),t.clear=o((function(e){var t=e.XMLDocument.documentElement.attributes;e.load("localStorage");for(var u=t.length-1;u>=0;u--)e.removeAttribute(t[u].name);e.save("localStorage")})),t.forEach=o((function(e,u){for(var n,r=e.XMLDocument.documentElement.attributes,i=0;n=r[i];++i)u(n.name,t.deserialize(e.getAttribute(n.name)))}))}try{var c="__storejs__";t.set(c,c),t.get(c)!=c&&(t.disabled=!0),t.remove(c)}catch(e){t.disabled=!0}return t.enabled=!t.disabled,t}(),Wt=new(function(){function e(t){u(this,e),this._options={},this.enabled=!1,this.options(t)}return r(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this._options;Ot(e,{enabled:!0}),this.enabled=e.enabled&&Ht.enabled,this._options=e}},{key:"set",value:function(e,t){return!!this.enabled&&Ht.set(e,t)}},{key:"get",value:function(e){return this.enabled?Ht.get(e):null}},{key:"remove",value:function(e){return!!this.enabled&&Ht.remove(e)}}]),e}())({}),Jt="rl_user_id",Yt="rl_trait",$t="rl_anonymous_id",Zt="rl_group_id",Qt="rl_group_trait",Xt="RudderEncrypt:",eu="Rudder",tu=new(function(){function e(){if(u(this,e),Vt.set("rudder_cookies",!0),Vt.get("rudder_cookies"))return Vt.remove("rudder_cookies"),void(this.storage=Vt);Wt.enabled&&(this.storage=Wt)}return r(e,[{key:"stringify",value:function(e){return JSON.stringify(e)}},{key:"parse",value:function(e){try{return e?JSON.parse(e):null}catch(t){return w(t),e||null}}},{key:"trim",value:function(e){return e.replace(/^\s+|\s+$/gm,"")}},{key:"encryptValue",value:function(e){return""==this.trim(e)?e:"".concat(Xt).concat(tt.encrypt(e,eu).toString())}},{key:"decryptValue",value:function(e){return!e||"string"==typeof e&&""==this.trim(e)?e:e.substring(0,Xt.length)==Xt?tt.decrypt(e.substring(Xt.length),eu).toString(ut):e}},{key:"setItem",value:function(e,t){this.storage.set(e,this.encryptValue(this.stringify(t)))}},{key:"setUserId",value:function(e){"string"==typeof e?this.storage.set(Jt,this.encryptValue(this.stringify(e))):w("[Storage] setUserId:: userId should be string")}},{key:"setUserTraits",value:function(e){this.storage.set(Yt,this.encryptValue(this.stringify(e)))}},{key:"setGroupId",value:function(e){"string"==typeof e?this.storage.set(Zt,this.encryptValue(this.stringify(e))):w("[Storage] setGroupId:: groupId should be string")}},{key:"setGroupTraits",value:function(e){this.storage.set(Qt,this.encryptValue(this.stringify(e)))}},{key:"setAnonymousId",value:function(e){"string"==typeof e?this.storage.set($t,this.encryptValue(this.stringify(e))):w("[Storage] setAnonymousId:: anonymousId should be string")}},{key:"getItem",value:function(e){return this.parse(this.decryptValue(this.storage.get(e)))}},{key:"getUserId",value:function(){return this.parse(this.decryptValue(this.storage.get(Jt)))}},{key:"getUserTraits",value:function(){return this.parse(this.decryptValue(this.storage.get(Yt)))}},{key:"getGroupId",value:function(){return this.parse(this.decryptValue(this.storage.get(Zt)))}},{key:"getGroupTraits",value:function(){return this.parse(this.decryptValue(this.storage.get(Qt)))}},{key:"getAnonymousId",value:function(){return this.parse(this.decryptValue(this.storage.get($t)))}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"clear",value:function(){this.storage.remove(Jt),this.storage.remove(Yt),this.storage.remove(Zt),this.storage.remove(Qt)}}]),e}()),uu="lt_synch_timestamp",nu=new(function(){function e(){u(this,e),this.storage=tu}return r(e,[{key:"setLotameSynchTime",value:function(e){this.storage.setItem(uu,e)}},{key:"getLotameSynchTime",value:function(){return this.storage.getItem(uu)}}]),e}()),ru=function(){function e(t,n){var r=this;u(this,e),this.name="LOTAME",this.analytics=n,this.storage=nu,this.bcpUrlSettingsPixel=t.bcpUrlSettingsPixel,this.bcpUrlSettingsIframe=t.bcpUrlSettingsIframe,this.dspUrlSettingsPixel=t.dspUrlSettingsPixel,this.dspUrlSettingsIframe=t.dspUrlSettingsIframe,this.mappings={},t.mappings.forEach((function(e){var t=e.key,u=e.value;r.mappings[t]=u}))}return r(e,[{key:"init",value:function(){F("===in init Lotame==="),window.LOTAME_SYNCH_CALLBACK=function(){}}},{key:"addPixel",value:function(e,t,u){F("Adding pixel for :: ".concat(e));var n=document.createElement("img");n.src=e,n.setAttribute("width",t),n.setAttribute("height",u),F("Image Pixel :: ".concat(n)),document.getElementsByTagName("body")[0].appendChild(n)}},{key:"addIFrame",value:function(e){F("Adding iframe for :: ".concat(e));var t=document.createElement("iframe");t.src=e,t.title="empty",t.setAttribute("id","LOTCCFrame"),t.setAttribute("tabindex","-1"),t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true"),t.setAttribute("style","border: 0px; width: 0px; height: 0px; display: block;"),F("IFrame :: ".concat(t)),document.getElementsByTagName("body")[0].appendChild(t)}},{key:"syncPixel",value:function(e){var t=this;if(F("===== in syncPixel ======"),F("Firing DSP Pixel URLs"),this.dspUrlSettingsPixel&&this.dspUrlSettingsPixel.length>0){var u=Date.now();this.dspUrlSettingsPixel.forEach((function(n){var r=t.compileUrl(s(s({},t.mappings),{},{userId:e,random:u}),n.dspUrlTemplate);t.addPixel(r,"1","1")}))}if(F("Firing DSP IFrame URLs"),this.dspUrlSettingsIframe&&this.dspUrlSettingsIframe.length>0){var n=Date.now();this.dspUrlSettingsIframe.forEach((function(u){var r=t.compileUrl(s(s({},t.mappings),{},{userId:e,random:n}),u.dspUrlTemplate);t.addIFrame(r)}))}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(u){if(e.hasOwnProperty(u)){var n="{{".concat(u,"}}"),r=new RegExp(n,"gi");t=t.replace(r,e[u])}})),t}},{key:"identify",value:function(e){F("in Lotame identify");var t=e.message.userId;this.syncPixel(t)}},{key:"track",value:function(e){F("track not supported for lotame")}},{key:"page",value:function(e){var t=this;if(F("in Lotame page"),F("Firing BCP Pixel URLs"),this.bcpUrlSettingsPixel&&this.bcpUrlSettingsPixel.length>0){var u=Date.now();this.bcpUrlSettingsPixel.forEach((function(e){var n=t.compileUrl(s(s({},t.mappings),{},{random:u}),e.bcpUrlTemplate);t.addPixel(n,"1","1")}))}if(F("Firing BCP IFrame URLs"),this.bcpUrlSettingsIframe&&this.bcpUrlSettingsIframe.length>0){var n=Date.now();this.bcpUrlSettingsIframe.forEach((function(e){var u=t.compileUrl(s(s({},t.mappings),{},{random:n}),e.bcpUrlTemplate);t.addIFrame(u)}))}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 F("in Lotame isLoaded"),!0}},{key:"isReady",value:function(){return!0}}]),e}(),iu=function(){function e(t,n){var r=this;u(this,e),this.referrerOverride=function(e){if(e)return window.optimizelyEffectiveReferrer=e,e},this.sendDataToRudder=function(e){F(e);var t=e.experiment,u=e.variation,n={integrations:{All:!0}},i=e.audiences,o={};i.forEach((function(e){o[e.id]=e.name}));var s=Object.keys(o).sort().join(),a=Object.values(o).sort().join(", ");if(r.sendExperimentTrack){var c={campaignName:e.campaignName,campaignId:e.id,experimentId:t.id,experimentName:t.name,variationName:u.name,variationId:u.id,audienceId:s,audienceName:a,isInCampaignHoldback:e.isInCampaignHoldback};if(t.referrer&&(c.referrer=t.referrer,n.page={referrer:t.referrer}),r.sendExperimentTrackAsNonInteractive&&(c.nonInteraction=1),e&&r.customCampaignProperties.length>0)for(var l=0;l1){var u=t.pop();switch(u){case"str":case"int":case"date":case"real":case"bool":case"strs":case"ints":case"dates":case"reals":case"bools":return"".concat(au(t.join("_")),"_").concat(u)}}return au(e)}}]),e}(),TVSQUARED:function(){function e(t){u(this,e),this.isLoaded=function(){return F("in TVSqaured isLoaded"),!(!window._tvq||window._tvq.push===Array.prototype.push)},this.isReady=function(){return F("in TVSqaured isReady"),!(!window._tvq||window._tvq.push===Array.prototype.push)},this.page=function(){window._tvq.push(["trackPageView"])},this.formatRevenue=function(e){var t=e;return t=parseFloat(t.toString().replace(/^[^\d.]*/,""))},this.brandId=t.brandId,this.clientId=t.clientId,this.eventWhiteList=t.eventWhiteList||[],this.customMetrics=t.customMetrics||[],this.name="TVSquared"}return r(e,[{key:"init",value:function(){F("===in init TVSquared==="),window._tvq=window._tvq||[];var e="https:"===document.location.protocol?"https://":"http://";e+="collector-".concat(this.clientId,".tvsquared.com/"),window._tvq.push(["setSiteId",this.brandId]),window._tvq.push(["setTrackerUrl","".concat(e,"tv2track.php")]),V("TVSquared-integration","".concat(e,"tv2track.js"))}},{key:"track",value:function(e){var t,u,n=e.message,r=n.event,i=n.userId,o=n.anonymousId,s=e.message.properties,a=s.revenue,c=s.productType,l=s.category,d=s.order_id,p=s.promotion_id,D=this.eventWhiteList.slice();for(D=D.filter((function(e){return""!==e.event})),t=0;t>>((3&t)<<3)&255;return n}}})),Eu=[],Au=0;Au<256;++Au)Eu[Au]=(Au+256).toString(16).substr(1);var vu,Fu,wu=function(e,t){var u=t||0,n=Eu;return[n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]]].join("")},bu=0,Bu=0;var ku=function(e,t,u){var n=t&&u||0,r=t||[],i=(e=e||{}).node||vu,o=void 0!==e.clockseq?e.clockseq:Fu;if(null==i||null==o){var s=Cu();null==i&&(i=vu=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==o&&(o=Fu=16383&(s[6]<<8|s[7]))}var a=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Bu+1,l=a-bu+(c-Bu)/1e4;if(l<0&&void 0===e.clockseq&&(o=o+1&16383),(l<0||a>bu)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");bu=a,Bu=c,Fu=o;var d=(1e4*(268435455&(a+=122192928e5))+c)%4294967296;r[n++]=d>>>24&255,r[n++]=d>>>16&255,r[n++]=d>>>8&255,r[n++]=255&d;var p=a/4294967296*1e4&268435455;r[n++]=p>>>8&255,r[n++]=255&p,r[n++]=p>>>24&15|16,r[n++]=p>>>16&255,r[n++]=o>>>8|128,r[n++]=255&o;for(var D=0;D<6;++D)r[n+D]=i[D];return t||wu(r)};var _u=function(e,t,u){var n=t&&u||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var r=(e=e||{}).random||(e.rng||Cu)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(var i=0;i<16;++i)t[n+i]=r[i];return t||wu(r)},Iu=_u;Iu.v1=ku,Iu.v4=_u;var Tu=Iu,Su=Tu.v4,Ou={_data:{},length:0,setItem:function(e,t){return this._data[e]=t,this.length=He(this._data).length,t},getItem:function(e){return e in this._data?this._data[e]:null},removeItem:function(e){return e in this._data&&delete this._data[e],this.length=He(this._data).length,null},clear:function(){this._data={},this.length=0},key:function(e){return He(this._data)[e]}};var xu={defaultEngine:function(){try{if(!window.localStorage)return!1;var e=Su();window.localStorage.setItem(e,"test_value");var t=window.localStorage.getItem(e);return window.localStorage.removeItem(e),"test_value"===t}catch(e){return!1}}()?window.localStorage:Ou,inMemoryEngine:Ou},Pu=xu.defaultEngine,Ru=xu.inMemoryEngine;function ju(e,t,u,n){this.id=t,this.name=e,this.keys=u||{},this.engine=n||Pu,this.originalEngine=this.engine}ju.prototype.set=function(e,t){var u=this._createValidKey(e);if(u)try{this.engine.setItem(u,Pt.stringify(t))}catch(u){(function(e){var t=!1;if(e.code)switch(e.code){case 22:t=!0;break;case 1014:"NS_ERROR_DOM_QUOTA_REACHED"===e.name&&(t=!0)}else-2147024882===e.number&&(t=!0);return t})(u)&&(this._swapEngine(),this.set(e,t))}},ju.prototype.get=function(e){try{var t=this.engine.getItem(this._createValidKey(e));return null===t?null:Pt.parse(t)}catch(e){return null}},ju.prototype.getOriginalEngine=function(){return this.originalEngine},ju.prototype.remove=function(e){this.engine.removeItem(this._createValidKey(e))},ju.prototype._createValidKey=function(e){var t,u=this.name,n=this.id;return He(this.keys).length?(Qe((function(r){r===e&&(t=[u,n,e].join("."))}),this.keys),t):[u,n,e].join(".")},ju.prototype._swapEngine=function(){var e=this;Qe((function(t){var u=e.get(t);Ru.setItem([e.name,e.id,t].join("."),u),e.remove(t)}),this.keys),this.engine=Ru};var Lu=ju;var Uu={setTimeout:function(e,t){return window.setTimeout(e,t)},clearTimeout:function(e){return window.clearTimeout(e)},Date:window.Date},Mu=Uu;function Nu(){this.tasks={},this.nextId=1}Nu.prototype.now=function(){return+new Mu.Date},Nu.prototype.run=function(e,t){var u=this.nextId++;return this.tasks[u]=Mu.setTimeout(this._handle(u,e),t),u},Nu.prototype.cancel=function(e){this.tasks[e]&&(Mu.clearTimeout(this.tasks[e]),delete this.tasks[e])},Nu.prototype.cancelAll=function(){Qe(Mu.clearTimeout,this.tasks),this.tasks={}},Nu.prototype._handle=function(e,t){var u=this;return function(){return delete u.tasks[e],t()}},Nu.setClock=function(e){Mu=e},Nu.resetClock=function(){Mu=Uu};var qu=Nu,zu=Gu;function Gu(e){return Gu.enabled(e)?function(t){t=Ku(t);var u=new Date,n=u-(Gu[e]||u);Gu[e]=u,t=e+" "+t+" +"+Gu.humanize(n),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function Ku(e){return e instanceof Error?e.stack||e.message:e}Gu.names=[],Gu.skips=[],Gu.enable=function(e){try{localStorage.debug=e}catch(e){}for(var t=(e||"").split(/[\s,]+/),u=t.length,n=0;n=36e5?(e/36e5).toFixed(1)+"h":e>=6e4?(e/6e4).toFixed(1)+"m":e>=1e3?(e/1e3|0)+"s":e+"ms"},Gu.enabled=function(e){for(var t=0,u=Gu.skips.length;tthis.maxAttempts)},Ju.prototype.getDelay=function(e){var t=this.backoff.MIN_RETRY_DELAY*Math.pow(this.backoff.FACTOR,e);if(this.backoff.JITTER){var u=Math.random(),n=Math.floor(u*this.backoff.JITTER*t);Math.floor(10*u)<5?t-=n:t+=n}return Number(Math.min(t,this.backoff.MAX_RETRY_DELAY).toPrecision(1))},Ju.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now()})},Ju.prototype.requeue=function(e,t,u){this.shouldRetry(e,t,u)?this._enqueue({item:e,attemptNumber:t,time:this._schedule.now()+this.getDelay(t)}):this.emit("discard",e,t)},Ju.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()},Ju.prototype._processHead=function(){var e=this,t=this._store;this._schedule.cancel(this._processId);var u=t.get(this.keys.QUEUE)||[],n=t.get(this.keys.IN_PROGRESS)||{},r=this._schedule.now(),i=[];function o(u,n){i.push({item:u.item,done:function(r,i){var o=t.get(e.keys.IN_PROGRESS)||{};delete o[n],t.set(e.keys.IN_PROGRESS,o),e.emit("processed",r,i,u.item),r&&e.requeue(u.item,u.attemptNumber+1,r)}})}for(var s=Object.keys(n).length;u.length&&u[0].time<=r&&s++0&&(this._processId=this._schedule.run(this._processHead,u[0].time-r))},Ju.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)},Ju.prototype._checkReclaim=function(){var e=this;Qe((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)=500&&i.status<600?(x(new Error("request failed with status: ".concat(i.status).concat(i.statusText," for url: ").concat(e))),r(new Error("request failed with status: ".concat(i.status).concat(i.statusText," for url: ").concat(e)))):(F("====== request processed successfully: ".concat(i.status)),r(null,i.status)))},i.send(JSON.stringify(u,T))}catch(e){r(e)}}},{key:"enqueue",value:function(e,t){var u=e.getElementContent(),n={"Content-Type":"application/json",Authorization:"Basic ".concat(btoa("".concat(this.writeKey,":"))),AnonymousId:btoa(u.anonymousId)};u.originalTimestamp=O(),u.sentAt=O(),JSON.stringify(u).length>32e3&&w("[EventRepository] enqueue:: message length greater 32 Kb ",u);var r="/"==this.url.slice(-1)?this.url.slice(0,-1):this.url;this.payloadQueue.addItem({url:"".concat(r,"/v1/").concat(t),headers:n,message:u})}}]),e}());function Xu(e){var t=function(t){var u=(t=t||window.event).target||t.srcElement;rn(u)&&(u=u.parentNode),tn(u,t)?F("to be tracked ",t.type):F("not to be tracked ",t.type),function(e,t){var u,n=e.target||e.srcElement;rn(n)&&(n=n.parentNode);if(tn(n,e)){if("form"==n.tagName.toLowerCase()){u={};for(var r=0;r=0)return!0;return!1}(l))return!1;for(;l.parentNode&&!un(l,"body");)on(l)&&c.push(l),l=l.parentNode;var d,p=[];if(c.forEach((function(e){"a"===e.tagName.toLowerCase()&&(d=an(d=e.getAttribute("href"))&&d),p.push(function(e,t){for(var u={classes:sn(e).split(" "),tag_name:e.tagName.toLowerCase()},n=e.attributes.length,r=0;r=0)return!1;t=t.parentNode}if(sn(e).split(" ").indexOf("rudder-include")>=0)return!0;if(un(e,"input")||un(e,"select")||un(e,"textarea")||"true"===e.getAttribute("contenteditable"))return!1;if("inherit"===e.getAttribute("contenteditable"))for(t=e.parentNode;t.parentNode&&!un(t,"body");t=t.parentNode)if("true"===t.getAttribute("contenteditable"))return!1;var u=e.type||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";if("string"==typeof n){if(/^adhar|cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pan|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function sn(e){switch(t(e.className)){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function an(e){if(null==e)return!1;if("string"==typeof e){e=e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1;if(/(^\d{4}-?\d{4}-?\d{4}$)/.test(e))return!1;if(/(^\w{5}-?\d{4}-?\w{1}$)/.test(e))return!1}return!0}function cn(e,t){for(var u=e.attributes.length,n=0;n-1)return!0}return!1}function ln(e){if(e.previousElementSibling)return e.previousElementSibling;do{e=e.previousSibling}while(e&&!nn(e));return e}var dn="ajs_trait_",pn="ajs_prop_";function Dn(e,t){this.eventRepository||(this.eventRepository=Qu),this.eventRepository.enqueue(e,t)}var fn=new(function(){function e(){u(this,e),this.autoTrackHandlersRegistered=!1,this.autoTrackFeatureEnabled=!1,this.initialized=!1,this.trackValues=[],this.eventsBuffer=[],this.clientIntegrations=[],this.loadOnlyIntegrations={},this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=tu,this.eventRepository=Qu,this.sendAdblockPage=!1,this.sendAdblockPageOptions={},this.clientSuppliedCallbacks={},this.readyCallback=function(){},this.executeReadyCallback=void 0,this.methodToCallbackMapping={syncPixel:"syncPixelCallback"},this.loaded=!1}return r(e,[{key:"initializeUser",value:function(){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.storage.setAnonymousId(this.anonymousId),this.storage.setGroupId(this.groupId),this.storage.setUserTraits(this.userTraits),this.storage.setGroupTraits(this.groupTraits)}},{key:"processResponse",value:function(e,t){try{F("===in process response=== ".concat(e)),(t=JSON.parse(t)).source.useAutoTracking&&!this.autoTrackHandlersRegistered&&(this.autoTrackFeatureEnabled=!0,Xu(this),this.autoTrackHandlersRegistered=!0),t.source.destinations.forEach((function(e,t){F("Destination ".concat(t," Enabled? ").concat(e.enabled," Type: ").concat(e.destinationDefinition.name," Use Native SDK? ").concat(e.config.useNativeSDK)),e.enabled&&this.clientIntegrations.push({name:e.destinationDefinition.name,config:e.config})}),this),F("this.clientIntegrations: ",this.clientIntegrations),this.clientIntegrations=U(this.loadOnlyIntegrations,this.clientIntegrations),this.clientIntegrations=this.clientIntegrations.filter((function(e){return null!=lu[e.name]})),this.init(this.clientIntegrations)}catch(e){x(e),F("===handling config BE response processing error==="),F("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Xu(this),this.autoTrackHandlersRegistered=!0)}}},{key:"init",value:function(e){var t=this,u=this;if(F("supported intgs ",lu),!e||0==e.length)return this.readyCallback&&this.readyCallback(),void(this.toBeProcessedByIntegrationArray=[]);e.forEach((function(e){try{F("[Analytics] init :: trying to initialize integration name:: ",e.name);var n=new(0,lu[e.name])(e.config,u);n.init(),F("initializing destination: ",e),t.isInitialized(n).then(t.replayEvents)}catch(t){w("[Analytics] initialize integration (integration.init()) failed :: ",e.name)}}))}},{key:"replayEvents",value:function(e){e.successfullyLoadedIntegration.length+e.failedToBeLoadedIntegration.length===e.clientIntegrations.length&&(F("===replay events called====",e.successfullyLoadedIntegration.length,e.failedToBeLoadedIntegration.length),e.clientIntegrationObjects=[],e.clientIntegrationObjects=e.successfullyLoadedIntegration,F("==registering after callback===",e.clientIntegrationObjects.length),e.executeReadyCallback=D(e.clientIntegrationObjects.length,e.readyCallback),F("==registering ready callback==="),e.on("ready",e.executeReadyCallback),e.clientIntegrationObjects.forEach((function(t){F("===looping over each successful integration===="),t.isReady&&!t.isReady()||(F("===letting know I am ready=====",t.name),e.emit("ready"))})),e.toBeProcessedByIntegrationArray.length>0&&(e.toBeProcessedByIntegrationArray.forEach((function(t){var u=t[0];t.shift(),Object.keys(t[0].message.integrations).length>0&&L(t[0].message.integrations);for(var n=U(t[0].message.integrations,e.clientIntegrationObjects),r=0;r1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(n){return e.isLoaded()?(F("===integration loaded successfully====",e.name),t.successfullyLoadedIntegration.push(e),n(t)):u>=1e4?(F("====max wait over===="),t.failedToBeLoadedIntegration.push(e),n(t)):void t.pause(1e3).then((function(){return F("====after pause, again checking===="),t.isInitialized(e,u+1e3).then(n)}))}))}},{key:"page",value:function(e,u,n,r,i){this.loaded&&("function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=n=null),"function"==typeof u&&(i=u,r=n=u=null),"object"===t(e)&&null!=e&&null!=e&&(r=u,n=e,u=e=null),"object"===t(u)&&null!=u&&null!=u&&(r=n,n=u,u=null),"string"==typeof e&&"string"!=typeof u&&(u=e,e=null),this.sendAdblockPage&&"RudderJS-Initiated"!=e&&this.sendSampleRequest(),this.processPage(e,u,n,r,i))}},{key:"track",value:function(e,t,u,n){this.loaded&&("function"==typeof u&&(n=u,u=null),"function"==typeof t&&(n=t,u=null,t=null),this.processTrack(e,t,u,n))}},{key:"identify",value:function(e,u,n,r){this.loaded&&("function"==typeof n&&(r=n,n=null),"function"==typeof u&&(r=u,n=null,u=null),"object"===t(e)&&(n=u,u=e,e=this.userId),this.processIdentify(e,u,n,r))}},{key:"alias",value:function(e,u,n,r){if(this.loaded){"function"==typeof n&&(r=n,n=null),"function"==typeof u&&(r=u,n=null,u=null),"object"===t(u)&&(n=u,u=null);var i=(new yu).setType("alias").build();i.message.previousId=u||(this.userId?this.userId:this.getAnonymousId()),i.message.userId=e,this.processAndSendDataToDestinations("alias",i,n,r)}}},{key:"group",value:function(e,u,n,r){if(this.loaded&&arguments.length){"function"==typeof n&&(r=n,n=null),"function"==typeof u&&(r=u,n=null,u=null),"object"===t(e)&&(n=u,u=e,e=this.groupId),this.groupId=e,this.storage.setGroupId(this.groupId);var i=(new yu).setType("group").build();if(u)for(var o in u)this.groupTraits[o]=u[o];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",i,n,r)}}},{key:"processPage",value:function(e,t,u,n,r){var i=(new yu).setType("page").build();u||(u={}),t&&(i.message.name=t,u.name=t),e&&(i.message.category=e,u.category=e),i.message.properties=this.getPageProperties(u),this.trackPage(i,n,r)}},{key:"processTrack",value:function(e,t,u,n){var r=(new yu).setType("track").build();e&&r.setEventName(e),t?r.setProperty(t):r.setProperty({}),this.trackEvent(r,u,n)}},{key:"processIdentify",value:function(e,t,u,n){e&&this.userId&&e!==this.userId&&this.reset(),this.userId=e,this.storage.setUserId(this.userId);var r=(new yu).setType("identify").build();if(t){for(var i in t)this.userTraits[i]=t[i];this.storage.setUserTraits(this.userTraits)}this.identifyUser(r,u,n)}},{key:"identifyUser",value:function(e,t,u){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=s({},e.message.context.traits),this.storage.setUserTraits(this.userTraits)),this.processAndSendDataToDestinations("identify",e,t,u)}},{key:"trackPage",value:function(e,t,u){this.processAndSendDataToDestinations("page",e,t,u)}},{key:"trackEvent",value:function(e,t,u){this.processAndSendDataToDestinations("track",e,t,u)}},{key:"processAndSendDataToDestinations",value:function(e,t,u,n){try{this.anonymousId||this.setAnonymousId(),t.message.context.traits=s({},this.userTraits),F("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=s({},this.groupTraits))),this.processOptionsParam(t,u),F(JSON.stringify(t)),Object.keys(t.message.integrations).length>0&&L(t.message.integrations);var r=U(t.message.integrations,this.clientIntegrationObjects);try{r.forEach((function(u){u.isFailed&&u.isFailed()||u[e]&&u[e](t)}))}catch(e){x({message:"[sendToNative]:".concat(e)})}this.clientIntegrationObjects||(F("pushing in replay queue"),this.toBeProcessedByIntegrationArray.push([e,t])),i=t.message.integrations,Object.keys(i).forEach((function(e){i.hasOwnProperty(e)&&(B[e]&&(i[B[e]]=i[e]),"All"!=e&&null!=B[e]&&B[e]!=e&&delete i[e])})),Dn.call(this,t,e),F("".concat(e," is called ")),n&&n()}catch(e){x(e)}var i}},{key:"processOptionsParam",value:function(e,t){var u=e.message,n=u.type,r=u.properties,i=["integrations","anonymousId","originalTimestamp"];for(var o in t)if(i.includes(o))e.message[o]=t[o];else if("context"!==o)e.message.context[o]=t[o];else for(var s in t[o])e.message.context[s]=t[o][s];e.message.context.page="page"==n?this.getContextPageProperties(t,r):this.getContextPageProperties(t)}},{key:"getPageProperties",value:function(e,t){var u=P(),n=t&&t.page?t.page:{};for(var r in u)void 0===e[r]&&(e[r]=n[r]||u[r]);return e}},{key:"getContextPageProperties",value:function(e,t){var u=P(),n=e&&e.page?e.page:{};for(var r in u)void 0===n[r]&&(n[r]=t&&t[r]?t[r]:u[r]);return n}},{key:"reset",value:function(){this.loaded&&(this.userId="",this.userTraits={},this.groupId="",this.groupTraits={},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||S(),this.storage.setAnonymousId(this.anonymousId)}},{key:"isValidWriteKey",value:function(e){return!(!e||"string"!=typeof e||0==e.trim().length)}},{key:"isValidServerUrl",value:function(e){return!(!e||"string"!=typeof e||0==e.trim().length)}},{key:"load",value:function(e,u,n){var r=this;if(F("inside load "),!this.loaded){var i=I;if(!this.isValidWriteKey(e)||!this.isValidServerUrl(u))throw x({message:"[Analytics] load:: Unable to load due to wrong writeKey or serverUrl"}),Error("failed to initialize");if(n&&n.logLevel&&v(n.logLevel),n&&n.integrations&&(Object.assign(this.loadOnlyIntegrations,n.integrations),L(this.loadOnlyIntegrations)),n&&n.configUrl&&(i=function(e){var t=e;return-1==e.indexOf("sourceConfig")&&(t="/"==t.slice(-1)?t.slice(0,-1):t,t="".concat(t,"/sourceConfig/")),(t="/"==t.slice(-1)?t:"".concat(t,"/")).indexOf("?")>-1?t.split("?")[1]!==I.split("?")[1]&&(t="".concat(t.split("?")[0],"?").concat(I.split("?")[1])):t="".concat(t,"?").concat(I.split("?")[1]),t}(n.configUrl)),n&&n.sendAdblockPage&&(this.sendAdblockPage=!0),n&&n.sendAdblockPageOptions&&"object"===t(n.sendAdblockPageOptions)&&(this.sendAdblockPageOptions=n.sendAdblockPageOptions),n&&n.clientSuppliedCallbacks){var o={};Object.keys(this.methodToCallbackMapping).forEach((function(e){r.methodToCallbackMapping.hasOwnProperty(e)&&n.clientSuppliedCallbacks[r.methodToCallbackMapping[e]]&&(o[e]=n.clientSuppliedCallbacks[r.methodToCallbackMapping[e]])})),Object.assign(this.clientSuppliedCallbacks,o),this.registerCallbacks(!0)}this.eventRepository.writeKey=e,u&&(this.eventRepository.url=u),this.initializeUser(),this.loaded=!0,n&&n.valTrackingList&&n.valTrackingList.push==Array.prototype.push&&(this.trackValues=n.valTrackingList),n&&n.useAutoTracking&&(this.autoTrackFeatureEnabled=!0,this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Xu(this),this.autoTrackHandlersRegistered=!0,F("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered)));try{!function(e,t,u,n){var r=n.bind(e),i=new XMLHttpRequest;i.open("GET",t,!0),i.setRequestHeader("Authorization","Basic ".concat(btoa("".concat(u,":")))),i.onload=function(){var e=i.status;200==e?(F("status 200 calling callback"),r(200,i.responseText)):(x(new Error("request failed with status: ".concat(i.status," for url: ").concat(t))),r(e))},i.send()}(this,i,e,this.processResponse)}catch(e){x(e),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&Xu(this)}}}},{key:"ready",value:function(e){this.loaded&&("function"!=typeof e?w("ready callback is not a function"):this.readyCallback=e)}},{key:"initializeCallbacks",value:function(){var e=this;Object.keys(this.methodToCallbackMapping).forEach((function(t){e.methodToCallbackMapping.hasOwnProperty(t)&&e.on(t,(function(){}))}))}},{key:"registerCallbacks",value:function(e){var t=this;e||Object.keys(this.methodToCallbackMapping).forEach((function(e){t.methodToCallbackMapping.hasOwnProperty(e)&&window.rudderanalytics&&"function"==typeof window.rudderanalytics[t.methodToCallbackMapping[e]]&&(t.clientSuppliedCallbacks[e]=window.rudderanalytics[t.methodToCallbackMapping[e]])})),Object.keys(this.clientSuppliedCallbacks).forEach((function(e){t.clientSuppliedCallbacks.hasOwnProperty(e)&&(F("registerCallbacks",e,t.clientSuppliedCallbacks[e]),t.on(e,t.clientSuppliedCallbacks[e]))}))}},{key:"sendSampleRequest",value:function(){V("ad-block","//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js")}},{key:"parseQueryString",value:function(e){var t,u,n={},r=y(e),i=(t=r,u={},Object.keys(t).forEach((function(e){e.substr(0,dn.length)==dn&&(u[e.substr(dn.length)]=t[e])})),u),o=function(e){var t={};return Object.keys(e).forEach((function(u){u.substr(0,pn.length)==pn&&(t[u.substr(pn.length)]=e[u])})),t}(r);return r.ajs_uid&&(n.userId=r.ajs_uid,n.traits=i),r.ajs_aid&&(n.anonymousId=r.ajs_aid),r.ajs_event&&(n.event=r.ajs_event,n.properties=o),n}}]),e}());p(fn),window.addEventListener("error",(function(e){x(e,fn)}),!0),fn.initializeCallbacks(),fn.registerCallbacks(!1);for(var hn=!!window.rudderanalytics&&window.rudderanalytics.push==Array.prototype.push,gn=window.rudderanalytics;gn&&gn[0]&&"load"!==gn[0][0];)gn.shift();if(gn&&gn.length>0&&"load"===gn[0][0]){var mn=gn[0][0];gn[0].shift(),F("=====from init, calling method:: ",mn),fn[mn].apply(fn,a(gn[0])),gn.shift()}if(function(e,t){t.anonymousId?t.userId?e.unshift(["setAnonymousId",t.anonymousId],["identify",t.userId,t.traits]):e.unshift(["setAnonymousId",t.anonymousId]):t.userId&&e.unshift(["identify",t.userId,t.traits]),t.event&&e.push(["track",t.event,t.properties])}(gn,fn.parseQueryString(window.location.search)),hn&&gn&&gn.length>0){for(var yn=0;yn e.length) && (t = e.length); - for (var n = 0, r = new Array(t); n < t; n++) r[n] = e[n]; - return r; - } - let l = 4; - const d = function (e) { - switch (e.toUpperCase()) { - case "INFO": - return void (l = 1); - case "DEBUG": - return void (l = 2); - case "WARN": - return void (l = 3); - } - }; - const p = function () { - let e; - l <= 2 && (e = console).debug.apply(e, arguments); - }; - const f = function () { - let e; - l <= 4 && (e = console).error.apply(e, arguments); - }; - const h = { - All: "All", - "Google Analytics": "GA", - GoogleAnalytics: "GA", - GA: "GA", - "Google Ads": "GOOGLEADS", - GoogleAds: "GOOGLEADS", - GOOGLEADS: "GOOGLEADS", - Braze: "BRAZE", - BRAZE: "BRAZE", - Chartbeat: "CHARTBEAT", - CHARTBEAT: "CHARTBEAT", - Comscore: "COMSCORE", - COMSCORE: "COMSCORE", - Customerio: "CUSTOMERIO", - "Customer.io": "CUSTOMERIO", - "FB Pixel": "FACEBOOK_PIXEL", - "Facebook Pixel": "FACEBOOK_PIXEL", - FB_PIXEL: "FACEBOOK_PIXEL", - "Google Tag Manager": "GOOGLETAGMANAGER", - GTM: "GTM", - Hotjar: "HOTJAR", - hotjar: "HOTJAR", - HOTJAR: "HOTJAR", - Hubspot: "HS", - HUBSPOT: "HS", - Intercom: "INTERCOM", - INTERCOM: "INTERCOM", - Keen: "KEEN", - "Keen.io": "KEEN", - KEEN: "KEEN", - Kissmetrics: "KISSMETRICS", - KISSMETRICS: "KISSMETRICS", - Lotame: "LOTAME", - LOTAME: "LOTAME", - "Visual Website Optimizer": "VWO", - VWO: "VWO", - }; - const g = { - All: "All", - GA: "Google Analytics", - GOOGLEADS: "Google Ads", - BRAZE: "Braze", - CHARTBEAT: "Chartbeat", - COMSCORE: "Comscore", - CUSTOMERIO: "Customer IO", - FACEBOOK_PIXEL: "Facebook Pixel", - GTM: "Google Tag Manager", - HOTJAR: "Hotjar", - HS: "HubSpot", - INTERCOM: "Intercom", - KEEN: "Keen", - KISSMETRICS: "Kiss Metrics", - LOTAME: "Lotame", - VWO: "VWO", - }; - function y(e, t) { - return t == null ? void 0 : t; - } - function m() { - let e = new Date().getTime(); - return ( - typeof performance !== "undefined" && - typeof performance.now === "function" && - (e += performance.now()), - "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (t) { - const n = (e + 16 * Math.random()) % 16 | 0; - return ( - (e = Math.floor(e / 16)), (t === "x" ? n : (3 & n) | 8).toString(16) - ); - }) - ); - } - function v() { - return new Date().toISOString(); - } - function b(e, t) { - let n = e.message ? e.message : void 0; - let r = void 0; - try { - e instanceof Event && - e.target && - e.target.localName == "script" && - ((n = `error in script loading:: src:: ${e.target.src} id:: ${e.target.id}`), - t && - e.target.src.includes("adsbygoogle") && - ((r = !0), - t.page( - "RudderJS-Initiated", - "ad-block page request", - { path: "/ad-blocked", title: n }, - t.sendAdblockPageOptions - ))), - n && !r && f("[Util] handleError:: ", n); - } catch (e) { - f("[Util] handleError:: ", e); - } - } - function w() { - const e = k(); - const t = e ? e.pathname : window.location.pathname; - const n = document.referrer; - const r = window.location.search; - return { - path: t, - referrer: n, - search: r, - title: document.title, - url: (function (e) { - const t = k(); - const n = t ? (t.indexOf("?") > -1 ? t : t + e) : window.location.href; - const r = n.indexOf("#"); - return r > -1 ? n.slice(0, r) : n; - })(r), - }; - } - function k() { - for ( - var e, t = document.getElementsByTagName("link"), n = 0; - (e = t[n]); - n++ - ) - if (e.getAttribute("rel") === "canonical") return e.getAttribute("href"); - } - function I(e, t) { - let n = e.revenue; - return ( - !n && - t && - t.match( - /^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i - ) && - (n = e.total), - (function (e) { - if (e) { - if (typeof e === "number") return e; - if (typeof e === "string") - return ( - (e = e.replace(/\$/g, "")), - (e = parseFloat(e)), - isNaN(e) ? void 0 : e - ); - } - })(n) - ); - } - function _(e) { - Object.keys(e).forEach(function (t) { - e.hasOwnProperty(t) && - (h[t] && (e[h[t]] = e[t]), - t != "All" && h[t] != null && h[t] != t && delete e[t]); - }); - } - function E(e, n) { - const r = []; - if (!n || n.length == 0) return r; - let i = !0; - return typeof n[0] === "string" - ? (e.All != null && (i = e.All), - n.forEach(function (t) { - if (i) { - let n = !0; - e[t] != null && e[t] == 0 && (n = !1), n && r.push(t); - } else e[t] != null && e[t] == 1 && r.push(t); - }), - r) - : t(n[0]) == "object" - ? (e.All != null && (i = e.All), - n.forEach(function (t) { - if (i) { - let n = !0; - e[t.name] != null && e[t.name] == 0 && (n = !1), n && r.push(t); - } else e[t.name] != null && e[t.name] == 1 && r.push(t); - }), - r) - : void 0; - } - const A = { TRACK: "track", PAGE: "page", IDENTIFY: "identify" }; - const C = { - 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", - }; - function T(e, t) { - p(`in script loader=== ${e}`); - const n = document.createElement("script"); - (n.src = t), (n.async = !0), (n.type = "text/javascript"), (n.id = e); - const r = document.getElementsByTagName("script")[0]; - p("==script==", r), r.parentNode.insertBefore(n, r); - } - const O = (function () { - function e(t) { - n(this, e), (this.hubId = t.hubID), (this.name = "HS"); - } - return ( - i(e, [ - { - key: "init", - value() { - T( - "hubspot-integration", - `http://js.hs-scripts.com/${this.hubId}.js` - ), - p("===in init HS==="); - }, - }, - { - key: "identify", - value(e) { - p("in HubspotAnalyticsManager identify"); - const n = e.message.context.traits; - const r = {}; - for (const i in n) - if (Object.getOwnPropertyDescriptor(n, i) && n[i]) { - const o = i; - toString.call(n[i]) == "[object Date]" - ? (r[o] = n[i].getTime()) - : (r[o] = n[i]); - } - const s = e.message.context.user_properties; - for (const a in s) { - if (Object.getOwnPropertyDescriptor(s, a) && s[a]) r[a] = s[a]; - } - (p(r), - void 0 !== - (typeof window === "undefined" ? "undefined" : t(window))) && - (window._hsq = window._hsq || []).push(["identify", r]); - }, - }, - { - key: "track", - value(e) { - p("in HubspotAnalyticsManager track"); - const t = (window._hsq = window._hsq || []); - const 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(e) { - p("in HubspotAnalyticsManager page"); - const 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() { - return ( - p("in hubspot isLoaded"), - !(!window._hsq || window._hsq.push === Array.prototype.push) - ); - }, - }, - { - key: "isReady", - value() { - return !(!window._hsq || window._hsq.push === Array.prototype.push); - }, - }, - ]), - e - ); - })(); - const S = Object.prototype.toString; - const P = function e(t) { - const n = (function (e) { - switch (S.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 e === null - ? "null" - : void 0 === e - ? "undefined" - : e != e - ? "nan" - : e && e.nodeType === 1 - ? "element" - : (t = e) != null && - (t._isBuffer || - (t.constructor && - typeof t.constructor.isBuffer === "function" && - t.constructor.isBuffer(t))) - ? "buffer" - : typeof (e = e.valueOf - ? e.valueOf() - : Object.prototype.valueOf.apply(e)); - let t; - })(t); - if (n === "object") { - var r = {}; - for (const i in t) t.hasOwnProperty(i) && (r[i] = e(t[i])); - return r; - } - if (n === "array") { - r = new Array(t.length); - for (let o = 0, s = t.length; o < s; o++) r[o] = e(t[o]); - return r; - } - if (n === "regexp") { - let a = ""; - return ( - (a += t.multiline ? "m" : ""), - (a += t.global ? "g" : ""), - (a += t.ignoreCase ? "i" : ""), - new RegExp(t.source, a) - ); - } - return n === "date" ? new Date(t.getTime()) : t; - }; - const x = - typeof globalThis !== "undefined" - ? globalThis - : typeof window !== "undefined" - ? window - : typeof global !== "undefined" - ? global - : typeof self !== "undefined" - ? self - : {}; - function R(e, t) { - return e((t = { exports: {} }), t.exports), t.exports; - } - const j = 1e3; - const D = 6e4; - const U = 60 * D; - const L = 24 * U; - const M = function (e, t) { - return ( - (t = t || {}), - typeof e === "string" - ? (function (e) { - if ((e = `${e}`).length > 1e4) return; - const 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; - const n = parseFloat(t[1]); - switch ((t[2] || "ms").toLowerCase()) { - case "years": - case "year": - case "yrs": - case "yr": - case "y": - return 315576e5 * n; - case "days": - case "day": - case "d": - return n * L; - case "hours": - case "hour": - case "hrs": - case "hr": - case "h": - return n * U; - case "minutes": - case "minute": - case "mins": - case "min": - case "m": - return n * D; - case "seconds": - case "second": - case "secs": - case "sec": - case "s": - return n * j; - case "milliseconds": - case "millisecond": - case "msecs": - case "msec": - case "ms": - return n; - } - })(e) - : t.long - ? (function (e) { - return ( - N(e, L, "day") || - N(e, U, "hour") || - N(e, D, "minute") || - N(e, j, "second") || - `${e} ms` - ); - })(e) - : (function (e) { - return e >= L - ? `${Math.round(e / L)}d` - : e >= U - ? `${Math.round(e / U)}h` - : e >= D - ? `${Math.round(e / D)}m` - : e >= j - ? `${Math.round(e / j)}s` - : `${e}ms`; - })(e) - ); - }; - function N(e, t, n) { - if (!(e < t)) - return e < 1.5 * t - ? `${Math.floor(e / t)} ${n}` - : `${Math.ceil(e / t)} ${n}s`; - } - const B = R(function (e, t) { - ((t = e.exports = function (e) { - function r() {} - function o() { - const e = o; - const r = +new Date(); - const s = r - (n || r); - (e.diff = s), - (e.prev = n), - (e.curr = r), - (n = r), - e.useColors == null && (e.useColors = t.useColors()), - e.color == null && e.useColors && (e.color = i()); - let a = Array.prototype.slice.call(arguments); - (a[0] = t.coerce(a[0])), - typeof a[0] !== "string" && (a = ["%o"].concat(a)); - let u = 0; - (a[0] = a[0].replace(/%([a-z%])/g, function (n, r) { - if (n === "%%") return n; - u++; - const i = t.formatters[r]; - if (typeof i === "function") { - const o = a[u]; - (n = i.call(e, o)), a.splice(u, 1), u--; - } - return n; - })), - typeof t.formatArgs === "function" && (a = t.formatArgs.apply(e, a)); - const c = o.log || t.log || console.log.bind(console); - c.apply(e, a); - } - (r.enabled = !1), (o.enabled = !0); - const s = t.enabled(e) ? o : r; - return (s.namespace = e), s; - }).coerce = function (e) { - return e instanceof Error ? e.stack || e.message : e; - }), - (t.disable = function () { - t.enable(""); - }), - (t.enable = function (e) { - t.save(e); - for (let n = (e || "").split(/[\s,]+/), r = n.length, i = 0; i < r; i++) - n[i] && - ((e = n[i].replace(/\*/g, ".*?"))[0] === "-" - ? t.skips.push(new RegExp(`^${e.substr(1)}$`)) - : t.names.push(new RegExp(`^${e}$`))); - }), - (t.enabled = function (e) { - let n; - let r; - for (n = 0, r = t.skips.length; n < r; n++) - if (t.skips[n].test(e)) return !1; - for (n = 0, r = t.names.length; n < r; n++) - if (t.names[n].test(e)) return !0; - return !1; - }), - (t.humanize = M), - (t.names = []), - (t.skips = []), - (t.formatters = {}); - let n; - let r = 0; - function i() { - return t.colors[r++ % t.colors.length]; - } - }); - const q = - (B.coerce, - B.disable, - B.enable, - B.enabled, - B.humanize, - B.names, - B.skips, - B.formatters, - R(function (e, t) { - function n() { - let e; - try { - e = t.storage.debug; - } catch (e) {} - return e; - } - ((t = e.exports = B).log = function () { - return ( - typeof console === "object" && - console.log && - Function.prototype.apply.call(console.log, console, arguments) - ); - }), - (t.formatArgs = function () { - let e = arguments; - const n = this.useColors; - if ( - ((e[0] = `${ - (n ? "%c" : "") + - this.namespace + - (n ? " %c" : " ") + - e[0] + - (n ? "%c " : " ") - }+${t.humanize(this.diff)}`), - !n) - ) - return e; - const r = `color: ${this.color}`; - e = [e[0], r, "color: inherit"].concat( - Array.prototype.slice.call(e, 1) - ); - let i = 0; - let o = 0; - return ( - e[0].replace(/%[a-z%]/g, function (e) { - e !== "%%" && (i++, e === "%c" && (o = i)); - }), - e.splice(o, 0, r), - e - ); - }), - (t.save = function (e) { - try { - e == null ? t.storage.removeItem("debug") : (t.storage.debug = e); - } catch (e) {} - }), - (t.load = n), - (t.useColors = function () { - return ( - "WebkitAppearance" in document.documentElement.style || - (window.console && - (console.firebug || (console.exception && console.table))) || - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && - parseInt(RegExp.$1, 10) >= 31) - ); - }), - (t.storage = - typeof chrome !== "undefined" && 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()); - })); - const F = - (q.log, - q.formatArgs, - q.save, - q.load, - q.useColors, - q.storage, - q.colors, - q("cookie")); - const K = function (e, t, n) { - switch (arguments.length) { - case 3: - case 2: - return G(e, t, n); - case 1: - return V(e); - default: - return H(); - } - }; - function G(e, t, n) { - n = n || {}; - let r = `${z(e)}=${z(t)}`; - t == null && (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 H() { - let e; - try { - e = document.cookie; - } catch (e) { - return ( - typeof console !== "undefined" && - typeof console.error === "function" && - console.error(e.stack || e), - {} - ); - } - return (function (e) { - let t; - const n = {}; - const r = e.split(/ *; */); - if (r[0] == "") return n; - for (let i = 0; i < r.length; ++i) - (t = r[i].split("=")), (n[J(t[0])] = J(t[1])); - return n; - })(e); - } - function V(e) { - return H()[e]; - } - function z(e) { - try { - return encodeURIComponent(e); - } catch (t) { - F("error `encode(%o)` - %o", e, t); - } - } - function J(e) { - try { - return decodeURIComponent(e); - } catch (t) { - F("error `decode(%o)` - %o", e, t); - } - } - const W = Math.max; - const $ = function (e, t) { - const n = t ? t.length : 0; - if (!n) return []; - for ( - var r = W(Number(e) || 0, 0), i = W(n - r, 0), o = new Array(i), s = 0; - s < i; - s += 1 - ) - o[s] = t[s + r]; - return o; - }; - const Y = Math.max; - const Q = function (e) { - if (e == null || !e.length) return []; - for (var t = new Array(Y(e.length - 2, 0)), n = 1; n < e.length; n += 1) - t[n - 1] = e[n]; - return t; - }; - const Z = Object.prototype.hasOwnProperty; - const X = Object.prototype.toString; - const ee = function (e) { - return Boolean(e) && typeof e === "object"; - }; - const te = function (e) { - return Boolean(e) && X.call(e) === "[object Object]"; - }; - const ne = function (e, t, n, r) { - return Z.call(t, r) && void 0 === e[r] && (e[r] = n), t; - }; - const re = function (e, t, n, r) { - return ( - Z.call(t, r) && - (te(e[r]) && te(n) - ? (e[r] = oe(e[r], n)) - : void 0 === e[r] && (e[r] = n)), - t - ); - }; - const ie = function (e, t) { - if (!ee(t)) return t; - e = e || ne; - for (let n = $(2, arguments), r = 0; r < n.length; r += 1) - for (const i in n[r]) e(t, n[r], n[r][i], i); - return t; - }; - var oe = function (e) { - return ie.apply(null, [re, e].concat(Q(arguments))); - }; - const se = function (e) { - return ie.apply(null, [null, e].concat(Q(arguments))); - }; - const ae = oe; - se.deep = ae; - const ue = R(function (e, t) { - (function () { - const n = { function: !0, object: !0 }; - const r = n.object && t && !t.nodeType && t; - let i = (n[typeof window] && window) || this; - const o = r && n.object && e && !e.nodeType && typeof x === "object" && x; - function s(e, t) { - e || (e = i.Object()), t || (t = i.Object()); - const r = e.Number || i.Number; - const o = e.String || i.String; - const a = e.Object || i.Object; - const u = e.Date || i.Date; - const c = e.SyntaxError || i.SyntaxError; - const l = e.TypeError || i.TypeError; - const d = e.Math || i.Math; - const p = e.JSON || i.JSON; - typeof p === "object" && - p && - ((t.stringify = p.stringify), (t.parse = p.parse)); - const f = a.prototype; - const h = f.toString; - const g = f.hasOwnProperty; - function y(e, t) { - try { - e(); - } catch (e) { - t && t(); - } - } - let m = new u(-0xc782b5b800cec); - function v(e) { - if (v[e] != null) return v[e]; - let n; - if (e == "bug-string-char-index") n = "a"[0] != "a"; - else if (e == "json") - n = - v("json-stringify") && v("date-serialization") && v("json-parse"); - else if (e == "date-serialization") { - if ((n = v("json-stringify") && m)) { - var i = t.stringify; - y(function () { - n = - i(new u(-864e13)) == '"-271821-04-20T00:00:00.000Z"' && - i(new u(864e13)) == '"+275760-09-13T00:00:00.000Z"' && - i(new u(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && - i(new u(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - let s; - const a = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; - if (e == "json-stringify") { - let c = typeof (i = t.stringify) === "function"; - c && - (((s = function () { - return 1; - }).toJSON = s), - y( - function () { - c = - i(0) === "0" && - i(new r()) === "0" && - i(new o()) == '""' && - void 0 === i(h) && - void 0 === i(void 0) && - void 0 === i() && - i(s) === "1" && - i([s]) == "[1]" && - i([void 0]) == "[null]" && - i(null) == "null" && - i([void 0, h, null]) == "[null,null,null]" && - i({ a: [s, !0, !1, null, "\0\b\n\f\r\t"] }) == a && - i(null, s) === "1" && - i([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, - function () { - c = !1; - } - )), - (n = c); - } - if (e == "json-parse") { - let l; - const d = t.parse; - typeof d === "function" && - y( - function () { - d("0") !== 0 || - d(!1) || - ((s = d(a)), - (l = s.a.length == 5 && s.a[0] === 1) && - (y(function () { - l = !d('"\t"'); - }), - l && - y(function () { - l = d("01") !== 1; - }), - l && - y(function () { - l = d("1.") !== 1; - }))); - }, - function () { - l = !1; - } - ), - (n = l); - } - } - return (v[e] = !!n); - } - if ( - (y(function () { - m = - m.getUTCFullYear() == -109252 && - m.getUTCMonth() === 0 && - m.getUTCDate() === 1 && - m.getUTCHours() == 10 && - m.getUTCMinutes() == 37 && - m.getUTCSeconds() == 6 && - m.getUTCMilliseconds() == 708; - }), - (v["bug-string-char-index"] = v["date-serialization"] = v.json = v[ - "json-stringify" - ] = v["json-parse"] = null), - !v("json")) - ) { - const b = v("bug-string-char-index"); - var w = function (e, t) { - let r; - let i; - let o; - let s = 0; - for (o in (((r = function () { - this.valueOf = 0; - }).prototype.valueOf = 0), - (i = new r()))) - g.call(i, o) && s++; - return ( - (r = i = null), - s - ? (w = function (e, t) { - let n; - let r; - const i = h.call(e) == "[object Function]"; - for (n in e) - (i && n == "prototype") || - !g.call(e, n) || - (r = n === "constructor") || - t(n); - (r || g.call(e, (n = "constructor"))) && t(n); - }) - : ((i = [ - "valueOf", - "toString", - "toLocaleString", - "propertyIsEnumerable", - "isPrototypeOf", - "hasOwnProperty", - "constructor", - ]), - (w = function (e, t) { - let r; - let o; - const s = h.call(e) == "[object Function]"; - const a = - (!s && - typeof e.constructor !== "function" && - n[typeof e.hasOwnProperty] && - e.hasOwnProperty) || - g; - for (r in e) - (s && r == "prototype") || !a.call(e, r) || t(r); - for (o = i.length; (r = i[--o]); ) a.call(e, r) && t(r); - })), - w(e, t) - ); - }; - if (!v("json-stringify") && !v("date-serialization")) { - const k = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t", - }; - const I = function (e, t) { - return `000000${t || 0}`.slice(-e); - }; - var _ = function (e) { - let t; - let n; - let r; - let i; - let o; - let s; - let a; - let u; - let c; - if (m) - t = function (e) { - (n = e.getUTCFullYear()), - (r = e.getUTCMonth()), - (i = e.getUTCDate()), - (s = e.getUTCHours()), - (a = e.getUTCMinutes()), - (u = e.getUTCSeconds()), - (c = e.getUTCMilliseconds()); - }; - else { - const l = d.floor; - const p = [ - 0, - 31, - 59, - 90, - 120, - 151, - 181, - 212, - 243, - 273, - 304, - 334, - ]; - const f = function (e, t) { - return ( - p[t] + - 365 * (e - 1970) + - l((e - 1969 + (t = +(t > 1))) / 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; - f(n + 1, 0) <= i; - n++ - ); - for (r = l((i - f(n, 0)) / 30.42); f(n, r + 1) <= i; r++); - (i = 1 + i - f(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 (_ = function (e) { - return ( - e > -1 / 0 && e < 1 / 0 - ? (t(e), - (e = `${ - n <= 0 || n >= 1e4 - ? (n < 0 ? "-" : "+") + I(6, n < 0 ? -n : n) - : I(4, n) - }-${I(2, r + 1)}-${I(2, i)}T${I(2, s)}:${I(2, a)}:${I( - 2, - u - )}.${I(3, c)}Z`), - (n = r = i = s = a = u = c = null)) - : (e = null), - e - ); - })(e); - }; - if (v("json-stringify") && !v("date-serialization")) { - function E(e) { - return _(this); - } - const A = t.stringify; - t.stringify = function (e, t, n) { - const r = u.prototype.toJSON; - u.prototype.toJSON = E; - const i = A(e, t, n); - return (u.prototype.toJSON = r), i; - }; - } else { - const C = function (e) { - const t = e.charCodeAt(0); - const n = k[t]; - return n || `\\u00${I(2, t.toString(16))}`; - }; - const T = /[\x00-\x1f\x22\x5c]/g; - const O = function (e) { - return ( - (T.lastIndex = 0), `"${T.test(e) ? e.replace(T, C) : e}"` - ); - }; - var S = function (e, t, n, r, i, o, s) { - let a; - let c; - let d; - let p; - let f; - let g; - let m; - let v; - let b; - if ( - (y(function () { - a = t[e]; - }), - typeof a === "object" && - a && - (a.getUTCFullYear && - h.call(a) == "[object Date]" && - a.toJSON === u.prototype.toJSON - ? (a = _(a)) - : typeof a.toJSON === "function" && (a = a.toJSON(e))), - n && (a = n.call(t, e, a)), - a == null) - ) - return void 0 === a ? a : "null"; - switch ( - ((c = typeof a) == "object" && (d = h.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 O(`${a}`); - } - if (typeof a === "object") { - for (m = s.length; m--; ) if (s[m] === a) throw l(); - if ( - (s.push(a), - (p = []), - (v = o), - (o += i), - d == "[object Array]") - ) { - for (g = 0, m = a.length; g < m; g++) - (f = S(g, a, n, r, i, o, s)), - p.push(void 0 === f ? "null" : f); - b = p.length - ? i - ? `[\n${o}${p.join(`,\n${o}`)}\n${v}]` - : `[${p.join(",")}]` - : "[]"; - } else - w(r || a, function (e) { - const t = S(e, a, n, r, i, o, s); - void 0 !== t && p.push(`${O(e)}:${i ? " " : ""}${t}`); - }), - (b = p.length - ? i - ? `{\n${o}${p.join(`,\n${o}`)}\n${v}}` - : `{${p.join(",")}}` - : "{}"); - return s.pop(), b; - } - }; - t.stringify = function (e, t, r) { - let i; - let o; - let s; - let a; - if (n[typeof t] && t) - if ((a = h.call(t)) == "[object Function]") o = t; - else if (a == "[object Array]") { - s = {}; - for (var u, c = 0, l = t.length; c < l; ) - (u = t[c++]), - ((a = h.call(u)) != "[object String]" && - a != "[object Number]") || - (s[u] = 1); - } - if (r) - if ((a = h.call(r)) == "[object Number]") { - if ((r -= r % 1) > 0) - for (r > 10 && (r = 10), i = ""; i.length < r; ) i += " "; - } else - a == "[object String]" && - (i = r.length <= 10 ? r : r.slice(0, 10)); - return S("", (((u = {})[""] = e), u), o, s, i, "", []); - }; - } - } - if (!v("json-parse")) { - let P; - let x; - const R = o.fromCharCode; - const j = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r", - }; - const D = function () { - throw ((P = x = null), c()); - }; - const U = function () { - for (var e, t, n, r, i, o = x, s = o.length; P < s; ) - switch ((i = o.charCodeAt(P))) { - case 9: - case 10: - case 13: - case 32: - P++; - break; - case 123: - case 125: - case 91: - case 93: - case 58: - case 44: - return (e = b ? o.charAt(P) : o[P]), P++, e; - case 34: - for (e = "@", P++; P < s; ) - if ((i = o.charCodeAt(P)) < 32) D(); - else if (i == 92) - switch ((i = o.charCodeAt(++P))) { - case 92: - case 34: - case 47: - case 98: - case 116: - case 110: - case 102: - case 114: - (e += j[i]), P++; - break; - case 117: - for (t = ++P, n = P + 4; P < n; P++) - ((i = o.charCodeAt(P)) >= 48 && i <= 57) || - (i >= 97 && i <= 102) || - (i >= 65 && i <= 70) || - D(); - e += R(`0x${o.slice(t, P)}`); - break; - default: - D(); - } - else { - if (i == 34) break; - for ( - i = o.charCodeAt(P), t = P; - i >= 32 && i != 92 && i != 34; - - ) - i = o.charCodeAt(++P); - e += o.slice(t, P); - } - if (o.charCodeAt(P) == 34) return P++, e; - D(); - default: - if ( - ((t = P), - i == 45 && ((r = !0), (i = o.charCodeAt(++P))), - i >= 48 && i <= 57) - ) { - for ( - i == 48 && - (i = o.charCodeAt(P + 1)) >= 48 && - i <= 57 && - D(), - r = !1; - P < s && (i = o.charCodeAt(P)) >= 48 && i <= 57; - P++ - ); - if (o.charCodeAt(P) == 46) { - for ( - n = ++P; - n < s && !((i = o.charCodeAt(n)) < 48 || i > 57); - n++ - ); - n == P && D(), (P = n); - } - if ((i = o.charCodeAt(P)) == 101 || i == 69) { - for ( - ((i = o.charCodeAt(++P)) != 43 && i != 45) || P++, - n = P; - n < s && !((i = o.charCodeAt(n)) < 48 || i > 57); - n++ - ); - n == P && D(), (P = n); - } - return +o.slice(t, P); - } - r && D(); - var a = o.slice(P, P + 4); - if (a == "true") return (P += 4), !0; - if (a == "fals" && o.charCodeAt(P + 4) == 101) - return (P += 5), !1; - if (a == "null") return (P += 4), null; - D(); - } - return "$"; - }; - var L = function (e) { - let t; - let n; - if ((e == "$" && D(), typeof e === "string")) { - if ((b ? e.charAt(0) : e[0]) == "@") return e.slice(1); - if (e == "[") { - for (t = []; (e = U()) != "]"; ) - n ? (e == "," ? (e = U()) == "]" && D() : D()) : (n = !0), - e == "," && D(), - t.push(L(e)); - return t; - } - if (e == "{") { - for (t = {}; (e = U()) != "}"; ) - n ? (e == "," ? (e = U()) == "}" && D() : D()) : (n = !0), - (e != "," && - typeof e === "string" && - (b ? e.charAt(0) : e[0]) == "@" && - U() == ":") || - D(), - (t[e.slice(1)] = L(U())); - return t; - } - D(); - } - return e; - }; - const M = function (e, t, n) { - const r = N(e, t, n); - void 0 === r ? delete e[t] : (e[t] = r); - }; - var N = function (e, t, n) { - let r; - const i = e[t]; - if (typeof i === "object" && i) - if (h.call(i) == "[object Array]") - for (r = i.length; r--; ) M(h, w, i); - else - w(i, function (e) { - M(i, e, n); - }); - return n.call(e, t, i); - }; - t.parse = function (e, t) { - let n; - let r; - return ( - (P = 0), - (x = `${e}`), - (n = L(U())), - U() != "$" && D(), - (P = x = null), - t && h.call(t) == "[object Function]" - ? N((((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 { - let a = i.JSON; - let u = i.JSON3; - let c = !1; - var l = s( - i, - (i.JSON3 = { - noConflict() { - return ( - c || ((c = !0), (i.JSON = a), (i.JSON3 = u), (a = u = null)), l - ); - }, - }) - ); - i.JSON = { parse: l.parse, stringify: l.stringify }; - } - }.call(x)); - }); - const ce = R(function (e, t) { - function n(e) { - switch (e) { - case "http:": - return 80; - case "https:": - return 443; - default: - return location.port; - } - } - (t.parse = function (e) { - const t = document.createElement("a"); - return ( - (t.href = e), - { - href: t.href, - host: t.host || location.host, - port: t.port === "0" || 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 e.indexOf("//") == 0 || !!~e.indexOf("://"); - }), - (t.isRelative = function (e) { - return !t.isAbsolute(e); - }), - (t.isCrossDomain = function (e) { - e = t.parse(e); - const n = t.parse(window.location.href); - return ( - e.hostname !== n.hostname || - e.port !== n.port || - e.protocol !== n.protocol - ); - }); - }); - const le = - (ce.parse, - ce.isAbsolute, - ce.isRelative, - ce.isCrossDomain, - R(function (e, t) { - ((t = e.exports = function (e) { - function r() {} - function o() { - const e = o; - const r = +new Date(); - const s = r - (n || r); - (e.diff = s), - (e.prev = n), - (e.curr = r), - (n = r), - e.useColors == null && (e.useColors = t.useColors()), - e.color == null && e.useColors && (e.color = i()); - let a = Array.prototype.slice.call(arguments); - (a[0] = t.coerce(a[0])), - typeof a[0] !== "string" && (a = ["%o"].concat(a)); - let u = 0; - (a[0] = a[0].replace(/%([a-z%])/g, function (n, r) { - if (n === "%%") return n; - u++; - const i = t.formatters[r]; - if (typeof i === "function") { - const o = a[u]; - (n = i.call(e, o)), a.splice(u, 1), u--; - } - return n; - })), - typeof t.formatArgs === "function" && - (a = t.formatArgs.apply(e, a)); - const c = o.log || t.log || console.log.bind(console); - c.apply(e, a); - } - (r.enabled = !1), (o.enabled = !0); - const s = t.enabled(e) ? o : r; - return (s.namespace = e), s; - }).coerce = function (e) { - return e instanceof Error ? e.stack || e.message : e; - }), - (t.disable = function () { - t.enable(""); - }), - (t.enable = function (e) { - t.save(e); - for ( - let n = (e || "").split(/[\s,]+/), r = n.length, i = 0; - i < r; - i++ - ) - n[i] && - ((e = n[i].replace(/\*/g, ".*?"))[0] === "-" - ? t.skips.push(new RegExp(`^${e.substr(1)}$`)) - : t.names.push(new RegExp(`^${e}$`))); - }), - (t.enabled = function (e) { - let n; - let r; - for (n = 0, r = t.skips.length; n < r; n++) - if (t.skips[n].test(e)) return !1; - for (n = 0, r = t.names.length; n < r; n++) - if (t.names[n].test(e)) return !0; - return !1; - }), - (t.humanize = M), - (t.names = []), - (t.skips = []), - (t.formatters = {}); - let n; - let r = 0; - function i() { - return t.colors[r++ % t.colors.length]; - } - })); - const de = - (le.coerce, - le.disable, - le.enable, - le.enabled, - le.humanize, - le.names, - le.skips, - le.formatters, - R(function (e, t) { - function n() { - let e; - try { - e = t.storage.debug; - } catch (e) {} - return e; - } - ((t = e.exports = le).log = function () { - return ( - typeof console === "object" && - console.log && - Function.prototype.apply.call(console.log, console, arguments) - ); - }), - (t.formatArgs = function () { - let e = arguments; - const n = this.useColors; - if ( - ((e[0] = `${ - (n ? "%c" : "") + - this.namespace + - (n ? " %c" : " ") + - e[0] + - (n ? "%c " : " ") - }+${t.humanize(this.diff)}`), - !n) - ) - return e; - const r = `color: ${this.color}`; - e = [e[0], r, "color: inherit"].concat( - Array.prototype.slice.call(e, 1) - ); - let i = 0; - let o = 0; - return ( - e[0].replace(/%[a-z%]/g, function (e) { - e !== "%%" && (i++, e === "%c" && (o = i)); - }), - e.splice(o, 0, r), - e - ); - }), - (t.save = function (e) { - try { - e == null ? t.storage.removeItem("debug") : (t.storage.debug = e); - } catch (e) {} - }), - (t.load = n), - (t.useColors = function () { - return ( - "WebkitAppearance" in document.documentElement.style || - (window.console && - (console.firebug || (console.exception && console.table))) || - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && - parseInt(RegExp.$1, 10) >= 31) - ); - }), - (t.storage = - typeof chrome !== "undefined" && 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()); - })); - const pe = - (de.log, - de.formatArgs, - de.save, - de.load, - de.useColors, - de.storage, - de.colors, - de("cookie")); - const fe = function (e, t, n) { - switch (arguments.length) { - case 3: - case 2: - return he(e, t, n); - case 1: - return ye(e); - default: - return ge(); - } - }; - function he(e, t, n) { - n = n || {}; - let r = `${me(e)}=${me(t)}`; - t == null && (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"), - (document.cookie = r); - } - function ge() { - let e; - try { - e = document.cookie; - } catch (e) { - return ( - typeof console !== "undefined" && - typeof console.error === "function" && - console.error(e.stack || e), - {} - ); - } - return (function (e) { - let t; - const n = {}; - const r = e.split(/ *; */); - if (r[0] == "") return n; - for (let i = 0; i < r.length; ++i) - (t = r[i].split("=")), (n[ve(t[0])] = ve(t[1])); - return n; - })(e); - } - function ye(e) { - return ge()[e]; - } - function me(e) { - try { - return encodeURIComponent(e); - } catch (t) { - pe("error `encode(%o)` - %o", e, t); - } - } - function ve(e) { - try { - return decodeURIComponent(e); - } catch (t) { - pe("error `decode(%o)` - %o", e, t); - } - } - const be = R(function (e, t) { - const n = ce.parse; - function r(e) { - for (let n = t.cookie, r = t.levels(e), i = 0; i < r.length; ++i) { - const o = r[i]; - const s = { domain: `.${o}` }; - if ((n("__tld__", 1, s), n("__tld__"))) return n("__tld__", null, s), o; - } - return ""; - } - (r.levels = function (e) { - const t = n(e).hostname.split("."); - const r = t[t.length - 1]; - const i = []; - if (t.length === 4 && r === parseInt(r, 10)) return i; - if (t.length <= 1) return i; - for (let o = t.length - 2; o >= 0; --o) i.push(t.slice(o).join(".")); - return i; - }), - (r.cookie = fe), - (t = e.exports = r); - }); - const we = new ((function () { - function e(t) { - n(this, e), (this._options = {}), this.options(t); - } - return ( - i(e, [ - { - key: "options", - value() { - const e = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : {}; - if (arguments.length === 0) return this._options; - let t = `.${be(window.location.href)}`; - t === "." && (t = null), - (this._options = se(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(e, t) { - try { - return (t = ue.stringify(t)), K(e, t, P(this._options)), !0; - } catch (e) { - return !1; - } - }, - }, - { - key: "get", - value(e) { - let t; - try { - return (t = (t = K(e)) ? ue.parse(t) : null); - } catch (e) { - return t || null; - } - }, - }, - { - key: "remove", - value(e) { - try { - return K(e, null, P(this._options)), !0; - } catch (e) { - return !1; - } - }, - }, - ]), - e - ); - })())({}); - const ke = (function () { - let e; - const t = {}; - const n = typeof window !== "undefined" ? window : x; - const r = n.document; - 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) { - r == null && ((r = n), (n = null)), n == null && (n = {}); - const i = t.get(e, n); - r(i), t.set(e, i); - }), - (t.getAll = function () { - const e = {}; - return ( - t.forEach(function (t, n) { - e[t] = n; - }), - e - ); - }), - (t.forEach = function () {}), - (t.serialize = function (e) { - return ue.stringify(e); - }), - (t.deserialize = function (e) { - if (typeof e === "string") - try { - return ue.parse(e); - } catch (t) { - return e || void 0; - } - }), - (function () { - try { - return "localStorage" in n && n.localStorage; - } catch (e) { - return !1; - } - })()) - ) - (e = n.localStorage), - (t.set = function (n, r) { - return void 0 === r ? t.remove(n) : (e.setItem(n, t.serialize(r)), r); - }), - (t.get = function (n, r) { - const 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 (let r = 0; r < e.length; r++) { - const i = e.key(r); - n(i, t.get(i)); - } - }); - else if (r && r.documentElement.addBehavior) { - let i; - let o; - try { - (o = new ActiveXObject("htmlfile")).open(), - o.write( - '' - ), - o.close(), - (i = o.w.frames[0].document), - (e = i.createElement("div")); - } catch (t) { - (e = r.createElement("div")), (i = r.body); - } - const s = function (n) { - return function () { - const r = Array.prototype.slice.call(arguments, 0); - r.unshift(e), - i.appendChild(e), - e.addBehavior("#default#userData"), - e.load("localStorage"); - const o = n.apply(t, r); - return i.removeChild(e), o; - }; - }; - const a = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g"); - const u = function (e) { - return e.replace(/^d/, "___$&").replace(a, "___"); - }; - (t.set = s(function (e, n, r) { - return ( - (n = u(n)), - void 0 === r - ? t.remove(n) - : (e.setAttribute(n, t.serialize(r)), e.save("localStorage"), r) - ); - })), - (t.get = s(function (e, n, r) { - n = u(n); - const i = t.deserialize(e.getAttribute(n)); - return void 0 === i ? r : i; - })), - (t.remove = s(function (e, t) { - (t = u(t)), e.removeAttribute(t), e.save("localStorage"); - })), - (t.clear = s(function (e) { - const t = e.XMLDocument.documentElement.attributes; - e.load("localStorage"); - for (let n = t.length - 1; n >= 0; n--) e.removeAttribute(t[n].name); - e.save("localStorage"); - })), - (t.forEach = s(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 { - const c = "__storejs__"; - t.set(c, c), t.get(c) != c && (t.disabled = !0), t.remove(c); - } catch (e) { - t.disabled = !0; - } - return (t.enabled = !t.disabled), t; - })(); - const Ie = new ((function () { - function e(t) { - n(this, e), (this._options = {}), (this.enabled = !1), this.options(t); - } - return ( - i(e, [ - { - key: "options", - value() { - const e = - arguments.length > 0 && void 0 !== arguments[0] - ? arguments[0] - : {}; - if (arguments.length === 0) return this._options; - se(e, { enabled: !0 }), - (this.enabled = e.enabled && ke.enabled), - (this._options = e); - }, - }, - { - key: "set", - value(e, t) { - return !!this.enabled && ke.set(e, t); - }, - }, - { - key: "get", - value(e) { - return this.enabled ? ke.get(e) : null; - }, - }, - { - key: "remove", - value(e) { - return !!this.enabled && ke.remove(e); - }, - }, - ]), - e - ); - })())({}); - const _e = "rl_user_id"; - const Ee = "rl_trait"; - const Ae = "rl_anonymous_id"; - const Ce = "rl_group_id"; - const Te = "rl_group_trait"; - const Oe = new ((function () { - function e() { - if ((n(this, e), we.set("rudder_cookies", !0), we.get("rudder_cookies"))) - return we.remove("rudder_cookies"), void (this.storage = we); - Ie.enabled && (this.storage = Ie); - } - return ( - i(e, [ - { - key: "setItem", - value(e, t) { - this.storage.set(e, t); - }, - }, - { - key: "setUserId", - value(e) { - typeof e === "string" - ? this.storage.set(_e, e) - : f("[Storage] setUserId:: userId should be string"); - }, - }, - { - key: "setUserTraits", - value(e) { - this.storage.set(Ee, e); - }, - }, - { - key: "setGroupId", - value(e) { - typeof e === "string" - ? this.storage.set(Ce, e) - : f("[Storage] setGroupId:: groupId should be string"); - }, - }, - { - key: "setGroupTraits", - value(e) { - this.storage.set(Te, e); - }, - }, - { - key: "setAnonymousId", - value(e) { - typeof e === "string" - ? this.storage.set(Ae, e) - : f("[Storage] setAnonymousId:: anonymousId should be string"); - }, - }, - { - key: "getItem", - value(e) { - return this.storage.get(e); - }, - }, - { - key: "getUserId", - value() { - return this.storage.get(_e); - }, - }, - { - key: "getUserTraits", - value() { - return this.storage.get(Ee); - }, - }, - { - key: "getGroupId", - value() { - return this.storage.get(Ce); - }, - }, - { - key: "getGroupTraits", - value() { - return this.storage.get(Te); - }, - }, - { - key: "getAnonymousId", - value() { - return this.storage.get(Ae); - }, - }, - { - key: "removeItem", - value(e) { - return this.storage.remove(e); - }, - }, - { - key: "clear", - value() { - this.storage.remove(_e), this.storage.remove(Ee); - }, - }, - ]), - e - ); - })())(); - const Se = (function () { - function e(t) { - n(this, e), - (this.trackingID = t.trackingID), - (this.allowLinker = t.allowLinker || !1), - (this.name = "GA"); - } - return ( - i(e, [ - { - key: "init", - value() { - !(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", { - allowLinker: this.allowLinker, - }); - const e = Oe.getUserId(); - e && e !== "" && ga("rudder_ga.set", "userId", e), - p("===in init GA==="); - }, - }, - { - key: "identify", - value(e) { - const t = - e.message.userId !== "" - ? e.message.userId - : e.message.anonymousId; - ga("rudder_ga.set", "userId", t), - p("in GoogleAnalyticsManager identify"); - }, - }, - { - key: "track", - value(e) { - let t = e.message.event; - const n = e.message.event; - let r = e.message.event; - let 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, - }), - p("in GoogleAnalyticsManager track"); - }, - }, - { - key: "page", - value(e) { - p("in GoogleAnalyticsManager page"); - const t = - e.message.properties && e.message.properties.path - ? e.message.properties.path - : void 0; - const n = - e.message.properties && e.message.properties.title - ? e.message.properties.title - : void 0; - const 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() { - return p("in GA isLoaded"), !!window.gaplugins; - }, - }, - { - key: "isReady", - value() { - return !!window.gaplugins; - }, - }, - ]), - e - ); - })(); - const Pe = (function () { - function e(t) { - n(this, e), - (this.siteId = t.siteID), - (this.name = "HOTJAR"), - (this._ready = !1); - } - return ( - i(e, [ - { - key: "init", - value() { - (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), - p("===in init Hotjar==="); - }, - }, - { - key: "identify", - value(e) { - if (e.message.userId || e.message.anonymousId) { - const t = e.message.context.traits; - window.hj("identify", e.message.userId, t); - } else p("[Hotjar] identify:: user id is required"); - }, - }, - { - key: "track", - value(e) { - p("[Hotjar] track:: method not supported"); - }, - }, - { - key: "page", - value(e) { - p("[Hotjar] page:: method not supported"); - }, - }, - { - key: "isLoaded", - value() { - return this._ready; - }, - }, - { - key: "isReady", - value() { - return this._ready; - }, - }, - ]), - e - ); - })(); - const xe = (function () { - function e(t) { - n(this, e), - (this.conversionId = t.conversionID), - (this.pageLoadConversions = t.pageLoadConversions), - (this.clickEventConversions = t.clickEventConversions), - (this.defaultPageConversion = t.defaultPageConversion), - (this.name = "GOOGLEADS"); - } - return ( - i(e, [ - { - key: "init", - value() { - !(function (e, t, n) { - p(`in script loader=== ${e}`); - const r = n.createElement("script"); - (r.src = t), - (r.async = 1), - (r.type = "text/javascript"), - (r.id = e); - const i = n.getElementsByTagName("head")[0]; - p("==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), - p("===in init Google Ads==="); - }, - }, - { - key: "identify", - value(e) { - p("[GoogleAds] identify:: method not supported"); - }, - }, - { - key: "track", - value(e) { - p("in GoogleAdsAnalyticsManager track"); - const t = this.getConversionData( - this.clickEventConversions, - e.message.event - ); - if (t.conversionLabel) { - const n = t.conversionLabel; - const r = t.eventName; - const i = `${this.conversionId}/${n}`; - const 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(e) { - p("in GoogleAdsAnalyticsManager page"); - const t = this.getConversionData( - this.pageLoadConversions, - e.message.name - ); - if (t.conversionLabel) { - const n = t.conversionLabel; - const r = t.eventName; - window.gtag("event", r, { - send_to: `${this.conversionId}/${n}`, - }); - } - }, - }, - { - key: "getConversionData", - value(e, t) { - const n = {}; - return ( - e && - (t - ? e.forEach(function (e) { - if (e.name.toLowerCase() === t.toLowerCase()) - return ( - (n.conversionLabel = e.conversionLabel), - void (n.eventName = e.name) - ); - }) - : this.defaultPageConversion && - ((n.conversionLabel = this.defaultPageConversion), - (n.eventName = "Viewed a Page"))), - n - ); - }, - }, - { - key: "isLoaded", - value() { - return window.dataLayer.push !== Array.prototype.push; - }, - }, - { - key: "isReady", - value() { - return window.dataLayer.push !== Array.prototype.push; - }, - }, - ]), - e - ); - })(); - const Re = (function () { - function e(t, r) { - 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"), - (this.analytics = r), - p("Config ", t); - } - return ( - i(e, [ - { - key: "init", - value() { - p("===in init VWO==="); - const e = this.accountId; - const t = this.settingsTolerance; - const n = this.libraryTolerance; - const r = this.useExistingJquery; - const i = this.isSPA; - (window._vwo_code = (function () { - let o = !1; - const s = document; - return { - use_existing_jquery() { - return r; - }, - library_tolerance() { - return n; - }, - finish() { - if (!o) { - o = !0; - const e = s.getElementById("_vis_opt_path_hides"); - e && e.parentNode.removeChild(e); - } - }, - finished() { - return o; - }, - load(e) { - const 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() { - const n = setTimeout("_vwo_code.finish()", t); - const r = s.createElement("style"); - const o = - "body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}"; - const 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() { - const e = this; - window.VWO = window.VWO || []; - const t = this; - window.VWO.push([ - "onVariationApplied", - function (n) { - if (n) { - p("Variation Applied"); - const r = n[1]; - const i = n[2]; - if ( - (p( - "experiment id:", - r, - "Variation Name:", - _vwo_exp[r].comb_n[i] - ), - void 0 !== _vwo_exp[r].comb_n[i] && - ["VISUAL_AB", "VISUAL", "SPLIT_URL", "SURVEY"].indexOf( - _vwo_exp[r].type - ) > -1) - ) { - try { - t.sendExperimentTrack && - (p("Tracking..."), - e.analytics.track("Experiment Viewed", { - experimentId: r, - variationName: _vwo_exp[r].comb_n[i], - })); - } catch (e) { - f("[VWO] experimentViewed:: ", e); - } - try { - t.sendExperimentIdentify && - (p("Identifying..."), - e.analytics.identify( - o({}, "Experiment: ".concat(r), _vwo_exp[r].comb_n[i]) - )); - } catch (e) { - f("[VWO] experimentViewed:: ", e); - } - } - } - }, - ]); - }, - }, - { - key: "identify", - value(e) { - p("method not supported"); - }, - }, - { - key: "track", - value(e) { - if (e.message.event === "Order Completed") { - const t = e.message.properties - ? e.message.properties.total || e.message.properties.revenue - : 0; - p("Revenue", t), - (window.VWO = window.VWO || []), - window.VWO.push(["track.revenueConversion", t]); - } - }, - }, - { - key: "page", - value(e) { - p("method not supported"); - }, - }, - { - key: "isLoaded", - value() { - return !!window._vwo_code; - }, - }, - { - key: "isReady", - value() { - return !!window._vwo_code; - }, - }, - ]), - e - ); - })(); - const je = (function () { - function e(t) { - n(this, e), - (this.containerID = t.containerID), - (this.name = "GOOGLETAGMANAGER"); - } - return ( - i(e, [ - { - key: "init", - value() { - p("===in init GoogleTagManager==="), - (function (e, t, n, r, i) { - (e[r] = e[r] || []), - e[r].push({ - "gtm.start": new Date().getTime(), - event: "gtm.js", - }); - const o = t.getElementsByTagName(n)[0]; - const 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(e) { - p("[GTM] identify:: method not supported"); - }, - }, - { - key: "track", - value(e) { - p("===in track GoogleTagManager==="); - const t = e.message; - const n = a( - { - event: t.event, - userId: t.userId, - anonymousId: t.anonymousId, - }, - t.properties - ); - this.sendToGTMDatalayer(n); - }, - }, - { - key: "page", - value(e) { - p("===in page GoogleTagManager==="); - let t; - const n = e.message; - const r = n.name; - const i = n.properties ? n.properties.category : void 0; - r && (t = `Viewed ${r} page`), - i && r && (t = `Viewed ${i} ${r} page`), - t || (t = "Viewed a Page"); - const o = a( - { event: t, userId: n.userId, anonymousId: n.anonymousId }, - n.properties - ); - this.sendToGTMDatalayer(o); - }, - }, - { - key: "isLoaded", - value() { - return !( - !window.dataLayer || - Array.prototype.push === window.dataLayer.push - ); - }, - }, - { - key: "sendToGTMDatalayer", - value(e) { - window.dataLayer.push(e); - }, - }, - { - key: "isReady", - value() { - return !( - !window.dataLayer || - Array.prototype.push === window.dataLayer.push - ); - }, - }, - ]), - e - ); - })(); - const De = (function () { - function e(t, r) { - if ( - (n(this, e), - (this.analytics = r), - (this.appKey = t.appKey), - t.appKey || (this.appKey = ""), - (this.endPoint = ""), - t.dataCenter) - ) { - const i = t.dataCenter.trim().split("-"); - i[0].toLowerCase() === "eu" - ? (this.endPoint = "sdk.fra-01.braze.eu") - : (this.endPoint = `sdk.iad-${i[1]}.braze.com`); - } - (this.name = "BRAZE"), p("Config ", t); - } - return ( - i(e, [ - { - key: "formatGender", - value(e) { - if (e && typeof e === "string") { - 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() { - p("===in init Braze==="), - (function (e, t, n, r, i) { - (e.appboy = {}), (e.appboyQueue = []); - for ( - let 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 < o.length; - s++ - ) { - for ( - var a = o[s], u = e.appboy, c = a.split("."), l = 0; - l < c.length - 1; - l++ - ) - u = u[c[l]]; - u[c[l]] = new Function( - `return function ${a.replace( - /\./g, - "_" - )}(){window.appboyQueue.push(arguments); return true}` - )(); - } - (window.appboy.getUser = function () { - return new window.appboy.ab.User(); - }), - (window.appboy.getCachedFeed = function () { - return new window.appboy.ab.Feed(); - }), - (window.appboy.getCachedContentCards = function () { - return new window.appboy.ab.ContentCards(); - }), - ((i = t.createElement(n)).type = "text/javascript"), - (i.src = - "https://js.appboycdn.com/web-sdk/2.4/appboy.min.js"), - (i.async = 1), - (r = t.getElementsByTagName(n)[0]).parentNode.insertBefore( - i, - r - ); - })(window, document, "script"), - window.appboy.initialize(this.appKey, { - enableLogging: !0, - baseUrl: this.endPoint, - }), - window.appboy.display.automaticallyShowNewInAppMessages(); - const e = this.analytics.userId; - e && appboy.changeUser(e), window.appboy.openSession(); - }, - }, - { - key: "handleReservedProperties", - value(e) { - return ( - [ - "time", - "product_id", - "quantity", - "event_name", - "price", - "currency", - ].forEach(function (t) { - delete e[t]; - }), - e - ); - }, - }, - { - key: "identify", - value(e) { - const t = e.message.userId; - const n = e.message.context.traits.address; - const r = e.message.context.traits.avatar; - const i = e.message.context.traits.birthday; - const o = e.message.context.traits.email; - const s = e.message.context.traits.firstname; - const a = e.message.context.traits.gender; - const u = e.message.context.traits.lastname; - const c = e.message.context.traits.phone; - const l = JSON.parse(JSON.stringify(e.message.context.traits)); - window.appboy.changeUser(t), - window.appboy.getUser().setAvatarImageUrl(r), - o && window.appboy.getUser().setEmail(o), - s && window.appboy.getUser().setFirstName(s), - a && window.appboy.getUser().setGender(this.formatGender(a)), - u && window.appboy.getUser().setLastName(u), - c && window.appboy.getUser().setPhoneNumber(c), - n && - (window.appboy.getUser().setCountry(n.country), - window.appboy.getUser().setHomeCity(n.city)), - i && - window.appboy - .getUser() - .setDateOfBirth( - i.getUTCFullYear(), - i.getUTCMonth() + 1, - i.getUTCDate() - ); - [ - "avatar", - "address", - "birthday", - "email", - "id", - "firstname", - "gender", - "lastname", - "phone", - "facebook", - "twitter", - "first_name", - "last_name", - "dob", - "external_id", - "country", - "home_city", - "bio", - "gender", - "phone", - "email_subscribe", - "push_subscribe", - ].forEach(function (e) { - delete l[e]; - }), - Object.keys(l).forEach(function (e) { - window.appboy.getUser().setCustomUserAttribute(e, l[e]); - }); - }, - }, - { - key: "handlePurchase", - value(e, t) { - const n = e.products; - const r = e.currency; - window.appboy.changeUser(t), - del(e, "products"), - del(e, "currency"), - n.forEach(function (t) { - const n = t.product_id; - const i = t.price; - const o = t.quantity; - o && i && n && window.appboy.logPurchase(n, i, r, o, e); - }); - }, - }, - { - key: "track", - value(e) { - const t = e.message.userId; - const n = e.message.event; - let r = e.message.properties; - window.appboy.changeUser(t), - n.toLowerCase() === "order completed" - ? this.handlePurchase(r, t) - : ((r = this.handleReservedProperties(r)), - window.appboy.logCustomEvent(n, r)); - }, - }, - { - key: "page", - value(e) { - const t = e.message.userId; - const n = e.message.name; - let r = e.message.properties; - (r = this.handleReservedProperties(r)), - window.appboy.changeUser(t), - window.appboy.logCustomEvent(n, r); - }, - }, - { - key: "isLoaded", - value() { - return window.appboyQueue === null; - }, - }, - { - key: "isReady", - value() { - return window.appboyQueue === null; - }, - }, - ]), - e - ); - })(); - const Ue = R(function (e) { - !(function () { - const t = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - var n = { - rotl(e, t) { - return (e << t) | (e >>> (32 - t)); - }, - rotr(e, t) { - return (e << (32 - t)) | (e >>> t); - }, - endian(e) { - if (e.constructor == Number) - return (16711935 & n.rotl(e, 8)) | (4278255360 & n.rotl(e, 24)); - for (let t = 0; t < e.length; t++) e[t] = n.endian(e[t]); - return e; - }, - randomBytes(e) { - for (var t = []; e > 0; e--) t.push(Math.floor(256 * Math.random())); - return t; - }, - bytesToWords(e) { - for (var t = [], n = 0, r = 0; n < e.length; n++, r += 8) - t[r >>> 5] |= e[n] << (24 - (r % 32)); - return t; - }, - wordsToBytes(e) { - for (var t = [], n = 0; n < 32 * e.length; n += 8) - t.push((e[n >>> 5] >>> (24 - (n % 32))) & 255); - return t; - }, - bytesToHex(e) { - for (var t = [], n = 0; n < e.length; n++) - t.push((e[n] >>> 4).toString(16)), t.push((15 & e[n]).toString(16)); - return t.join(""); - }, - hexToBytes(e) { - for (var t = [], n = 0; n < e.length; n += 2) - t.push(parseInt(e.substr(n, 2), 16)); - return t; - }, - bytesToBase64(e) { - for (var n = [], r = 0; r < e.length; r += 3) - for ( - let i = (e[r] << 16) | (e[r + 1] << 8) | e[r + 2], o = 0; - o < 4; - o++ - ) - 8 * r + 6 * o <= 8 * e.length - ? n.push(t.charAt((i >>> (6 * (3 - o))) & 63)) - : n.push("="); - return n.join(""); - }, - base64ToBytes(e) { - e = e.replace(/[^A-Z0-9+\/]/gi, ""); - for (var n = [], r = 0, i = 0; r < e.length; i = ++r % 4) - i != 0 && - n.push( - ((t.indexOf(e.charAt(r - 1)) & (Math.pow(2, -2 * i + 8) - 1)) << - (2 * i)) | - (t.indexOf(e.charAt(r)) >>> (6 - 2 * i)) - ); - return n; - }, - }; - e.exports = n; - })(); - }); - var Le = { - utf8: { - stringToBytes(e) { - return Le.bin.stringToBytes(unescape(encodeURIComponent(e))); - }, - bytesToString(e) { - return decodeURIComponent(escape(Le.bin.bytesToString(e))); - }, - }, - bin: { - stringToBytes(e) { - for (var t = [], n = 0; n < e.length; n++) - t.push(255 & e.charCodeAt(n)); - return t; - }, - bytesToString(e) { - for (var t = [], n = 0; n < e.length; n++) - t.push(String.fromCharCode(e[n])); - return t.join(""); - }, - }, - }; - const Me = Le; - const Ne = function (e) { - return ( - e != null && - (Be(e) || - (function (e) { - return ( - typeof e.readFloatLE === "function" && - typeof e.slice === "function" && - Be(e.slice(0, 0)) - ); - })(e) || - !!e._isBuffer) - ); - }; - function Be(e) { - return ( - !!e.constructor && - typeof e.constructor.isBuffer === "function" && - e.constructor.isBuffer(e) - ); - } - let qe; - let Fe; - const Ke = R(function (e) { - !(function () { - const t = Ue; - const n = Me.utf8; - const r = Ne; - const i = Me.bin; - var o = function (e, s) { - e.constructor == String - ? (e = - s && s.encoding === "binary" - ? i.stringToBytes(e) - : n.stringToBytes(e)) - : r(e) - ? (e = Array.prototype.slice.call(e, 0)) - : Array.isArray(e) || (e = e.toString()); - for ( - var a = t.bytesToWords(e), - u = 8 * e.length, - c = 1732584193, - l = -271733879, - d = -1732584194, - p = 271733878, - f = 0; - f < a.length; - f++ - ) - a[f] = - (16711935 & ((a[f] << 8) | (a[f] >>> 24))) | - (4278255360 & ((a[f] << 24) | (a[f] >>> 8))); - (a[u >>> 5] |= 128 << u % 32), (a[14 + (((u + 64) >>> 9) << 4)] = u); - const h = o._ff; - const g = o._gg; - const y = o._hh; - const m = o._ii; - for (f = 0; f < a.length; f += 16) { - const v = c; - const b = l; - const w = d; - const k = p; - (c = h(c, l, d, p, a[f + 0], 7, -680876936)), - (p = h(p, c, l, d, a[f + 1], 12, -389564586)), - (d = h(d, p, c, l, a[f + 2], 17, 606105819)), - (l = h(l, d, p, c, a[f + 3], 22, -1044525330)), - (c = h(c, l, d, p, a[f + 4], 7, -176418897)), - (p = h(p, c, l, d, a[f + 5], 12, 1200080426)), - (d = h(d, p, c, l, a[f + 6], 17, -1473231341)), - (l = h(l, d, p, c, a[f + 7], 22, -45705983)), - (c = h(c, l, d, p, a[f + 8], 7, 1770035416)), - (p = h(p, c, l, d, a[f + 9], 12, -1958414417)), - (d = h(d, p, c, l, a[f + 10], 17, -42063)), - (l = h(l, d, p, c, a[f + 11], 22, -1990404162)), - (c = h(c, l, d, p, a[f + 12], 7, 1804603682)), - (p = h(p, c, l, d, a[f + 13], 12, -40341101)), - (d = h(d, p, c, l, a[f + 14], 17, -1502002290)), - (c = g( - c, - (l = h(l, d, p, c, a[f + 15], 22, 1236535329)), - d, - p, - a[f + 1], - 5, - -165796510 - )), - (p = g(p, c, l, d, a[f + 6], 9, -1069501632)), - (d = g(d, p, c, l, a[f + 11], 14, 643717713)), - (l = g(l, d, p, c, a[f + 0], 20, -373897302)), - (c = g(c, l, d, p, a[f + 5], 5, -701558691)), - (p = g(p, c, l, d, a[f + 10], 9, 38016083)), - (d = g(d, p, c, l, a[f + 15], 14, -660478335)), - (l = g(l, d, p, c, a[f + 4], 20, -405537848)), - (c = g(c, l, d, p, a[f + 9], 5, 568446438)), - (p = g(p, c, l, d, a[f + 14], 9, -1019803690)), - (d = g(d, p, c, l, a[f + 3], 14, -187363961)), - (l = g(l, d, p, c, a[f + 8], 20, 1163531501)), - (c = g(c, l, d, p, a[f + 13], 5, -1444681467)), - (p = g(p, c, l, d, a[f + 2], 9, -51403784)), - (d = g(d, p, c, l, a[f + 7], 14, 1735328473)), - (c = y( - c, - (l = g(l, d, p, c, a[f + 12], 20, -1926607734)), - d, - p, - a[f + 5], - 4, - -378558 - )), - (p = y(p, c, l, d, a[f + 8], 11, -2022574463)), - (d = y(d, p, c, l, a[f + 11], 16, 1839030562)), - (l = y(l, d, p, c, a[f + 14], 23, -35309556)), - (c = y(c, l, d, p, a[f + 1], 4, -1530992060)), - (p = y(p, c, l, d, a[f + 4], 11, 1272893353)), - (d = y(d, p, c, l, a[f + 7], 16, -155497632)), - (l = y(l, d, p, c, a[f + 10], 23, -1094730640)), - (c = y(c, l, d, p, a[f + 13], 4, 681279174)), - (p = y(p, c, l, d, a[f + 0], 11, -358537222)), - (d = y(d, p, c, l, a[f + 3], 16, -722521979)), - (l = y(l, d, p, c, a[f + 6], 23, 76029189)), - (c = y(c, l, d, p, a[f + 9], 4, -640364487)), - (p = y(p, c, l, d, a[f + 12], 11, -421815835)), - (d = y(d, p, c, l, a[f + 15], 16, 530742520)), - (c = m( - c, - (l = y(l, d, p, c, a[f + 2], 23, -995338651)), - d, - p, - a[f + 0], - 6, - -198630844 - )), - (p = m(p, c, l, d, a[f + 7], 10, 1126891415)), - (d = m(d, p, c, l, a[f + 14], 15, -1416354905)), - (l = m(l, d, p, c, a[f + 5], 21, -57434055)), - (c = m(c, l, d, p, a[f + 12], 6, 1700485571)), - (p = m(p, c, l, d, a[f + 3], 10, -1894986606)), - (d = m(d, p, c, l, a[f + 10], 15, -1051523)), - (l = m(l, d, p, c, a[f + 1], 21, -2054922799)), - (c = m(c, l, d, p, a[f + 8], 6, 1873313359)), - (p = m(p, c, l, d, a[f + 15], 10, -30611744)), - (d = m(d, p, c, l, a[f + 6], 15, -1560198380)), - (l = m(l, d, p, c, a[f + 13], 21, 1309151649)), - (c = m(c, l, d, p, a[f + 4], 6, -145523070)), - (p = m(p, c, l, d, a[f + 11], 10, -1120210379)), - (d = m(d, p, c, l, a[f + 2], 15, 718787259)), - (l = m(l, d, p, c, a[f + 9], 21, -343485551)), - (c = (c + v) >>> 0), - (l = (l + b) >>> 0), - (d = (d + w) >>> 0), - (p = (p + k) >>> 0); - } - return t.endian([c, l, d, p]); - }; - (o._ff = function (e, t, n, r, i, o, s) { - const a = e + ((t & n) | (~t & r)) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._gg = function (e, t, n, r, i, o, s) { - const a = e + ((t & r) | (n & ~r)) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._hh = function (e, t, n, r, i, o, s) { - const a = e + (t ^ n ^ r) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._ii = function (e, t, n, r, i, o, s) { - const a = e + (n ^ (t | ~r)) + (i >>> 0) + s; - return ((a << o) | (a >>> (32 - o))) + t; - }), - (o._blocksize = 16), - (o._digestsize = 16), - (e.exports = function (e, n) { - if (e == null) throw new Error(`Illegal argument ${e}`); - const r = t.wordsToBytes(o(e, n)); - return n && n.asBytes - ? r - : n && n.asString - ? i.bytesToString(r) - : t.bytesToHex(r); - }); - })(); - }); - const Ge = (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), - p("Config ", t); - } - return ( - i(e, [ - { - key: "init", - value() { - (window.intercomSettings = { app_id: this.APP_ID }), - (function () { - const e = window; - const t = e.Intercom; - if (typeof t === "function") - t("reattach_activator"), t("update", e.intercomSettings); - else { - const n = document; - const r = function e() { - e.c(arguments); - }; - (r.q = []), - (r.c = function (e) { - r.q.push(e); - }), - (e.Intercom = r); - const i = function () { - const e = n.createElement("script"); - (e.type = "text/javascript"), - (e.async = !0), - (e.src = `https://widget.intercom.io/widget/${window.intercomSettings.app_id}`); - const t = n.getElementsByTagName("script")[0]; - t.parentNode.insertBefore(e, t); - }; - document.readyState === "complete" - ? (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() { - window.Intercom("update"); - }, - }, - { - key: "identify", - value(e) { - const n = {}; - const r = e.message.context; - if ((r.Intercom ? r.Intercom : null) != null) { - const i = r.Intercom.user_hash ? r.Intercom.user_hash : null; - i != null && (n.user_hash = i); - const o = r.Intercom.hideDefaultLauncher - ? r.Intercom.hideDefaultLauncher - : null; - o != null && (n.hide_default_launcher = o); - } - Object.keys(r.traits).forEach(function (e) { - if (r.traits.hasOwnProperty(e)) { - const i = r.traits[e]; - if (e === "company") { - const o = []; - const s = {}; - typeof r.traits[e] === "string" && - (s.company_id = Ke(r.traits[e])); - const a = - (t(r.traits[e]) == "object" && Object.keys(r.traits[e])) || - []; - a.forEach(function (t) { - a.hasOwnProperty(t) && - (t != "id" - ? (s[t] = r.traits[e][t]) - : (s.company_id = r.traits[e][t])); - }), - t(r.traits[e]) != "object" || - a.includes("id") || - (s.company_id = Ke(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(e) { - const t = {}; - const n = e.message; - (n.properties ? Object.keys(n.properties) : null).forEach(function ( - e - ) { - const 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() { - return !!window.intercom_code; - }, - }, - { - key: "isReady", - value() { - return !!window.intercom_code; - }, - }, - ]), - e - ); - })(); - const He = (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() { - p("===in init Keen==="), - T( - "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(e) { - p("in Keen identify"); - const t = e.message.context.traits; - const n = e.message.userId - ? e.message.userId - : e.message.anonymousId; - var 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(e) { - p("in Keen track"); - const t = e.message.event; - let n = e.message.properties; - (n = this.getAddOn(n)), this.client.recordEvent(t, n); - }, - }, - { - key: "page", - value(e) { - p("in Keen page"); - const t = e.message.name; - const n = e.message.properties - ? e.message.properties.category - : void 0; - let r = "Loaded a Page"; - t && (r = `Viewed ${t} page`), - n && t && (r = `Viewed ${n} ${t} page`); - let i = e.message.properties; - (i = this.getAddOn(i)), this.client.recordEvent(r, i); - }, - }, - { - key: "isLoaded", - value() { - return p("in Keen isLoaded"), !(this.client == null); - }, - }, - { - key: "isReady", - value() { - return !(this.client == null); - }, - }, - { - key: "getAddOn", - value(e) { - const 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 - ); - })(); - const Ve = Object.prototype; - const ze = Ve.hasOwnProperty; - const Je = Ve.toString; - typeof Symbol === "function" && (qe = Symbol.prototype.valueOf), - typeof BigInt === "function" && (Fe = BigInt.prototype.valueOf); - const We = function (e) { - return e != e; - }; - const $e = { boolean: 1, number: 1, string: 1, undefined: 1 }; - const Ye = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/; - const Qe = /^[A-Fa-f0-9]+$/; - const Ze = {}; - (Ze.a = Ze.type = function (e, t) { - return typeof e === t; - }), - (Ze.defined = function (e) { - return void 0 !== e; - }), - (Ze.empty = function (e) { - let t; - const n = Je.call(e); - if ( - n === "[object Array]" || - n === "[object Arguments]" || - n === "[object String]" - ) - return e.length === 0; - if (n === "[object Object]") { - for (t in e) if (ze.call(e, t)) return !1; - return !0; - } - return !e; - }), - (Ze.equal = function (e, t) { - if (e === t) return !0; - let n; - const r = Je.call(e); - if (r !== Je.call(t)) return !1; - if (r === "[object Object]") { - for (n in e) if (!Ze.equal(e[n], t[n]) || !(n in t)) return !1; - for (n in t) if (!Ze.equal(e[n], t[n]) || !(n in e)) return !1; - return !0; - } - if (r === "[object Array]") { - if ((n = e.length) !== t.length) return !1; - for (; n--; ) if (!Ze.equal(e[n], t[n])) return !1; - return !0; - } - return r === "[object Function]" - ? e.prototype === t.prototype - : r === "[object Date]" && e.getTime() === t.getTime(); - }), - (Ze.hosted = function (e, t) { - const n = typeof t[e]; - return n === "object" ? !!t[e] : !$e[n]; - }), - (Ze.instance = Ze.instanceof = function (e, t) { - return e instanceof t; - }), - (Ze.nil = Ze.null = function (e) { - return e === null; - }), - (Ze.undef = Ze.undefined = function (e) { - return void 0 === e; - }), - (Ze.args = Ze.arguments = function (e) { - const t = Je.call(e) === "[object Arguments]"; - const n = - !Ze.array(e) && Ze.arraylike(e) && Ze.object(e) && Ze.fn(e.callee); - return t || n; - }), - (Ze.array = - Array.isArray || - function (e) { - return Je.call(e) === "[object Array]"; - }), - (Ze.args.empty = function (e) { - return Ze.args(e) && e.length === 0; - }), - (Ze.array.empty = function (e) { - return Ze.array(e) && e.length === 0; - }), - (Ze.arraylike = function (e) { - return ( - !!e && - !Ze.bool(e) && - ze.call(e, "length") && - isFinite(e.length) && - Ze.number(e.length) && - e.length >= 0 - ); - }), - (Ze.bool = Ze.boolean = function (e) { - return Je.call(e) === "[object Boolean]"; - }), - (Ze.false = function (e) { - return Ze.bool(e) && !1 === Boolean(Number(e)); - }), - (Ze.true = function (e) { - return Ze.bool(e) && !0 === Boolean(Number(e)); - }), - (Ze.date = function (e) { - return Je.call(e) === "[object Date]"; - }), - (Ze.date.valid = function (e) { - return Ze.date(e) && !isNaN(Number(e)); - }), - (Ze.element = function (e) { - return ( - void 0 !== e && - typeof HTMLElement !== "undefined" && - e instanceof HTMLElement && - e.nodeType === 1 - ); - }), - (Ze.error = function (e) { - return Je.call(e) === "[object Error]"; - }), - (Ze.fn = Ze.function = function (e) { - if (typeof window !== "undefined" && e === window.alert) return !0; - const t = Je.call(e); - return ( - t === "[object Function]" || - t === "[object GeneratorFunction]" || - t === "[object AsyncFunction]" - ); - }), - (Ze.number = function (e) { - return Je.call(e) === "[object Number]"; - }), - (Ze.infinite = function (e) { - return e === 1 / 0 || e === -1 / 0; - }), - (Ze.decimal = function (e) { - return Ze.number(e) && !We(e) && !Ze.infinite(e) && e % 1 != 0; - }), - (Ze.divisibleBy = function (e, t) { - const n = Ze.infinite(e); - const r = Ze.infinite(t); - const i = Ze.number(e) && !We(e) && Ze.number(t) && !We(t) && t !== 0; - return n || r || (i && e % t == 0); - }), - (Ze.integer = Ze.int = function (e) { - return Ze.number(e) && !We(e) && e % 1 == 0; - }), - (Ze.maximum = function (e, t) { - if (We(e)) throw new TypeError("NaN is not a valid value"); - if (!Ze.arraylike(t)) - throw new TypeError("second argument must be array-like"); - for (let n = t.length; --n >= 0; ) if (e < t[n]) return !1; - return !0; - }), - (Ze.minimum = function (e, t) { - if (We(e)) throw new TypeError("NaN is not a valid value"); - if (!Ze.arraylike(t)) - throw new TypeError("second argument must be array-like"); - for (let n = t.length; --n >= 0; ) if (e > t[n]) return !1; - return !0; - }), - (Ze.nan = function (e) { - return !Ze.number(e) || e != e; - }), - (Ze.even = function (e) { - return Ze.infinite(e) || (Ze.number(e) && e == e && e % 2 == 0); - }), - (Ze.odd = function (e) { - return Ze.infinite(e) || (Ze.number(e) && e == e && e % 2 != 0); - }), - (Ze.ge = function (e, t) { - if (We(e) || We(t)) throw new TypeError("NaN is not a valid value"); - return !Ze.infinite(e) && !Ze.infinite(t) && e >= t; - }), - (Ze.gt = function (e, t) { - if (We(e) || We(t)) throw new TypeError("NaN is not a valid value"); - return !Ze.infinite(e) && !Ze.infinite(t) && e > t; - }), - (Ze.le = function (e, t) { - if (We(e) || We(t)) throw new TypeError("NaN is not a valid value"); - return !Ze.infinite(e) && !Ze.infinite(t) && e <= t; - }), - (Ze.lt = function (e, t) { - if (We(e) || We(t)) throw new TypeError("NaN is not a valid value"); - return !Ze.infinite(e) && !Ze.infinite(t) && e < t; - }), - (Ze.within = function (e, t, n) { - if (We(e) || We(t) || We(n)) - throw new TypeError("NaN is not a valid value"); - if (!Ze.number(e) || !Ze.number(t) || !Ze.number(n)) - throw new TypeError("all arguments must be numbers"); - return ( - Ze.infinite(e) || Ze.infinite(t) || Ze.infinite(n) || (e >= t && e <= n) - ); - }), - (Ze.object = function (e) { - return Je.call(e) === "[object Object]"; - }), - (Ze.primitive = function (e) { - return ( - !e || - !(typeof e === "object" || Ze.object(e) || Ze.fn(e) || Ze.array(e)) - ); - }), - (Ze.hash = function (e) { - return ( - Ze.object(e) && - e.constructor === Object && - !e.nodeType && - !e.setInterval - ); - }), - (Ze.regexp = function (e) { - return Je.call(e) === "[object RegExp]"; - }), - (Ze.string = function (e) { - return Je.call(e) === "[object String]"; - }), - (Ze.base64 = function (e) { - return Ze.string(e) && (!e.length || Ye.test(e)); - }), - (Ze.hex = function (e) { - return Ze.string(e) && (!e.length || Qe.test(e)); - }), - (Ze.symbol = function (e) { - return ( - typeof Symbol === "function" && - Je.call(e) === "[object Symbol]" && - typeof qe.call(e) === "symbol" - ); - }), - (Ze.bigint = function (e) { - return ( - typeof BigInt === "function" && - Je.call(e) === "[object BigInt]" && - typeof Fe.call(e) === "bigint" - ); - }); - let Xe; - const et = Ze; - const tt = Object.prototype.hasOwnProperty; - const nt = function (e) { - for ( - let t = Array.prototype.slice.call(arguments, 1), n = 0; - n < t.length; - n += 1 - ) - for (const r in t[n]) tt.call(t[n], r) && (e[r] = t[n][r]); - return e; - }; - const rt = R(function (e) { - function t(e) { - return function (t, n, r, o) { - let s; - (normalize = - o && - (function (e) { - return typeof e === "function"; - })(o.normalizer) - ? o.normalizer - : i), - (n = normalize(n)); - for (var a = !1; !a; ) u(); - function u() { - for (s in t) { - const e = normalize(s); - if (n.indexOf(e) === 0) { - const r = n.substr(e.length); - if (r.charAt(0) === "." || r.length === 0) { - n = r.substr(1); - const i = t[s]; - return i == null - ? void (a = !0) - : n.length - ? void (t = i) - : void (a = !0); - } - } - } - (s = void 0), (a = !0); - } - if (s) return t == null ? t : e(t, s, r); - }; - } - function n(e, t) { - return e.hasOwnProperty(t) && delete e[t], e; - } - function r(e, t, n) { - return e.hasOwnProperty(t) && (e[t] = n), e; - } - function i(e) { - return e.replace(/[^a-zA-Z0-9\.]+/g, "").toLowerCase(); - } - (e.exports = t(function (e, t) { - if (e.hasOwnProperty(t)) return e[t]; - })), - (e.exports.find = e.exports), - (e.exports.replace = function (e, n, i, o) { - return t(r).call(this, e, n, i, o), e; - }), - (e.exports.del = function (e, r, i) { - return t(n).call(this, e, r, null, i), e; - }); - }); - const it = (rt.find, rt.replace, rt.del, Object.prototype.toString); - const ot = function (e) { - switch (it.call(e)) { - case "[object Function]": - return "function"; - case "[object Date]": - return "date"; - case "[object RegExp]": - return "regexp"; - case "[object Arguments]": - return "arguments"; - case "[object Array]": - return "array"; - case "[object String]": - return "string"; - } - return e === null - ? "null" - : void 0 === e - ? "undefined" - : e && e.nodeType === 1 - ? "element" - : e === Object(e) - ? "object" - : typeof e; - }; - const st = /\b(Array|Date|Object|Math|JSON)\b/g; - const at = function (e, t) { - const n = (function (e) { - for (var t = [], n = 0; n < e.length; n++) - ~t.indexOf(e[n]) || t.push(e[n]); - return t; - })( - (function (e) { - return ( - e - .replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g, "") - .replace(st, "") - .match(/[a-zA-Z_]\w*/g) || [] - ); - })(e) - ); - return ( - t && - typeof t === "string" && - (t = (function (e) { - return function (t) { - return e + t; - }; - })(t)), - t - ? (function (e, t, n) { - return e.replace( - /\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g, - function (e) { - return e[e.length - 1] == "(" || ~t.indexOf(e) ? n(e) : e; - } - ); - })(e, n, t) - : n - ); - }; - try { - Xe = at; - } catch (e) { - Xe = at; - } - const ut = ct; - function ct(e) { - switch ({}.toString.call(e)) { - case "[object Object]": - return (function (e) { - const t = {}; - for (const n in e) - t[n] = typeof e[n] === "string" ? lt(e[n]) : ct(e[n]); - return function (e) { - if (typeof e !== "object") return !1; - for (const n in t) { - if (!(n in e)) return !1; - if (!t[n](e[n])) return !1; - } - return !0; - }; - })(e); - case "[object Function]": - return e; - case "[object String]": - return /^ *\W+/.test((n = e)) - ? new Function("_", `return _ ${n}`) - : new Function( - "_", - `return ${(function (e) { - let t; - let n; - let r; - const i = Xe(e); - if (!i.length) return `_.${e}`; - for (n = 0; n < i.length; n++) - (r = i[n]), - (e = dt( - r, - e, - (t = `('function' == typeof ${(t = `_.${r}`)} ? ${t}() : ${t})`) - )); - return e; - })(n)}` - ); - case "[object RegExp]": - return ( - (t = e), - function (e) { - return t.test(e); - } - ); - default: - return lt(e); - } - let t; - let n; - } - function lt(e) { - return function (t) { - return e === t; - }; - } - function dt(e, t, n) { - return t.replace(new RegExp(`(\\.)?${e}`, "g"), function (e, t) { - return t ? e : n; - }); - } - try { - var pt = ot; - } catch (e) { - pt = ot; - } - const ft = Object.prototype.hasOwnProperty; - const ht = function (e, t, n) { - switch (((t = ut(t)), (n = n || this), pt(e))) { - case "array": - return gt(e, t, n); - case "object": - return typeof e.length === "number" - ? gt(e, t, n) - : (function (e, t, n) { - for (const r in e) ft.call(e, r) && t.call(n, r, e[r]); - })(e, t, n); - case "string": - return (function (e, t, n) { - for (let r = 0; r < e.length; ++r) t.call(n, e.charAt(r), r); - })(e, t, n); - } - }; - function gt(e, t, n) { - for (let r = 0; r < e.length; ++r) t.call(n, e[r], r); - } - const yt = (function () { - function e(t) { - n(this, e), - (this.apiKey = t.apiKey), - (this.prefixProperties = t.prefixProperties), - (this.name = "KISSMETRICS"); - } - return ( - i(e, [ - { - key: "init", - value() { - p("===in init Kissmetrics==="), (window._kmq = window._kmq || []); - const e = window._kmk || this.apiKey; - function t(e) { - setTimeout(function () { - const t = document; - const n = t.getElementsByTagName("script")[0]; - const r = t.createElement("script"); - (r.type = "text/javascript"), - (r.async = !0), - (r.src = e), - n.parentNode.insertBefore(r, n); - }, 1); - } - t("//i.kissmetrics.com/i.js"), - t(`//scripts.kissmetrics.com/${e}.2.js`), - this.isEnvMobile() && - window._kmq.push(["set", { "Mobile Session": "Yes" }]); - }, - }, - { - key: "isEnvMobile", - value() { - return ( - navigator.userAgent.match(/Android/i) || - navigator.userAgent.match(/BlackBerry/i) || - navigator.userAgent.match(/IEMobile/i) || - navigator.userAgent.match(/Opera Mini/i) || - navigator.userAgent.match(/iPad/i) || - navigator.userAgent.match(/iPhone|iPod/i) - ); - }, - }, - { - key: "toUnixTimestamp", - value(e) { - return (e = new Date(e)), Math.floor(e.getTime() / 1e3); - }, - }, - { - key: "clean", - value(e) { - let t = {}; - for (const n in e) - if (e.hasOwnProperty(n)) { - const r = e[n]; - if (r == null) continue; - if (et.date(r)) { - t[n] = this.toUnixTimestamp(r); - continue; - } - if (et.bool(r)) { - t[n] = r; - continue; - } - if (et.number(r)) { - t[n] = r; - continue; - } - if ((p(r.toString()), r.toString() !== "[object Object]")) { - t[n] = r.toString(); - continue; - } - const i = {}; - i[n] = r; - const o = this.flatten(i, { safe: !0 }); - for (const s in o) et.array(o[s]) && (o[s] = o[s].toString()); - delete (t = nt(t, o))[n]; - } - return t; - }, - }, - { - key: "flatten", - value(e, t) { - const n = (t = t || {}).delimiter || "."; - let r = t.maxDepth; - let i = 1; - const o = {}; - return ( - (function e(s, a) { - for (const u in s) - if (s.hasOwnProperty(u)) { - const c = s[u]; - const l = t.safe && et.array(c); - const d = Object.prototype.toString.call(c); - const p = d === "[object Object]" || d === "[object Array]"; - const f = []; - const h = a ? a + n + u : u; - for (const g in (t.maxDepth || (r = i + 1), c)) - c.hasOwnProperty(g) && f.push(g); - if (!l && p && f.length && i < r) return ++i, e(c, h); - o[h] = c; - } - })(e), - o - ); - }, - }, - { - key: "prefix", - value(e, t) { - const n = {}; - return ( - ht(t, function (t, r) { - t === "Billing Amount" - ? (n[t] = r) - : t === "revenue" - ? ((n[`${e} - ${t}`] = r), (n["Billing Amount"] = r)) - : (n[`${e} - ${t}`] = r); - }), - n - ); - }, - }, - { - key: "identify", - value(e) { - p("in Kissmetrics identify"); - const t = this.clean(e.message.context.traits); - const n = - e.message.userId && e.message.userId != "" - ? e.message.userId - : void 0; - n && window._kmq.push(["identify", n]), - t && window._kmq.push(["set", t]); - }, - }, - { - key: "track", - value(e) { - p("in Kissmetrics track"); - const t = e.message.event; - let n = JSON.parse(JSON.stringify(e.message.properties)); - const r = this.toUnixTimestamp(new Date()); - const i = I(n); - i && (n.revenue = i); - const o = n.products; - o && delete n.products, - (n = this.clean(n)), - p(JSON.stringify(n)), - this.prefixProperties && (n = this.prefix(t, n)), - window._kmq.push(["record", t, n]); - const s = function (e, n) { - let i = e; - this.prefixProperties && (i = this.prefix(t, i)), - (i._t = r + n), - (i._d = 1), - window.KM.set(i); - }.bind(this); - o && - window._kmq.push(function () { - ht(o, s); - }); - }, - }, - { - key: "page", - value(e) { - p("in Kissmetrics page"); - const t = e.message.name; - const n = e.message.properties - ? e.message.properties.category - : void 0; - let r = "Loaded a Page"; - t && (r = `Viewed ${t} page`), - n && t && (r = `Viewed ${n} ${t} page`); - let i = e.message.properties; - this.prefixProperties && (i = this.prefix("Page", i)), - window._kmq.push(["record", r, i]); - }, - }, - { - key: "alias", - value(e) { - const t = e.message.previousId; - const n = e.message.userId; - window._kmq.push(["alias", n, t]); - }, - }, - { - key: "group", - value(e) { - const t = e.message.groupId; - let n = e.message.traits; - (n = this.prefix("Group", n)), - t && (n["Group - id"] = t), - window._kmq.push(["set", n]), - p("in Kissmetrics group"); - }, - }, - { - key: "isLoaded", - value() { - return et.object(window.KM); - }, - }, - { - key: "isReady", - value() { - return et.object(window.KM); - }, - }, - ]), - e - ); - })(); - const mt = (function () { - function e(t) { - n(this, e), - (this.siteID = t.siteID), - (this.apiKey = t.apiKey), - (this.name = "CUSTOMERIO"); - } - return ( - i(e, [ - { - key: "init", - value() { - p("===in init Customer IO init==="), - (window._cio = window._cio || []); - const e = this.siteID; - !(function () { - let t; - let n; - let r; - for ( - t = function (e) { - return function () { - window._cio.push( - [e].concat(Array.prototype.slice.call(arguments, 0)) - ); - }; - }, - n = ["load", "identify", "sidentify", "track", "page"], - r = 0; - r < n.length; - r++ - ) - window._cio[n[r]] = t(n[r]); - const i = document.createElement("script"); - const o = document.getElementsByTagName("script")[0]; - (i.async = !0), - (i.id = "cio-tracker"), - i.setAttribute("data-site-id", e), - (i.src = "https://assets.customer.io/assets/track.js"), - o.parentNode.insertBefore(i, o); - })(); - }, - }, - { - key: "identify", - value(e) { - p("in Customer IO identify"); - const t = e.message.userId - ? e.message.userId - : e.message.anonymousId; - const n = e.message.context.traits ? e.message.context.traits : {}; - n.created_at || - (n.created_at = Math.floor(new Date().getTime() / 1e3)), - (n.id = t), - window._cio.identify(n); - }, - }, - { - key: "track", - value(e) { - p("in Customer IO track"); - const t = e.message.event; - const n = e.message.properties; - window._cio.track(t, n); - }, - }, - { - key: "page", - value(e) { - p("in Customer IO page"); - const t = e.message.name || e.message.properties.url; - window._cio.page(t, e.message.properties); - }, - }, - { - key: "isLoaded", - value() { - return !(!window._cio || window._cio.push === Array.prototype.push); - }, - }, - { - key: "isReady", - value() { - return !(!window._cio || window._cio.push === Array.prototype.push); - }, - }, - ]), - e - ); - })(); - let vt = !1; - const bt = []; - var wt = setInterval(function () { - document.body && ((vt = !0), ht(bt, kt), clearInterval(wt)); - }, 5); - function kt(e) { - e(document.body); - } - for ( - var It = (function () { - function e(t, r) { - n(this, e), - (this.analytics = r), - (this._sf_async_config = window._sf_async_config = - window._sf_async_config || {}), - (window._sf_async_config.useCanonical = !0), - (window._sf_async_config.uid = t.uid), - (window._sf_async_config.domain = t.domain), - (this.isVideo = !!t.video), - (this.sendNameAndCategoryAsTitle = - t.sendNameAndCategoryAsTitle || !0), - (this.subscriberEngagementKeys = t.subscriberEngagementKeys || []), - (this.replayEvents = []), - (this.failed = !1), - (this.isFirstPageCallMade = !1), - (this.name = "CHARTBEAT"); - } - return ( - i(e, [ - { - key: "init", - value() { - p("===in init Chartbeat==="); - }, - }, - { - key: "identify", - value(e) { - p("in Chartbeat identify"); - }, - }, - { - key: "track", - value(e) { - p("in Chartbeat track"); - }, - }, - { - key: "page", - value(e) { - if ( - (p("in Chartbeat page"), - this.loadConfig(e), - this.isFirstPageCallMade) - ) { - if (this.failed) - return ( - p("===ignoring cause failed integration==="), - void (this.replayEvents = []) - ); - if (!this.isLoaded() && !this.failed) - return ( - p("===pushing to replay queue for chartbeat==="), - void this.replayEvents.push(["page", e]) - ); - p("===processing page event in chartbeat==="); - const t = e.message.properties; - window.pSUPERFLY.virtualPage(t.path); - } else (this.isFirstPageCallMade = !0), this.initAfterPage(); - }, - }, - { - key: "isLoaded", - value() { - return ( - p("in Chartbeat isLoaded"), - !this.isFirstPageCallMade || !!window.pSUPERFLY - ); - }, - }, - { - key: "isFailed", - value() { - return this.failed; - }, - }, - { - key: "isReady", - value() { - return !!window.pSUPERFLY; - }, - }, - { - key: "loadConfig", - value(e) { - let t; - const n = e.message.properties; - const r = n ? n.category : void 0; - const i = e.message.name; - const o = n ? n.author : void 0; - this.sendNameAndCategoryAsTitle && - (t = r && i ? `${r} ${i}` : i), - r && (window._sf_async_config.sections = r), - o && (window._sf_async_config.authors = o), - t && (window._sf_async_config.title = t); - const s = (window._cbq = window._cbq || []); - for (const a in n) - n.hasOwnProperty(a) && - this.subscriberEngagementKeys.indexOf(a) > -1 && - s.push([a, n[a]]); - }, - }, - { - key: "initAfterPage", - value() { - let e; - const t = this; - (e = function () { - let e; - let n; - const 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); - }), - vt ? kt(e) : bt.push(e), - this._isReady(this).then(function (e) { - p("===replaying on chartbeat==="), - e.replayEvents.forEach(function (t) { - e[t[0]](t[1]); - }); - }); - }, - }, - { - key: "pause", - value(e) { - return new Promise(function (t) { - setTimeout(t, e); - }); - }, - }, - { - key: "_isReady", - value(e) { - const t = this; - const n = - arguments.length > 1 && void 0 !== arguments[1] - ? arguments[1] - : 0; - return new Promise(function (r) { - return t.isLoaded() - ? ((t.failed = !1), - p("===chartbeat loaded successfully==="), - e.analytics.emit("ready"), - r(e)) - : n >= 1e4 - ? ((t.failed = !0), p("===chartbeat failed==="), r(e)) - : void t.pause(1e3).then(function () { - return t._isReady(e, n + 1e3).then(r); - }); - }); - }, - }, - ]), - e - ); - })(), - _t = (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() { - p("===in init Comscore init==="); - }, - }, - { - key: "identify", - value(e) { - p("in Comscore identify"); - }, - }, - { - key: "track", - value(e) { - p("in Comscore track"); - }, - }, - { - key: "page", - value(e) { - if ( - (p("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(e) { - p("=====in loadConfig====="), - (this.comScoreParams = this.mapComscoreParams( - e.message.properties - )), - (window._comscore = window._comscore || []), - window._comscore.push(this.comScoreParams); - }, - }, - { - key: "initAfterPage", - value() { - p("=====in initAfterPage====="), - (function () { - const e = document.createElement("script"); - const t = document.getElementsByTagName("script")[0]; - (e.async = !0), - (e.src = `${ - document.location.protocol == "https:" - ? "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(e) { - return new Promise(function (t) { - setTimeout(t, e); - }); - }, - }, - { - key: "_isReady", - value(e) { - const t = this; - const 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(e) { - p("=====in mapComscoreParams====="); - const t = this.comScoreBeaconParam; - const n = {}; - return ( - Object.keys(t).forEach(function (r) { - if ((r in e)) { - const i = t[r]; - const o = e[r]; - n[i] = o; - } - }), - (n.c1 = "2"), - (n.c2 = this.c2ID), - p("=====in mapComscoreParams=====", n), - n - ); - }, - }, - { - key: "isLoaded", - value() { - return ( - p("in Comscore isLoaded"), - !this.isFirstPageCallMade || !!window.COMSCORE - ); - }, - }, - { - key: "isReady", - value() { - return !!window.COMSCORE; - }, - }, - ]), - e - ); - })(), - Et = Object.prototype.hasOwnProperty, - At = String.prototype.charAt, - Ct = Object.prototype.toString, - Tt = function (e, t) { - return At.call(e, t); - }, - Ot = function (e, t) { - return Et.call(e, t); - }, - St = function (e, t) { - t = t || Ot; - for (var n = [], r = 0, i = e.length; r < i; r += 1) - t(e, r) && n.push(String(r)); - return n; - }, - Pt = function (e) { - return e == null - ? [] - : ((t = e), - Ct.call(t) === "[object String]" - ? St(e, Tt) - : (function (e) { - return ( - e != null && - typeof e !== "function" && - typeof e.length === "number" - ); - })(e) - ? St(e, Ot) - : (function (e, t) { - t = t || Ot; - const n = []; - for (const r in e) t(e, r) && n.push(String(r)); - return n; - })(e)); - let t; - }, - xt = Object.prototype.toString, - Rt = - typeof Array.isArray === "function" - ? Array.isArray - : function (e) { - return xt.call(e) === "[object Array]"; - }, - jt = function (e) { - return ( - e != null && - (Rt(e) || - (e !== "function" && - (function (e) { - const t = typeof e; - return ( - t === "number" || - (t === "object" && xt.call(e) === "[object Number]") - ); - })(e.length))) - ); - }, - Dt = function (e, t) { - for (let n = 0; n < t.length && !1 !== e(t[n], n, t); n += 1); - }, - Ut = function (e, t) { - for ( - let n = Pt(t), r = 0; - r < n.length && !1 !== e(t[n[r]], n[r], t); - r += 1 - ); - }, - Lt = function (e, t) { - return (jt(t) ? Dt : Ut).call(this, e, t); - }, - Mt = (function () { - function e(t) { - n(this, e), - (this.blacklistPiiProperties = t.blacklistPiiProperties), - (this.categoryToContent = t.categoryToContent), - (this.pixelId = t.pixelId), - (this.eventsToEvents = t.eventsToEvents), - (this.eventCustomProperties = t.eventCustomProperties), - (this.valueFieldIdentifier = t.valueFieldIdentifier), - (this.advancedMapping = t.advancedMapping), - (this.traitKeyToExternalId = t.traitKeyToExternalId), - (this.legacyConversionPixelId = t.legacyConversionPixelId), - (this.userIdAsPixelId = t.userIdAsPixelId), - (this.whitelistPiiProperties = t.whitelistPiiProperties), - (this.name = "FB_PIXEL"); - } - return ( - i(e, [ - { - key: "init", - value() { - void 0 === this.categoryToContent && - (this.categoryToContent = []), - void 0 === this.legacyConversionPixelId && - (this.legacyConversionPixelId = []), - void 0 === this.userIdAsPixelId && - (this.userIdAsPixelId = []), - p("===in init FbPixel==="), - (window._fbq = function () { - window.fbq.callMethod - ? window.fbq.callMethod.apply(window.fbq, arguments) - : window.fbq.queue.push(arguments); - }), - (window.fbq = window.fbq || window._fbq), - (window.fbq.push = window.fbq), - (window.fbq.loaded = !0), - (window.fbq.disablePushState = !0), - (window.fbq.allowDuplicatePageViews = !0), - (window.fbq.version = "2.0"), - (window.fbq.queue = []), - window.fbq("init", this.pixelId), - T( - "fbpixel-integration", - "//connect.facebook.net/en_US/fbevents.js" - ); - }, - }, - { - key: "isLoaded", - value() { - return ( - p("in FBPixel isLoaded"), - !(!window.fbq || !window.fbq.callMethod) - ); - }, - }, - { - key: "isReady", - value() { - return ( - p("in FBPixel isReady"), - !(!window.fbq || !window.fbq.callMethod) - ); - }, - }, - { - key: "page", - value(e) { - window.fbq("track", "PageView"); - }, - }, - { - key: "identify", - value(e) { - this.advancedMapping && - window.fbq("init", this.pixelId, e.message.context.traits); - }, - }, - { - key: "track", - value(e) { - const t = this; - const n = this; - const r = e.message.event; - let i = this.formatRevenue(e.message.properties.revenue); - const o = this.buildPayLoad(e, !0); - void 0 === this.categoryToContent && - (this.categoryToContent = []), - void 0 === this.legacyConversionPixelId && - (this.legacyConversionPixelId = []), - void 0 === this.userIdAsPixelId && - (this.userIdAsPixelId = []), - (o.value = i); - let s; - let a; - const u = this.eventsToEvents; - const c = this.legacyConversionPixelId; - if ( - ((s = u.reduce(function (e, t) { - return t.from === r && e.push(t.to), e; - }, [])), - (a = c.reduce(function (e, t) { - return t.from === r && e.push(t.to), e; - }, [])), - Lt(function (t) { - (o.currency = e.message.properties.currency || "USD"), - window.fbq("trackSingle", n.pixelId, t, o, { - eventID: e.message.messageId, - }); - }, s), - Lt(function (t) { - window.fbq( - "trackSingle", - n.pixelId, - t, - { currency: e.message.properties.currency, value: i }, - { eventID: e.message.messageId } - ); - }, a), - r === "Product List Viewed") - ) { - var l = []; - var d = e.message.properties.products; - var p = this.buildPayLoad(e, !0); - Array.isArray(d) && - d.forEach(function (t) { - const n = t.product_id; - n && - (g.push(n), - l.push({ - id: n, - quantity: e.message.properties.quantity, - })); - }), - g.length - ? (h = ["product"]) - : (g.push(e.message.properties.category || ""), - l.push({ - id: e.message.properties.category || "", - quantity: 1, - }), - (h = ["product_group"])), - window.fbq( - "trackSingle", - n.pixelId, - "ViewContent", - this.merge( - { - content_ids: g, - content_type: this.getContentType(e, h), - contents: l, - }, - p - ), - { eventID: e.message.messageId } - ), - Lt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: t.formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Product Viewed") { - var f = this.valueFieldIdentifier === "properties.value"; - p = this.buildPayLoad(e, !0); - window.fbq( - "trackSingle", - n.pixelId, - "ViewContent", - this.merge( - { - content_ids: [ - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - ], - content_type: this.getContentType(e, ["product"]), - content_name: e.message.properties.product_name || "", - content_category: e.message.properties.category || "", - currency: e.message.properties.currency, - value: f - ? this.formatRevenue(e.message.properties.value) - : this.formatRevenue(e.message.properties.price), - contents: [ - { - id: - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }, - ], - }, - p - ), - { eventID: e.message.messageId } - ), - Lt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: f - ? t.formatRevenue(e.message.properties.value) - : t.formatRevenue(e.message.properties.price), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Product Added") { - (f = this.valueFieldIdentifier === "properties.value"), - (p = this.buildPayLoad(e, !0)); - window.fbq( - "trackSingle", - n.pixelId, - "AddToCart", - this.merge( - { - content_ids: [ - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - ], - content_type: this.getContentType(e, ["product"]), - content_name: e.message.properties.product_name || "", - content_category: e.message.properties.category || "", - currency: e.message.properties.currency, - value: f - ? this.formatRevenue(e.message.properties.value) - : this.formatRevenue(e.message.properties.price), - contents: [ - { - id: - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }, - ], - }, - p - ), - { eventID: e.message.messageId } - ), - Lt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: f - ? t.formatRevenue(e.message.properties.value) - : t.formatRevenue(e.message.properties.price), - }, - { eventID: e.message.messageId } - ); - }, a), - this.merge( - { - content_ids: [ - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - ], - content_type: this.getContentType(e, ["product"]), - content_name: e.message.properties.product_name || "", - content_category: e.message.properties.category || "", - currency: e.message.properties.currency, - value: f - ? this.formatRevenue(e.message.properties.value) - : this.formatRevenue(e.message.properties.price), - contents: [ - { - id: - e.message.properties.product_id || - e.message.properties.id || - e.message.properties.sku || - "", - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }, - ], - }, - p - ); - } else if (r === "Order Completed") { - (d = e.message.properties.products), - (p = this.buildPayLoad(e, !0)), - (i = this.formatRevenue(e.message.properties.revenue)); - for ( - var h = this.getContentType(e, ["product"]), - g = [], - y = ((l = []), 0); - y < d.length; - y++ - ) { - var m = product.product_id; - g.push(m); - var v = { id: m, quantity: e.message.properties.quantity }; - e.message.properties.price && - (v.item_price = e.message.properties.price), - l.push(v); - } - window.fbq( - "trackSingle", - n.pixelId, - "Purchase", - this.merge( - { - content_ids: g, - content_type: h, - currency: e.message.properties.currency, - value: i, - contents: l, - num_items: g.length, - }, - p - ), - { eventID: e.message.messageId } - ), - Lt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: t.formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Products Searched") { - p = this.buildPayLoad(e, !0); - window.fbq( - "trackSingle", - n.pixelId, - "Search", - this.merge( - { search_string: e.message.properties.query }, - p - ), - { eventID: e.message.messageId } - ), - Lt(function (t) { - window.fbq( - "trackSingle", - n.pixelId, - t, - { - currency: e.message.properties.currency, - value: formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } else if (r === "Checkout Started") { - (d = e.message.properties.products), - (p = this.buildPayLoad(e, !0)), - (i = this.formatRevenue(e.message.properties.revenue)); - let b = e.message.properties.category; - for (g = [], l = [], y = 0; y < d.length; y++) { - m = d[y].product_id; - g.push(m); - v = { - id: m, - quantity: e.message.properties.quantity, - item_price: e.message.properties.price, - }; - e.message.properties.price && - (v.item_price = e.message.properties.price), - l.push(v); - } - !b && d[0] && d[0].category && (b = d[0].category), - window.fbq( - "trackSingle", - n.pixelId, - "InitiateCheckout", - this.merge( - { - content_category: b, - content_ids: g, - content_type: this.getContentType(e, ["product"]), - currency: e.message.properties.currency, - value: i, - contents: l, - num_items: g.length, - }, - p - ), - { eventID: e.message.messageId } - ), - Lt(function (r) { - window.fbq( - "trackSingle", - n.pixelId, - r, - { - currency: e.message.properties.currency, - value: t.formatRevenue(e.message.properties.revenue), - }, - { eventID: e.message.messageId } - ); - }, a); - } - }, - }, - { - key: "getContentType", - value(e, t) { - const n = e.message.options; - if (n && n.contentType) return [n.contentType]; - let r; - let i = e.message.properties.category; - if (!i) { - const o = e.message.properties.products; - o && o.length && (i = o[0].category); - } - if ( - i && - (r = this.categoryToContent.reduce(function (e, t) { - return t.from == i && e.push(t.to), e; - }, [])).length - ) - return r; - return t; - }, - }, - { - key: "merge", - value(e, t) { - const n = {}; - for (const r in e) e.hasOwnProperty(r) && (n[r] = e[r]); - for (const i in t) - t.hasOwnProperty(i) && !n.hasOwnProperty(i) && (n[i] = t[i]); - return n; - }, - }, - { - key: "formatRevenue", - value(e) { - return Number(e || 0).toFixed(2); - }, - }, - { - key: "buildPayLoad", - value(e, t) { - for ( - var n = [ - "checkinDate", - "checkoutDate", - "departingArrivalDate", - "departingDepartureDate", - "returningArrivalDate", - "returningDepartureDate", - "travelEnd", - "travelStart", - ], - r = [ - "email", - "firstName", - "lastName", - "gender", - "city", - "country", - "phone", - "state", - "zip", - "birthday", - ], - i = this.whitelistPiiProperties || [], - o = this.blacklistPiiProperties || [], - s = this.eventCustomProperties || [], - a = {}, - u = 0; - u < o[u]; - u++ - ) { - const c = o[u]; - a[c.blacklistPiiProperties] = c.blacklistPiiHash; - } - const l = {}; - const d = e.message.properties; - for (const p in d) - if (d.hasOwnProperty(p) && !(t && s.indexOf(p) < 0)) { - const f = d[p]; - if (n.indexOf(d) >= 0 && et.date(f)) - l[p] = f.toISOTring().split("T")[0]; - else if (a.hasOwnProperty(p)) - a[p] && typeof f === "string" && (l[p] = sha256(f)); - else { - const h = r.indexOf(p) >= 0; - const g = i.indexOf(p) >= 0; - (h && !g) || (l[p] = f); - } - } - return l; - }, - }, - ]), - e - ); - })(), - Nt = "lt_synch_timestamp", - Bt = new ((function () { - function e() { - n(this, e), (this.storage = Oe); - } - return ( - i(e, [ - { - key: "setLotameSynchTime", - value(e) { - this.storage.setItem(Nt, e); - }, - }, - { - key: "getLotameSynchTime", - value() { - return this.storage.getItem(Nt); - }, - }, - ]), - e - ); - })())(), - qt = { - HS: O, - GA: Se, - HOTJAR: Pe, - GOOGLEADS: xe, - VWO: Re, - GTM: je, - BRAZE: De, - INTERCOM: Ge, - KEEN: He, - KISSMETRICS: yt, - CUSTOMERIO: mt, - CHARTBEAT: It, - COMSCORE: _t, - FACEBOOK_PIXEL: Mt, - LOTAME: (function () { - function e(t, r) { - const i = this; - n(this, e), - (this.name = "LOTAME"), - (this.analytics = r), - (this.storage = Bt), - (this.bcpUrlSettingsPixel = t.bcpUrlSettingsPixel), - (this.bcpUrlSettingsIframe = t.bcpUrlSettingsIframe), - (this.dspUrlSettingsPixel = t.dspUrlSettingsPixel), - (this.dspUrlSettingsIframe = t.dspUrlSettingsIframe), - (this.mappings = {}), - t.mappings.forEach(function (e) { - const t = e.key; - const n = e.value; - i.mappings[t] = n; - }); - } - return ( - i(e, [ - { - key: "init", - value() { - p("===in init Lotame==="), - (window.LOTAME_SYNCH_CALLBACK = function () {}); - }, - }, - { - key: "addPixel", - value(e, t, n) { - p(`Adding pixel for :: ${e}`); - const r = document.createElement("img"); - (r.src = e), - r.setAttribute("width", t), - r.setAttribute("height", n), - p(`Image Pixel :: ${r}`), - document.getElementsByTagName("body")[0].appendChild(r); - }, - }, - { - key: "addIFrame", - value(e) { - p(`Adding iframe for :: ${e}`); - const t = document.createElement("iframe"); - (t.src = e), - (t.title = "empty"), - t.setAttribute("id", "LOTCCFrame"), - t.setAttribute("tabindex", "-1"), - t.setAttribute("role", "presentation"), - t.setAttribute("aria-hidden", "true"), - t.setAttribute( - "style", - "border: 0px; width: 0px; height: 0px; display: block;" - ), - p(`IFrame :: ${t}`), - document.getElementsByTagName("body")[0].appendChild(t); - }, - }, - { - key: "syncPixel", - value(e) { - const t = this; - if ( - (p("===== in syncPixel ======"), - p("Firing DSP Pixel URLs"), - this.dspUrlSettingsPixel && - this.dspUrlSettingsPixel.length > 0) - ) { - const n = Date.now(); - this.dspUrlSettingsPixel.forEach(function (r) { - const i = t.compileUrl( - a({}, t.mappings, { userId: e, random: n }), - r.dspUrlTemplate - ); - t.addPixel(i, "1", "1"); - }); - } - if ( - (p("Firing DSP IFrame URLs"), - this.dspUrlSettingsIframe && - this.dspUrlSettingsIframe.length > 0) - ) { - const r = Date.now(); - this.dspUrlSettingsIframe.forEach(function (n) { - const i = t.compileUrl( - a({}, t.mappings, { userId: e, random: r }), - n.dspUrlTemplate - ); - t.addIFrame(i); - }); - } - this.storage.setLotameSynchTime(Date.now()), - this.analytics.methodToCallbackMapping.syncPixel && - this.analytics.emit("syncPixel", { - destination: this.name, - }); - }, - }, - { - key: "compileUrl", - value(e, t) { - return ( - Object.keys(e).forEach(function (n) { - if (e.hasOwnProperty(n)) { - const r = new RegExp(`{{${n}}}`, "gi"); - t = t.replace(r, e[n]); - } - }), - t - ); - }, - }, - { - key: "identify", - value(e) { - p("in Lotame identify"); - const t = e.message.userId; - this.syncPixel(t); - }, - }, - { - key: "track", - value(e) { - p("track not supported for lotame"); - }, - }, - { - key: "page", - value(e) { - const t = this; - if ( - (p("in Lotame page"), - p("Firing BCP Pixel URLs"), - this.bcpUrlSettingsPixel && - this.bcpUrlSettingsPixel.length > 0) - ) { - const n = Date.now(); - this.bcpUrlSettingsPixel.forEach(function (e) { - const r = t.compileUrl( - a({}, t.mappings, { random: n }), - e.bcpUrlTemplate - ); - t.addPixel(r, "1", "1"); - }); - } - if ( - (p("Firing BCP IFrame URLs"), - this.bcpUrlSettingsIframe && - this.bcpUrlSettingsIframe.length > 0) - ) { - const r = Date.now(); - this.bcpUrlSettingsIframe.forEach(function (e) { - const n = t.compileUrl( - a({}, t.mappings, { random: r }), - e.bcpUrlTemplate - ); - t.addIFrame(n); - }); - } - e.message.userId && - this.isPixelToBeSynched() && - this.syncPixel(e.message.userId); - }, - }, - { - key: "isPixelToBeSynched", - value() { - const e = this.storage.getLotameSynchTime(); - const t = Date.now(); - return !e || Math.floor((t - e) / 864e5) >= 7; - }, - }, - { - key: "isLoaded", - value() { - return p("in Lotame isLoaded"), !0; - }, - }, - { - key: "isReady", - value() { - return !0; - }, - }, - ]), - e - ); - })(), - }, - Ft = function e() { - n(this, e), - (this.build = "1.0.0"), - (this.name = "RudderLabs JavaScript SDK"), - (this.namespace = "com.rudderlabs.javascript"), - (this.version = "1.1.2"); - }, - Kt = function e() { - n(this, e), - (this.name = "RudderLabs JavaScript SDK"), - (this.version = "1.1.2"); - }, - Gt = function e() { - n(this, e), (this.name = ""), (this.version = ""); - }, - Ht = function e() { - n(this, e), (this.density = 0), (this.width = 0), (this.height = 0); - }, - Vt = function e() { - n(this, e), - (this.app = new Ft()), - (this.traits = null), - (this.library = new Kt()); - const t = new Gt(); - t.version = ""; - const r = new Ht(); - (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); - }, - zt = (function () { - function e() { - n(this, e), - (this.channel = "web"), - (this.context = new Vt()), - (this.type = null), - (this.action = null), - (this.messageId = m().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(e) { - return this.properties[e]; - }, - }, - { - key: "addProperty", - value(e, t) { - this.properties[e] = t; - }, - }, - { - key: "validateFor", - value(e) { - if (!this.properties) - throw new Error("Key properties is required"); - switch (e) { - case A.TRACK: - if (!this.event) - throw new Error("Key event is required for track event"); - if ((this.event in Object.values(C))) - switch (this.event) { - case C.CHECKOUT_STEP_VIEWED: - case C.CHECKOUT_STEP_COMPLETED: - case C.PAYMENT_INFO_ENTERED: - this.checkForKey("checkout_id"), - this.checkForKey("step"); - break; - case C.PROMOTION_VIEWED: - case C.PROMOTION_CLICKED: - this.checkForKey("promotion_id"); - break; - case C.ORDER_REFUNDED: - this.checkForKey("order_id"); - } - else - this.properties.category || - (this.properties.category = this.event); - break; - case A.PAGE: - break; - case A.SCREEN: - if (!this.properties.name) - throw new Error("Key 'name' is required in properties"); - } - }, - }, - { - key: "checkForKey", - value(e) { - if (!this.properties[e]) - throw new Error(`Key '${e}' is required in properties`); - }, - }, - ]), - e - ); - })(), - Jt = (function () { - function e() { - n(this, e), (this.message = new zt()); - } - return ( - i(e, [ - { - key: "setType", - value(e) { - this.message.type = e; - }, - }, - { - key: "setProperty", - value(e) { - this.message.properties = e; - }, - }, - { - key: "setUserProperty", - value(e) { - this.message.user_properties = e; - }, - }, - { - key: "setUserId", - value(e) { - this.message.userId = e; - }, - }, - { - key: "setEventName", - value(e) { - this.message.event = e; - }, - }, - { - key: "updateTraits", - value(e) { - this.message.context.traits = e; - }, - }, - { - key: "getElementContent", - value() { - return this.message; - }, - }, - ]), - e - ); - })(), - Wt = (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(e) { - return (this.rudderProperty = e), this; - }, - }, - { - key: "setPropertyBuilder", - value(e) { - return (this.rudderProperty = e.build()), this; - }, - }, - { - key: "setUserProperty", - value(e) { - return (this.rudderUserProperty = e), this; - }, - }, - { - key: "setUserPropertyBuilder", - value(e) { - return (this.rudderUserProperty = e.build()), this; - }, - }, - { - key: "setEvent", - value(e) { - return (this.event = e), this; - }, - }, - { - key: "setUserId", - value(e) { - return (this.userId = e), this; - }, - }, - { - key: "setChannel", - value(e) { - return (this.channel = e), this; - }, - }, - { - key: "setType", - value(e) { - return (this.type = e), this; - }, - }, - { - key: "build", - value() { - const e = new Jt(); - return ( - e.setUserId(this.userId), - e.setType(this.type), - e.setEventName(this.event), - e.setProperty(this.rudderProperty), - e.setUserProperty(this.rudderUserProperty), - e - ); - }, - }, - ]), - e - ); - })(), - $t = function e() { - n(this, e), (this.batch = null), (this.writeKey = null); - }, - Yt = R(function (e) { - const t = - (typeof crypto !== "undefined" && - crypto.getRandomValues && - crypto.getRandomValues.bind(crypto)) || - (typeof msCrypto !== "undefined" && - typeof window.msCrypto.getRandomValues === "function" && - msCrypto.getRandomValues.bind(msCrypto)); - if (t) { - const n = new Uint8Array(16); - e.exports = function () { - return t(n), n; - }; - } else { - const r = new Array(16); - e.exports = function () { - for (var e, t = 0; t < 16; t++) - (3 & t) == 0 && (e = 4294967296 * Math.random()), - (r[t] = (e >>> ((3 & t) << 3)) & 255); - return r; - }; - } - }), - Qt = [], - Zt = 0; - Zt < 256; - ++Zt - ) - Qt[Zt] = (Zt + 256).toString(16).substr(1); - let Xt; - let en; - const tn = function (e, t) { - let n = t || 0; - const r = Qt; - 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(""); - }; - let nn = 0; - let rn = 0; - const on = function (e, t, n) { - let r = (t && n) || 0; - const i = t || []; - let o = (e = e || {}).node || Xt; - let s = void 0 !== e.clockseq ? e.clockseq : en; - if (o == null || s == null) { - const a = Yt(); - o == null && (o = Xt = [1 | a[0], a[1], a[2], a[3], a[4], a[5]]), - s == null && (s = en = 16383 & ((a[6] << 8) | a[7])); - } - let u = void 0 !== e.msecs ? e.msecs : new Date().getTime(); - let c = void 0 !== e.nsecs ? e.nsecs : rn + 1; - const l = u - nn + (c - rn) / 1e4; - if ( - (l < 0 && void 0 === e.clockseq && (s = (s + 1) & 16383), - (l < 0 || u > nn) && void 0 === e.nsecs && (c = 0), - c >= 1e4) - ) - throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); - (nn = u), (rn = c), (en = s); - const 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); - const p = ((u / 4294967296) * 1e4) & 268435455; - (i[r++] = (p >>> 8) & 255), - (i[r++] = 255 & p), - (i[r++] = ((p >>> 24) & 15) | 16), - (i[r++] = (p >>> 16) & 255), - (i[r++] = (s >>> 8) | 128), - (i[r++] = 255 & s); - for (let f = 0; f < 6; ++f) i[r + f] = o[f]; - return t || tn(i); - }; - const sn = function (e, t, n) { - const r = (t && n) || 0; - typeof e === "string" && - ((t = e === "binary" ? new Array(16) : null), (e = null)); - const i = (e = e || {}).random || (e.rng || Yt)(); - if (((i[6] = (15 & i[6]) | 64), (i[8] = (63 & i[8]) | 128), t)) - for (let o = 0; o < 16; ++o) t[r + o] = i[o]; - return t || tn(i); - }; - const an = sn; - (an.v1 = on), (an.v4 = sn); - const un = an; - const cn = un.v4; - const ln = { - _data: {}, - length: 0, - setItem(e, t) { - return (this._data[e] = t), (this.length = Pt(this._data).length), t; - }, - getItem(e) { - return e in this._data ? this._data[e] : null; - }, - removeItem(e) { - return ( - e in this._data && delete this._data[e], - (this.length = Pt(this._data).length), - null - ); - }, - clear() { - (this._data = {}), (this.length = 0); - }, - key(e) { - return Pt(this._data)[e]; - }, - }; - const dn = { - defaultEngine: (function () { - try { - if (!window.localStorage) return !1; - const e = cn(); - window.localStorage.setItem(e, "test_value"); - const t = window.localStorage.getItem(e); - return window.localStorage.removeItem(e), t === "test_value"; - } catch (e) { - return !1; - } - })() - ? window.localStorage - : ln, - inMemoryEngine: ln, - }; - const pn = dn.defaultEngine; - const fn = dn.inMemoryEngine; - function hn(e, t, n, r) { - (this.id = t), - (this.name = e), - (this.keys = n || {}), - (this.engine = r || pn); - } - (hn.prototype.set = function (e, t) { - const n = this._createValidKey(e); - if (n) - try { - this.engine.setItem(n, ue.stringify(t)); - } catch (n) { - (function (e) { - let t = !1; - if (e.code) - switch (e.code) { - case 22: - t = !0; - break; - case 1014: - e.name === "NS_ERROR_DOM_QUOTA_REACHED" && (t = !0); - } - else e.number === -2147024882 && (t = !0); - return t; - })(n) && (this._swapEngine(), this.set(e, t)); - } - }), - (hn.prototype.get = function (e) { - try { - const t = this.engine.getItem(this._createValidKey(e)); - return t === null ? null : ue.parse(t); - } catch (e) { - return null; - } - }), - (hn.prototype.remove = function (e) { - this.engine.removeItem(this._createValidKey(e)); - }), - (hn.prototype._createValidKey = function (e) { - let t; - const n = this.name; - const r = this.id; - return Pt(this.keys).length - ? (Lt(function (i) { - i === e && (t = [n, r, e].join(".")); - }, this.keys), - t) - : [n, r, e].join("."); - }), - (hn.prototype._swapEngine = function () { - const e = this; - Lt(function (t) { - const n = e.get(t); - fn.setItem([e.name, e.id, t].join("."), n), e.remove(t); - }, this.keys), - (this.engine = fn); - }); - const gn = hn; - const yn = { - setTimeout(e, t) { - return window.setTimeout(e, t); - }, - clearTimeout(e) { - return window.clearTimeout(e); - }, - Date: window.Date, - }; - let mn = yn; - function vn() { - (this.tasks = {}), (this.nextId = 1); - } - (vn.prototype.now = function () { - return +new mn.Date(); - }), - (vn.prototype.run = function (e, t) { - const n = this.nextId++; - return (this.tasks[n] = mn.setTimeout(this._handle(n, e), t)), n; - }), - (vn.prototype.cancel = function (e) { - this.tasks[e] && (mn.clearTimeout(this.tasks[e]), delete this.tasks[e]); - }), - (vn.prototype.cancelAll = function () { - Lt(mn.clearTimeout, this.tasks), (this.tasks = {}); - }), - (vn.prototype._handle = function (e, t) { - const n = this; - return function () { - return delete n.tasks[e], t(); - }; - }), - (vn.setClock = function (e) { - mn = e; - }), - (vn.resetClock = function () { - mn = yn; - }); - const bn = vn; - const wn = kn; - function kn(e) { - return kn.enabled(e) - ? function (t) { - t = In(t); - const n = new Date(); - const r = n - (kn[e] || n); - (kn[e] = n), - (t = `${e} ${t} +${kn.humanize(r)}`), - window.console && - console.log && - Function.prototype.apply.call(console.log, console, arguments); - } - : function () {}; - } - function In(e) { - return e instanceof Error ? e.stack || e.message : e; - } - (kn.names = []), - (kn.skips = []), - (kn.enable = function (e) { - try { - localStorage.debug = e; - } catch (e) {} - for (let t = (e || "").split(/[\s,]+/), n = t.length, r = 0; r < n; r++) - (e = t[r].replace("*", ".*?"))[0] === "-" - ? kn.skips.push(new RegExp(`^${e.substr(1)}$`)) - : kn.names.push(new RegExp(`^${e}$`)); - }), - (kn.disable = function () { - kn.enable(""); - }), - (kn.humanize = function (e) { - return e >= 36e5 - ? `${(e / 36e5).toFixed(1)}h` - : e >= 6e4 - ? `${(e / 6e4).toFixed(1)}m` - : e >= 1e3 - ? `${(e / 1e3) | 0}s` - : `${e}ms`; - }), - (kn.enabled = function (e) { - for (var t = 0, n = kn.skips.length; t < n; t++) - if (kn.skips[t].test(e)) return !1; - for (t = 0, n = kn.names.length; t < n; t++) - if (kn.names[t].test(e)) return !0; - return !1; - }); - try { - window.localStorage && kn.enable(localStorage.debug); - } catch (e) {} - const _n = R(function (e) { - function t(e) { - if (e) - return (function (e) { - for (const n in t.prototype) e[n] = t.prototype[n]; - return e; - })(e); - } - (e.exports = t), - (t.prototype.on = t.prototype.addEventListener = function (e, t) { - return ( - (this._callbacks = this._callbacks || {}), - (this._callbacks[`$${e}`] = this._callbacks[`$${e}`] || []).push(t), - this - ); - }), - (t.prototype.once = function (e, t) { - function n() { - this.off(e, n), t.apply(this, arguments); - } - return (n.fn = t), this.on(e, n), this; - }), - (t.prototype.off = t.prototype.removeListener = t.prototype.removeAllListeners = t.prototype.removeEventListener = function ( - e, - t - ) { - if (((this._callbacks = this._callbacks || {}), arguments.length == 0)) - return (this._callbacks = {}), this; - let n; - const r = this._callbacks[`$${e}`]; - if (!r) return this; - if (arguments.length == 1) return delete this._callbacks[`$${e}`], this; - for (let i = 0; i < r.length; i++) - if ((n = r[i]) === t || n.fn === t) { - r.splice(i, 1); - break; - } - return r.length === 0 && delete this._callbacks[`$${e}`], this; - }), - (t.prototype.emit = function (e) { - this._callbacks = this._callbacks || {}; - for ( - var t = new Array(arguments.length - 1), - n = this._callbacks[`$${e}`], - r = 1; - r < arguments.length; - r++ - ) - t[r - 1] = arguments[r]; - if (n) { - r = 0; - for (let i = (n = n.slice(0)).length; r < i; ++r) n[r].apply(this, t); - } - return this; - }), - (t.prototype.listeners = function (e) { - return ( - (this._callbacks = this._callbacks || {}), - this._callbacks[`$${e}`] || [] - ); - }), - (t.prototype.hasListeners = function (e) { - return !!this.listeners(e).length; - }); - }); - const En = un.v4; - const An = wn("localstorage-retry"); - function Cn(e, t) { - return function () { - return e.apply(t, arguments); - }; - } - function Tn(e, t, n) { - typeof t === "function" && (n = t), - (this.name = e), - (this.id = En()), - (this.fn = n), - (this.maxItems = t.maxItems || 1 / 0), - (this.maxAttempts = t.maxAttempts || 1 / 0), - (this.backoff = { - MIN_RETRY_DELAY: t.minRetryDelay || 1e3, - MAX_RETRY_DELAY: t.maxRetryDelay || 3e4, - FACTOR: t.backoffFactor || 2, - JITTER: t.backoffJitter || 0, - }), - (this.timeouts = { - ACK_TIMER: 1e3, - RECLAIM_TIMER: 3e3, - RECLAIM_TIMEOUT: 1e4, - RECLAIM_WAIT: 500, - }), - (this.keys = { - IN_PROGRESS: "inProgress", - QUEUE: "queue", - ACK: "ack", - RECLAIM_START: "reclaimStart", - RECLAIM_END: "reclaimEnd", - }), - (this._schedule = new bn()), - (this._processId = 0), - (this._store = new gn(this.name, this.id, this.keys)), - this._store.set(this.keys.IN_PROGRESS, {}), - this._store.set(this.keys.QUEUE, []), - (this._ack = Cn(this._ack, this)), - (this._checkReclaim = Cn(this._checkReclaim, this)), - (this._processHead = Cn(this._processHead, this)), - (this._running = !1); - } - _n(Tn.prototype), - (Tn.prototype.start = function () { - this._running && this.stop(), - (this._running = !0), - this._ack(), - this._checkReclaim(), - this._processHead(); - }), - (Tn.prototype.stop = function () { - this._schedule.cancelAll(), (this._running = !1); - }), - (Tn.prototype.shouldRetry = function (e, t) { - return !(t > this.maxAttempts); - }), - (Tn.prototype.getDelay = function (e) { - let t = this.backoff.MIN_RETRY_DELAY * Math.pow(this.backoff.FACTOR, e); - if (this.backoff.JITTER) { - const n = Math.random(); - const 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)); - }), - (Tn.prototype.addItem = function (e) { - this._enqueue({ item: e, attemptNumber: 0, time: this._schedule.now() }); - }), - (Tn.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); - }), - (Tn.prototype._enqueue = function (e) { - let 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(); - }), - (Tn.prototype._processHead = function () { - const e = this; - const t = this._store; - this._schedule.cancel(this._processId); - let n = t.get(this.keys.QUEUE) || []; - const r = t.get(this.keys.IN_PROGRESS) || {}; - const i = this._schedule.now(); - const o = []; - function s(n, r) { - o.push({ - item: n.item, - done(i, o) { - const 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 ( - let a = Object.keys(r).length; - n.length && n[0].time <= i && a++ < e.maxItems; - - ) { - const u = n.shift(); - const c = En(); - (r[c] = { - item: u.item, - attemptNumber: u.attemptNumber, - time: e._schedule.now(), - }), - s(u, c); - } - t.set(this.keys.QUEUE, n), - t.set(this.keys.IN_PROGRESS, r), - Lt(function (t) { - try { - e.fn(t.item, t.done); - } catch (e) { - An(`Process function threw error: ${e}`); - } - }, o), - (n = t.get(this.keys.QUEUE) || []), - this._schedule.cancel(this._processId), - n.length > 0 && - (this._processId = this._schedule.run( - this._processHead, - n[0].time - i - )); - }), - (Tn.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); - }), - (Tn.prototype._checkReclaim = function () { - const e = this; - Lt( - function (t) { - t.id !== e.id && - (e._schedule.now() - t.get(e.keys.ACK) < - e.timeouts.RECLAIM_TIMEOUT || - (function (t) { - t.set(e.keys.RECLAIM_START, e.id), - t.set(e.keys.ACK, e._schedule.now()), - e._schedule.run(function () { - t.get(e.keys.RECLAIM_START) === e.id && - (t.set(e.keys.RECLAIM_END, e.id), - e._schedule.run(function () { - t.get(e.keys.RECLAIM_END) === e.id && - t.get(e.keys.RECLAIM_START) === e.id && - e._reclaim(t.id); - }, e.timeouts.RECLAIM_WAIT)); - }, e.timeouts.RECLAIM_WAIT); - })(t)); - }, - (function (t) { - for (var n = [], r = e._store.engine, i = 0; i < r.length; i++) { - const o = r.key(i).split("."); - o.length === 3 && - o[0] === t && - o[2] === "ack" && - n.push(new gn(t, o[1], e.keys)); - } - return n; - })(this.name) - ), - this._schedule.run(this._checkReclaim, this.timeouts.RECLAIM_TIMER); - }), - (Tn.prototype._reclaim = function (e) { - const t = this; - const n = new gn(this.name, e, this.keys); - const r = { queue: this._store.get(this.keys.QUEUE) || [] }; - const i = { - inProgress: n.get(this.keys.IN_PROGRESS) || {}, - queue: n.get(this.keys.QUEUE) || [], - }; - Lt(function (e) { - r.queue.push({ - item: e.item, - attemptNumber: e.attemptNumber, - time: t._schedule.now(), - }); - }, i.queue), - Lt(function (e) { - r.queue.push({ - item: e.item, - attemptNumber: e.attemptNumber + 1, - time: t._schedule.now(), - }); - }, i.inProgress), - (r.queue = r.queue.sort(function (e, t) { - return e.time - t.time; - })), - this._store.set(this.keys.QUEUE, r.queue), - n.remove(this.keys.ACK), - n.remove(this.keys.RECLAIM_START), - n.remove(this.keys.RECLAIM_END), - n.remove(this.keys.IN_PROGRESS), - n.remove(this.keys.QUEUE), - this._processHead(); - }); - const On = Tn; - const Sn = { - maxRetryDelay: 36e4, - minRetryDelay: 1e3, - backoffFactor: 2, - maxAttempts: 10, - maxItems: 100, - }; - var Pn = new ((function () { - function e() { - n(this, e), - (this.eventsBuffer = []), - (this.writeKey = ""), - (this.url = "https://hosted.rudderlabs.com"), - (this.state = "READY"), - (this.batchSize = 0), - (this.payloadQueue = new On("rudder", Sn, function (e, t) { - (e.message.sentAt = v()), - Pn.processQueueElement(e.url, e.headers, e.message, 1e4, function ( - e, - n - ) { - if (e) return t(e); - t(null, n); - }); - })), - this.payloadQueue.start(); - } - return ( - i(e, [ - { - key: "preaparePayloadAndFlush", - value(e) { - if ( - (p(`==== in preaparePayloadAndFlush with state: ${e.state}`), - p(e.eventsBuffer), - e.eventsBuffer.length != 0 && e.state !== "PROCESSING") - ) { - const t = e.eventsBuffer; - const n = new $t(); - (n.batch = t), - (n.writeKey = e.writeKey), - (n.sentAt = v()), - n.batch.forEach(function (e) { - e.sentAt = n.sentAt; - }), - (e.batchSize = e.eventsBuffer.length); - const r = new XMLHttpRequest(); - p("==== in flush sending to Rudder BE ===="), - p(JSON.stringify(n, y)), - r.open("POST", e.url, !0), - r.setRequestHeader("Content-Type", "application/json"), - r.setRequestHeader( - "Authorization", - `Basic ${btoa(`${n.writeKey}:`)}` - ), - (r.onreadystatechange = function () { - r.readyState === 4 && r.status === 200 - ? (p(`====== request processed successfully: ${r.status}`), - (e.eventsBuffer = e.eventsBuffer.slice(e.batchSize)), - p(e.eventsBuffer.length)) - : r.readyState === 4 && - r.status !== 200 && - b( - new Error( - `request failed with status: ${r.status} for url: ${e.url}` - ) - ), - (e.state = "READY"); - }), - r.send(JSON.stringify(n, y)), - (e.state = "PROCESSING"); - } - }, - }, - { - key: "processQueueElement", - value(e, t, n, r, i) { - try { - const o = new XMLHttpRequest(); - for (const s in (o.open("POST", e, !0), t)) - o.setRequestHeader(s, t[s]); - (o.timeout = r), - (o.ontimeout = i), - (o.onerror = i), - (o.onreadystatechange = function () { - o.readyState === 4 && - (o.status === 429 || (o.status >= 500 && o.status < 600) - ? (b( - 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}` - ) - )) - : (p( - `====== request processed successfully: ${o.status}` - ), - i(null, o.status))); - }), - o.send(JSON.stringify(n, y)); - } catch (e) { - i(e); - } - }, - }, - { - key: "enqueue", - value(e, t) { - const n = e.getElementContent(); - const r = { - "Content-Type": "application/json", - Authorization: `Basic ${btoa(`${this.writeKey}:`)}`, - AnonymousId: btoa(n.anonymousId), - }; - (n.originalTimestamp = v()), - (n.sentAt = v()), - JSON.stringify(n).length > 32e3 && - f( - "[EventRepository] enqueue:: message length greater 32 Kb ", - n - ); - const i = - this.url.slice(-1) == "/" ? this.url.slice(0, -1) : this.url; - this.payloadQueue.addItem({ - url: `${i}/v1/${t}`, - headers: r, - message: n, - }); - }, - }, - ]), - e - ); - })())(); - function xn(e) { - const t = function (t) { - let n = (t = t || window.event).target || t.srcElement; - Ln(n) && (n = n.parentNode), - jn(n, t) - ? p("to be tracked ", t.type) - : p("not to be tracked ", t.type), - (function (e, t) { - let n = e.target || e.srcElement; - let r = void 0; - Ln(n) && (n = n.parentNode); - if (jn(n, e)) { - if (n.tagName.toLowerCase() == "form") { - r = {}; - for (let i = 0; i < n.elements.length; i++) { - const o = n.elements[i]; - if (Bn(o) && Nn(o, t.trackValues)) { - const s = o.id ? o.id : o.name; - if (s && typeof s === "string") { - const a = o.id ? o.id : o.name; - let u = o.id - ? document.getElementById(o.id).value - : document.getElementsByName(o.name)[0].value; - (o.type !== "checkbox" && o.type !== "radio") || - (u = o.checked), - a.trim() !== "" && - (r[encodeURIComponent(a)] = encodeURIComponent(u)); - } - } - } - } - for (var c = [n], l = n; l.parentNode && !Dn(l, "body"); ) - c.push(l.parentNode), (l = l.parentNode); - let d; - const f = []; - let h = !1; - if ( - (c.forEach(function (e) { - const n = (function (e) { - return !(!e.parentNode || Dn(e, "body")); - })(e); - e.tagName.toLowerCase() === "a" && - ((d = e.getAttribute("href")), (d = n && d)), - (h = h || !Bn(e)), - f.push( - (function (e, t) { - for ( - var n = { - classes: Mn(e).split(" "), - tag_name: e.tagName.toLowerCase(), - }, - r = e.attributes.length, - i = 0; - i < r; - i++ - ) { - const o = e.attributes[i].name; - const s = e.attributes[i].value; - s && (n[`attr__${o}`] = s), - (o != "name" && o != "id") || - !Nn(e, t.trackValues) || - ((n.field_value = - o == "id" - ? document.getElementById(s).value - : document.getElementsByName(s)[0].value), - (e.type !== "checkbox" && e.type !== "radio") || - (n.field_value = e.checked)); - } - let a = 1; - let u = 1; - let c = e; - for (; (c = qn(c)); ) a++, c.tagName === e.tagName && u++; - return (n.nth_child = a), (n.nth_of_type = u), n; - })(e, t) - ); - }), - h) - ) - return !1; - let g = ""; - const y = (function (e) { - let t = ""; - return ( - e.childNodes.forEach(function (e) { - e.nodeType === Node.TEXT_NODE && (t += e.nodeValue); - }), - t.trim() - ); - })(n); - y && y.length && (g = y); - const m = { - event_type: e.type, - page: w(), - elements: f, - el_attr_href: d, - el_text: g, - }; - r && (m.form_values = r), - p("web_event", m), - t.track("autotrack", m); - } - })(t, e); - }; - Rn(document, "submit", t, !0), - Rn(document, "change", t, !0), - Rn(document, "click", t, !0), - e.page(); - } - function Rn(e, t, n, r) { - e - ? e.addEventListener(t, n, !!r) - : f( - "[Autotrack] register_event:: No valid element provided to register_event" - ); - } - function jn(e, t) { - if (!e || Dn(e, "html") || !Un(e)) return !1; - switch (e.tagName.toLowerCase()) { - case "html": - return !1; - case "form": - return t.type === "submit"; - case "input": - return ["button", "submit"].indexOf(e.getAttribute("type")) === -1 - ? t.type === "change" - : t.type === "click"; - case "select": - case "textarea": - return t.type === "change"; - default: - return t.type === "click"; - } - } - function Dn(e, t) { - return e && e.tagName && e.tagName.toLowerCase() === t.toLowerCase(); - } - function Un(e) { - return e && e.nodeType === 1; - } - function Ln(e) { - return e && e.nodeType === 3; - } - function Mn(e) { - switch (t(e.className)) { - case "string": - return e.className; - case "object": - return e.className.baseVal || e.getAttribute("class") || ""; - default: - return ""; - } - } - function Nn(e, t) { - for (let n = e.attributes.length, r = 0; r < n; r++) { - const i = e.attributes[r].value; - if (t.indexOf(i) > -1) return !0; - } - return !1; - } - function Bn(e) { - return !(Mn(e).split(" ").indexOf("rudder-no-track") >= 0); - } - function qn(e) { - if (e.previousElementSibling) return e.previousElementSibling; - do { - e = e.previousSibling; - } while (e && !Un(e)); - return e; - } - const Fn = function (e, t, n) { - let r = !1; - return (n = n || Kn), (i.count = e), e === 0 ? 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)) : i.count !== 0 || r || t(null, o); - } - }; - function Kn() {} - function Gn(e, t) { - this.eventRepository || (this.eventRepository = Pn), - this.eventRepository.enqueue(e, t); - } - var Hn = new ((function () { - function e() { - n(this, e), - (this.autoTrackHandlersRegistered = !1), - (this.autoTrackFeatureEnabled = !1), - (this.initialized = !1), - (this.trackValues = []), - (this.eventsBuffer = []), - (this.clientIntegrations = []), - (this.loadOnlyIntegrations = {}), - (this.clientIntegrationObjects = void 0), - (this.successfullyLoadedIntegration = []), - (this.failedToBeLoadedIntegration = []), - (this.toBeProcessedArray = []), - (this.toBeProcessedByIntegrationArray = []), - (this.storage = Oe), - (this.userId = - this.storage.getUserId() != null ? this.storage.getUserId() : ""), - (this.userTraits = - this.storage.getUserTraits() != null - ? this.storage.getUserTraits() - : {}), - (this.groupId = - this.storage.getGroupId() != null ? this.storage.getGroupId() : ""), - (this.groupTraits = - this.storage.getGroupTraits() != null - ? this.storage.getGroupTraits() - : {}), - (this.anonymousId = this.getAnonymousId()), - this.storage.setUserId(this.userId), - (this.eventRepository = Pn), - (this.sendAdblockPage = !1), - (this.sendAdblockPageOptions = {}), - (this.clientSuppliedCallbacks = {}), - (this.readyCallback = function () {}), - (this.executeReadyCallback = void 0), - (this.methodToCallbackMapping = { syncPixel: "syncPixelCallback" }); - } - return ( - i(e, [ - { - key: "processResponse", - value(e, t) { - try { - p(`===in process response=== ${e}`), - (t = JSON.parse(t)).source.useAutoTracking && - !this.autoTrackHandlersRegistered && - ((this.autoTrackFeatureEnabled = !0), - xn(this), - (this.autoTrackHandlersRegistered = !0)), - t.source.destinations.forEach(function (e, t) { - p( - `Destination ${t} Enabled? ${e.enabled} Type: ${e.destinationDefinition.name} Use Native SDK? ${e.config.useNativeSDK}` - ), - e.enabled && - this.clientIntegrations.push({ - name: e.destinationDefinition.name, - config: e.config, - }); - }, this), - (this.clientIntegrations = E( - this.loadOnlyIntegrations, - this.clientIntegrations - )), - (this.clientIntegrations = this.clientIntegrations.filter( - function (e) { - return qt[e.name] != null; - } - )), - this.init(this.clientIntegrations); - } catch (e) { - b(e), - p("===handling config BE response processing error==="), - p( - "autoTrackHandlersRegistered", - this.autoTrackHandlersRegistered - ), - this.autoTrackFeatureEnabled && - !this.autoTrackHandlersRegistered && - (xn(this), (this.autoTrackHandlersRegistered = !0)); - } - }, - }, - { - key: "init", - value(e) { - const t = this; - const n = this; - if ((p("supported intgs ", qt), !e || e.length == 0)) - return ( - this.readyCallback && this.readyCallback(), - void (this.toBeProcessedByIntegrationArray = []) - ); - e.forEach(function (e) { - try { - p( - "[Analytics] init :: trying to initialize integration name:: ", - e.name - ); - const r = new (0, qt[e.name])(e.config, n); - r.init(), - p("initializing destination: ", e), - t.isInitialized(r).then(t.replayEvents); - } catch (t) { - f( - "[Analytics] initialize integration (integration.init()) failed :: ", - e.name - ); - } - }); - }, - }, - { - key: "replayEvents", - value(e) { - e.successfullyLoadedIntegration.length + - e.failedToBeLoadedIntegration.length == - e.clientIntegrations.length && - e.toBeProcessedByIntegrationArray.length > 0 && - (p( - "===replay events called====", - e.successfullyLoadedIntegration.length, - e.failedToBeLoadedIntegration.length - ), - (e.clientIntegrationObjects = []), - (e.clientIntegrationObjects = e.successfullyLoadedIntegration), - p( - "==registering after callback===", - e.clientIntegrationObjects.length - ), - (e.executeReadyCallback = Fn( - e.clientIntegrationObjects.length, - e.readyCallback - )), - p("==registering ready callback==="), - e.on("ready", e.executeReadyCallback), - e.clientIntegrationObjects.forEach(function (t) { - p("===looping over each successful integration===="), - (t.isReady && !t.isReady()) || - (p("===letting know I am ready=====", t.name), - e.emit("ready")); - }), - e.toBeProcessedByIntegrationArray.forEach(function (t) { - const n = t[0]; - t.shift(), - Object.keys(t[0].message.integrations).length > 0 && - _(t[0].message.integrations); - for ( - let r = E( - t[0].message.integrations, - e.clientIntegrationObjects - ), - i = 0; - i < r.length; - i++ - ) - try { - var o; - if (!r[i].isFailed || !r[i].isFailed()) - if (r[i][n]) (o = r[i])[n].apply(o, u(t)); - } catch (e) { - b(e); - } - }), - (e.toBeProcessedByIntegrationArray = [])); - }, - }, - { - key: "pause", - value(e) { - return new Promise(function (t) { - setTimeout(t, e); - }); - }, - }, - { - key: "isInitialized", - value(e) { - const t = this; - const n = - arguments.length > 1 && void 0 !== arguments[1] - ? arguments[1] - : 0; - return new Promise(function (r) { - return e.isLoaded() - ? (p("===integration loaded successfully====", e.name), - t.successfullyLoadedIntegration.push(e), - r(t)) - : n >= 1e4 - ? (p("====max wait over===="), - t.failedToBeLoadedIntegration.push(e), - r(t)) - : void t.pause(1e3).then(function () { - return ( - p("====after pause, again checking===="), - t.isInitialized(e, n + 1e3).then(r) - ); - }); - }); - }, - }, - { - key: "page", - value(e, n, r, i, o) { - typeof i === "function" && ((o = i), (i = null)), - typeof r === "function" && ((o = r), (i = r = null)), - typeof n === "function" && ((o = n), (i = r = n = null)), - t(e) === "object" && ((i = n), (r = e), (n = e = null)), - t(n) === "object" && ((i = r), (r = n), (n = null)), - typeof e === "string" && - typeof n !== "string" && - ((n = e), (e = null)), - this.sendAdblockPage && - e != "RudderJS-Initiated" && - this.sendSampleRequest(), - this.processPage(e, n, r, i, o); - }, - }, - { - key: "track", - value(e, t, n, r) { - typeof n === "function" && ((r = n), (n = null)), - typeof t === "function" && ((r = t), (n = null), (t = null)), - this.processTrack(e, t, n, r); - }, - }, - { - key: "identify", - value(e, n, r, i) { - typeof r === "function" && ((i = r), (r = null)), - typeof n === "function" && ((i = n), (r = null), (n = null)), - t(e) == "object" && ((r = n), (n = e), (e = this.userId)), - this.processIdentify(e, n, r, i); - }, - }, - { - key: "alias", - value(e, n, r, i) { - typeof r === "function" && ((i = r), (r = null)), - typeof n === "function" && ((i = n), (r = null), (n = null)), - t(n) == "object" && ((r = n), (n = null)); - const o = new Wt().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(e, n, r, i) { - if (arguments.length) { - typeof r === "function" && ((i = r), (r = null)), - typeof n === "function" && ((i = n), (r = null), (n = null)), - t(e) == "object" && ((r = n), (n = e), (e = this.groupId)), - (this.groupId = e), - this.storage.setGroupId(this.groupId); - const o = new Wt().setType("group").build(); - if (n) for (const 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(e, t, n, r, i) { - const o = new Wt().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(e, t, n, r) { - const i = new Wt().setType("track").build(); - e && i.setEventName(e), - t ? i.setProperty(t) : i.setProperty({}), - this.trackEvent(i, n, r); - }, - }, - { - key: "processIdentify", - value(e, t, n, r) { - e && this.userId && e !== this.userId && this.reset(), - (this.userId = e), - this.storage.setUserId(this.userId); - const i = new Wt().setType("identify").build(); - if (t) { - for (const o in t) this.userTraits[o] = t[o]; - this.storage.setUserTraits(this.userTraits); - } - this.identifyUser(i, n, r); - }, - }, - { - key: "identifyUser", - value(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 = { - ...e.message.context.traits, - }), - this.storage.setUserTraits(this.userTraits)), - this.processAndSendDataToDestinations("identify", e, t, n); - }, - }, - { - key: "trackPage", - value(e, t, n) { - this.processAndSendDataToDestinations("page", e, t, n); - }, - }, - { - key: "trackEvent", - value(e, t, n) { - this.processAndSendDataToDestinations("track", e, t, n); - }, - }, - { - key: "processAndSendDataToDestinations", - value(e, t, n, r) { - try { - this.anonymousId || this.setAnonymousId(), - (t.message.context.page = w()), - (t.message.context.traits = { ...this.userTraits }), - p("anonymousId: ", this.anonymousId), - (t.message.anonymousId = this.anonymousId), - (t.message.userId = t.message.userId - ? t.message.userId - : this.userId), - e == "group" && - (this.groupId && (t.message.groupId = this.groupId), - this.groupTraits && - (t.message.traits = { ...this.groupTraits })), - n && this.processOptionsParam(t, n), - p(JSON.stringify(t)), - Object.keys(t.message.integrations).length > 0 && - _(t.message.integrations), - E( - t.message.integrations, - this.clientIntegrationObjects - ).forEach(function (n) { - (n.isFailed && n.isFailed()) || (n[e] && n[e](t)); - }), - this.clientIntegrationObjects || - (p("pushing in replay queue"), - this.toBeProcessedByIntegrationArray.push([e, t])), - (i = t.message.integrations), - Object.keys(i).forEach(function (e) { - i.hasOwnProperty(e) && - (g[e] && (i[g[e]] = i[e]), - e != "All" && g[e] != null && g[e] != e && delete i[e]); - }), - Gn.call(this, t, e), - p(`${e} is called `), - r && r(); - } catch (e) { - b(e); - } - let i; - }, - }, - { - key: "processOptionsParam", - value(e, t) { - const n = ["integrations", "anonymousId", "originalTimestamp"]; - for (const r in t) - if (n.includes(r)) e.message[r] = t[r]; - else if (r !== "context") e.message.context[r] = t[r]; - else for (const i in t[r]) e.message.context[i] = t[r][i]; - }, - }, - { - key: "getPageProperties", - value(e) { - const t = w(); - for (const n in t) void 0 === e[n] && (e[n] = t[n]); - return e; - }, - }, - { - key: "reset", - value() { - (this.userId = ""), (this.userTraits = {}), this.storage.clear(); - }, - }, - { - key: "getAnonymousId", - value() { - return ( - (this.anonymousId = this.storage.getAnonymousId()), - this.anonymousId || this.setAnonymousId(), - this.anonymousId - ); - }, - }, - { - key: "setAnonymousId", - value(e) { - (this.anonymousId = e || m()), - this.storage.setAnonymousId(this.anonymousId); - }, - }, - { - key: "load", - value(e, n, r) { - const i = this; - p("inside load "); - let o = "https://api.rudderlabs.com/sourceConfig/?p=web&v=1.1.2"; - if (!e || !n || n.length == 0) - throw ( - (b({ - message: - "[Analytics] load:: Unable to load due to wrong writeKey or serverUrl", - }), - Error("failed to initialize")) - ); - if ( - (r && r.logLevel && d(r.logLevel), - r && - r.integrations && - (Object.assign(this.loadOnlyIntegrations, r.integrations), - _(this.loadOnlyIntegrations)), - r && r.configUrl && (o = r.configUrl), - r && r.sendAdblockPage && (this.sendAdblockPage = !0), - r && - r.sendAdblockPageOptions && - t(r.sendAdblockPageOptions) == "object" && - (this.sendAdblockPageOptions = r.sendAdblockPageOptions), - r && r.clientSuppliedCallbacks) - ) { - const s = {}; - Object.keys(this.methodToCallbackMapping).forEach(function (e) { - i.methodToCallbackMapping.hasOwnProperty(e) && - r.clientSuppliedCallbacks[i.methodToCallbackMapping[e]] && - (s[e] = - r.clientSuppliedCallbacks[i.methodToCallbackMapping[e]]); - }), - Object.assign(this.clientSuppliedCallbacks, s), - this.registerCallbacks(!0); - } - (this.eventRepository.writeKey = e), - n && (this.eventRepository.url = n), - r && - r.valTrackingList && - r.valTrackingList.push == Array.prototype.push && - (this.trackValues = r.valTrackingList), - r && - r.useAutoTracking && - ((this.autoTrackFeatureEnabled = !0), - this.autoTrackFeatureEnabled && - !this.autoTrackHandlersRegistered && - (xn(this), - (this.autoTrackHandlersRegistered = !0), - p( - "autoTrackHandlersRegistered", - this.autoTrackHandlersRegistered - ))); - try { - !(function (e, t, n, r) { - let i; - const o = r.bind(e); - (i = new XMLHttpRequest()).open("GET", t, !0), - i.setRequestHeader("Authorization", `Basic ${btoa(`${n}:`)}`), - (i.onload = function () { - const e = i.status; - e == 200 - ? (p("status 200 calling callback"), - o(200, i.responseText)) - : (b( - new Error( - `request failed with status: ${i.status} for url: ${t}` - ) - ), - o(e)); - }), - i.send(); - })(this, o, e, this.processResponse); - } catch (e) { - b(e), - this.autoTrackFeatureEnabled && - !this.autoTrackHandlersRegistered && - xn(Hn); - } - }, - }, - { - key: "ready", - value(e) { - typeof e !== "function" - ? f("ready callback is not a function") - : (this.readyCallback = e); - }, - }, - { - key: "initializeCallbacks", - value() { - const e = this; - Object.keys(this.methodToCallbackMapping).forEach(function (t) { - e.methodToCallbackMapping.hasOwnProperty(t) && - e.on(t, function () {}); - }); - }, - }, - { - key: "registerCallbacks", - value(e) { - const t = this; - e || - Object.keys(this.methodToCallbackMapping).forEach(function (e) { - t.methodToCallbackMapping.hasOwnProperty(e) && - window.rudderanalytics && - typeof window.rudderanalytics[ - t.methodToCallbackMapping[e] - ] === "function" && - (t.clientSuppliedCallbacks[e] = - window.rudderanalytics[t.methodToCallbackMapping[e]]); - }), - Object.keys(this.clientSuppliedCallbacks).forEach(function (e) { - t.clientSuppliedCallbacks.hasOwnProperty(e) && - (p("registerCallbacks", e, t.clientSuppliedCallbacks[e]), - t.on(e, t.clientSuppliedCallbacks[e])); - }); - }, - }, - { - key: "sendSampleRequest", - value() { - T( - "ad-block", - "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js" - ); - }, - }, - ]), - e - ); - })())(); - _n(Hn), - window.addEventListener( - "error", - function (e) { - b(e, Hn); - }, - !0 - ), - Hn.initializeCallbacks(), - Hn.registerCallbacks(!1); - const Vn = - !!window.rudderanalytics && - window.rudderanalytics.push == Array.prototype.push; - const zn = window.rudderanalytics ? window.rudderanalytics[0] : []; - if (zn.length > 0 && zn[0] == "load") { - const Jn = zn[0]; - zn.shift(), - p("=====from init, calling method:: ", Jn), - Hn[Jn].apply(Hn, u(zn)); - } - if (Vn) { - for (let Wn = 1; Wn < window.rudderanalytics.length; Wn++) - Hn.toBeProcessedArray.push(window.rudderanalytics[Wn]); - for (let $n = 0; $n < Hn.toBeProcessedArray.length; $n++) { - const Yn = u(Hn.toBeProcessedArray[$n]); - const Qn = Yn[0]; - Yn.shift(), - p("=====from init, calling method:: ", Qn), - Hn[Qn].apply(Hn, u(Yn)); - } - Hn.toBeProcessedArray = []; - } - const Zn = Hn.ready.bind(Hn); - const Xn = Hn.identify.bind(Hn); - const er = Hn.page.bind(Hn); - const tr = Hn.track.bind(Hn); - const nr = Hn.alias.bind(Hn); - const rr = Hn.group.bind(Hn); - const ir = Hn.reset.bind(Hn); - const or = Hn.load.bind(Hn); - const sr = (Hn.initialized = !0); - const ar = Hn.getAnonymousId.bind(Hn); - const ur = Hn.setAnonymousId.bind(Hn); - return ( - (e.alias = nr), - (e.getAnonymousId = ar), - (e.group = rr), - (e.identify = Xn), - (e.initialized = sr), - (e.load = or), - (e.page = er), - (e.ready = Zn), - (e.reset = ir), - (e.setAnonymousId = ur), - (e.track = tr), - e - ); -})({}); -// # sourceMappingURL=https://cdn.rudderlabs.com/v1/rudder-analytics.min.js.map +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 u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var u=0;ue.length)&&(t=e.length);for(var u=0,n=new Array(t);u-1?t:t+e:window.location.href,n=u.indexOf("#");return n>-1?u.slice(0,n):u}(n)}}function R(){for(var e,t=document.getElementsByTagName("link"),u=0;e=t[u];u++)if("canonical"===e.getAttribute("rel"))return e.getAttribute("href")}function j(e,t){var u=e.revenue;return!u&&t&&t.match(/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i)&&(u=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}}(u)}function L(e){Object.keys(e).forEach((function(t){e.hasOwnProperty(t)&&(b[t]&&(e[b[t]]=e[t]),"All"!=t&&null!=b[t]&&b[t]!=t&&delete e[t])}))}function U(e,u){var n=[];if(!u||0==u.length)return n;var r=!0;return"string"==typeof u[0]?(null!=e.All&&(r=e.All),u.forEach((function(t){if(r){var u=!0;null!=e[t]&&0==e[t]&&(u=!1),u&&n.push(t)}else null!=e[t]&&1==e[t]&&n.push(t)})),n):"object"===t(u[0])?(null!=e.All&&(r=e.All),u.forEach((function(t){if(r){var u=!0;null!=e[t.name]&&0==e[t.name]&&(u=!1),u&&n.push(t)}else null!=e[t.name]&&1==e[t.name]&&n.push(t)})),n):void 0}function M(e,u){return u=u||z,"array"==function(e){switch(Object.prototype.toString.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array"}return null===e?"null":void 0===e?"undefined":e===Object(e)?"object":t(e)}(e)?N(e,u):q(e,u)}var N=function(e,t){for(var u=[],n=0;n=0},ee.bool=ee.boolean=function(e){return"[object Boolean]"===Y.call(e)},ee.false=function(e){return ee.bool(e)&&!1===Boolean(Number(e))},ee.true=function(e){return ee.bool(e)&&!0===Boolean(Number(e))},ee.date=function(e){return"[object Date]"===Y.call(e)},ee.date.valid=function(e){return ee.date(e)&&!isNaN(Number(e))},ee.element=function(e){return void 0!==e&&"undefined"!=typeof HTMLElement&&e instanceof HTMLElement&&1===e.nodeType},ee.error=function(e){return"[object Error]"===Y.call(e)},ee.fn=ee.function=function(e){if("undefined"!=typeof window&&e===window.alert)return!0;var t=Y.call(e);return"[object Function]"===t||"[object GeneratorFunction]"===t||"[object AsyncFunction]"===t},ee.number=function(e){return"[object Number]"===Y.call(e)},ee.infinite=function(e){return e===1/0||e===-1/0},ee.decimal=function(e){return ee.number(e)&&!$(e)&&!ee.infinite(e)&&e%1!=0},ee.divisibleBy=function(e,t){var u=ee.infinite(e),n=ee.infinite(t),r=ee.number(e)&&!$(e)&&ee.number(t)&&!$(t)&&0!==t;return u||n||r&&e%t==0},ee.integer=ee.int=function(e){return ee.number(e)&&!$(e)&&e%1==0},ee.maximum=function(e,t){if($(e))throw new TypeError("NaN is not a valid value");if(!ee.arraylike(t))throw new TypeError("second argument must be array-like");for(var u=t.length;--u>=0;)if(e=0;)if(e>t[u])return!1;return!0},ee.nan=function(e){return!ee.number(e)||e!=e},ee.even=function(e){return ee.infinite(e)||ee.number(e)&&e==e&&e%2==0},ee.odd=function(e){return ee.infinite(e)||ee.number(e)&&e==e&&e%2!=0},ee.ge=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e>=t},ee.gt=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e>t},ee.le=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e<=t},ee.lt=function(e,t){if($(e)||$(t))throw new TypeError("NaN is not a valid value");return!ee.infinite(e)&&!ee.infinite(t)&&e=t&&e<=u},ee.object=function(e){return"[object Object]"===Y.call(e)},ee.primitive=function(e){return!e||!("object"===t(e)||ee.object(e)||ee.fn(e)||ee.array(e))},ee.hash=function(e){return ee.object(e)&&e.constructor===Object&&!e.nodeType&&!e.setInterval},ee.regexp=function(e){return"[object RegExp]"===Y.call(e)},ee.string=function(e){return"[object String]"===Y.call(e)},ee.base64=function(e){return ee.string(e)&&(!e.length||Q.test(e))},ee.hex=function(e){return ee.string(e)&&(!e.length||X.test(e))},ee.symbol=function(e){return"function"==typeof Symbol&&"[object Symbol]"===Y.call(e)&&"symbol"===t(G.call(e))},ee.bigint=function(e){return"function"==typeof BigInt&&"[object BigInt]"===Y.call(e)&&"bigint"==typeof K.call(e)};var te,ue=ee,ne=Object.prototype.toString,re=function(e){switch(ne.call(e)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===e?"null":void 0===e?"undefined":e&&1===e.nodeType?"element":e===Object(e)?"object":t(e)},ie=/\b(Array|Date|Object|Math|JSON)\b/g,oe=function(e,t){var u=function(e){for(var t=[],u=0;u-1?u:t.map((function(e){return e.product_id})).indexOf(e.properties.product_id)+1}},{key:"extractCheckoutOptions",value:function(e){var t=M([e.message.properties.paymentMethod,e.message.properties.shippingMethod]);return t.length>0?t.join(", "):null}}]),e}(),ge=function(){function e(t){u(this,e),this.siteId=t.siteID,this.name="HOTJAR",this._ready=!1}return r(e,[{key:"init",value:function(){window.hotjarSiteId=this.siteId,function(e,t,u,n,r,i){e.hj=e.hj||function(){(e.hj.q=e.hj.q||[]).push(arguments)},e._hjSettings={hjid:e.hotjarSiteId,hjsv:6},r=t.getElementsByTagName("head")[0],(i=t.createElement("script")).async=1,i.src="https://static.hotjar.com/c/hotjar-"+e._hjSettings.hjid+".js?sv="+e._hjSettings.hjsv,r.appendChild(i)}(window,document),this._ready=!0,F("===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 F("[Hotjar] identify:: user id is required")}},{key:"track",value:function(e){F("[Hotjar] track:: method not supported")}},{key:"page",value:function(e){F("[Hotjar] page:: method not supported")}},{key:"isLoaded",value:function(){return this._ready}},{key:"isReady",value:function(){return this._ready}}]),e}(),me=function(){function e(t){u(this,e),this.conversionId=t.conversionID,this.pageLoadConversions=t.pageLoadConversions,this.clickEventConversions=t.clickEventConversions,this.defaultPageConversion=t.defaultPageConversion,this.name="GOOGLEADS"}return r(e,[{key:"init",value:function(){!function(e,t,u){F("in script loader=== ".concat(e));var n=u.createElement("script");n.src=t,n.async=1,n.type="text/javascript",n.id=e;var r=u.getElementsByTagName("head")[0];F("==script==",r),r.appendChild(n)}("googleAds-integration","https://www.googletagmanager.com/gtag/js?id=".concat(this.conversionId),document),window.dataLayer=window.dataLayer||[],window.gtag=function(){window.dataLayer.push(arguments)},window.gtag("js",new Date),window.gtag("config",this.conversionId),F("===in init Google Ads===")}},{key:"identify",value:function(e){F("[GoogleAds] identify:: method not supported")}},{key:"track",value:function(e){F("in GoogleAdsAnalyticsManager track");var t=this.getConversionData(this.clickEventConversions,e.message.event);if(t.conversionLabel){var u=t.conversionLabel,n=t.eventName,r="".concat(this.conversionId,"/").concat(u),i={};e.properties&&(i.value=e.properties.revenue,i.currency=e.properties.currency,i.transaction_id=e.properties.order_id),i.send_to=r,window.gtag("event",n,i)}}},{key:"page",value:function(e){F("in GoogleAdsAnalyticsManager page");var t=this.getConversionData(this.pageLoadConversions,e.message.name);if(t.conversionLabel){var u=t.conversionLabel,n=t.eventName;window.gtag("event",n,{send_to:"".concat(this.conversionId,"/").concat(u)})}}},{key:"getConversionData",value:function(e,t){var u={};return e&&(t?e.forEach((function(e){e.name.toLowerCase()===t.toLowerCase()&&(u.conversionLabel=e.conversionLabel,u.eventName=e.name)})):this.defaultPageConversion&&(u.conversionLabel=this.defaultPageConversion,u.eventName="Viewed a Page")),u}},{key:"isLoaded",value:function(){return window.dataLayer.push!==Array.prototype.push}},{key:"isReady",value:function(){return window.dataLayer.push!==Array.prototype.push}}]),e}(),ye=function(){function e(t,n){u(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",this.analytics=n,F("Config ",t)}return r(e,[{key:"init",value:function(){F("===in init VWO===");var e=this.accountId,t=this.settingsTolerance,u=this.libraryTolerance,n=this.useExistingJquery,r=this.isSPA;window._vwo_code=function(){var i=!1,o=document;return{use_existing_jquery:function(){return n},library_tolerance:function(){return u},finish:function(){if(!i){i=!0;var e=o.getElementById("_vis_opt_path_hides");e&&e.parentNode.removeChild(e)}},finished:function(){return i},load:function(e){var t=o.createElement("script");t.src=e,t.type="text/javascript",t.innerText,t.onerror=function(){_vwo_code.finish()},o.getElementsByTagName("head")[0].appendChild(t)},init:function(){var u=setTimeout("_vwo_code.finish()",t),n=o.createElement("style"),i="body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}",s=o.getElementsByTagName("head")[0];return n.setAttribute("id","_vis_opt_path_hides"),n.setAttribute("type","text/css"),n.styleSheet?n.styleSheet.cssText=i:n.appendChild(o.createTextNode(i)),s.appendChild(n),this.load("//dev.visualwebsiteoptimizer.com/j.php?a=".concat(e,"&u=").concat(encodeURIComponent(o.URL),"&r=").concat(Math.random(),"&f=").concat(+r)),u}}}(),window._vwo_settings_timer=window._vwo_code.init(),(this.sendExperimentTrack||this.experimentViewedIdentify)&&this.experimentViewed()}},{key:"experimentViewed",value:function(){var e=this;window.VWO=window.VWO||[];var t=this;window.VWO.push(["onVariationApplied",function(u){if(u){F("Variation Applied");var n=u[1],r=u[2];if(F("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{t.sendExperimentTrack&&(F("Tracking..."),e.analytics.track("Experiment Viewed",{experimentId:n,variationName:_vwo_exp[n].comb_n[r]}))}catch(e){w("[VWO] experimentViewed:: ",e)}try{t.sendExperimentIdentify&&(F("Identifying..."),e.analytics.identify(i({},"Experiment: ".concat(n),_vwo_exp[n].comb_n[r])))}catch(e){w("[VWO] experimentViewed:: ",e)}}}}])}},{key:"identify",value:function(e){F("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;F("Revenue",t),window.VWO=window.VWO||[],window.VWO.push(["track.revenueConversion",t])}}},{key:"page",value:function(e){F("method not supported")}},{key:"isLoaded",value:function(){return!!window._vwo_code}},{key:"isReady",value:function(){return!!window._vwo_code}}]),e}(),Ce=function(){function e(t){u(this,e),this.containerID=t.containerID,this.name="GOOGLETAGMANAGER"}return r(e,[{key:"init",value:function(){F("===in init GoogleTagManager==="),function(e,t,u,n,r){e[n]=e[n]||[],e[n].push({"gtm.start":(new Date).getTime(),event:"gtm.js"});var i=t.getElementsByTagName(u)[0],o=t.createElement(u);o.async=!0,o.src="https://www.googletagmanager.com/gtm.js?id=".concat(r).concat(""),i.parentNode.insertBefore(o,i)}(window,document,"script","dataLayer",this.containerID)}},{key:"identify",value:function(e){F("[GTM] identify:: method not supported")}},{key:"track",value:function(e){F("===in track GoogleTagManager===");var t=e.message,u=s({event:t.event,userId:t.userId,anonymousId:t.anonymousId},t.properties);this.sendToGTMDatalayer(u)}},{key:"page",value:function(e){F("===in page GoogleTagManager===");var t,u=e.message,n=u.name,r=u.properties?u.properties.category:void 0;n&&(t="Viewed ".concat(n," page")),r&&n&&(t="Viewed ".concat(r," ").concat(n," page")),t||(t="Viewed a Page");var i=s({event:t,userId:u.userId,anonymousId:u.anonymousId},u.properties);this.sendToGTMDatalayer(i)}},{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}(),Ee=function(){function e(t,n){if(u(this,e),this.analytics=n,this.appKey=t.appKey,t.appKey||(this.appKey=""),this.endPoint="",t.dataCenter){var r=t.dataCenter.trim().split("-");"eu"===r[0].toLowerCase()?this.endPoint="sdk.fra-01.braze.eu":this.endPoint="sdk.iad-".concat(r[1],".braze.com")}this.name="BRAZE",F("Config ",t)}return r(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(){F("===in init Braze==="),function(e,t,u,n,r){e.appboy={},e.appboyQueue=[];for(var i="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(" "),o=0;o>>32-t},rotr:function(e,t){return e<<32-t|e>>>t},endian:function(e){if(e.constructor==Number)return 16711935&u.rotl(e,8)|4278255360&u.rotl(e,24);for(var t=0;t0;e--)t.push(Math.floor(256*Math.random()));return t},bytesToWords:function(e){for(var t=[],u=0,n=0;u>>5]|=e[u]<<24-n%32;return t},wordsToBytes:function(e){for(var t=[],u=0;u<32*e.length;u+=8)t.push(e[u>>>5]>>>24-u%32&255);return t},bytesToHex:function(e){for(var t=[],u=0;u>>4).toString(16)),t.push((15&e[u]).toString(16));return t.join("")},hexToBytes:function(e){for(var t=[],u=0;u>>6*(3-i)&63)):u.push("=");return u.join("")},base64ToBytes:function(e){e=e.replace(/[^A-Z0-9+\/]/gi,"");for(var u=[],n=0,r=0;n>>6-2*r);return u}};e.exports=u}()})),ve={utf8:{stringToBytes:function(e){return ve.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(ve.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var t=[],u=0;u>>24)|4278255360&(s[D]<<24|s[D]>>>8);s[a>>>5]|=128<>>9<<4)]=a;var f=e._ff,h=e._gg,g=e._hh,m=e._ii;for(D=0;D>>0,l=l+C>>>0,d=d+E>>>0,p=p+A>>>0}return t.endian([c,l,d,p])};i._ff=function(e,t,u,n,r,i,o){var s=e+(t&u|~t&n)+(r>>>0)+o;return(s<>>32-i)+t},i._gg=function(e,t,u,n,r,i,o){var s=e+(t&n|u&~n)+(r>>>0)+o;return(s<>>32-i)+t},i._hh=function(e,t,u,n,r,i,o){var s=e+(t^u^n)+(r>>>0)+o;return(s<>>32-i)+t},i._ii=function(e,t,u,n,r,i,o){var s=e+(u^(t|~n))+(r>>>0)+o;return(s<>>32-i)+t},i._blocksize=16,i._digestsize=16,e.exports=function(e,u){if(null==e)throw new Error("Illegal argument "+e);var n=t.wordsToBytes(i(e,u));return u&&u.asBytes?n:u&&u.asString?r.bytesToString(n):t.bytesToHex(n)}}()})),ke=function(){function e(t){u(this,e),this.NAME="INTERCOM",this.API_KEY=t.apiKey,this.APP_ID=t.appId,this.MOBILE_APP_ID=t.mobileAppId,F("Config ",t)}return r(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 u=document,n=function e(){e.c(arguments)};n.q=[],n.c=function(e){n.q.push(e)},e.Intercom=n;var r=function(){var e=u.createElement("script");e.type="text/javascript",e.async=!0,e.src="https://widget.intercom.io/widget/".concat(window.intercomSettings.app_id);var t=u.getElementsByTagName("script")[0];t.parentNode.insertBefore(e,t)};"complete"===document.readyState?(r(),window.intercom_code=!0):e.attachEvent?(e.attachEvent("onload",r),window.intercom_code=!0):(e.addEventListener("load",r,!1),window.intercom_code=!0)}}()}},{key:"page",value:function(){window.Intercom("update")}},{key:"identify",value:function(e){var u={},n=e.message.context;if(null!=(n.Intercom?n.Intercom:null)){var r=n.Intercom.user_hash?n.Intercom.user_hash:null;null!=r&&(u.user_hash=r);var i=n.Intercom.hideDefaultLauncher?n.Intercom.hideDefaultLauncher:null;null!=i&&(u.hide_default_launcher=i)}Object.keys(n.traits).forEach((function(e){if(n.traits.hasOwnProperty(e)){var r=n.traits[e];if("company"===e){var i=[],o={};"string"==typeof n.traits[e]&&(o.company_id=Be(n.traits[e]));var s="object"===t(n.traits[e])&&Object.keys(n.traits[e])||[];s.forEach((function(t){s.hasOwnProperty(t)&&("id"!=t?o[t]=n.traits[e][t]:o.company_id=n.traits[e][t])})),"object"!==t(n.traits[e])||s.includes("id")||(o.company_id=Be(o.name)),i.push(o),u.companies=i}else u[e]=n.traits[e];switch(e){case"createdAt":u.created_at=r;break;case"anonymousId":u.user_id=r}}})),u.user_id=e.message.userId,window.Intercom("update",u)}},{key:"track",value:function(e){var t={},u=e.message;(u.properties?Object.keys(u.properties):null).forEach((function(e){var n=u.properties[e];t[e]=n})),u.event&&(t.event_name=u.event),t.user_id=u.userId?u.userId:u.anonymousId,t.created_at=Math.floor(new Date(u.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}(),_e=function(){function e(t){u(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 r(e,[{key:"init",value:function(){F("===in init Keen==="),V("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){F("in Keen identify");var t=e.message.context.traits,u=e.message.userId?e.message.userId:e.message.anonymousId,n=e.message.properties?Object.assign(n,e.message.properties):{};n.user={userId:u,traits:t},n=this.getAddOn(n),this.client.extendEvents(n)}},{key:"track",value:function(e){F("in Keen track");var t=e.message.event,u=e.message.properties;u=this.getAddOn(u),this.client.recordEvent(t,u)}},{key:"page",value:function(e){F("in Keen page");var t=e.message.name,u=e.message.properties?e.message.properties.category:void 0,n="Loaded a Page";t&&(n="Viewed ".concat(t," page")),u&&t&&(n="Viewed ".concat(u," ").concat(t," page"));var r=e.message.properties;r=this.getAddOn(r),this.client.recordEvent(n,r)}},{key:"isLoaded",value:function(){return F("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}(),Ie=Object.prototype.hasOwnProperty,Te=function(e){for(var t=Array.prototype.slice.call(arguments,1),u=0;u-1&&o.push([s,u[s]])}},{key:"initAfterPage",value:function(){var e,t=this;e=function(){var e,u,n=t.isVideo?"chartbeat_video.js":"chartbeat.js";e=document.createElement("script"),u=document.getElementsByTagName("script")[0],e.type="text/javascript",e.async=!0,e.src="//static.chartbeat.com/js/".concat(n),u.parentNode.insertBefore(e,u)},Pe?Le(e):Re.push(e),this._isReady(this).then((function(e){F("===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,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(n){return t.isLoaded()?(t.failed=!1,F("===chartbeat loaded successfully==="),e.analytics.emit("ready"),n(e)):u>=1e4?(t.failed=!0,F("===chartbeat failed==="),n(e)):void t.pause(1e3).then((function(){return t._isReady(e,u+1e3).then(n)}))}))}}]),e}(),Me=function(){function e(t,n){u(this,e),this.c2ID=t.c2ID,this.analytics=n,this.comScoreBeaconParam=t.comScoreBeaconParam?t.comScoreBeaconParam:{},this.isFirstPageCallMade=!1,this.failed=!1,this.comScoreParams={},this.replayEvents=[],this.name="COMSCORE"}return r(e,[{key:"init",value:function(){F("===in init Comscore init===")}},{key:"identify",value:function(e){F("in Comscore identify")}},{key:"track",value:function(e){F("in Comscore track")}},{key:"page",value:function(e){if(F("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){F("=====in loadConfig====="),this.comScoreParams=this.mapComscoreParams(e.message.properties),window._comscore=window._comscore||[],window._comscore.push(this.comScoreParams)}},{key:"initAfterPage",value:function(){F("=====in initAfterPage====="),function(){var e=document.createElement("script"),t=document.getElementsByTagName("script")[0];e.async=!0,e.src="".concat("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,u=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(n){return t.isLoaded()?(t.failed=!1,e.analytics.emit("ready"),n(e)):u>=1e4?(t.failed=!0,n(e)):void t.pause(1e3).then((function(){return t._isReady(e,u+1e3).then(n)}))}))}},{key:"mapComscoreParams",value:function(e){F("=====in mapComscoreParams=====");var t=this.comScoreBeaconParam,u={};return Object.keys(t).forEach((function(n){if(n in e){var r=t[n],i=e[n];u[r]=i}})),u.c1="2",u.c2=this.c2ID,F("=====in mapComscoreParams=====",u),u}},{key:"isLoaded",value:function(){return F("in Comscore isLoaded"),!this.isFirstPageCallMade||!!window.COMSCORE}},{key:"isReady",value:function(){return!!window.COMSCORE}}]),e}(),Ne=Object.prototype.hasOwnProperty,qe=String.prototype.charAt,ze=Object.prototype.toString,Ge=function(e,t){return qe.call(e,t)},Ke=function(e,t){return Ne.call(e,t)},Ve=function(e,t){t=t||Ke;for(var u=[],n=0,r=e.length;n=0&&ue.date(D))l[p]=D.toISOTring().split("T")[0];else if(s.hasOwnProperty(p))s[p]&&"string"==typeof D&&(l[p]=sha256(D));else{var f=n.indexOf(p)>=0,h=r.indexOf(p)>=0;f&&!h||(l[p]=D)}}return l}}]),e}(),et=d((function(e,t){var u;e.exports=(u=u||function(e,t){var u=Object.create||function(){function e(){}return function(t){var u;return e.prototype=t,u=new e,e.prototype=null,u}}(),n={},r=n.lib={},i=r.Base={extend:function(e){var t=u(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},o=r.WordArray=i.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||a).stringify(this)},concat:function(e){var t=this.words,u=e.words,n=this.sigBytes,r=e.sigBytes;if(this.clamp(),n%4)for(var i=0;i>>2]>>>24-i%4*8&255;t[n+i>>>2]|=o<<24-(n+i)%4*8}else for(i=0;i>>2]=u[i>>>2];return this.sigBytes+=r,this},clamp:function(){var t=this.words,u=this.sigBytes;t[u>>>2]&=4294967295<<32-u%4*8,t.length=e.ceil(u/4)},clone:function(){var e=i.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var u,n=[],r=function(t){t=t;var u=987654321,n=4294967295;return function(){var r=((u=36969*(65535&u)+(u>>16)&n)<<16)+(t=18e3*(65535&t)+(t>>16)&n)&n;return r/=4294967296,(r+=.5)*(e.random()>.5?1:-1)}},i=0;i>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,u=[],n=0;n>>3]|=parseInt(e.substr(n,2),16)<<24-n%8*4;return new o.init(u,t/2)}},c=s.Latin1={stringify:function(e){for(var t=e.words,u=e.sigBytes,n=[],r=0;r>>2]>>>24-r%4*8&255;n.push(String.fromCharCode(i))}return n.join("")},parse:function(e){for(var t=e.length,u=[],n=0;n>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new o.init(u,t)}},l=s.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},d=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var u=this._data,n=u.words,r=u.sigBytes,i=this.blockSize,s=r/(4*i),a=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*i,c=e.min(4*a,r);if(a){for(var l=0;l>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;s<4&&i+.75*s>>6*(3-s)&63));var a=n.charAt(64);if(a)for(;r.length%4;)r.push(a);return r.join("")},parse:function(e){var t=e.length,u=this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var i=0;i>>6-o%4*2;r[i>>>2]|=(s|a)<<24-i%4*8,i++}return n.create(r,i)}(e,t,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},r.enc.Base64)})),d((function(e,t){var u;e.exports=(u=et,function(e){var t=u,n=t.lib,r=n.WordArray,i=n.Hasher,o=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var a=o.MD5=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var u=0;u<16;u++){var n=t+u,r=e[n];e[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var i=this._hash.words,o=e[t+0],a=e[t+1],D=e[t+2],f=e[t+3],h=e[t+4],g=e[t+5],m=e[t+6],y=e[t+7],C=e[t+8],E=e[t+9],A=e[t+10],v=e[t+11],F=e[t+12],w=e[t+13],b=e[t+14],B=e[t+15],k=i[0],_=i[1],I=i[2],T=i[3];k=c(k,_,I,T,o,7,s[0]),T=c(T,k,_,I,a,12,s[1]),I=c(I,T,k,_,D,17,s[2]),_=c(_,I,T,k,f,22,s[3]),k=c(k,_,I,T,h,7,s[4]),T=c(T,k,_,I,g,12,s[5]),I=c(I,T,k,_,m,17,s[6]),_=c(_,I,T,k,y,22,s[7]),k=c(k,_,I,T,C,7,s[8]),T=c(T,k,_,I,E,12,s[9]),I=c(I,T,k,_,A,17,s[10]),_=c(_,I,T,k,v,22,s[11]),k=c(k,_,I,T,F,7,s[12]),T=c(T,k,_,I,w,12,s[13]),I=c(I,T,k,_,b,17,s[14]),k=l(k,_=c(_,I,T,k,B,22,s[15]),I,T,a,5,s[16]),T=l(T,k,_,I,m,9,s[17]),I=l(I,T,k,_,v,14,s[18]),_=l(_,I,T,k,o,20,s[19]),k=l(k,_,I,T,g,5,s[20]),T=l(T,k,_,I,A,9,s[21]),I=l(I,T,k,_,B,14,s[22]),_=l(_,I,T,k,h,20,s[23]),k=l(k,_,I,T,E,5,s[24]),T=l(T,k,_,I,b,9,s[25]),I=l(I,T,k,_,f,14,s[26]),_=l(_,I,T,k,C,20,s[27]),k=l(k,_,I,T,w,5,s[28]),T=l(T,k,_,I,D,9,s[29]),I=l(I,T,k,_,y,14,s[30]),k=d(k,_=l(_,I,T,k,F,20,s[31]),I,T,g,4,s[32]),T=d(T,k,_,I,C,11,s[33]),I=d(I,T,k,_,v,16,s[34]),_=d(_,I,T,k,b,23,s[35]),k=d(k,_,I,T,a,4,s[36]),T=d(T,k,_,I,h,11,s[37]),I=d(I,T,k,_,y,16,s[38]),_=d(_,I,T,k,A,23,s[39]),k=d(k,_,I,T,w,4,s[40]),T=d(T,k,_,I,o,11,s[41]),I=d(I,T,k,_,f,16,s[42]),_=d(_,I,T,k,m,23,s[43]),k=d(k,_,I,T,E,4,s[44]),T=d(T,k,_,I,F,11,s[45]),I=d(I,T,k,_,B,16,s[46]),k=p(k,_=d(_,I,T,k,D,23,s[47]),I,T,o,6,s[48]),T=p(T,k,_,I,y,10,s[49]),I=p(I,T,k,_,b,15,s[50]),_=p(_,I,T,k,g,21,s[51]),k=p(k,_,I,T,F,6,s[52]),T=p(T,k,_,I,f,10,s[53]),I=p(I,T,k,_,A,15,s[54]),_=p(_,I,T,k,a,21,s[55]),k=p(k,_,I,T,C,6,s[56]),T=p(T,k,_,I,B,10,s[57]),I=p(I,T,k,_,m,15,s[58]),_=p(_,I,T,k,w,21,s[59]),k=p(k,_,I,T,h,6,s[60]),T=p(T,k,_,I,v,10,s[61]),I=p(I,T,k,_,D,15,s[62]),_=p(_,I,T,k,E,21,s[63]),i[0]=i[0]+k|0,i[1]=i[1]+_|0,i[2]=i[2]+I|0,i[3]=i[3]+T|0},_doFinalize:function(){var t=this._data,u=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;u[r>>>5]|=128<<24-r%32;var i=e.floor(n/4294967296),o=n;u[15+(r+64>>>9<<4)]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),u[14+(r+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(u.length+1),this._process();for(var s=this._hash,a=s.words,c=0;c<4;c++){var l=a[c];a[c]=16711935&(l<<8|l>>>24)|4278255360&(l<<24|l>>>8)}return s},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}});function c(e,t,u,n,r,i,o){var s=e+(t&u|~t&n)+r+o;return(s<>>32-i)+t}function l(e,t,u,n,r,i,o){var s=e+(t&n|u&~n)+r+o;return(s<>>32-i)+t}function d(e,t,u,n,r,i,o){var s=e+(t^u^n)+r+o;return(s<>>32-i)+t}function p(e,t,u,n,r,i,o){var s=e+(u^(t|~n))+r+o;return(s<>>32-i)+t}t.MD5=i._createHelper(a),t.HmacMD5=i._createHmacHelper(a)}(Math),u.MD5)})),d((function(e,t){var u,n,r,i,o,s,a,c;e.exports=(n=(u=c=et).lib,r=n.WordArray,i=n.Hasher,o=u.algo,s=[],a=o.SHA1=i.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var u=this._hash.words,n=u[0],r=u[1],i=u[2],o=u[3],a=u[4],c=0;c<80;c++){if(c<16)s[c]=0|e[t+c];else{var l=s[c-3]^s[c-8]^s[c-14]^s[c-16];s[c]=l<<1|l>>>31}var d=(n<<5|n>>>27)+a+s[c];d+=c<20?1518500249+(r&i|~r&o):c<40?1859775393+(r^i^o):c<60?(r&i|r&o|i&o)-1894007588:(r^i^o)-899497514,a=o,o=i,i=r<<30|r>>>2,r=n,n=d}u[0]=u[0]+n|0,u[1]=u[1]+r|0,u[2]=u[2]+i|0,u[3]=u[3]+o|0,u[4]=u[4]+a|0},_doFinalize:function(){var e=this._data,t=e.words,u=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(u/4294967296),t[15+(n+64>>>9<<4)]=u,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=i.clone.call(this);return e._hash=this._hash.clone(),e}}),u.SHA1=i._createHelper(a),u.HmacSHA1=i._createHmacHelper(a),c.SHA1)})),d((function(e,t){var u,n,r;e.exports=(n=(u=et).lib.Base,r=u.enc.Utf8,void(u.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=r.parse(t));var u=e.blockSize,n=4*u;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,a=o.words,c=0;c>>2];e.sigBytes-=t}},r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:f,padding:h}),reset:function(){d.reset.call(this);var e=this.cfg,t=e.iv,u=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=u.createEncryptor;else n=u.createDecryptor,this._minBufferSize=1;this._mode&&this._mode.__creator==n?this._mode.init(this,t&&t.words):(this._mode=n.call(u,this,t&&t.words),this._mode.__creator=n)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4}),g=r.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),m=(n.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,u=e.salt;if(u)var n=o.create([1398893684,1701076831]).concat(u).concat(t);else n=t;return n.toString(c)},parse:function(e){var t=c.parse(e),u=t.words;if(1398893684==u[0]&&1701076831==u[1]){var n=o.create(u.slice(2,4));u.splice(0,4),t.sigBytes-=16}return g.create({ciphertext:t,salt:n})}},y=r.SerializableCipher=i.extend({cfg:i.extend({format:m}),encrypt:function(e,t,u,n){n=this.cfg.extend(n);var r=e.createEncryptor(u,n),i=r.finalize(t),o=r.cfg;return g.create({ciphertext:i,key:u,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,u,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(u,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),C=(n.kdf={}).OpenSSL={execute:function(e,t,u,n){n||(n=o.random(8));var r=l.create({keySize:t+u}).compute(e,n),i=o.create(r.words.slice(t),4*u);return r.sigBytes=4*t,g.create({key:r,iv:i,salt:n})}},E=r.PasswordBasedCipher=y.extend({cfg:y.cfg.extend({kdf:C}),encrypt:function(e,t,u,n){var r=(n=this.cfg.extend(n)).kdf.execute(u,e.keySize,e.ivSize);n.iv=r.iv;var i=y.encrypt.call(this,e,t,r.key,n);return i.mixIn(r),i},decrypt:function(e,t,u,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var r=n.kdf.execute(u,e.keySize,e.ivSize,t.salt);return n.iv=r.iv,y.decrypt.call(this,e,t,r.key,n)}})))})),d((function(e,t){var u;e.exports=(u=et,function(){var e=u,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],s=[],a=[],c=[],l=[],d=[],p=[],D=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var u=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,r[u]=f,i[f]=u;var h=e[u],g=e[h],m=e[g],y=257*e[f]^16843008*f;o[u]=y<<24|y>>>8,s[u]=y<<16|y>>>16,a[u]=y<<8|y>>>24,c[u]=y,y=16843009*m^65537*g^257*h^16843008*u,l[f]=y<<24|y>>>8,d[f]=y<<16|y>>>16,p[f]=y<<8|y>>>24,D[f]=y,u?(u=h^e[e[e[m^h]]],n^=e[e[n]]):u=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],h=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,u=e.sigBytes/4,n=4*((this._nRounds=u+6)+1),i=this._keySchedule=[],o=0;o6&&o%u==4&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=f[o/u|0]<<24),i[o]=i[o-u]^s}for(var a=this._invKeySchedule=[],c=0;c>>24]]^d[r[s>>>16&255]]^p[r[s>>>8&255]]^D[r[255&s]]}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,c,r)},decryptBlock:function(e,t){var u=e[t+1];e[t+1]=e[t+3],e[t+3]=u,this._doCryptBlock(e,t,this._invKeySchedule,l,d,p,D,i),u=e[t+1],e[t+1]=e[t+3],e[t+3]=u},_doCryptBlock:function(e,t,u,n,r,i,o,s){for(var a=this._nRounds,c=e[t]^u[0],l=e[t+1]^u[1],d=e[t+2]^u[2],p=e[t+3]^u[3],D=4,f=1;f>>24]^r[l>>>16&255]^i[d>>>8&255]^o[255&p]^u[D++],g=n[l>>>24]^r[d>>>16&255]^i[p>>>8&255]^o[255&c]^u[D++],m=n[d>>>24]^r[p>>>16&255]^i[c>>>8&255]^o[255&l]^u[D++],y=n[p>>>24]^r[c>>>16&255]^i[l>>>8&255]^o[255&d]^u[D++];c=h,l=g,d=m,p=y}h=(s[c>>>24]<<24|s[l>>>16&255]<<16|s[d>>>8&255]<<8|s[255&p])^u[D++],g=(s[l>>>24]<<24|s[d>>>16&255]<<16|s[p>>>8&255]<<8|s[255&c])^u[D++],m=(s[d>>>24]<<24|s[p>>>16&255]<<16|s[c>>>8&255]<<8|s[255&l])^u[D++],y=(s[p>>>24]<<24|s[c>>>16&255]<<16|s[l>>>8&255]<<8|s[255&d])^u[D++],e[t]=h,e[t+1]=g,e[t+2]=m,e[t+3]=y},keySize:8});e.AES=t._createHelper(h)}(),u.AES)}))),ut=d((function(e,t){e.exports=et.enc.Utf8})),nt=Object.prototype.toString;var rt=function e(u){var n=function(e){switch(nt.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!=(u=e)&&(u._isBuffer||u.constructor&&"function"==typeof u.constructor.isBuffer&&u.constructor.isBuffer(u))?"buffer":t(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e));var u}(u);if("object"===n){var r={};for(var i in u)u.hasOwnProperty(i)&&(r[i]=e(u[i]));return r}if("array"===n){r=new Array(u.length);for(var o=0,s=u.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 u=parseFloat(t[1]);switch((t[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return 315576e5*u;case"days":case"day":case"d":return u*at;case"hours":case"hour":case"hrs":case"hr":case"h":return u*st;case"minutes":case"minute":case"mins":case"min":case"m":return u*ot;case"seconds":case"second":case"secs":case"sec":case"s":return u*it;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return u}}(e):t.long?function(e){return lt(e,at,"day")||lt(e,st,"hour")||lt(e,ot,"minute")||lt(e,it,"second")||e+" ms"}(e):function(e){return e>=at?Math.round(e/at)+"d":e>=st?Math.round(e/st)+"h":e>=ot?Math.round(e/ot)+"m":e>=it?Math.round(e/it)+"s":e+"ms"}(e)};function lt(e,t,u){if(!(e=31},u.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),u.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],u.formatters.j=function(e){return JSON.stringify(e)},u.enable(n())}))),Dt=(pt.log,pt.formatArgs,pt.save,pt.load,pt.useColors,pt.storage,pt.colors,pt("cookie")),ft=function(e,t,u){switch(arguments.length){case 3:case 2:return ht(e,t,u);case 1:return mt(e);default:return gt()}};function ht(e,t,u){u=u||{};var n=yt(e)+"="+yt(t);null==t&&(u.maxage=-1),u.maxage&&(u.expires=new Date(+new Date+u.maxage)),u.path&&(n+="; path="+u.path),u.domain&&(n+="; domain="+u.domain),u.expires&&(n+="; expires="+u.expires.toUTCString()),u.samesite&&(n+="; samesite="+u.samesite),u.secure&&(n+="; secure"),document.cookie=n}function gt(){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,u={},n=e.split(/ *; */);if(""==n[0])return u;for(var r=0;r1)))/4)-l((e-1901+t)/100)+l((e-1601+t)/400)};t=function(e){for(r=l(e/864e5),u=l(r/365.2425)+1970-1;D(u+1,0)<=r;u++);for(n=l((r-D(u,0))/30.42);D(u,n+1)<=r;n++);r=1+r-D(u,n),o=l((i=(e%864e5+864e5)%864e5)/36e5)%24,s=l(i/6e4)%60,a=l(i/1e3)%60,c=i%1e3}}return(w=function(e){return e>-1/0&&e<1/0?(t(e),e=(u<=0||u>=1e4?(u<0?"-":"+")+F(6,u<0?-u:u):F(4,u))+"-"+F(2,n+1)+"-"+F(2,r)+"T"+F(2,o)+":"+F(2,s)+":"+F(2,a)+"."+F(3,c)+"Z",u=n=r=o=s=a=c=null):e=null,e})(e)};if(C("json-stringify")&&!C("date-serialization")){var b=function(e){return w(this)},B=u.stringify;u.stringify=function(e,t,u){var n=c.prototype.toJSON;c.prototype.toJSON=b;var r=B(e,t,u);return c.prototype.toJSON=n,r}}else{var k=function(e){var t=e.charCodeAt(0),u=v[t];return u||"\\u00"+F(2,t.toString(16))},_=/[\x00-\x1f\x22\x5c]/g,I=function(e){return _.lastIndex=0,'"'+(_.test(e)?e.replace(_,k):e)+'"'};u.stringify=function(e,u,r){var i,o,s,a;if(n[t(u)]&&u)if("[object Function]"==(a=h.call(u)))o=u;else if("[object Array]"==a){s={};for(var l,p=0,D=u.length;p0)for(r>10&&(r=10),i="";i.length-1/0&&l<1/0?""+l:"null";case"string":case"[object String]":return I(""+l)}if("object"==t(l)){for(C=a.length;C--;)if(a[C]===l)throw d();if(a.push(l),f=[],E=s,s+=o,"[object Array]"==D){for(y=0,C=l.length;y=48&&r<=57||r>=97&&r<=102||r>=65&&r<=70||P();e+=O("0x"+i.slice(t,T));break;default:P()}else{if(34==r)break;for(r=i.charCodeAt(T),t=T;r>=32&&92!=r&&34!=r;)r=i.charCodeAt(++T);e+=i.slice(t,T)}if(34==i.charCodeAt(T))return T++,e;P();default:if(t=T,45==r&&(n=!0,r=i.charCodeAt(++T)),r>=48&&r<=57){for(48==r&&((r=i.charCodeAt(T+1))>=48&&r<=57)&&P(),n=!1;T=48&&r<=57);T++);if(46==i.charCodeAt(T)){for(u=++T;u57);u++);u==T&&P(),T=u}if(101==(r=i.charCodeAt(T))||69==r){for(43!=(r=i.charCodeAt(++T))&&45!=r||T++,u=T;u57);u++);u==T&&P(),T=u}return+i.slice(t,T)}n&&P();var s=i.slice(T,T+4);if("true"==s)return T+=4,!0;if("fals"==s&&101==i.charCodeAt(T+4))return T+=5,!1;if("null"==s)return T+=4,null;P()}return"$"},j=function(e,t,u){var n=L(e,t,u);void 0===n?delete e[t]:e[t]=n},L=function(e,u,n){var r,i=e[u];if("object"==t(i)&&i)if("[object Array]"==h.call(i))for(r=i.length;r--;)j(h,A,i);else A(i,(function(e){j(i,e,n)}));return n.call(e,u,i)};u.parse=function(e,t){var u,n;return T=0,S=""+e,u=function e(t){var u,n;if("$"==t&&P(),"string"==typeof t){if("@"==(E?t.charAt(0):t[0]))return t.slice(1);if("["==t){for(u=[];"]"!=(t=R());)n?","==t?"]"==(t=R())&&P():P():n=!0,","==t&&P(),u.push(e(t));return u}if("{"==t){for(u={};"}"!=(t=R());)n?","==t?"}"==(t=R())&&P():P():n=!0,","!=t&&"string"==typeof t&&"@"==(E?t.charAt(0):t[0])&&":"==R()||P(),u[t.slice(1)]=e(R());return u}P()}return t}(R()),"$"!=R()&&P(),T=S=null,t&&"[object Function]"==h.call(t)?L(((n={})[""]=u,n),"",t):u}}}return u.runInContext=s,u}if(!o||o.global!==o&&o.window!==o&&o.self!==o||(i=o),r)s(i,r);else{var a=i.JSON,c=i.JSON3,d=!1,p=s(i,i.JSON3={noConflict:function(){return d||(d=!0,i.JSON=a,i.JSON3=c,a=c=null),p}});i.JSON={parse:p.parse,stringify:p.stringify}}}).call(l)})),Rt=d((function(e,t){(t=e.exports=function(e){function n(){}function i(){var e=i,n=+new Date,o=n-(u||n);e.diff=o,e.prev=u,e.curr=n,u=n,null==e.useColors&&(e.useColors=t.useColors()),null==e.color&&e.useColors&&(e.color=r());var s=Array.prototype.slice.call(arguments);s[0]=t.coerce(s[0]),"string"!=typeof s[0]&&(s=["%o"].concat(s));var a=0;s[0]=s[0].replace(/%([a-z%])/g,(function(u,n){if("%%"===u)return u;a++;var r=t.formatters[n];if("function"==typeof r){var i=s[a];u=r.call(e,i),s.splice(a,1),a--}return u})),"function"==typeof t.formatArgs&&(s=t.formatArgs.apply(e,s));var c=i.log||t.log||console.log.bind(console);c.apply(e,s)}n.enabled=!1,i.enabled=!0;var o=t.enabled(e)?i:n;return o.namespace=e,o}).coerce=function(e){return e instanceof Error?e.stack||e.message:e},t.disable=function(){t.enable("")},t.enable=function(e){t.save(e);for(var u=(e||"").split(/[\s,]+/),n=u.length,r=0;r=31},u.storage="undefined"!=typeof chrome&&void 0!==chrome.storage?chrome.storage.local:function(){try{return window.localStorage}catch(e){}}(),u.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],u.formatters.j=function(e){return JSON.stringify(e)},u.enable(n())}))),Lt=(jt.log,jt.formatArgs,jt.save,jt.load,jt.useColors,jt.storage,jt.colors,jt("cookie")),Ut=function(e,t,u){switch(arguments.length){case 3:case 2:return Mt(e,t,u);case 1:return qt(e);default:return Nt()}};function Mt(e,t,u){u=u||{};var n=zt(e)+"="+zt(t);null==t&&(u.maxage=-1),u.maxage&&(u.expires=new Date(+new Date+u.maxage)),u.path&&(n+="; path="+u.path),u.domain&&(n+="; domain="+u.domain),u.expires&&(n+="; expires="+u.expires.toUTCString()),u.secure&&(n+="; secure"),document.cookie=n}function Nt(){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,u={},n=e.split(/ *; */);if(""==n[0])return u;for(var r=0;r=0;--i)r.push(t.slice(i).join("."));return r},n.cookie=Ut,t=e.exports=n})),Vt=new(function(){function e(t){u(this,e),this._options={},this.options(t)}return r(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=".".concat(Kt(window.location.href));"."===t&&(t=null),this._options=Ot(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 ft(e,t,rt(this._options)),!0}catch(e){return w(e),!1}}},{key:"get",value:function(e){return ft(e)}},{key:"remove",value:function(e){try{return ft(e,null,rt(this._options)),!0}catch(e){return!1}}}]),e}())({}),Ht=function(){var e,t={},u="undefined"!=typeof window?window:l,n=u.document;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,u,n){null==n&&(n=u,u=null),null==u&&(u={});var r=t.get(e,u);n(r),t.set(e,r)},t.getAll=function(){var e={};return t.forEach((function(t,u){e[t]=u})),e},t.forEach=function(){},t.serialize=function(e){return Pt.stringify(e)},t.deserialize=function(e){if("string"==typeof e)try{return Pt.parse(e)}catch(t){return e||void 0}},function(){try{return"localStorage"in u&&u.localStorage}catch(e){return!1}}())e=u.localStorage,t.set=function(u,n){return void 0===n?t.remove(u):(e.setItem(u,t.serialize(n)),n)},t.get=function(u,n){var r=t.deserialize(e.getItem(u));return void 0===r?n:r},t.remove=function(t){e.removeItem(t)},t.clear=function(){e.clear()},t.forEach=function(u){for(var n=0;ndocument.w=window<\/script>'),i.close(),r=i.w.frames[0].document,e=r.createElement("div")}catch(t){e=n.createElement("div"),r=n.body}var o=function(u){return function(){var n=Array.prototype.slice.call(arguments,0);n.unshift(e),r.appendChild(e),e.addBehavior("#default#userData"),e.load("localStorage");var i=u.apply(t,n);return r.removeChild(e),i}},s=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g"),a=function(e){return e.replace(/^d/,"___$&").replace(s,"___")};t.set=o((function(e,u,n){return u=a(u),void 0===n?t.remove(u):(e.setAttribute(u,t.serialize(n)),e.save("localStorage"),n)})),t.get=o((function(e,u,n){u=a(u);var r=t.deserialize(e.getAttribute(u));return void 0===r?n:r})),t.remove=o((function(e,t){t=a(t),e.removeAttribute(t),e.save("localStorage")})),t.clear=o((function(e){var t=e.XMLDocument.documentElement.attributes;e.load("localStorage");for(var u=t.length-1;u>=0;u--)e.removeAttribute(t[u].name);e.save("localStorage")})),t.forEach=o((function(e,u){for(var n,r=e.XMLDocument.documentElement.attributes,i=0;n=r[i];++i)u(n.name,t.deserialize(e.getAttribute(n.name)))}))}try{var c="__storejs__";t.set(c,c),t.get(c)!=c&&(t.disabled=!0),t.remove(c)}catch(e){t.disabled=!0}return t.enabled=!t.disabled,t}(),Wt=new(function(){function e(t){u(this,e),this._options={},this.enabled=!1,this.options(t)}return r(e,[{key:"options",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(0===arguments.length)return this._options;Ot(e,{enabled:!0}),this.enabled=e.enabled&&Ht.enabled,this._options=e}},{key:"set",value:function(e,t){return!!this.enabled&&Ht.set(e,t)}},{key:"get",value:function(e){return this.enabled?Ht.get(e):null}},{key:"remove",value:function(e){return!!this.enabled&&Ht.remove(e)}}]),e}())({}),Jt="rl_user_id",Yt="rl_trait",$t="rl_anonymous_id",Zt="rl_group_id",Qt="rl_group_trait",Xt="RudderEncrypt:",eu="Rudder",tu=new(function(){function e(){if(u(this,e),Vt.set("rudder_cookies",!0),Vt.get("rudder_cookies"))return Vt.remove("rudder_cookies"),void(this.storage=Vt);Wt.enabled&&(this.storage=Wt)}return r(e,[{key:"stringify",value:function(e){return JSON.stringify(e)}},{key:"parse",value:function(e){try{return e?JSON.parse(e):null}catch(t){return w(t),e||null}}},{key:"trim",value:function(e){return e.replace(/^\s+|\s+$/gm,"")}},{key:"encryptValue",value:function(e){return""==this.trim(e)?e:"".concat(Xt).concat(tt.encrypt(e,eu).toString())}},{key:"decryptValue",value:function(e){return!e||"string"==typeof e&&""==this.trim(e)?e:e.substring(0,Xt.length)==Xt?tt.decrypt(e.substring(Xt.length),eu).toString(ut):e}},{key:"setItem",value:function(e,t){this.storage.set(e,this.encryptValue(this.stringify(t)))}},{key:"setUserId",value:function(e){"string"==typeof e?this.storage.set(Jt,this.encryptValue(this.stringify(e))):w("[Storage] setUserId:: userId should be string")}},{key:"setUserTraits",value:function(e){this.storage.set(Yt,this.encryptValue(this.stringify(e)))}},{key:"setGroupId",value:function(e){"string"==typeof e?this.storage.set(Zt,this.encryptValue(this.stringify(e))):w("[Storage] setGroupId:: groupId should be string")}},{key:"setGroupTraits",value:function(e){this.storage.set(Qt,this.encryptValue(this.stringify(e)))}},{key:"setAnonymousId",value:function(e){"string"==typeof e?this.storage.set($t,this.encryptValue(this.stringify(e))):w("[Storage] setAnonymousId:: anonymousId should be string")}},{key:"getItem",value:function(e){return this.parse(this.decryptValue(this.storage.get(e)))}},{key:"getUserId",value:function(){return this.parse(this.decryptValue(this.storage.get(Jt)))}},{key:"getUserTraits",value:function(){return this.parse(this.decryptValue(this.storage.get(Yt)))}},{key:"getGroupId",value:function(){return this.parse(this.decryptValue(this.storage.get(Zt)))}},{key:"getGroupTraits",value:function(){return this.parse(this.decryptValue(this.storage.get(Qt)))}},{key:"getAnonymousId",value:function(){return this.parse(this.decryptValue(this.storage.get($t)))}},{key:"removeItem",value:function(e){return this.storage.remove(e)}},{key:"clear",value:function(){this.storage.remove(Jt),this.storage.remove(Yt),this.storage.remove(Zt),this.storage.remove(Qt)}}]),e}()),uu="lt_synch_timestamp",nu=new(function(){function e(){u(this,e),this.storage=tu}return r(e,[{key:"setLotameSynchTime",value:function(e){this.storage.setItem(uu,e)}},{key:"getLotameSynchTime",value:function(){return this.storage.getItem(uu)}}]),e}()),ru=function(){function e(t,n){var r=this;u(this,e),this.name="LOTAME",this.analytics=n,this.storage=nu,this.bcpUrlSettingsPixel=t.bcpUrlSettingsPixel,this.bcpUrlSettingsIframe=t.bcpUrlSettingsIframe,this.dspUrlSettingsPixel=t.dspUrlSettingsPixel,this.dspUrlSettingsIframe=t.dspUrlSettingsIframe,this.mappings={},t.mappings.forEach((function(e){var t=e.key,u=e.value;r.mappings[t]=u}))}return r(e,[{key:"init",value:function(){F("===in init Lotame==="),window.LOTAME_SYNCH_CALLBACK=function(){}}},{key:"addPixel",value:function(e,t,u){F("Adding pixel for :: ".concat(e));var n=document.createElement("img");n.src=e,n.setAttribute("width",t),n.setAttribute("height",u),F("Image Pixel :: ".concat(n)),document.getElementsByTagName("body")[0].appendChild(n)}},{key:"addIFrame",value:function(e){F("Adding iframe for :: ".concat(e));var t=document.createElement("iframe");t.src=e,t.title="empty",t.setAttribute("id","LOTCCFrame"),t.setAttribute("tabindex","-1"),t.setAttribute("role","presentation"),t.setAttribute("aria-hidden","true"),t.setAttribute("style","border: 0px; width: 0px; height: 0px; display: block;"),F("IFrame :: ".concat(t)),document.getElementsByTagName("body")[0].appendChild(t)}},{key:"syncPixel",value:function(e){var t=this;if(F("===== in syncPixel ======"),F("Firing DSP Pixel URLs"),this.dspUrlSettingsPixel&&this.dspUrlSettingsPixel.length>0){var u=Date.now();this.dspUrlSettingsPixel.forEach((function(n){var r=t.compileUrl(s(s({},t.mappings),{},{userId:e,random:u}),n.dspUrlTemplate);t.addPixel(r,"1","1")}))}if(F("Firing DSP IFrame URLs"),this.dspUrlSettingsIframe&&this.dspUrlSettingsIframe.length>0){var n=Date.now();this.dspUrlSettingsIframe.forEach((function(u){var r=t.compileUrl(s(s({},t.mappings),{},{userId:e,random:n}),u.dspUrlTemplate);t.addIFrame(r)}))}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(u){if(e.hasOwnProperty(u)){var n="{{".concat(u,"}}"),r=new RegExp(n,"gi");t=t.replace(r,e[u])}})),t}},{key:"identify",value:function(e){F("in Lotame identify");var t=e.message.userId;this.syncPixel(t)}},{key:"track",value:function(e){F("track not supported for lotame")}},{key:"page",value:function(e){var t=this;if(F("in Lotame page"),F("Firing BCP Pixel URLs"),this.bcpUrlSettingsPixel&&this.bcpUrlSettingsPixel.length>0){var u=Date.now();this.bcpUrlSettingsPixel.forEach((function(e){var n=t.compileUrl(s(s({},t.mappings),{},{random:u}),e.bcpUrlTemplate);t.addPixel(n,"1","1")}))}if(F("Firing BCP IFrame URLs"),this.bcpUrlSettingsIframe&&this.bcpUrlSettingsIframe.length>0){var n=Date.now();this.bcpUrlSettingsIframe.forEach((function(e){var u=t.compileUrl(s(s({},t.mappings),{},{random:n}),e.bcpUrlTemplate);t.addIFrame(u)}))}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 F("in Lotame isLoaded"),!0}},{key:"isReady",value:function(){return!0}}]),e}(),iu=function(){function e(t,n){var r=this;u(this,e),this.referrerOverride=function(e){if(e)return window.optimizelyEffectiveReferrer=e,e},this.sendDataToRudder=function(e){F(e);var t=e.experiment,u=e.variation,n={integrations:{All:!0}},i=e.audiences,o={};i.forEach((function(e){o[e.id]=e.name}));var s=Object.keys(o).sort().join(),a=Object.values(o).sort().join(", ");if(r.sendExperimentTrack){var c={campaignName:e.campaignName,campaignId:e.id,experimentId:t.id,experimentName:t.name,variationName:u.name,variationId:u.id,audienceId:s,audienceName:a,isInCampaignHoldback:e.isInCampaignHoldback};if(t.referrer&&(c.referrer=t.referrer,n.page={referrer:t.referrer}),r.sendExperimentTrackAsNonInteractive&&(c.nonInteraction=1),e&&r.customCampaignProperties.length>0)for(var l=0;l1){var u=t.pop();switch(u){case"str":case"int":case"date":case"real":case"bool":case"strs":case"ints":case"dates":case"reals":case"bools":return"".concat(au(t.join("_")),"_").concat(u)}}return au(e)}}]),e}(),TVSQUARED:function(){function e(t){u(this,e),this.isLoaded=function(){return F("in TVSqaured isLoaded"),!(!window._tvq||window._tvq.push===Array.prototype.push)},this.isReady=function(){return F("in TVSqaured isReady"),!(!window._tvq||window._tvq.push===Array.prototype.push)},this.page=function(){window._tvq.push(["trackPageView"])},this.formatRevenue=function(e){var t=e;return t=parseFloat(t.toString().replace(/^[^\d.]*/,""))},this.brandId=t.brandId,this.clientId=t.clientId,this.eventWhiteList=t.eventWhiteList||[],this.customMetrics=t.customMetrics||[],this.name="TVSquared"}return r(e,[{key:"init",value:function(){F("===in init TVSquared==="),window._tvq=window._tvq||[];var e="https:"===document.location.protocol?"https://":"http://";e+="collector-".concat(this.clientId,".tvsquared.com/"),window._tvq.push(["setSiteId",this.brandId]),window._tvq.push(["setTrackerUrl","".concat(e,"tv2track.php")]),V("TVSquared-integration","".concat(e,"tv2track.js"))}},{key:"track",value:function(e){var t,u,n=e.message,r=n.event,i=n.userId,o=n.anonymousId,s=e.message.properties,a=s.revenue,c=s.productType,l=s.category,d=s.order_id,p=s.promotion_id,D=this.eventWhiteList.slice();for(D=D.filter((function(e){return""!==e.event})),t=0;t>>((3&t)<<3)&255;return n}}})),Eu=[],Au=0;Au<256;++Au)Eu[Au]=(Au+256).toString(16).substr(1);var vu,Fu,wu=function(e,t){var u=t||0,n=Eu;return[n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],"-",n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]],n[e[u++]]].join("")},bu=0,Bu=0;var ku=function(e,t,u){var n=t&&u||0,r=t||[],i=(e=e||{}).node||vu,o=void 0!==e.clockseq?e.clockseq:Fu;if(null==i||null==o){var s=Cu();null==i&&(i=vu=[1|s[0],s[1],s[2],s[3],s[4],s[5]]),null==o&&(o=Fu=16383&(s[6]<<8|s[7]))}var a=void 0!==e.msecs?e.msecs:(new Date).getTime(),c=void 0!==e.nsecs?e.nsecs:Bu+1,l=a-bu+(c-Bu)/1e4;if(l<0&&void 0===e.clockseq&&(o=o+1&16383),(l<0||a>bu)&&void 0===e.nsecs&&(c=0),c>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");bu=a,Bu=c,Fu=o;var d=(1e4*(268435455&(a+=122192928e5))+c)%4294967296;r[n++]=d>>>24&255,r[n++]=d>>>16&255,r[n++]=d>>>8&255,r[n++]=255&d;var p=a/4294967296*1e4&268435455;r[n++]=p>>>8&255,r[n++]=255&p,r[n++]=p>>>24&15|16,r[n++]=p>>>16&255,r[n++]=o>>>8|128,r[n++]=255&o;for(var D=0;D<6;++D)r[n+D]=i[D];return t||wu(r)};var _u=function(e,t,u){var n=t&&u||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var r=(e=e||{}).random||(e.rng||Cu)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t)for(var i=0;i<16;++i)t[n+i]=r[i];return t||wu(r)},Iu=_u;Iu.v1=ku,Iu.v4=_u;var Tu=Iu,Su=Tu.v4,Ou={_data:{},length:0,setItem:function(e,t){return this._data[e]=t,this.length=He(this._data).length,t},getItem:function(e){return e in this._data?this._data[e]:null},removeItem:function(e){return e in this._data&&delete this._data[e],this.length=He(this._data).length,null},clear:function(){this._data={},this.length=0},key:function(e){return He(this._data)[e]}};var xu={defaultEngine:function(){try{if(!window.localStorage)return!1;var e=Su();window.localStorage.setItem(e,"test_value");var t=window.localStorage.getItem(e);return window.localStorage.removeItem(e),"test_value"===t}catch(e){return!1}}()?window.localStorage:Ou,inMemoryEngine:Ou},Pu=xu.defaultEngine,Ru=xu.inMemoryEngine;function ju(e,t,u,n){this.id=t,this.name=e,this.keys=u||{},this.engine=n||Pu,this.originalEngine=this.engine}ju.prototype.set=function(e,t){var u=this._createValidKey(e);if(u)try{this.engine.setItem(u,Pt.stringify(t))}catch(u){(function(e){var t=!1;if(e.code)switch(e.code){case 22:t=!0;break;case 1014:"NS_ERROR_DOM_QUOTA_REACHED"===e.name&&(t=!0)}else-2147024882===e.number&&(t=!0);return t})(u)&&(this._swapEngine(),this.set(e,t))}},ju.prototype.get=function(e){try{var t=this.engine.getItem(this._createValidKey(e));return null===t?null:Pt.parse(t)}catch(e){return null}},ju.prototype.getOriginalEngine=function(){return this.originalEngine},ju.prototype.remove=function(e){this.engine.removeItem(this._createValidKey(e))},ju.prototype._createValidKey=function(e){var t,u=this.name,n=this.id;return He(this.keys).length?(Qe((function(r){r===e&&(t=[u,n,e].join("."))}),this.keys),t):[u,n,e].join(".")},ju.prototype._swapEngine=function(){var e=this;Qe((function(t){var u=e.get(t);Ru.setItem([e.name,e.id,t].join("."),u),e.remove(t)}),this.keys),this.engine=Ru};var Lu=ju;var Uu={setTimeout:function(e,t){return window.setTimeout(e,t)},clearTimeout:function(e){return window.clearTimeout(e)},Date:window.Date},Mu=Uu;function Nu(){this.tasks={},this.nextId=1}Nu.prototype.now=function(){return+new Mu.Date},Nu.prototype.run=function(e,t){var u=this.nextId++;return this.tasks[u]=Mu.setTimeout(this._handle(u,e),t),u},Nu.prototype.cancel=function(e){this.tasks[e]&&(Mu.clearTimeout(this.tasks[e]),delete this.tasks[e])},Nu.prototype.cancelAll=function(){Qe(Mu.clearTimeout,this.tasks),this.tasks={}},Nu.prototype._handle=function(e,t){var u=this;return function(){return delete u.tasks[e],t()}},Nu.setClock=function(e){Mu=e},Nu.resetClock=function(){Mu=Uu};var qu=Nu,zu=Gu;function Gu(e){return Gu.enabled(e)?function(t){t=Ku(t);var u=new Date,n=u-(Gu[e]||u);Gu[e]=u,t=e+" "+t+" +"+Gu.humanize(n),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function Ku(e){return e instanceof Error?e.stack||e.message:e}Gu.names=[],Gu.skips=[],Gu.enable=function(e){try{localStorage.debug=e}catch(e){}for(var t=(e||"").split(/[\s,]+/),u=t.length,n=0;n=36e5?(e/36e5).toFixed(1)+"h":e>=6e4?(e/6e4).toFixed(1)+"m":e>=1e3?(e/1e3|0)+"s":e+"ms"},Gu.enabled=function(e){for(var t=0,u=Gu.skips.length;tthis.maxAttempts)},Ju.prototype.getDelay=function(e){var t=this.backoff.MIN_RETRY_DELAY*Math.pow(this.backoff.FACTOR,e);if(this.backoff.JITTER){var u=Math.random(),n=Math.floor(u*this.backoff.JITTER*t);Math.floor(10*u)<5?t-=n:t+=n}return Number(Math.min(t,this.backoff.MAX_RETRY_DELAY).toPrecision(1))},Ju.prototype.addItem=function(e){this._enqueue({item:e,attemptNumber:0,time:this._schedule.now()})},Ju.prototype.requeue=function(e,t,u){this.shouldRetry(e,t,u)?this._enqueue({item:e,attemptNumber:t,time:this._schedule.now()+this.getDelay(t)}):this.emit("discard",e,t)},Ju.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()},Ju.prototype._processHead=function(){var e=this,t=this._store;this._schedule.cancel(this._processId);var u=t.get(this.keys.QUEUE)||[],n=t.get(this.keys.IN_PROGRESS)||{},r=this._schedule.now(),i=[];function o(u,n){i.push({item:u.item,done:function(r,i){var o=t.get(e.keys.IN_PROGRESS)||{};delete o[n],t.set(e.keys.IN_PROGRESS,o),e.emit("processed",r,i,u.item),r&&e.requeue(u.item,u.attemptNumber+1,r)}})}for(var s=Object.keys(n).length;u.length&&u[0].time<=r&&s++0&&(this._processId=this._schedule.run(this._processHead,u[0].time-r))},Ju.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)},Ju.prototype._checkReclaim=function(){var e=this;Qe((function(t){t.id!==e.id&&(e._schedule.now()-t.get(e.keys.ACK)=500&&i.status<600?(x(new Error("request failed with status: ".concat(i.status).concat(i.statusText," for url: ").concat(e))),r(new Error("request failed with status: ".concat(i.status).concat(i.statusText," for url: ").concat(e)))):(F("====== request processed successfully: ".concat(i.status)),r(null,i.status)))},i.send(JSON.stringify(u,T))}catch(e){r(e)}}},{key:"enqueue",value:function(e,t){var u=e.getElementContent(),n={"Content-Type":"application/json",Authorization:"Basic ".concat(btoa("".concat(this.writeKey,":"))),AnonymousId:btoa(u.anonymousId)};u.originalTimestamp=O(),u.sentAt=O(),JSON.stringify(u).length>32e3&&w("[EventRepository] enqueue:: message length greater 32 Kb ",u);var r="/"==this.url.slice(-1)?this.url.slice(0,-1):this.url;this.payloadQueue.addItem({url:"".concat(r,"/v1/").concat(t),headers:n,message:u})}}]),e}());function Xu(e){var t=function(t){var u=(t=t||window.event).target||t.srcElement;rn(u)&&(u=u.parentNode),tn(u,t)?F("to be tracked ",t.type):F("not to be tracked ",t.type),function(e,t){var u,n=e.target||e.srcElement;rn(n)&&(n=n.parentNode);if(tn(n,e)){if("form"==n.tagName.toLowerCase()){u={};for(var r=0;r=0)return!0;return!1}(l))return!1;for(;l.parentNode&&!un(l,"body");)on(l)&&c.push(l),l=l.parentNode;var d,p=[];if(c.forEach((function(e){"a"===e.tagName.toLowerCase()&&(d=an(d=e.getAttribute("href"))&&d),p.push(function(e,t){for(var u={classes:sn(e).split(" "),tag_name:e.tagName.toLowerCase()},n=e.attributes.length,r=0;r=0)return!1;t=t.parentNode}if(sn(e).split(" ").indexOf("rudder-include")>=0)return!0;if(un(e,"input")||un(e,"select")||un(e,"textarea")||"true"===e.getAttribute("contenteditable"))return!1;if("inherit"===e.getAttribute("contenteditable"))for(t=e.parentNode;t.parentNode&&!un(t,"body");t=t.parentNode)if("true"===t.getAttribute("contenteditable"))return!1;var u=e.type||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";if("string"==typeof n){if(/^adhar|cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pan|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function sn(e){switch(t(e.className)){case"string":return e.className;case"object":return e.className.baseVal||e.getAttribute("class")||"";default:return""}}function an(e){if(null==e)return!1;if("string"==typeof e){e=e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1;if(/(^\d{4}-?\d{4}-?\d{4}$)/.test(e))return!1;if(/(^\w{5}-?\d{4}-?\w{1}$)/.test(e))return!1}return!0}function cn(e,t){for(var u=e.attributes.length,n=0;n-1)return!0}return!1}function ln(e){if(e.previousElementSibling)return e.previousElementSibling;do{e=e.previousSibling}while(e&&!nn(e));return e}var dn="ajs_trait_",pn="ajs_prop_";function Dn(e,t){this.eventRepository||(this.eventRepository=Qu),this.eventRepository.enqueue(e,t)}var fn=new(function(){function e(){u(this,e),this.autoTrackHandlersRegistered=!1,this.autoTrackFeatureEnabled=!1,this.initialized=!1,this.trackValues=[],this.eventsBuffer=[],this.clientIntegrations=[],this.loadOnlyIntegrations={},this.clientIntegrationObjects=void 0,this.successfullyLoadedIntegration=[],this.failedToBeLoadedIntegration=[],this.toBeProcessedArray=[],this.toBeProcessedByIntegrationArray=[],this.storage=tu,this.eventRepository=Qu,this.sendAdblockPage=!1,this.sendAdblockPageOptions={},this.clientSuppliedCallbacks={},this.readyCallback=function(){},this.executeReadyCallback=void 0,this.methodToCallbackMapping={syncPixel:"syncPixelCallback"},this.loaded=!1}return r(e,[{key:"initializeUser",value:function(){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.storage.setAnonymousId(this.anonymousId),this.storage.setGroupId(this.groupId),this.storage.setUserTraits(this.userTraits),this.storage.setGroupTraits(this.groupTraits)}},{key:"processResponse",value:function(e,t){try{F("===in process response=== ".concat(e)),(t=JSON.parse(t)).source.useAutoTracking&&!this.autoTrackHandlersRegistered&&(this.autoTrackFeatureEnabled=!0,Xu(this),this.autoTrackHandlersRegistered=!0),t.source.destinations.forEach((function(e,t){F("Destination ".concat(t," Enabled? ").concat(e.enabled," Type: ").concat(e.destinationDefinition.name," Use Native SDK? ").concat(e.config.useNativeSDK)),e.enabled&&this.clientIntegrations.push({name:e.destinationDefinition.name,config:e.config})}),this),F("this.clientIntegrations: ",this.clientIntegrations),this.clientIntegrations=U(this.loadOnlyIntegrations,this.clientIntegrations),this.clientIntegrations=this.clientIntegrations.filter((function(e){return null!=lu[e.name]})),this.init(this.clientIntegrations)}catch(e){x(e),F("===handling config BE response processing error==="),F("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Xu(this),this.autoTrackHandlersRegistered=!0)}}},{key:"init",value:function(e){var t=this,u=this;if(F("supported intgs ",lu),!e||0==e.length)return this.readyCallback&&this.readyCallback(),void(this.toBeProcessedByIntegrationArray=[]);e.forEach((function(e){try{F("[Analytics] init :: trying to initialize integration name:: ",e.name);var n=new(0,lu[e.name])(e.config,u);n.init(),F("initializing destination: ",e),t.isInitialized(n).then(t.replayEvents)}catch(t){w("[Analytics] initialize integration (integration.init()) failed :: ",e.name)}}))}},{key:"replayEvents",value:function(e){e.successfullyLoadedIntegration.length+e.failedToBeLoadedIntegration.length===e.clientIntegrations.length&&(F("===replay events called====",e.successfullyLoadedIntegration.length,e.failedToBeLoadedIntegration.length),e.clientIntegrationObjects=[],e.clientIntegrationObjects=e.successfullyLoadedIntegration,F("==registering after callback===",e.clientIntegrationObjects.length),e.executeReadyCallback=D(e.clientIntegrationObjects.length,e.readyCallback),F("==registering ready callback==="),e.on("ready",e.executeReadyCallback),e.clientIntegrationObjects.forEach((function(t){F("===looping over each successful integration===="),t.isReady&&!t.isReady()||(F("===letting know I am ready=====",t.name),e.emit("ready"))})),e.toBeProcessedByIntegrationArray.length>0&&(e.toBeProcessedByIntegrationArray.forEach((function(t){var u=t[0];t.shift(),Object.keys(t[0].message.integrations).length>0&&L(t[0].message.integrations);for(var n=U(t[0].message.integrations,e.clientIntegrationObjects),r=0;r1&&void 0!==arguments[1]?arguments[1]:0;return new Promise((function(n){return e.isLoaded()?(F("===integration loaded successfully====",e.name),t.successfullyLoadedIntegration.push(e),n(t)):u>=1e4?(F("====max wait over===="),t.failedToBeLoadedIntegration.push(e),n(t)):void t.pause(1e3).then((function(){return F("====after pause, again checking===="),t.isInitialized(e,u+1e3).then(n)}))}))}},{key:"page",value:function(e,u,n,r,i){this.loaded&&("function"==typeof r&&(i=r,r=null),"function"==typeof n&&(i=n,r=n=null),"function"==typeof u&&(i=u,r=n=u=null),"object"===t(e)&&null!=e&&null!=e&&(r=u,n=e,u=e=null),"object"===t(u)&&null!=u&&null!=u&&(r=n,n=u,u=null),"string"==typeof e&&"string"!=typeof u&&(u=e,e=null),this.sendAdblockPage&&"RudderJS-Initiated"!=e&&this.sendSampleRequest(),this.processPage(e,u,n,r,i))}},{key:"track",value:function(e,t,u,n){this.loaded&&("function"==typeof u&&(n=u,u=null),"function"==typeof t&&(n=t,u=null,t=null),this.processTrack(e,t,u,n))}},{key:"identify",value:function(e,u,n,r){this.loaded&&("function"==typeof n&&(r=n,n=null),"function"==typeof u&&(r=u,n=null,u=null),"object"===t(e)&&(n=u,u=e,e=this.userId),this.processIdentify(e,u,n,r))}},{key:"alias",value:function(e,u,n,r){if(this.loaded){"function"==typeof n&&(r=n,n=null),"function"==typeof u&&(r=u,n=null,u=null),"object"===t(u)&&(n=u,u=null);var i=(new yu).setType("alias").build();i.message.previousId=u||(this.userId?this.userId:this.getAnonymousId()),i.message.userId=e,this.processAndSendDataToDestinations("alias",i,n,r)}}},{key:"group",value:function(e,u,n,r){if(this.loaded&&arguments.length){"function"==typeof n&&(r=n,n=null),"function"==typeof u&&(r=u,n=null,u=null),"object"===t(e)&&(n=u,u=e,e=this.groupId),this.groupId=e,this.storage.setGroupId(this.groupId);var i=(new yu).setType("group").build();if(u)for(var o in u)this.groupTraits[o]=u[o];else this.groupTraits={};this.storage.setGroupTraits(this.groupTraits),this.processAndSendDataToDestinations("group",i,n,r)}}},{key:"processPage",value:function(e,t,u,n,r){var i=(new yu).setType("page").build();u||(u={}),t&&(i.message.name=t,u.name=t),e&&(i.message.category=e,u.category=e),i.message.properties=this.getPageProperties(u),this.trackPage(i,n,r)}},{key:"processTrack",value:function(e,t,u,n){var r=(new yu).setType("track").build();e&&r.setEventName(e),t?r.setProperty(t):r.setProperty({}),this.trackEvent(r,u,n)}},{key:"processIdentify",value:function(e,t,u,n){e&&this.userId&&e!==this.userId&&this.reset(),this.userId=e,this.storage.setUserId(this.userId);var r=(new yu).setType("identify").build();if(t){for(var i in t)this.userTraits[i]=t[i];this.storage.setUserTraits(this.userTraits)}this.identifyUser(r,u,n)}},{key:"identifyUser",value:function(e,t,u){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=s({},e.message.context.traits),this.storage.setUserTraits(this.userTraits)),this.processAndSendDataToDestinations("identify",e,t,u)}},{key:"trackPage",value:function(e,t,u){this.processAndSendDataToDestinations("page",e,t,u)}},{key:"trackEvent",value:function(e,t,u){this.processAndSendDataToDestinations("track",e,t,u)}},{key:"processAndSendDataToDestinations",value:function(e,t,u,n){try{this.anonymousId||this.setAnonymousId(),t.message.context.traits=s({},this.userTraits),F("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=s({},this.groupTraits))),this.processOptionsParam(t,u),F(JSON.stringify(t)),Object.keys(t.message.integrations).length>0&&L(t.message.integrations);var r=U(t.message.integrations,this.clientIntegrationObjects);try{r.forEach((function(u){u.isFailed&&u.isFailed()||u[e]&&u[e](t)}))}catch(e){x({message:"[sendToNative]:".concat(e)})}this.clientIntegrationObjects||(F("pushing in replay queue"),this.toBeProcessedByIntegrationArray.push([e,t])),i=t.message.integrations,Object.keys(i).forEach((function(e){i.hasOwnProperty(e)&&(B[e]&&(i[B[e]]=i[e]),"All"!=e&&null!=B[e]&&B[e]!=e&&delete i[e])})),Dn.call(this,t,e),F("".concat(e," is called ")),n&&n()}catch(e){x(e)}var i}},{key:"processOptionsParam",value:function(e,t){var u=e.message,n=u.type,r=u.properties,i=["integrations","anonymousId","originalTimestamp"];for(var o in t)if(i.includes(o))e.message[o]=t[o];else if("context"!==o)e.message.context[o]=t[o];else for(var s in t[o])e.message.context[s]=t[o][s];e.message.context.page="page"==n?this.getContextPageProperties(t,r):this.getContextPageProperties(t)}},{key:"getPageProperties",value:function(e,t){var u=P(),n=t&&t.page?t.page:{};for(var r in u)void 0===e[r]&&(e[r]=n[r]||u[r]);return e}},{key:"getContextPageProperties",value:function(e,t){var u=P(),n=e&&e.page?e.page:{};for(var r in u)void 0===n[r]&&(n[r]=t&&t[r]?t[r]:u[r]);return n}},{key:"reset",value:function(){this.loaded&&(this.userId="",this.userTraits={},this.groupId="",this.groupTraits={},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||S(),this.storage.setAnonymousId(this.anonymousId)}},{key:"isValidWriteKey",value:function(e){return!(!e||"string"!=typeof e||0==e.trim().length)}},{key:"isValidServerUrl",value:function(e){return!(!e||"string"!=typeof e||0==e.trim().length)}},{key:"load",value:function(e,u,n){var r=this;if(F("inside load "),!this.loaded){var i=I;if(!this.isValidWriteKey(e)||!this.isValidServerUrl(u))throw x({message:"[Analytics] load:: Unable to load due to wrong writeKey or serverUrl"}),Error("failed to initialize");if(n&&n.logLevel&&v(n.logLevel),n&&n.integrations&&(Object.assign(this.loadOnlyIntegrations,n.integrations),L(this.loadOnlyIntegrations)),n&&n.configUrl&&(i=function(e){var t=e;return-1==e.indexOf("sourceConfig")&&(t="/"==t.slice(-1)?t.slice(0,-1):t,t="".concat(t,"/sourceConfig/")),(t="/"==t.slice(-1)?t:"".concat(t,"/")).indexOf("?")>-1?t.split("?")[1]!==I.split("?")[1]&&(t="".concat(t.split("?")[0],"?").concat(I.split("?")[1])):t="".concat(t,"?").concat(I.split("?")[1]),t}(n.configUrl)),n&&n.sendAdblockPage&&(this.sendAdblockPage=!0),n&&n.sendAdblockPageOptions&&"object"===t(n.sendAdblockPageOptions)&&(this.sendAdblockPageOptions=n.sendAdblockPageOptions),n&&n.clientSuppliedCallbacks){var o={};Object.keys(this.methodToCallbackMapping).forEach((function(e){r.methodToCallbackMapping.hasOwnProperty(e)&&n.clientSuppliedCallbacks[r.methodToCallbackMapping[e]]&&(o[e]=n.clientSuppliedCallbacks[r.methodToCallbackMapping[e]])})),Object.assign(this.clientSuppliedCallbacks,o),this.registerCallbacks(!0)}this.eventRepository.writeKey=e,u&&(this.eventRepository.url=u),this.initializeUser(),this.loaded=!0,n&&n.valTrackingList&&n.valTrackingList.push==Array.prototype.push&&(this.trackValues=n.valTrackingList),n&&n.useAutoTracking&&(this.autoTrackFeatureEnabled=!0,this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&(Xu(this),this.autoTrackHandlersRegistered=!0,F("autoTrackHandlersRegistered",this.autoTrackHandlersRegistered)));try{!function(e,t,u,n){var r=n.bind(e),i=new XMLHttpRequest;i.open("GET",t,!0),i.setRequestHeader("Authorization","Basic ".concat(btoa("".concat(u,":")))),i.onload=function(){var e=i.status;200==e?(F("status 200 calling callback"),r(200,i.responseText)):(x(new Error("request failed with status: ".concat(i.status," for url: ").concat(t))),r(e))},i.send()}(this,i,e,this.processResponse)}catch(e){x(e),this.autoTrackFeatureEnabled&&!this.autoTrackHandlersRegistered&&Xu(this)}}}},{key:"ready",value:function(e){this.loaded&&("function"!=typeof e?w("ready callback is not a function"):this.readyCallback=e)}},{key:"initializeCallbacks",value:function(){var e=this;Object.keys(this.methodToCallbackMapping).forEach((function(t){e.methodToCallbackMapping.hasOwnProperty(t)&&e.on(t,(function(){}))}))}},{key:"registerCallbacks",value:function(e){var t=this;e||Object.keys(this.methodToCallbackMapping).forEach((function(e){t.methodToCallbackMapping.hasOwnProperty(e)&&window.rudderanalytics&&"function"==typeof window.rudderanalytics[t.methodToCallbackMapping[e]]&&(t.clientSuppliedCallbacks[e]=window.rudderanalytics[t.methodToCallbackMapping[e]])})),Object.keys(this.clientSuppliedCallbacks).forEach((function(e){t.clientSuppliedCallbacks.hasOwnProperty(e)&&(F("registerCallbacks",e,t.clientSuppliedCallbacks[e]),t.on(e,t.clientSuppliedCallbacks[e]))}))}},{key:"sendSampleRequest",value:function(){V("ad-block","//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js")}},{key:"parseQueryString",value:function(e){var t,u,n={},r=y(e),i=(t=r,u={},Object.keys(t).forEach((function(e){e.substr(0,dn.length)==dn&&(u[e.substr(dn.length)]=t[e])})),u),o=function(e){var t={};return Object.keys(e).forEach((function(u){u.substr(0,pn.length)==pn&&(t[u.substr(pn.length)]=e[u])})),t}(r);return r.ajs_uid&&(n.userId=r.ajs_uid,n.traits=i),r.ajs_aid&&(n.anonymousId=r.ajs_aid),r.ajs_event&&(n.event=r.ajs_event,n.properties=o),n}}]),e}());p(fn),window.addEventListener("error",(function(e){x(e,fn)}),!0),fn.initializeCallbacks(),fn.registerCallbacks(!1);for(var hn=!!window.rudderanalytics&&window.rudderanalytics.push==Array.prototype.push,gn=window.rudderanalytics;gn&&gn[0]&&"load"!==gn[0][0];)gn.shift();if(gn&&gn.length>0&&"load"===gn[0][0]){var mn=gn[0][0];gn[0].shift(),F("=====from init, calling method:: ",mn),fn[mn].apply(fn,a(gn[0])),gn.shift()}if(function(e,t){t.anonymousId?t.userId?e.unshift(["setAnonymousId",t.anonymousId],["identify",t.userId,t.traits]):e.unshift(["setAnonymousId",t.anonymousId]):t.userId&&e.unshift(["identify",t.userId,t.traits]),t.event&&e.push(["track",t.event,t.properties])}(gn,fn.parseQueryString(window.location.search)),hn&&gn&&gn.length>0){for(var yn=0;yn -1\n ? canonicalUrl\n : canonicalUrl + search\n : window.location.href;\n let hashIndex = url.indexOf(\"#\");\n return hashIndex > -1 ? url.slice(0, hashIndex) : url;\n}\n\nfunction getCanonicalUrl() {\n var tags = document.getElementsByTagName(\"link\");\n for (var i = 0, tag; (tag = tags[i]); i++) {\n if (tag.getAttribute(\"rel\") === \"canonical\") {\n return tag.getAttribute(\"href\");\n }\n }\n}\n\nfunction getCurrency(val) {\n if (!val) return;\n if (typeof val === \"number\") {\n return val;\n }\n if (typeof val !== \"string\") {\n return;\n }\n\n val = val.replace(/\\$/g, \"\");\n val = parseFloat(val);\n\n if (!isNaN(val)) {\n return val;\n }\n}\n\nfunction getRevenue(properties, eventName) {\n var revenue = properties.revenue;\n var orderCompletedRegExp = /^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;\n\n // it's always revenue, unless it's called during an order completion.\n if (!revenue && eventName && eventName.match(orderCompletedRegExp)) {\n revenue = properties.total;\n }\n\n return getCurrency(revenue);\n}\n\n/**\n *\n *\n * @param {*} integrationObject\n */\nfunction tranformToRudderNames(integrationObject) {\n Object.keys(integrationObject).forEach(key => {\n if(integrationObject.hasOwnProperty(key)) {\n if(commonNames[key]) {\n integrationObject[commonNames[key]] = integrationObject[key]\n }\n if(key != \"All\") {\n // delete user supplied keys except All and if except those where oldkeys are not present or oldkeys are same as transformed keys \n if(commonNames[key] != undefined && commonNames[key] != key) {\n delete integrationObject[key]\n }\n }\n \n }\n })\n}\n\nfunction transformToServerNames(integrationObject) {\n Object.keys(integrationObject).forEach(key => {\n if(integrationObject.hasOwnProperty(key)) {\n if(clientToServerNames[key]) {\n integrationObject[clientToServerNames[key]] = integrationObject[key]\n }\n if(key != \"All\") {\n // delete user supplied keys except All and if except those where oldkeys are not present or oldkeys are same as transformed keys \n if(clientToServerNames[key] != undefined && clientToServerNames[key] != key) {\n delete integrationObject[key]\n }\n }\n \n }\n })\n}\n\n/**\n * \n * @param {*} sdkSuppliedIntegrations \n * @param {*} configPlaneEnabledIntegrations \n */\nfunction findAllEnabledDestinations(sdkSuppliedIntegrations, configPlaneEnabledIntegrations) {\n let enabledList = []\n if(!configPlaneEnabledIntegrations || configPlaneEnabledIntegrations.length == 0) {\n return enabledList\n }\n let allValue = true\n if(typeof configPlaneEnabledIntegrations[0] == \"string\") {\n if(sdkSuppliedIntegrations[\"All\"] != undefined) {\n allValue = sdkSuppliedIntegrations[\"All\"]\n }\n configPlaneEnabledIntegrations.forEach(intg => {\n if(!allValue) {\n // All false ==> check if intg true supplied\n if(sdkSuppliedIntegrations[intg]!= undefined && sdkSuppliedIntegrations[intg] == true) {\n enabledList.push(intg)\n }\n } else {\n // All true ==> intg true by default\n let intgValue = true\n // check if intg false supplied\n if(sdkSuppliedIntegrations[intg] != undefined && sdkSuppliedIntegrations[intg] == false) {\n intgValue = false\n }\n if(intgValue) {\n enabledList.push(intg)\n }\n }\n })\n\n return enabledList\n }\n\n if(typeof configPlaneEnabledIntegrations[0] == \"object\") {\n if(sdkSuppliedIntegrations[\"All\"] != undefined) {\n allValue = sdkSuppliedIntegrations[\"All\"]\n }\n configPlaneEnabledIntegrations.forEach(intg => {\n if(!allValue) {\n // All false ==> check if intg true supplied\n if(sdkSuppliedIntegrations[intg.name]!= undefined && sdkSuppliedIntegrations[intg.name] == true) {\n enabledList.push(intg)\n }\n } else {\n // All true ==> intg true by default\n let intgValue = true\n // check if intg false supplied\n if(sdkSuppliedIntegrations[intg.name] != undefined && sdkSuppliedIntegrations[intg.name] == false) {\n intgValue = false\n }\n if(intgValue) {\n enabledList.push(intg)\n }\n }\n })\n\n return enabledList\n }\n\n}\n\nexport {\n replacer,\n generateUUID,\n getCurrentTimeFormatted,\n getJSONTrimmed,\n getJSON,\n getRevenue,\n getDefaultPageProperties,\n findAllEnabledDestinations,\n tranformToRudderNames,\n transformToServerNames,\n handleError\n};\n","import { version } from \"../package.json\";\n//Message Type enumeration\nlet MessageType = {\n TRACK: \"track\",\n PAGE: \"page\",\n //SCREEN: \"screen\",\n IDENTIFY: \"identify\"\n};\n\n//ECommerce Parameter Names Enumeration\nlet ECommerceParamNames = {\n QUERY: \"query\",\n PRICE: \"price\",\n PRODUCT_ID: \"product_id\",\n CATEGORY: \"category\",\n CURRENCY: \"currency\",\n LIST_ID: \"list_id\",\n PRODUCTS: \"products\",\n WISHLIST_ID: \"wishlist_id\",\n WISHLIST_NAME: \"wishlist_name\",\n QUANTITY: \"quantity\",\n CART_ID: \"cart_id\",\n CHECKOUT_ID: \"checkout_id\",\n TOTAL: \"total\",\n REVENUE: \"revenue\",\n ORDER_ID: \"order_id\",\n FILTERS: \"filters\",\n SORTS: \"sorts\",\n SHARE_VIA: \"share_via\",\n SHARE_MESSAGE: \"share_message\",\n RECIPIENT: \"recipient\"\n};\n//ECommerce Events Enumeration\nlet ECommerceEvents = {\n PRODUCTS_SEARCHED: \"Products Searched\",\n PRODUCT_LIST_VIEWED: \"Product List Viewed\",\n PRODUCT_LIST_FILTERED: \"Product List Filtered\",\n PROMOTION_VIEWED: \"Promotion Viewed\",\n PROMOTION_CLICKED: \"Promotion Clicked\",\n PRODUCT_CLICKED: \"Product Clicked\",\n PRODUCT_VIEWED: \"Product Viewed\",\n PRODUCT_ADDED: \"Product Added\",\n PRODUCT_REMOVED: \"Product Removed\",\n CART_VIEWED: \"Cart Viewed\",\n CHECKOUT_STARTED: \"Checkout Started\",\n CHECKOUT_STEP_VIEWED: \"Checkout Step Viewed\",\n CHECKOUT_STEP_COMPLETED: \"Checkout Step Completed\",\n PAYMENT_INFO_ENTERED: \"Payment Info Entered\",\n ORDER_UPDATED: \"Order Updated\",\n ORDER_COMPLETED: \"Order Completed\",\n ORDER_REFUNDED: \"Order Refunded\",\n ORDER_CANCELLED: \"Order Cancelled\",\n COUPON_ENTERED: \"Coupon Entered\",\n COUPON_APPLIED: \"Coupon Applied\",\n COUPON_DENIED: \"Coupon Denied\",\n COUPON_REMOVED: \"Coupon Removed\",\n PRODUCT_ADDED_TO_WISHLIST: \"Product Added to Wishlist\",\n PRODUCT_REMOVED_FROM_WISHLIST: \"Product Removed from Wishlist\",\n WISH_LIST_PRODUCT_ADDED_TO_CART: \"Wishlist Product Added to Cart\",\n PRODUCT_SHARED: \"Product Shared\",\n CART_SHARED: \"Cart Shared\",\n PRODUCT_REVIEWED: \"Product Reviewed\"\n};\n\n//Enumeration for integrations supported\nlet RudderIntegrationPlatform = {\n RUDDERLABS: \"rudderlabs\",\n GA: \"ga\",\n AMPLITUDE: \"amplitude\"\n};\n\nlet BASE_URL = \"https://hosted.rudderlabs.com\"; // default to RudderStack\nlet CONFIG_URL = \"https://api.rudderlabs.com/sourceConfig/?p=web&v=\" + version;\n\nlet FLUSH_QUEUE_SIZE = 30;\n\nlet FLUSH_INTERVAL_DEFAULT = 5000;\n\nconst MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;\nconst INTEGRATION_LOAD_CHECK_INTERVAL = 1000;\n\nexport {\n MessageType,\n ECommerceParamNames,\n ECommerceEvents,\n RudderIntegrationPlatform,\n BASE_URL,\n CONFIG_URL,\n FLUSH_QUEUE_SIZE,\n FLUSH_INTERVAL_DEFAULT,\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL\n};\n/* module.exports = {\n MessageType: MessageType,\n ECommerceParamNames: ECommerceParamNames,\n ECommerceEvents: ECommerceEvents,\n RudderIntegrationPlatform: RudderIntegrationPlatform,\n BASE_URL: BASE_URL,\n CONFIG_URL: CONFIG_URL,\n FLUSH_QUEUE_SIZE: FLUSH_QUEUE_SIZE\n}; */\n","import logger from \"../utils/logUtil\";\nfunction ScriptLoader(id, src) {\n logger.debug(\"in script loader=== \" + id);\n let js = document.createElement(\"script\");\n js.src = src;\n js.async = true;\n js.type = \"text/javascript\";\n js.id = id;\n let e = document.getElementsByTagName(\"script\")[0];\n logger.debug(\"==script==\", e);\n e.parentNode.insertBefore(js, e);\n}\n\nexport { ScriptLoader };\n","import { ScriptLoader } from \"../ScriptLoader\";\nimport logger from \"../../utils/logUtil\";\n\nclass HubSpot {\n constructor(config) {\n this.hubId = config.hubID; //6405167\n this.name = \"HS\";\n }\n\n init() {\n let hubspotJs = \"http://js.hs-scripts.com/\" + this.hubId + \".js\";\n ScriptLoader(\"hubspot-integration\", hubspotJs);\n\n logger.debug(\"===in init HS===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"in HubspotAnalyticsManager identify\");\n\n let traits = rudderElement.message.context.traits;\n let traitsValue = {};\n\n for (let k in traits) {\n if (!!Object.getOwnPropertyDescriptor(traits, k) && traits[k]) {\n let hubspotkey = k; //k.startsWith(\"rl_\") ? k.substring(3, k.length) : k;\n if (toString.call(traits[k]) == \"[object Date]\") {\n traitsValue[hubspotkey] = traits[k].getTime();\n } else {\n traitsValue[hubspotkey] = traits[k];\n }\n }\n }\n /* if (traitsValue[\"address\"]) {\n let address = traitsValue[\"address\"];\n //traitsValue.delete(address)\n delete traitsValue[\"address\"];\n for (let k in address) {\n if (!!Object.getOwnPropertyDescriptor(address, k) && address[k]) {\n let hubspotkey = k;//k.startsWith(\"rl_\") ? k.substring(3, k.length) : k;\n hubspotkey = hubspotkey == \"street\" ? \"address\" : hubspotkey;\n traitsValue[hubspotkey] = address[k];\n }\n }\n } */\n let userProperties = rudderElement.message.context.user_properties;\n for (let k in userProperties) {\n if (\n !!Object.getOwnPropertyDescriptor(userProperties, k) &&\n userProperties[k]\n ) {\n let hubspotkey = k; //k.startsWith(\"rl_\") ? k.substring(3, k.length) : k;\n traitsValue[hubspotkey] = userProperties[k];\n }\n }\n\n logger.debug(traitsValue);\n\n if (typeof window !== undefined) {\n let _hsq = (window._hsq = window._hsq || []);\n _hsq.push([\"identify\", traitsValue]);\n }\n }\n\n track(rudderElement) {\n logger.debug(\"in HubspotAnalyticsManager track\");\n let _hsq = (window._hsq = window._hsq || []);\n let eventValue = {};\n eventValue[\"id\"] = rudderElement.message.event;\n if (\n rudderElement.message.properties &&\n (rudderElement.message.properties.revenue ||\n rudderElement.message.properties.value)\n ) {\n eventValue[\"value\"] =\n rudderElement.message.properties.revenue ||\n rudderElement.message.properties.value;\n }\n _hsq.push([\"trackEvent\", eventValue]);\n }\n\n page(rudderElement) {\n logger.debug(\"in HubspotAnalyticsManager page\");\n let _hsq = (window._hsq = window._hsq || []);\n //logger.debug(\"path: \" + rudderElement.message.properties.path);\n //_hsq.push([\"setPath\", rudderElement.message.properties.path]);\n /* _hsq.push([\"identify\",{\n email: \"testtrackpage@email.com\"\n }]); */\n if (\n rudderElement.message.properties &&\n rudderElement.message.properties.path\n ) {\n _hsq.push([\"setPath\", rudderElement.message.properties.path]);\n }\n _hsq.push([\"trackPageView\"]);\n }\n\n isLoaded() {\n logger.debug(\"in hubspot isLoaded\");\n return !!(window._hsq && window._hsq.push !== Array.prototype.push);\n }\n\n isReady() {\n return !!(window._hsq && window._hsq.push !== Array.prototype.push);\n }\n}\n\nexport { HubSpot };\n","/**\n * toString ref.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n *\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nmodule.exports = function(val){\n switch (toString.call(val)) {\n case '[object Date]': return 'date';\n case '[object RegExp]': return 'regexp';\n case '[object Arguments]': return 'arguments';\n case '[object Array]': return 'array';\n case '[object Error]': return 'error';\n }\n\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (val !== val) return 'nan';\n if (val && val.nodeType === 1) return 'element';\n\n if (isBuffer(val)) return 'buffer';\n\n val = val.valueOf\n ? val.valueOf()\n : Object.prototype.valueOf.apply(val);\n\n return typeof val;\n};\n\n// code borrowed from https://github.com/feross/is-buffer/blob/master/index.js\nfunction isBuffer(obj) {\n return !!(obj != null &&\n (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)\n (obj.constructor &&\n typeof obj.constructor.isBuffer === 'function' &&\n obj.constructor.isBuffer(obj))\n ))\n}\n","'use strict';\n\n/*\n * Module dependencies.\n */\n\nvar type = require('component-type');\n\n/**\n * Deeply clone an object.\n *\n * @param {*} obj Any object.\n */\n\nvar clone = function clone(obj) {\n var t = type(obj);\n\n if (t === 'object') {\n var copy = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n copy[key] = clone(obj[key]);\n }\n }\n return copy;\n }\n\n if (t === 'array') {\n var copy = new Array(obj.length);\n for (var i = 0, l = obj.length; i < l; i++) {\n copy[i] = clone(obj[i]);\n }\n return copy;\n }\n\n if (t === 'regexp') {\n // from millermedeiros/amd-utils - MIT\n var flags = '';\n flags += obj.multiline ? 'm' : '';\n flags += obj.global ? 'g' : '';\n flags += obj.ignoreCase ? 'i' : '';\n return new RegExp(obj.source, flags);\n }\n\n if (t === 'date') {\n return new Date(obj.getTime());\n }\n\n // string, number, boolean, etc.\n return obj;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = clone;\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} options\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options){\n options = options || {};\n if ('string' == typeof val) return parse(val);\n return options.long\n ? long(val)\n : short(val);\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = '' + str;\n if (str.length > 10000) return;\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);\n if (!match) return;\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction short(ms) {\n if (ms >= d) return Math.round(ms / d) + 'd';\n if (ms >= h) return Math.round(ms / h) + 'h';\n if (ms >= m) return Math.round(ms / m) + 'm';\n if (ms >= s) return Math.round(ms / s) + 's';\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction long(ms) {\n return plural(ms, d, 'day')\n || plural(ms, h, 'hour')\n || plural(ms, m, 'minute')\n || plural(ms, s, 'second')\n || ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) return;\n if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = debug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lowercased letter, i.e. \"n\".\n */\n\nexports.formatters = {};\n\n/**\n * Previously assigned color.\n */\n\nvar prevColor = 0;\n\n/**\n * Previous log timestamp.\n */\n\nvar prevTime;\n\n/**\n * Select a color.\n *\n * @return {Number}\n * @api private\n */\n\nfunction selectColor() {\n return exports.colors[prevColor++ % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction debug(namespace) {\n\n // define the `disabled` version\n function disabled() {\n }\n disabled.enabled = false;\n\n // define the `enabled` version\n function enabled() {\n\n var self = enabled;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // add the `color` if not set\n if (null == self.useColors) self.useColors = exports.useColors();\n if (null == self.color && self.useColors) self.color = selectColor();\n\n var args = Array.prototype.slice.call(arguments);\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %o\n args = ['%o'].concat(args);\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n if ('function' === typeof exports.formatArgs) {\n args = exports.formatArgs.apply(self, args);\n }\n var logFn = enabled.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n enabled.enabled = true;\n\n var fn = exports.enabled(namespace) ? enabled : disabled;\n\n fn.namespace = namespace;\n\n return fn;\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n var split = (namespaces || '').split(/[\\s,]+/);\n var len = split.length;\n\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n","\n/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n 'lightseagreen',\n 'forestgreen',\n 'goldenrod',\n 'dodgerblue',\n 'darkorchid',\n 'crimson'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // is webkit? http://stackoverflow.com/a/16459606/376773\n return ('WebkitAppearance' in document.documentElement.style) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (window.console && (console.firebug || (console.exception && console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31);\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n return JSON.stringify(v);\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs() {\n var args = arguments;\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return args;\n\n var c = 'color: ' + this.color;\n args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n return args;\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage(){\n try {\n return window.localStorage;\n } catch (e) {}\n}\n","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('cookie');\n\n/**\n * Set or get cookie `name` with `value` and `options` object.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @return {Mixed}\n * @api public\n */\n\nmodule.exports = function(name, value, options){\n switch (arguments.length) {\n case 3:\n case 2:\n return set(name, value, options);\n case 1:\n return get(name);\n default:\n return all();\n }\n};\n\n/**\n * Set cookie `name` to `value`.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @api private\n */\n\nfunction set(name, value, options) {\n options = options || {};\n var str = encode(name) + '=' + encode(value);\n\n if (null == value) options.maxage = -1;\n\n if (options.maxage) {\n options.expires = new Date(+new Date + options.maxage);\n }\n\n if (options.path) str += '; path=' + options.path;\n if (options.domain) str += '; domain=' + options.domain;\n if (options.expires) str += '; expires=' + options.expires.toUTCString();\n if (options.samesite) str += '; samesite=' + options.samesite;\n if (options.secure) str += '; secure';\n\n document.cookie = str;\n}\n\n/**\n * Return all cookies.\n *\n * @return {Object}\n * @api private\n */\n\nfunction all() {\n var str;\n try {\n str = document.cookie;\n } catch (err) {\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(err.stack || err);\n }\n return {};\n }\n return parse(str);\n}\n\n/**\n * Get cookie `name`.\n *\n * @param {String} name\n * @return {String}\n * @api private\n */\n\nfunction get(name) {\n return all()[name];\n}\n\n/**\n * Parse cookie `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parse(str) {\n var obj = {};\n var pairs = str.split(/ *; */);\n var pair;\n if ('' == pairs[0]) return obj;\n for (var i = 0; i < pairs.length; ++i) {\n pair = pairs[i].split('=');\n obj[decode(pair[0])] = decode(pair[1]);\n }\n return obj;\n}\n\n/**\n * Encode.\n */\n\nfunction encode(value){\n try {\n return encodeURIComponent(value);\n } catch (e) {\n debug('error `encode(%o)` - %o', value, e)\n }\n}\n\n/**\n * Decode.\n */\n\nfunction decode(value) {\n try {\n return decodeURIComponent(value);\n } catch (e) {\n debug('error `decode(%o)` - %o', value, e)\n }\n}\n","'use strict';\n\nvar max = Math.max;\n\n/**\n * Produce a new array composed of all but the first `n` elements of an input `collection`.\n *\n * @name drop\n * @api public\n * @param {number} count The number of elements to drop.\n * @param {Array} collection The collection to iterate over.\n * @return {Array} A new array containing all but the first element from `collection`.\n * @example\n * drop(0, [1, 2, 3]); // => [1, 2, 3]\n * drop(1, [1, 2, 3]); // => [2, 3]\n * drop(2, [1, 2, 3]); // => [3]\n * drop(3, [1, 2, 3]); // => []\n * drop(4, [1, 2, 3]); // => []\n */\nvar drop = function drop(count, collection) {\n var length = collection ? collection.length : 0;\n\n if (!length) {\n return [];\n }\n\n // Preallocating an array *significantly* boosts performance when dealing with\n // `arguments` objects on v8. For a summary, see:\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var toDrop = max(Number(count) || 0, 0);\n var resultsLength = max(length - toDrop, 0);\n var results = new Array(resultsLength);\n\n for (var i = 0; i < resultsLength; i += 1) {\n results[i] = collection[i + toDrop];\n }\n\n return results;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = drop;\n","'use strict';\n\nvar max = Math.max;\n\n/**\n * Produce a new array by passing each value in the input `collection` through a transformative\n * `iterator` function. The `iterator` function is passed three arguments:\n * `(value, index, collection)`.\n *\n * @name rest\n * @api public\n * @param {Array} collection The collection to iterate over.\n * @return {Array} A new array containing all but the first element from `collection`.\n * @example\n * rest([1, 2, 3]); // => [2, 3]\n */\nvar rest = function rest(collection) {\n if (collection == null || !collection.length) {\n return [];\n }\n\n // Preallocating an array *significantly* boosts performance when dealing with\n // `arguments` objects on v8. For a summary, see:\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var results = new Array(max(collection.length - 2, 0));\n\n for (var i = 1; i < collection.length; i += 1) {\n results[i - 1] = collection[i];\n }\n\n return results;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = rest;\n","'use strict';\n\n/*\n * Module dependencies.\n */\n\nvar drop = require('@ndhoule/drop');\nvar rest = require('@ndhoule/rest');\n\nvar has = Object.prototype.hasOwnProperty;\nvar objToString = Object.prototype.toString;\n\n/**\n * Returns `true` if a value is an object, otherwise `false`.\n *\n * @name isObject\n * @api private\n * @param {*} val The value to test.\n * @return {boolean}\n */\n// TODO: Move to a library\nvar isObject = function isObject(value) {\n return Boolean(value) && typeof value === 'object';\n};\n\n/**\n * Returns `true` if a value is a plain object, otherwise `false`.\n *\n * @name isPlainObject\n * @api private\n * @param {*} val The value to test.\n * @return {boolean}\n */\n// TODO: Move to a library\nvar isPlainObject = function isPlainObject(value) {\n return Boolean(value) && objToString.call(value) === '[object Object]';\n};\n\n/**\n * Assigns a key-value pair to a target object when the value assigned is owned,\n * and where target[key] is undefined.\n *\n * @name shallowCombiner\n * @api private\n * @param {Object} target\n * @param {Object} source\n * @param {*} value\n * @param {string} key\n */\nvar shallowCombiner = function shallowCombiner(target, source, value, key) {\n if (has.call(source, key) && target[key] === undefined) {\n target[key] = value;\n }\n return source;\n};\n\n/**\n * Assigns a key-value pair to a target object when the value assigned is owned,\n * and where target[key] is undefined; also merges objects recursively.\n *\n * @name deepCombiner\n * @api private\n * @param {Object} target\n * @param {Object} source\n * @param {*} value\n * @param {string} key\n * @return {Object}\n */\nvar deepCombiner = function(target, source, value, key) {\n if (has.call(source, key)) {\n if (isPlainObject(target[key]) && isPlainObject(value)) {\n target[key] = defaultsDeep(target[key], value);\n } else if (target[key] === undefined) {\n target[key] = value;\n }\n }\n\n return source;\n};\n\n/**\n * TODO: Document\n *\n * @name defaultsWith\n * @api private\n * @param {Function} combiner\n * @param {Object} target\n * @param {...Object} sources\n * @return {Object} Return the input `target`.\n */\nvar defaultsWith = function(combiner, target /*, ...sources */) {\n if (!isObject(target)) {\n return target;\n }\n\n combiner = combiner || shallowCombiner;\n var sources = drop(2, arguments);\n\n for (var i = 0; i < sources.length; i += 1) {\n for (var key in sources[i]) {\n combiner(target, sources[i], sources[i][key], key);\n }\n }\n\n return target;\n};\n\n/**\n * Copies owned, enumerable properties from a source object(s) to a target\n * object when the value of that property on the source object is `undefined`.\n * Recurses on objects.\n *\n * @name defaultsDeep\n * @api public\n * @param {Object} target\n * @param {...Object} sources\n * @return {Object} The input `target`.\n */\nvar defaultsDeep = function defaultsDeep(target /*, sources */) {\n // TODO: Replace with `partial` call?\n return defaultsWith.apply(null, [deepCombiner, target].concat(rest(arguments)));\n};\n\n/**\n * Copies owned, enumerable properties from a source object(s) to a target\n * object when the value of that property on the source object is `undefined`.\n *\n * @name defaults\n * @api public\n * @param {Object} target\n * @param {...Object} sources\n * @return {Object}\n * @example\n * var a = { a: 1 };\n * var b = { a: 2, b: 2 };\n *\n * defaults(a, b);\n * console.log(a); //=> { a: 1, b: 2 }\n */\nvar defaults = function(target /*, ...sources */) {\n // TODO: Replace with `partial` call?\n return defaultsWith.apply(null, [null, target].concat(rest(arguments)));\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = defaults;\nmodule.exports.deep = defaultsDeep;\n","/*! JSON v3.3.2 | https://bestiejs.github.io/json3 | Copyright 2012-2015, Kit Cambridge, Benjamin Tan | http://kit.mit-license.org */\n;(function () {\n // Detect the `define` function exposed by asynchronous module loaders. The\n // strict `define` check is necessary for compatibility with `r.js`.\n var isLoader = typeof define === \"function\" && define.amd;\n\n // A set of types used to distinguish objects from primitives.\n var objectTypes = {\n \"function\": true,\n \"object\": true\n };\n\n // Detect the `exports` object exposed by CommonJS implementations.\n var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;\n\n // Use the `global` object exposed by Node (including Browserify via\n // `insert-module-globals`), Narwhal, and Ringo as the default context,\n // and the `window` object in browsers. Rhino exports a `global` function\n // instead.\n var root = objectTypes[typeof window] && window || this,\n freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == \"object\" && global;\n\n if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {\n root = freeGlobal;\n }\n\n // Public: Initializes JSON 3 using the given `context` object, attaching the\n // `stringify` and `parse` functions to the specified `exports` object.\n function runInContext(context, exports) {\n context || (context = root.Object());\n exports || (exports = root.Object());\n\n // Native constructor aliases.\n var Number = context.Number || root.Number,\n String = context.String || root.String,\n Object = context.Object || root.Object,\n Date = context.Date || root.Date,\n SyntaxError = context.SyntaxError || root.SyntaxError,\n TypeError = context.TypeError || root.TypeError,\n Math = context.Math || root.Math,\n nativeJSON = context.JSON || root.JSON;\n\n // Delegate to the native `stringify` and `parse` implementations.\n if (typeof nativeJSON == \"object\" && nativeJSON) {\n exports.stringify = nativeJSON.stringify;\n exports.parse = nativeJSON.parse;\n }\n\n // Convenience aliases.\n var objectProto = Object.prototype,\n getClass = objectProto.toString,\n isProperty = objectProto.hasOwnProperty,\n undefined;\n\n // Internal: Contains `try...catch` logic used by other functions.\n // This prevents other functions from being deoptimized.\n function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }\n\n // Test the `Date#getUTC*` methods. Based on work by @Yaffle.\n var isExtended = new Date(-3509827334573292);\n attempt(function () {\n // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical\n // results for certain dates in Opera >= 10.53.\n isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&\n isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;\n });\n\n // Internal: Determines whether the native `JSON.stringify` and `parse`\n // implementations are spec-compliant. Based on work by Ken Snyder.\n function has(name) {\n if (has[name] != null) {\n // Return cached feature test result.\n return has[name];\n }\n var isSupported;\n if (name == \"bug-string-char-index\") {\n // IE <= 7 doesn't support accessing string characters using square\n // bracket notation. IE 8 only supports this for primitives.\n isSupported = \"a\"[0] != \"a\";\n } else if (name == \"json\") {\n // Indicates whether both `JSON.stringify` and `JSON.parse` are\n // supported.\n isSupported = has(\"json-stringify\") && has(\"date-serialization\") && has(\"json-parse\");\n } else if (name == \"date-serialization\") {\n // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`.\n isSupported = has(\"json-stringify\") && isExtended;\n if (isSupported) {\n var stringify = exports.stringify;\n attempt(function () {\n isSupported =\n // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly\n // serialize extended years.\n stringify(new Date(-8.64e15)) == '\"-271821-04-20T00:00:00.000Z\"' &&\n // The milliseconds are optional in ES 5, but required in 5.1.\n stringify(new Date(8.64e15)) == '\"+275760-09-13T00:00:00.000Z\"' &&\n // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative\n // four-digit years instead of six-digit years. Credits: @Yaffle.\n stringify(new Date(-621987552e5)) == '\"-000001-01-01T00:00:00.000Z\"' &&\n // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond\n // values less than 1000. Credits: @Yaffle.\n stringify(new Date(-1)) == '\"1969-12-31T23:59:59.999Z\"';\n });\n }\n } else {\n var value, serialized = '{\"a\":[1,true,false,null,\"\\\\u0000\\\\b\\\\n\\\\f\\\\r\\\\t\"]}';\n // Test `JSON.stringify`.\n if (name == \"json-stringify\") {\n var stringify = exports.stringify, stringifySupported = typeof stringify == \"function\";\n if (stringifySupported) {\n // A test function object with a custom `toJSON` method.\n (value = function () {\n return 1;\n }).toJSON = value;\n attempt(function () {\n stringifySupported =\n // Firefox 3.1b1 and b2 serialize string, number, and boolean\n // primitives as object literals.\n stringify(0) === \"0\" &&\n // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object\n // literals.\n stringify(new Number()) === \"0\" &&\n stringify(new String()) == '\"\"' &&\n // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or\n // does not define a canonical JSON representation (this applies to\n // objects with `toJSON` properties as well, *unless* they are nested\n // within an object or array).\n stringify(getClass) === undefined &&\n // IE 8 serializes `undefined` as `\"undefined\"`. Safari <= 5.1.7 and\n // FF 3.1b3 pass this test.\n stringify(undefined) === undefined &&\n // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,\n // respectively, if the value is omitted entirely.\n stringify() === undefined &&\n // FF 3.1b1, 2 throw an error if the given value is not a number,\n // string, array, object, Boolean, or `null` literal. This applies to\n // objects with custom `toJSON` methods as well, unless they are nested\n // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`\n // methods entirely.\n stringify(value) === \"1\" &&\n stringify([value]) == \"[1]\" &&\n // Prototype <= 1.6.1 serializes `[undefined]` as `\"[]\"` instead of\n // `\"[null]\"`.\n stringify([undefined]) == \"[null]\" &&\n // YUI 3.0.0b1 fails to serialize `null` literals.\n stringify(null) == \"null\" &&\n // FF 3.1b1, 2 halts serialization if an array contains a function:\n // `[1, true, getClass, 1]` serializes as \"[1,true,],\". FF 3.1b3\n // elides non-JSON values from objects and arrays, unless they\n // define custom `toJSON` methods.\n stringify([undefined, getClass, null]) == \"[null,null,null]\" &&\n // Simple serialization test. FF 3.1b1 uses Unicode escape sequences\n // where character escape codes are expected (e.g., `\\b` => `\\u0008`).\n stringify({ \"a\": [value, true, false, null, \"\\x00\\b\\n\\f\\r\\t\"] }) == serialized &&\n // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.\n stringify(null, value) === \"1\" &&\n stringify([1, 2], null, 1) == \"[\\n 1,\\n 2\\n]\";\n }, function () {\n stringifySupported = false;\n });\n }\n isSupported = stringifySupported;\n }\n // Test `JSON.parse`.\n if (name == \"json-parse\") {\n var parse = exports.parse, parseSupported;\n if (typeof parse == \"function\") {\n attempt(function () {\n // FF 3.1b1, b2 will throw an exception if a bare literal is provided.\n // Conforming implementations should also coerce the initial argument to\n // a string prior to parsing.\n if (parse(\"0\") === 0 && !parse(false)) {\n // Simple parsing test.\n value = parse(serialized);\n parseSupported = value[\"a\"].length == 5 && value[\"a\"][0] === 1;\n if (parseSupported) {\n attempt(function () {\n // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.\n parseSupported = !parse('\"\\t\"');\n });\n if (parseSupported) {\n attempt(function () {\n // FF 4.0 and 4.0.1 allow leading `+` signs and leading\n // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow\n // certain octal literals.\n parseSupported = parse(\"01\") !== 1;\n });\n }\n if (parseSupported) {\n attempt(function () {\n // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal\n // points. These environments, along with FF 3.1b1 and 2,\n // also allow trailing commas in JSON objects and arrays.\n parseSupported = parse(\"1.\") !== 1;\n });\n }\n }\n }\n }, function () {\n parseSupported = false;\n });\n }\n isSupported = parseSupported;\n }\n }\n return has[name] = !!isSupported;\n }\n has[\"bug-string-char-index\"] = has[\"date-serialization\"] = has[\"json\"] = has[\"json-stringify\"] = has[\"json-parse\"] = null;\n\n if (!has(\"json\")) {\n // Common `[[Class]]` name aliases.\n var functionClass = \"[object Function]\",\n dateClass = \"[object Date]\",\n numberClass = \"[object Number]\",\n stringClass = \"[object String]\",\n arrayClass = \"[object Array]\",\n booleanClass = \"[object Boolean]\";\n\n // Detect incomplete support for accessing string characters by index.\n var charIndexBuggy = has(\"bug-string-char-index\");\n\n // Internal: Normalizes the `for...in` iteration algorithm across\n // environments. Each enumerated key is yielded to a `callback` function.\n var forOwn = function (object, callback) {\n var size = 0, Properties, dontEnums, property;\n\n // Tests for bugs in the current environment's `for...in` algorithm. The\n // `valueOf` property inherits the non-enumerable flag from\n // `Object.prototype` in older versions of IE, Netscape, and Mozilla.\n (Properties = function () {\n this.valueOf = 0;\n }).prototype.valueOf = 0;\n\n // Iterate over a new instance of the `Properties` class.\n dontEnums = new Properties();\n for (property in dontEnums) {\n // Ignore all properties inherited from `Object.prototype`.\n if (isProperty.call(dontEnums, property)) {\n size++;\n }\n }\n Properties = dontEnums = null;\n\n // Normalize the iteration algorithm.\n if (!size) {\n // A list of non-enumerable properties inherited from `Object.prototype`.\n dontEnums = [\"valueOf\", \"toString\", \"toLocaleString\", \"propertyIsEnumerable\", \"isPrototypeOf\", \"hasOwnProperty\", \"constructor\"];\n // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable\n // properties.\n forOwn = function (object, callback) {\n var isFunction = getClass.call(object) == functionClass, property, length;\n var hasProperty = !isFunction && typeof object.constructor != \"function\" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;\n for (property in object) {\n // Gecko <= 1.0 enumerates the `prototype` property of functions under\n // certain conditions; IE does not.\n if (!(isFunction && property == \"prototype\") && hasProperty.call(object, property)) {\n callback(property);\n }\n }\n // Manually invoke the callback for each non-enumerable property.\n for (length = dontEnums.length; property = dontEnums[--length];) {\n if (hasProperty.call(object, property)) {\n callback(property);\n }\n }\n };\n } else {\n // No bugs detected; use the standard `for...in` algorithm.\n forOwn = function (object, callback) {\n var isFunction = getClass.call(object) == functionClass, property, isConstructor;\n for (property in object) {\n if (!(isFunction && property == \"prototype\") && isProperty.call(object, property) && !(isConstructor = property === \"constructor\")) {\n callback(property);\n }\n }\n // Manually invoke the callback for the `constructor` property due to\n // cross-environment inconsistencies.\n if (isConstructor || isProperty.call(object, (property = \"constructor\"))) {\n callback(property);\n }\n };\n }\n return forOwn(object, callback);\n };\n\n // Public: Serializes a JavaScript `value` as a JSON string. The optional\n // `filter` argument may specify either a function that alters how object and\n // array members are serialized, or an array of strings and numbers that\n // indicates which properties should be serialized. The optional `width`\n // argument may be either a string or number that specifies the indentation\n // level of the output.\n if (!has(\"json-stringify\") && !has(\"date-serialization\")) {\n // Internal: A map of control characters and their escaped equivalents.\n var Escapes = {\n 92: \"\\\\\\\\\",\n 34: '\\\\\"',\n 8: \"\\\\b\",\n 12: \"\\\\f\",\n 10: \"\\\\n\",\n 13: \"\\\\r\",\n 9: \"\\\\t\"\n };\n\n // Internal: Converts `value` into a zero-padded string such that its\n // length is at least equal to `width`. The `width` must be <= 6.\n var leadingZeroes = \"000000\";\n var toPaddedString = function (width, value) {\n // The `|| 0` expression is necessary to work around a bug in\n // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== \"0\"`.\n return (leadingZeroes + (value || 0)).slice(-width);\n };\n\n // Internal: Serializes a date object.\n var serializeDate = function (value) {\n var getData, year, month, date, time, hours, minutes, seconds, milliseconds;\n // Define additional utility methods if the `Date` methods are buggy.\n if (!isExtended) {\n var floor = Math.floor;\n // A mapping between the months of the year and the number of days between\n // January 1st and the first of the respective month.\n var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n // Internal: Calculates the number of days between the Unix epoch and the\n // first day of the given month.\n var getDay = function (year, month) {\n return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);\n };\n getData = function (value) {\n // Manually compute the year, month, date, hours, minutes,\n // seconds, and milliseconds if the `getUTC*` methods are\n // buggy. Adapted from @Yaffle's `date-shim` project.\n date = floor(value / 864e5);\n for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);\n for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);\n date = 1 + date - getDay(year, month);\n // The `time` value specifies the time within the day (see ES\n // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used\n // to compute `A modulo B`, as the `%` operator does not\n // correspond to the `modulo` operation for negative numbers.\n time = (value % 864e5 + 864e5) % 864e5;\n // The hours, minutes, seconds, and milliseconds are obtained by\n // decomposing the time within the day. See section 15.9.1.10.\n hours = floor(time / 36e5) % 24;\n minutes = floor(time / 6e4) % 60;\n seconds = floor(time / 1e3) % 60;\n milliseconds = time % 1e3;\n };\n } else {\n getData = function (value) {\n year = value.getUTCFullYear();\n month = value.getUTCMonth();\n date = value.getUTCDate();\n hours = value.getUTCHours();\n minutes = value.getUTCMinutes();\n seconds = value.getUTCSeconds();\n milliseconds = value.getUTCMilliseconds();\n };\n }\n serializeDate = function (value) {\n if (value > -1 / 0 && value < 1 / 0) {\n // Dates are serialized according to the `Date#toJSON` method\n // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15\n // for the ISO 8601 date time string format.\n getData(value);\n // Serialize extended years correctly.\n value = (year <= 0 || year >= 1e4 ? (year < 0 ? \"-\" : \"+\") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +\n \"-\" + toPaddedString(2, month + 1) + \"-\" + toPaddedString(2, date) +\n // Months, dates, hours, minutes, and seconds should have two\n // digits; milliseconds should have three.\n \"T\" + toPaddedString(2, hours) + \":\" + toPaddedString(2, minutes) + \":\" + toPaddedString(2, seconds) +\n // Milliseconds are optional in ES 5.0, but required in 5.1.\n \".\" + toPaddedString(3, milliseconds) + \"Z\";\n year = month = date = hours = minutes = seconds = milliseconds = null;\n } else {\n value = null;\n }\n return value;\n };\n return serializeDate(value);\n };\n\n // For environments with `JSON.stringify` but buggy date serialization,\n // we override the native `Date#toJSON` implementation with a\n // spec-compliant one.\n if (has(\"json-stringify\") && !has(\"date-serialization\")) {\n // Internal: the `Date#toJSON` implementation used to override the native one.\n function dateToJSON (key) {\n return serializeDate(this);\n }\n\n // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.\n var nativeStringify = exports.stringify;\n exports.stringify = function (source, filter, width) {\n var nativeToJSON = Date.prototype.toJSON;\n Date.prototype.toJSON = dateToJSON;\n var result = nativeStringify(source, filter, width);\n Date.prototype.toJSON = nativeToJSON;\n return result;\n }\n } else {\n // Internal: Double-quotes a string `value`, replacing all ASCII control\n // characters (characters with code unit values between 0 and 31) with\n // their escaped equivalents. This is an implementation of the\n // `Quote(value)` operation defined in ES 5.1 section 15.12.3.\n var unicodePrefix = \"\\\\u00\";\n var escapeChar = function (character) {\n var charCode = character.charCodeAt(0), escaped = Escapes[charCode];\n if (escaped) {\n return escaped;\n }\n return unicodePrefix + toPaddedString(2, charCode.toString(16));\n };\n var reEscape = /[\\x00-\\x1f\\x22\\x5c]/g;\n var quote = function (value) {\n reEscape.lastIndex = 0;\n return '\"' +\n (\n reEscape.test(value)\n ? value.replace(reEscape, escapeChar)\n : value\n ) +\n '\"';\n };\n\n // Internal: Recursively serializes an object. Implements the\n // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.\n var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {\n var value, type, className, results, element, index, length, prefix, result;\n attempt(function () {\n // Necessary for host object support.\n value = object[property];\n });\n if (typeof value == \"object\" && value) {\n if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) {\n value = serializeDate(value);\n } else if (typeof value.toJSON == \"function\") {\n value = value.toJSON(property);\n }\n }\n if (callback) {\n // If a replacement function was provided, call it to obtain the value\n // for serialization.\n value = callback.call(object, property, value);\n }\n // Exit early if value is `undefined` or `null`.\n if (value == undefined) {\n return value === undefined ? value : \"null\";\n }\n type = typeof value;\n // Only call `getClass` if the value is an object.\n if (type == \"object\") {\n className = getClass.call(value);\n }\n switch (className || type) {\n case \"boolean\":\n case booleanClass:\n // Booleans are represented literally.\n return \"\" + value;\n case \"number\":\n case numberClass:\n // JSON numbers must be finite. `Infinity` and `NaN` are serialized as\n // `\"null\"`.\n return value > -1 / 0 && value < 1 / 0 ? \"\" + value : \"null\";\n case \"string\":\n case stringClass:\n // Strings are double-quoted and escaped.\n return quote(\"\" + value);\n }\n // Recursively serialize objects and arrays.\n if (typeof value == \"object\") {\n // Check for cyclic structures. This is a linear search; performance\n // is inversely proportional to the number of unique nested objects.\n for (length = stack.length; length--;) {\n if (stack[length] === value) {\n // Cyclic structures cannot be serialized by `JSON.stringify`.\n throw TypeError();\n }\n }\n // Add the object to the stack of traversed objects.\n stack.push(value);\n results = [];\n // Save the current indentation level and indent one additional level.\n prefix = indentation;\n indentation += whitespace;\n if (className == arrayClass) {\n // Recursively serialize array elements.\n for (index = 0, length = value.length; index < length; index++) {\n element = serialize(index, value, callback, properties, whitespace, indentation, stack);\n results.push(element === undefined ? \"null\" : element);\n }\n result = results.length ? (whitespace ? \"[\\n\" + indentation + results.join(\",\\n\" + indentation) + \"\\n\" + prefix + \"]\" : (\"[\" + results.join(\",\") + \"]\")) : \"[]\";\n } else {\n // Recursively serialize object members. Members are selected from\n // either a user-specified list of property names, or the object\n // itself.\n forOwn(properties || value, function (property) {\n var element = serialize(property, value, callback, properties, whitespace, indentation, stack);\n if (element !== undefined) {\n // According to ES 5.1 section 15.12.3: \"If `gap` {whitespace}\n // is not the empty string, let `member` {quote(property) + \":\"}\n // be the concatenation of `member` and the `space` character.\"\n // The \"`space` character\" refers to the literal space\n // character, not the `space` {width} argument provided to\n // `JSON.stringify`.\n results.push(quote(property) + \":\" + (whitespace ? \" \" : \"\") + element);\n }\n });\n result = results.length ? (whitespace ? \"{\\n\" + indentation + results.join(\",\\n\" + indentation) + \"\\n\" + prefix + \"}\" : (\"{\" + results.join(\",\") + \"}\")) : \"{}\";\n }\n // Remove the object from the traversed object stack.\n stack.pop();\n return result;\n }\n };\n\n // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.\n exports.stringify = function (source, filter, width) {\n var whitespace, callback, properties, className;\n if (objectTypes[typeof filter] && filter) {\n className = getClass.call(filter);\n if (className == functionClass) {\n callback = filter;\n } else if (className == arrayClass) {\n // Convert the property names array into a makeshift set.\n properties = {};\n for (var index = 0, length = filter.length, value; index < length;) {\n value = filter[index++];\n className = getClass.call(value);\n if (className == \"[object String]\" || className == \"[object Number]\") {\n properties[value] = 1;\n }\n }\n }\n }\n if (width) {\n className = getClass.call(width);\n if (className == numberClass) {\n // Convert the `width` to an integer and create a string containing\n // `width` number of space characters.\n if ((width -= width % 1) > 0) {\n if (width > 10) {\n width = 10;\n }\n for (whitespace = \"\"; whitespace.length < width;) {\n whitespace += \" \";\n }\n }\n } else if (className == stringClass) {\n whitespace = width.length <= 10 ? width : width.slice(0, 10);\n }\n }\n // Opera <= 7.54u2 discards the values associated with empty string keys\n // (`\"\"`) only if they are used directly within an object member list\n // (e.g., `!(\"\" in { \"\": 1})`).\n return serialize(\"\", (value = {}, value[\"\"] = source, value), callback, properties, whitespace, \"\", []);\n };\n }\n }\n\n // Public: Parses a JSON source string.\n if (!has(\"json-parse\")) {\n var fromCharCode = String.fromCharCode;\n\n // Internal: A map of escaped control characters and their unescaped\n // equivalents.\n var Unescapes = {\n 92: \"\\\\\",\n 34: '\"',\n 47: \"/\",\n 98: \"\\b\",\n 116: \"\\t\",\n 110: \"\\n\",\n 102: \"\\f\",\n 114: \"\\r\"\n };\n\n // Internal: Stores the parser state.\n var Index, Source;\n\n // Internal: Resets the parser state and throws a `SyntaxError`.\n var abort = function () {\n Index = Source = null;\n throw SyntaxError();\n };\n\n // Internal: Returns the next token, or `\"$\"` if the parser has reached\n // the end of the source string. A token may be a string, number, `null`\n // literal, or Boolean literal.\n var lex = function () {\n var source = Source, length = source.length, value, begin, position, isSigned, charCode;\n while (Index < length) {\n charCode = source.charCodeAt(Index);\n switch (charCode) {\n case 9: case 10: case 13: case 32:\n // Skip whitespace tokens, including tabs, carriage returns, line\n // feeds, and space characters.\n Index++;\n break;\n case 123: case 125: case 91: case 93: case 58: case 44:\n // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at\n // the current position.\n value = charIndexBuggy ? source.charAt(Index) : source[Index];\n Index++;\n return value;\n case 34:\n // `\"` delimits a JSON string; advance to the next character and\n // begin parsing the string. String tokens are prefixed with the\n // sentinel `@` character to distinguish them from punctuators and\n // end-of-string tokens.\n for (value = \"@\", Index++; Index < length;) {\n charCode = source.charCodeAt(Index);\n if (charCode < 32) {\n // Unescaped ASCII control characters (those with a code unit\n // less than the space character) are not permitted.\n abort();\n } else if (charCode == 92) {\n // A reverse solidus (`\\`) marks the beginning of an escaped\n // control character (including `\"`, `\\`, and `/`) or Unicode\n // escape sequence.\n charCode = source.charCodeAt(++Index);\n switch (charCode) {\n case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:\n // Revive escaped control characters.\n value += Unescapes[charCode];\n Index++;\n break;\n case 117:\n // `\\u` marks the beginning of a Unicode escape sequence.\n // Advance to the first character and validate the\n // four-digit code point.\n begin = ++Index;\n for (position = Index + 4; Index < position; Index++) {\n charCode = source.charCodeAt(Index);\n // A valid sequence comprises four hexdigits (case-\n // insensitive) that form a single hexadecimal value.\n if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {\n // Invalid Unicode escape sequence.\n abort();\n }\n }\n // Revive the escaped character.\n value += fromCharCode(\"0x\" + source.slice(begin, Index));\n break;\n default:\n // Invalid escape sequence.\n abort();\n }\n } else {\n if (charCode == 34) {\n // An unescaped double-quote character marks the end of the\n // string.\n break;\n }\n charCode = source.charCodeAt(Index);\n begin = Index;\n // Optimize for the common case where a string is valid.\n while (charCode >= 32 && charCode != 92 && charCode != 34) {\n charCode = source.charCodeAt(++Index);\n }\n // Append the string as-is.\n value += source.slice(begin, Index);\n }\n }\n if (source.charCodeAt(Index) == 34) {\n // Advance to the next character and return the revived string.\n Index++;\n return value;\n }\n // Unterminated string.\n abort();\n default:\n // Parse numbers and literals.\n begin = Index;\n // Advance past the negative sign, if one is specified.\n if (charCode == 45) {\n isSigned = true;\n charCode = source.charCodeAt(++Index);\n }\n // Parse an integer or floating-point value.\n if (charCode >= 48 && charCode <= 57) {\n // Leading zeroes are interpreted as octal literals.\n if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {\n // Illegal octal literal.\n abort();\n }\n isSigned = false;\n // Parse the integer component.\n for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);\n // Floats cannot contain a leading decimal point; however, this\n // case is already accounted for by the parser.\n if (source.charCodeAt(Index) == 46) {\n position = ++Index;\n // Parse the decimal component.\n for (; position < length; position++) {\n charCode = source.charCodeAt(position);\n if (charCode < 48 || charCode > 57) {\n break;\n }\n }\n if (position == Index) {\n // Illegal trailing decimal.\n abort();\n }\n Index = position;\n }\n // Parse exponents. The `e` denoting the exponent is\n // case-insensitive.\n charCode = source.charCodeAt(Index);\n if (charCode == 101 || charCode == 69) {\n charCode = source.charCodeAt(++Index);\n // Skip past the sign following the exponent, if one is\n // specified.\n if (charCode == 43 || charCode == 45) {\n Index++;\n }\n // Parse the exponential component.\n for (position = Index; position < length; position++) {\n charCode = source.charCodeAt(position);\n if (charCode < 48 || charCode > 57) {\n break;\n }\n }\n if (position == Index) {\n // Illegal empty exponent.\n abort();\n }\n Index = position;\n }\n // Coerce the parsed value to a JavaScript number.\n return +source.slice(begin, Index);\n }\n // A negative sign may only precede numbers.\n if (isSigned) {\n abort();\n }\n // `true`, `false`, and `null` literals.\n var temp = source.slice(Index, Index + 4);\n if (temp == \"true\") {\n Index += 4;\n return true;\n } else if (temp == \"fals\" && source.charCodeAt(Index + 4 ) == 101) {\n Index += 5;\n return false;\n } else if (temp == \"null\") {\n Index += 4;\n return null;\n }\n // Unrecognized token.\n abort();\n }\n }\n // Return the sentinel `$` character if the parser has reached the end\n // of the source string.\n return \"$\";\n };\n\n // Internal: Parses a JSON `value` token.\n var get = function (value) {\n var results, hasMembers;\n if (value == \"$\") {\n // Unexpected end of input.\n abort();\n }\n if (typeof value == \"string\") {\n if ((charIndexBuggy ? value.charAt(0) : value[0]) == \"@\") {\n // Remove the sentinel `@` character.\n return value.slice(1);\n }\n // Parse object and array literals.\n if (value == \"[\") {\n // Parses a JSON array, returning a new JavaScript array.\n results = [];\n for (;;) {\n value = lex();\n // A closing square bracket marks the end of the array literal.\n if (value == \"]\") {\n break;\n }\n // If the array literal contains elements, the current token\n // should be a comma separating the previous element from the\n // next.\n if (hasMembers) {\n if (value == \",\") {\n value = lex();\n if (value == \"]\") {\n // Unexpected trailing `,` in array literal.\n abort();\n }\n } else {\n // A `,` must separate each array element.\n abort();\n }\n } else {\n hasMembers = true;\n }\n // Elisions and leading commas are not permitted.\n if (value == \",\") {\n abort();\n }\n results.push(get(value));\n }\n return results;\n } else if (value == \"{\") {\n // Parses a JSON object, returning a new JavaScript object.\n results = {};\n for (;;) {\n value = lex();\n // A closing curly brace marks the end of the object literal.\n if (value == \"}\") {\n break;\n }\n // If the object literal contains members, the current token\n // should be a comma separator.\n if (hasMembers) {\n if (value == \",\") {\n value = lex();\n if (value == \"}\") {\n // Unexpected trailing `,` in object literal.\n abort();\n }\n } else {\n // A `,` must separate each object member.\n abort();\n }\n } else {\n hasMembers = true;\n }\n // Leading commas are not permitted, object property names must be\n // double-quoted strings, and a `:` must separate each property\n // name and value.\n if (value == \",\" || typeof value != \"string\" || (charIndexBuggy ? value.charAt(0) : value[0]) != \"@\" || lex() != \":\") {\n abort();\n }\n results[value.slice(1)] = get(lex());\n }\n return results;\n }\n // Unexpected token encountered.\n abort();\n }\n return value;\n };\n\n // Internal: Updates a traversed object member.\n var update = function (source, property, callback) {\n var element = walk(source, property, callback);\n if (element === undefined) {\n delete source[property];\n } else {\n source[property] = element;\n }\n };\n\n // Internal: Recursively traverses a parsed JSON object, invoking the\n // `callback` function for each value. This is an implementation of the\n // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.\n var walk = function (source, property, callback) {\n var value = source[property], length;\n if (typeof value == \"object\" && value) {\n // `forOwn` can't be used to traverse an array in Opera <= 8.54\n // because its `Object#hasOwnProperty` implementation returns `false`\n // for array indices (e.g., `![1, 2, 3].hasOwnProperty(\"0\")`).\n if (getClass.call(value) == arrayClass) {\n for (length = value.length; length--;) {\n update(getClass, forOwn, value, length, callback);\n }\n } else {\n forOwn(value, function (property) {\n update(value, property, callback);\n });\n }\n }\n return callback.call(source, property, value);\n };\n\n // Public: `JSON.parse`. See ES 5.1 section 15.12.2.\n exports.parse = function (source, callback) {\n var result, value;\n Index = 0;\n Source = \"\" + source;\n result = get(lex());\n // If a JSON string contains multiple tokens, it is invalid.\n if (lex() != \"$\") {\n abort();\n }\n // Reset the parser state.\n Index = Source = null;\n return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[\"\"] = result, value), \"\", callback) : result;\n };\n }\n }\n\n exports.runInContext = runInContext;\n return exports;\n }\n\n if (freeExports && !isLoader) {\n // Export for CommonJS environments.\n runInContext(root, freeExports);\n } else {\n // Export for web browsers and JavaScript engines.\n var nativeJSON = root.JSON,\n previousJSON = root.JSON3,\n isRestored = false;\n\n var JSON3 = runInContext(root, (root.JSON3 = {\n // Public: Restores the original value of the global `JSON` object and\n // returns a reference to the `JSON3` object.\n \"noConflict\": function () {\n if (!isRestored) {\n isRestored = true;\n root.JSON = nativeJSON;\n root.JSON3 = previousJSON;\n nativeJSON = previousJSON = null;\n }\n return JSON3;\n }\n }));\n\n root.JSON = {\n \"parse\": JSON3.parse,\n \"stringify\": JSON3.stringify\n };\n }\n\n // Export for asynchronous module loaders.\n if (isLoader) {\n define(function () {\n return JSON3;\n });\n }\n}).call(this);\n","\n/**\n * Parse the given `url`.\n *\n * @param {String} str\n * @return {Object}\n * @api public\n */\n\nexports.parse = function(url){\n var a = document.createElement('a');\n a.href = url;\n return {\n href: a.href,\n host: a.host || location.host,\n port: ('0' === a.port || '' === a.port) ? port(a.protocol) : a.port,\n hash: a.hash,\n hostname: a.hostname || location.hostname,\n pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname,\n protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol,\n search: a.search,\n query: a.search.slice(1)\n };\n};\n\n/**\n * Check if `url` is absolute.\n *\n * @param {String} url\n * @return {Boolean}\n * @api public\n */\n\nexports.isAbsolute = function(url){\n return 0 == url.indexOf('//') || !!~url.indexOf('://');\n};\n\n/**\n * Check if `url` is relative.\n *\n * @param {String} url\n * @return {Boolean}\n * @api public\n */\n\nexports.isRelative = function(url){\n return !exports.isAbsolute(url);\n};\n\n/**\n * Check if `url` is cross domain.\n *\n * @param {String} url\n * @return {Boolean}\n * @api public\n */\n\nexports.isCrossDomain = function(url){\n url = exports.parse(url);\n var location = exports.parse(window.location.href);\n return url.hostname !== location.hostname\n || url.port !== location.port\n || url.protocol !== location.protocol;\n};\n\n/**\n * Return default port for `protocol`.\n *\n * @param {String} protocol\n * @return {String}\n * @api private\n */\nfunction port (protocol){\n switch (protocol) {\n case 'http:':\n return 80;\n case 'https:':\n return 443;\n default:\n return location.port;\n }\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = debug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lowercased letter, i.e. \"n\".\n */\n\nexports.formatters = {};\n\n/**\n * Previously assigned color.\n */\n\nvar prevColor = 0;\n\n/**\n * Previous log timestamp.\n */\n\nvar prevTime;\n\n/**\n * Select a color.\n *\n * @return {Number}\n * @api private\n */\n\nfunction selectColor() {\n return exports.colors[prevColor++ % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction debug(namespace) {\n\n // define the `disabled` version\n function disabled() {\n }\n disabled.enabled = false;\n\n // define the `enabled` version\n function enabled() {\n\n var self = enabled;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // add the `color` if not set\n if (null == self.useColors) self.useColors = exports.useColors();\n if (null == self.color && self.useColors) self.color = selectColor();\n\n var args = Array.prototype.slice.call(arguments);\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %o\n args = ['%o'].concat(args);\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n if ('function' === typeof exports.formatArgs) {\n args = exports.formatArgs.apply(self, args);\n }\n var logFn = enabled.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n enabled.enabled = true;\n\n var fn = exports.enabled(namespace) ? enabled : disabled;\n\n fn.namespace = namespace;\n\n return fn;\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n var split = (namespaces || '').split(/[\\s,]+/);\n var len = split.length;\n\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n","\n/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n 'lightseagreen',\n 'forestgreen',\n 'goldenrod',\n 'dodgerblue',\n 'darkorchid',\n 'crimson'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // is webkit? http://stackoverflow.com/a/16459606/376773\n return ('WebkitAppearance' in document.documentElement.style) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (window.console && (console.firebug || (console.exception && console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31);\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n return JSON.stringify(v);\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs() {\n var args = arguments;\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return args;\n\n var c = 'color: ' + this.color;\n args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n return args;\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage(){\n try {\n return window.localStorage;\n } catch (e) {}\n}\n","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('cookie');\n\n/**\n * Set or get cookie `name` with `value` and `options` object.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @return {Mixed}\n * @api public\n */\n\nmodule.exports = function(name, value, options){\n switch (arguments.length) {\n case 3:\n case 2:\n return set(name, value, options);\n case 1:\n return get(name);\n default:\n return all();\n }\n};\n\n/**\n * Set cookie `name` to `value`.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @api private\n */\n\nfunction set(name, value, options) {\n options = options || {};\n var str = encode(name) + '=' + encode(value);\n\n if (null == value) options.maxage = -1;\n\n if (options.maxage) {\n options.expires = new Date(+new Date + options.maxage);\n }\n\n if (options.path) str += '; path=' + options.path;\n if (options.domain) str += '; domain=' + options.domain;\n if (options.expires) str += '; expires=' + options.expires.toUTCString();\n if (options.secure) str += '; secure';\n\n document.cookie = str;\n}\n\n/**\n * Return all cookies.\n *\n * @return {Object}\n * @api private\n */\n\nfunction all() {\n var str;\n try {\n str = document.cookie;\n } catch (err) {\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(err.stack || err);\n }\n return {};\n }\n return parse(str);\n}\n\n/**\n * Get cookie `name`.\n *\n * @param {String} name\n * @return {String}\n * @api private\n */\n\nfunction get(name) {\n return all()[name];\n}\n\n/**\n * Parse cookie `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parse(str) {\n var obj = {};\n var pairs = str.split(/ *; */);\n var pair;\n if ('' == pairs[0]) return obj;\n for (var i = 0; i < pairs.length; ++i) {\n pair = pairs[i].split('=');\n obj[decode(pair[0])] = decode(pair[1]);\n }\n return obj;\n}\n\n/**\n * Encode.\n */\n\nfunction encode(value){\n try {\n return encodeURIComponent(value);\n } catch (e) {\n debug('error `encode(%o)` - %o', value, e)\n }\n}\n\n/**\n * Decode.\n */\n\nfunction decode(value) {\n try {\n return decodeURIComponent(value);\n } catch (e) {\n debug('error `decode(%o)` - %o', value, e)\n }\n}\n","'use strict';\n\n/**\n * Module dependencies.\n */\n\nvar parse = require('component-url').parse;\nvar cookie = require('component-cookie');\n\n/**\n * Get the top domain.\n *\n * The function constructs the levels of domain and attempts to set a global\n * cookie on each one when it succeeds it returns the top level domain.\n *\n * The method returns an empty string when the hostname is an ip or `localhost`.\n *\n * Example levels:\n *\n * domain.levels('http://www.google.co.uk');\n * // => [\"co.uk\", \"google.co.uk\", \"www.google.co.uk\"]\n *\n * Example:\n *\n * domain('http://localhost:3000/baz');\n * // => ''\n * domain('http://dev:3000/baz');\n * // => ''\n * domain('http://127.0.0.1:3000/baz');\n * // => ''\n * domain('http://segment.io/baz');\n * // => 'segment.io'\n *\n * @param {string} url\n * @return {string}\n * @api public\n */\nfunction domain(url) {\n var cookie = exports.cookie;\n var levels = exports.levels(url);\n\n // Lookup the real top level one.\n for (var i = 0; i < levels.length; ++i) {\n var cname = '__tld__';\n var domain = levels[i];\n var opts = { domain: '.' + domain };\n\n cookie(cname, 1, opts);\n if (cookie(cname)) {\n cookie(cname, null, opts);\n return domain;\n }\n }\n\n return '';\n}\n\n/**\n * Levels returns all levels of the given url.\n *\n * @param {string} url\n * @return {Array}\n * @api public\n */\ndomain.levels = function(url) {\n var host = parse(url).hostname;\n var parts = host.split('.');\n var last = parts[parts.length - 1];\n var levels = [];\n\n // Ip address.\n if (parts.length === 4 && last === parseInt(last, 10)) {\n return levels;\n }\n\n // Localhost.\n if (parts.length <= 1) {\n return levels;\n }\n\n // Create levels.\n for (var i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join('.'));\n }\n\n return levels;\n};\n\n/**\n * Expose cookie on domain.\n */\ndomain.cookie = cookie;\n\n/*\n * Exports.\n */\n\nexports = module.exports = domain;\n","import clone from \"@ndhoule/clone\";\nimport cookie from \"rudder-component-cookie\";\nimport defaults from \"@ndhoule/defaults\";\nimport json from \"json3\";\nimport topDomain from \"@segment/top-domain\";\n\n/**\n * An object utility to persist values in cookies\n */\nclass CookieLocal {\n constructor(options) {\n this._options = {};\n this.options(options);\n }\n\n /**\n *\n * @param {*} options\n */\n options(options = {}) {\n if (arguments.length === 0) return this._options;\n\n let domain = \".\" + topDomain(window.location.href);\n if (domain === \".\") domain = null;\n\n // the default maxage and path\n this._options = defaults(options, {\n maxage: 31536000000,\n path: \"/\",\n domain: domain,\n samesite: \"Lax\"\n });\n\n //try setting a cookie first\n this.set(\"test_rudder\", true);\n if (!this.get(\"test_rudder\")) {\n this._options.domain = null;\n }\n this.remove(\"test_rudder\");\n }\n\n /**\n *\n * @param {*} key\n * @param {*} value\n */\n set(key, value) {\n try {\n value = json.stringify(value);\n cookie(key, value, clone(this._options));\n return true;\n } catch (e) {\n return false;\n }\n }\n\n /**\n *\n * @param {*} key\n */\n get(key) {\n // if not parseable, return as is without json parse\n let value;\n try {\n value = cookie(key);\n value = value ? json.parse(value) : null;\n return value;\n } catch (e) {\n if(value) {\n return value\n }\n return null;\n }\n }\n\n /**\n *\n * @param {*} key\n */\n remove(key) {\n try {\n cookie(key, null, clone(this._options));\n return true;\n } catch (e) {\n return false;\n }\n }\n}\n\n// Exporting only the instance\nlet Cookie = new CookieLocal({});\n\nexport { Cookie };\n","\"use strict\"\n\nvar JSON = require('json3');\n\nmodule.exports = (function() {\n\t// Store.js\n\tvar store = {},\n\t\twin = (typeof window != 'undefined' ? window : global),\n\t\tdoc = win.document,\n\t\tlocalStorageName = 'localStorage',\n\t\tscriptTag = 'script',\n\t\tstorage\n\n\tstore.disabled = false\n\tstore.version = '1.3.20'\n\tstore.set = function(key, value) {}\n\tstore.get = function(key, defaultVal) {}\n\tstore.has = function(key) { return store.get(key) !== undefined }\n\tstore.remove = function(key) {}\n\tstore.clear = function() {}\n\tstore.transact = function(key, defaultVal, transactionFn) {\n\t\tif (transactionFn == null) {\n\t\t\ttransactionFn = defaultVal\n\t\t\tdefaultVal = null\n\t\t}\n\t\tif (defaultVal == null) {\n\t\t\tdefaultVal = {}\n\t\t}\n\t\tvar val = store.get(key, defaultVal)\n\t\ttransactionFn(val)\n\t\tstore.set(key, val)\n\t}\n\tstore.getAll = function() {\n\t\tvar ret = {}\n\t\tstore.forEach(function(key, val) {\n\t\t\tret[key] = val\n\t\t})\n\t\treturn ret\n\t}\n\tstore.forEach = function() {}\n\tstore.serialize = function(value) {\n\t\treturn JSON.stringify(value)\n\t}\n\tstore.deserialize = function(value) {\n\t\tif (typeof value != 'string') { return undefined }\n\t\ttry { return JSON.parse(value) }\n\t\tcatch(e) { return value || undefined }\n\t}\n\n\t// Functions to encapsulate questionable FireFox 3.6.13 behavior\n\t// when about.config::dom.storage.enabled === false\n\t// See https://github.com/marcuswestin/store.js/issues#issue/13\n\tfunction isLocalStorageNameSupported() {\n\t\ttry { return (localStorageName in win && win[localStorageName]) }\n\t\tcatch(err) { return false }\n\t}\n\n\tif (isLocalStorageNameSupported()) {\n\t\tstorage = win[localStorageName]\n\t\tstore.set = function(key, val) {\n\t\t\tif (val === undefined) { return store.remove(key) }\n\t\t\tstorage.setItem(key, store.serialize(val))\n\t\t\treturn val\n\t\t}\n\t\tstore.get = function(key, defaultVal) {\n\t\t\tvar val = store.deserialize(storage.getItem(key))\n\t\t\treturn (val === undefined ? defaultVal : val)\n\t\t}\n\t\tstore.remove = function(key) { storage.removeItem(key) }\n\t\tstore.clear = function() { storage.clear() }\n\t\tstore.forEach = function(callback) {\n\t\t\tfor (var i=0; idocument.w=window')\n\t\t\tstorageContainer.close()\n\t\t\tstorageOwner = storageContainer.w.frames[0].document\n\t\t\tstorage = storageOwner.createElement('div')\n\t\t} catch(e) {\n\t\t\t// somehow ActiveXObject instantiation failed (perhaps some special\n\t\t\t// security settings or otherwse), fall back to per-path storage\n\t\t\tstorage = doc.createElement('div')\n\t\t\tstorageOwner = doc.body\n\t\t}\n\t\tvar withIEStorage = function(storeFunction) {\n\t\t\treturn function() {\n\t\t\t\tvar args = Array.prototype.slice.call(arguments, 0)\n\t\t\t\targs.unshift(storage)\n\t\t\t\t// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx\n\t\t\t\t// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx\n\t\t\t\tstorageOwner.appendChild(storage)\n\t\t\t\tstorage.addBehavior('#default#userData')\n\t\t\t\tstorage.load(localStorageName)\n\t\t\t\tvar result = storeFunction.apply(store, args)\n\t\t\t\tstorageOwner.removeChild(storage)\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\n\t\t// In IE7, keys cannot start with a digit or contain certain chars.\n\t\t// See https://github.com/marcuswestin/store.js/issues/40\n\t\t// See https://github.com/marcuswestin/store.js/issues/83\n\t\tvar forbiddenCharsRegex = new RegExp(\"[!\\\"#$%&'()*+,/\\\\\\\\:;<=>?@[\\\\]^`{|}~]\", \"g\")\n\t\tvar ieKeyFix = function(key) {\n\t\t\treturn key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___')\n\t\t}\n\t\tstore.set = withIEStorage(function(storage, key, val) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tif (val === undefined) { return store.remove(key) }\n\t\t\tstorage.setAttribute(key, store.serialize(val))\n\t\t\tstorage.save(localStorageName)\n\t\t\treturn val\n\t\t})\n\t\tstore.get = withIEStorage(function(storage, key, defaultVal) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tvar val = store.deserialize(storage.getAttribute(key))\n\t\t\treturn (val === undefined ? defaultVal : val)\n\t\t})\n\t\tstore.remove = withIEStorage(function(storage, key) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tstorage.removeAttribute(key)\n\t\t\tstorage.save(localStorageName)\n\t\t})\n\t\tstore.clear = withIEStorage(function(storage) {\n\t\t\tvar attributes = storage.XMLDocument.documentElement.attributes\n\t\t\tstorage.load(localStorageName)\n\t\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\t\tstorage.removeAttribute(attributes[i].name)\n\t\t\t}\n\t\t\tstorage.save(localStorageName)\n\t\t})\n\t\tstore.forEach = withIEStorage(function(storage, callback) {\n\t\t\tvar attributes = storage.XMLDocument.documentElement.attributes\n\t\t\tfor (var i=0, attr; attr=attributes[i]; ++i) {\n\t\t\t\tcallback(attr.name, store.deserialize(storage.getAttribute(attr.name)))\n\t\t\t}\n\t\t})\n\t}\n\n\ttry {\n\t\tvar testKey = '__storejs__'\n\t\tstore.set(testKey, testKey)\n\t\tif (store.get(testKey) != testKey) { store.disabled = true }\n\t\tstore.remove(testKey)\n\t} catch(e) {\n\t\tstore.disabled = true\n\t}\n\tstore.enabled = !store.disabled\n\t\n\treturn store\n}())\n","import defaults from \"@ndhoule/defaults\";\nimport store from \"@segment/store\";\n\n/**\n * An object utility to persist user and other values in localstorage\n */\nclass StoreLocal {\n constructor(options) {\n this._options = {};\n this.enabled = false;\n this.options(options);\n }\n\n /**\n *\n * @param {*} options\n */\n options(options = {}) {\n if (arguments.length === 0) return this._options;\n\n defaults(options, { enabled: true });\n\n this.enabled = options.enabled && store.enabled;\n this._options = options;\n }\n\n /**\n *\n * @param {*} key\n * @param {*} value\n */\n set(key, value) {\n if (!this.enabled) return false;\n return store.set(key, value);\n }\n\n /**\n *\n * @param {*} key\n */\n get(key) {\n if (!this.enabled) return null;\n return store.get(key);\n }\n\n /**\n *\n * @param {*} key\n */\n remove(key) {\n if (!this.enabled) return false;\n return store.remove(key);\n }\n}\n\n// Exporting only the instance\nlet Store = new StoreLocal({});\n\nexport { Store };\n","import logger from \"../logUtil\";\nimport { Cookie } from \"./cookie\";\nimport { Store } from \"./store\";\nlet defaults = {\n user_storage_key: \"rl_user_id\",\n user_storage_trait: \"rl_trait\",\n user_storage_anonymousId: \"rl_anonymous_id\",\n group_storage_key: \"rl_group_id\",\n group_storage_trait: \"rl_group_trait\"\n};\n\n/**\n * An object that handles persisting key-val from Analytics\n */\nclass Storage {\n constructor() {\n // First try setting the storage to cookie else to localstorage\n Cookie.set(\"rudder_cookies\", true);\n\n if (Cookie.get(\"rudder_cookies\")) {\n Cookie.remove(\"rudder_cookies\");\n this.storage = Cookie;\n return;\n }\n\n // localStorage is enabled.\n if (Store.enabled) {\n this.storage = Store;\n return;\n }\n }\n\n /**\n *\n * @param {*} key\n * @param {*} value\n */\n setItem(key, value) {\n this.storage.set(key, value);\n }\n\n /**\n *\n * @param {*} value\n */\n setUserId(value) {\n if (typeof value != \"string\") {\n logger.error(\"[Storage] setUserId:: userId should be string\");\n return;\n }\n this.storage.set(defaults.user_storage_key, value);\n return;\n }\n\n /**\n *\n * @param {*} value\n */\n setUserTraits(value) {\n this.storage.set(defaults.user_storage_trait, value);\n return;\n }\n\n /**\n *\n * @param {*} value\n */\n setGroupId(value) {\n if (typeof value != \"string\") {\n logger.error(\"[Storage] setGroupId:: groupId should be string\");\n return;\n }\n this.storage.set(defaults.group_storage_key, value);\n return;\n }\n\n /**\n *\n * @param {*} value\n */\n setGroupTraits(value) {\n this.storage.set(defaults.group_storage_trait, value);\n return;\n }\n\n /**\n *\n * @param {*} value\n */\n setAnonymousId(value) {\n if (typeof value != \"string\") {\n logger.error(\"[Storage] setAnonymousId:: anonymousId should be string\");\n return;\n }\n this.storage.set(defaults.user_storage_anonymousId, value);\n return;\n }\n\n /**\n *\n * @param {*} key\n */\n getItem(key) {\n return this.storage.get(key);\n }\n\n /**\n * get the stored userId\n */\n getUserId() {\n return this.storage.get(defaults.user_storage_key);\n }\n\n /**\n * get the stored user traits\n */\n getUserTraits() {\n return this.storage.get(defaults.user_storage_trait);\n }\n\n /**\n * get the stored userId\n */\n getGroupId() {\n return this.storage.get(defaults.group_storage_key);\n }\n\n /**\n * get the stored user traits\n */\n getGroupTraits() {\n return this.storage.get(defaults.group_storage_trait);\n }\n\n /**\n * get stored anonymous id\n */\n getAnonymousId() {\n return this.storage.get(defaults.user_storage_anonymousId);\n }\n\n /**\n *\n * @param {*} key\n */\n removeItem(key) {\n return this.storage.remove(key);\n }\n\n /**\n * remove stored keys\n */\n clear() {\n this.storage.remove(defaults.user_storage_key);\n this.storage.remove(defaults.user_storage_trait);\n // this.storage.remove(defaults.user_storage_anonymousId);\n }\n}\n\nexport { Storage };\n","import { Storage } from \"./storage\";\nimport { StorageNode } from \"./storage_node\";\nexport default process.browser ? new Storage() : StorageNode;\n","import logger from \"../../utils/logUtil\";\nimport Storage from \"../../utils/storage\";\n\nclass GA {\n constructor(config) {\n this.trackingID = config.trackingID;\n // config.allowLinker = true;\n this.allowLinker = config.allowLinker || false;\n this.name = \"GA\";\n }\n\n init() {\n (function(i, s, o, g, r, a, m) {\n i[\"GoogleAnalyticsObject\"] = r;\n (i[r] =\n i[r] ||\n function() {\n (i[r].q = i[r].q || []).push(arguments);\n }),\n (i[r].l = 1 * new Date());\n (a = s.createElement(o)), (m = s.getElementsByTagName(o)[0]);\n a.async = 1;\n a.src = g;\n m.parentNode.insertBefore(a, m);\n })(\n window,\n document,\n \"script\",\n \"https://www.google-analytics.com/analytics.js\",\n \"ga\"\n );\n\n // use analytics_debug.js for debugging\n\n ga(\"create\", this.trackingID, \"auto\", \"rudder_ga\", {\n allowLinker: this.allowLinker,\n });\n\n var userId = Storage.getUserId()\n if (userId && userId !== '') {\n ga(\"rudder_ga.set\", \"userId\", userId);\n }\n //ga(\"send\", \"pageview\");\n\n logger.debug(\"===in init GA===\");\n }\n\n identify(rudderElement) {\n var userId = rudderElement.message.userId !== ''\n ? rudderElement.message.userId\n : rudderElement.message.anonymousId\n ga(\"rudder_ga.set\", \"userId\", userId);\n logger.debug(\"in GoogleAnalyticsManager identify\");\n }\n\n track(rudderElement) {\n var eventCategory = rudderElement.message.event;\n var eventAction = rudderElement.message.event;\n var eventLabel = rudderElement.message.event;\n var eventValue = \"\";\n if (rudderElement.message.properties) {\n eventValue = rudderElement.message.properties.value\n ? rudderElement.message.properties.value\n : rudderElement.message.properties.revenue;\n eventCategory = rudderElement.message.properties.category\n ? rudderElement.message.properties.category\n : eventCategory;\n eventLabel = rudderElement.message.properties.label\n ? rudderElement.message.properties.label\n : eventLabel;\n }\n\n var payLoad = {\n hitType: \"event\",\n eventCategory: eventCategory,\n eventAction: eventAction,\n eventLabel: eventLabel,\n eventValue: eventValue\n };\n ga(\"rudder_ga.send\", \"event\", payLoad);\n logger.debug(\"in GoogleAnalyticsManager track\");\n }\n\n page(rudderElement) {\n logger.debug(\"in GoogleAnalyticsManager page\");\n var path =\n rudderElement.message.properties && rudderElement.message.properties.path\n ? rudderElement.message.properties.path\n : undefined;\n var title = rudderElement.message.properties && rudderElement.message.properties.title\n ? rudderElement.message.properties.title\n : undefined;\n var location = rudderElement.message.properties && rudderElement.message.properties.url\n ? rudderElement.message.properties.url\n : undefined;\n\n if (path) {\n ga(\"rudder_ga.set\", \"page\", path);\n }\n\n if (title) {\n ga(\"rudder_ga.set\", \"title\", title);\n }\n\n if (location) {\n ga(\"rudder_ga.set\", \"location\", location);\n }\n ga(\"rudder_ga.send\", \"pageview\");\n \n }\n\n isLoaded() {\n logger.debug(\"in GA isLoaded\");\n return !!window.gaplugins;\n }\n\n isReady() {\n return !!window.gaplugins;\n }\n}\n\nexport { GA };","import logger from \"../../utils/logUtil\";\nclass Hotjar {\n constructor(config) {\n this.siteId = config.siteID; //1549611\n this.name = \"HOTJAR\";\n this._ready = false;\n }\n\n init() {\n window.hotjarSiteId = this.siteId;\n (function(h, o, t, j, a, r) {\n h.hj =\n h.hj ||\n function() {\n (h.hj.q = h.hj.q || []).push(arguments);\n };\n h._hjSettings = { hjid: h.hotjarSiteId, hjsv: 6 };\n a = o.getElementsByTagName(\"head\")[0];\n r = o.createElement(\"script\");\n r.async = 1;\n r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;\n a.appendChild(r);\n })(window, document, \"https://static.hotjar.com/c/hotjar-\", \".js?sv=\");\n this._ready = true;\n\n logger.debug(\"===in init Hotjar===\");\n }\n\n identify(rudderElement) {\n let userId = rudderElement.message.userId || rudderElement.message.anonymousId;\n if (!userId){\n logger.debug('[Hotjar] identify:: user id is required');\n return;\n }\n \n var traits = rudderElement.message.context.traits;\n \n window.hj('identify', rudderElement.message.userId, traits);\n }\n\n track(rudderElement) {\n logger.debug(\"[Hotjar] track:: method not supported\");\n }\n\n page(rudderElement) {\n logger.debug(\"[Hotjar] page:: method not supported\");\n }\n\n isLoaded() {\n return this._ready;\n }\n\n isReady() {\n return this._ready;\n }\n}\n\nexport { Hotjar };\n","import logger from \"../../utils/logUtil\";\nclass GoogleAds {\n constructor(config) {\n //this.accountId = config.accountId;//AW-696901813\n this.conversionId = config.conversionID;\n this.pageLoadConversions = config.pageLoadConversions;\n this.clickEventConversions = config.clickEventConversions;\n this.defaultPageConversion = config.defaultPageConversion;\n\n this.name = \"GOOGLEADS\";\n }\n\n init() {\n let sourceUrl =\n \"https://www.googletagmanager.com/gtag/js?id=\" + this.conversionId;\n (function(id, src, document) {\n logger.debug(\"in script loader=== \" + id);\n let js = document.createElement(\"script\");\n js.src = src;\n js.async = 1;\n js.type = \"text/javascript\";\n js.id = id;\n let e = document.getElementsByTagName(\"head\")[0];\n logger.debug(\"==script==\", e);\n e.appendChild(js);\n })(\"googleAds-integration\", sourceUrl, document);\n\n window.dataLayer = window.dataLayer || [];\n window.gtag = function() {\n window.dataLayer.push(arguments);\n };\n window.gtag(\"js\", new Date());\n window.gtag(\"config\", this.conversionId);\n\n logger.debug(\"===in init Google Ads===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"[GoogleAds] identify:: method not supported\");\n }\n\n //https://developers.google.com/gtagjs/reference/event\n track(rudderElement) {\n logger.debug(\"in GoogleAdsAnalyticsManager track\");\n let conversionData = this.getConversionData(\n this.clickEventConversions,\n rudderElement.message.event\n );\n if (conversionData[\"conversionLabel\"]) {\n let conversionLabel = conversionData[\"conversionLabel\"];\n let eventName = conversionData[\"eventName\"];\n let sendToValue = this.conversionId + \"/\" + conversionLabel;\n let properties = {};\n if (rudderElement.properties) {\n properties[\"value\"] = rudderElement.properties[\"revenue\"];\n properties[\"currency\"] = rudderElement.properties[\"currency\"];\n properties[\"transaction_id\"] = rudderElement.properties[\"order_id\"];\n }\n properties[\"send_to\"] = sendToValue;\n window.gtag(\"event\", eventName, properties);\n }\n }\n\n page(rudderElement) {\n logger.debug(\"in GoogleAdsAnalyticsManager page\");\n let conversionData = this.getConversionData(\n this.pageLoadConversions,\n rudderElement.message.name\n );\n if (conversionData[\"conversionLabel\"]) {\n let conversionLabel = conversionData[\"conversionLabel\"];\n let eventName = conversionData[\"eventName\"];\n window.gtag(\"event\", eventName, {\n send_to: this.conversionId + \"/\" + conversionLabel\n });\n }\n }\n\n getConversionData(eventTypeConversions, eventName) {\n let conversionData = {};\n if (eventTypeConversions) {\n if (eventName) {\n eventTypeConversions.forEach(eventTypeConversion => {\n if (\n eventTypeConversion.name.toLowerCase() === eventName.toLowerCase()\n ) {\n //rudderElement[\"message\"][\"name\"]\n conversionData[\"conversionLabel\"] =\n eventTypeConversion.conversionLabel;\n conversionData[\"eventName\"] = eventTypeConversion.name;\n return;\n }\n });\n } else {\n if (this.defaultPageConversion) {\n conversionData[\"conversionLabel\"] = this.defaultPageConversion;\n conversionData[\"eventName\"] = \"Viewed a Page\";\n }\n }\n }\n return conversionData;\n }\n\n isLoaded() {\n return window.dataLayer.push !== Array.prototype.push;\n }\n\n isReady() {\n return window.dataLayer.push !== Array.prototype.push;\n }\n}\n\nexport { GoogleAds };\n","import logger from \"../../utils/logUtil\";\nclass VWO {\n constructor(config, analytics) {\n this.accountId = config.accountId; //1549611\n this.settingsTolerance = config.settingsTolerance;\n this.isSPA = config.isSPA;\n this.libraryTolerance = config.libraryTolerance;\n this.useExistingJquery = config.useExistingJquery;\n this.sendExperimentTrack = config.sendExperimentTrack;\n this.sendExperimentIdentify = config.sendExperimentIdentify;\n this.name = \"VWO\";\n this.analytics = analytics;\n logger.debug(\"Config \", config);\n }\n\n init() {\n logger.debug(\"===in init VWO===\");\n var account_id = this.accountId;\n var settings_tolerance = this.settingsTolerance;\n var library_tolerance = this.libraryTolerance;\n var use_existing_jquery = this.useExistingJquery;\n var isSPA = this.isSPA;\n window._vwo_code = (function() {\n var f = false;\n var d = document;\n return {\n use_existing_jquery: function() {\n return use_existing_jquery;\n },\n library_tolerance: function() {\n return library_tolerance;\n },\n finish: function() {\n if (!f) {\n f = true;\n var a = d.getElementById(\"_vis_opt_path_hides\");\n if (a) a.parentNode.removeChild(a);\n }\n },\n finished: function() {\n return f;\n },\n load: function(a) {\n var b = d.createElement(\"script\");\n b.src = a;\n b.type = \"text/javascript\";\n b.innerText;\n b.onerror = function() {\n _vwo_code.finish();\n };\n d.getElementsByTagName(\"head\")[0].appendChild(b);\n },\n init: function() {\n var settings_timer = setTimeout(\n \"_vwo_code.finish()\",\n settings_tolerance\n );\n var a = d.createElement(\"style\"),\n b =\n \"body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}\",\n h = d.getElementsByTagName(\"head\")[0];\n a.setAttribute(\"id\", \"_vis_opt_path_hides\");\n a.setAttribute(\"type\", \"text/css\");\n if (a.styleSheet) a.styleSheet.cssText = b;\n else a.appendChild(d.createTextNode(b));\n h.appendChild(a);\n this.load(\n \"//dev.visualwebsiteoptimizer.com/j.php?a=\" +\n account_id +\n \"&u=\" +\n encodeURIComponent(d.URL) +\n \"&r=\" +\n Math.random() +\n \"&f=\" +\n +isSPA\n );\n return settings_timer;\n }\n };\n })();\n window._vwo_settings_timer = window._vwo_code.init();\n\n //Send track or iddentify when\n if (this.sendExperimentTrack || this.experimentViewedIdentify) {\n this.experimentViewed();\n }\n }\n\n experimentViewed() {\n window.VWO = window.VWO || [];\n var self = this;\n window.VWO.push([\n \"onVariationApplied\",\n (data) => {\n if (!data) {\n return;\n }\n logger.debug(\"Variation Applied\");\n var expId = data[1],\n variationId = data[2];\n logger.debug(\n \"experiment id:\",\n expId,\n \"Variation Name:\",\n _vwo_exp[expId].comb_n[variationId]\n );\n if (\n typeof _vwo_exp[expId].comb_n[variationId] !== \"undefined\" &&\n [\"VISUAL_AB\", \"VISUAL\", \"SPLIT_URL\", \"SURVEY\"].indexOf(\n _vwo_exp[expId].type\n ) > -1\n ) {\n try {\n if (self.sendExperimentTrack) {\n logger.debug(\"Tracking...\");\n this.analytics.track(\"Experiment Viewed\", {\n experimentId: expId,\n variationName: _vwo_exp[expId].comb_n[variationId]\n });\n }\n } catch (error) {\n logger.error(\"[VWO] experimentViewed:: \", error);\n }\n try {\n if (self.sendExperimentIdentify) {\n logger.debug(\"Identifying...\");\n this.analytics.identify({\n [`Experiment: ${expId}`]: _vwo_exp[expId].comb_n[variationId]\n });\n }\n } catch (error) {\n logger.error(\"[VWO] experimentViewed:: \" , error);\n }\n }\n }\n ]);\n }\n\n identify(rudderElement) {\n logger.debug(\"method not supported\");\n }\n\n track(rudderElement) {\n var eventName = rudderElement.message.event;\n if (eventName === \"Order Completed\") {\n var total = rudderElement.message.properties\n ? rudderElement.message.properties.total ||\n rudderElement.message.properties.revenue\n : 0;\n logger.debug(\"Revenue\", total);\n window.VWO = window.VWO || [];\n window.VWO.push([\"track.revenueConversion\", total]);\n }\n }\n\n page(rudderElement) {\n logger.debug(\"method not supported\");\n }\n\n isLoaded() {\n return !!window._vwo_code;\n }\n\n isReady() {\n return !!window._vwo_code;\n }\n}\n\nexport { VWO };\n","import logger from \"../../utils/logUtil\";\nclass GoogleTagManager {\n constructor(config) {\n this.containerID = config.containerID;\n this.name = \"GOOGLETAGMANAGER\";\n }\n\n init() {\n logger.debug(\"===in init GoogleTagManager===\");\n (function(w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n var f = d.getElementsByTagName(s)[0],\n j = d.createElement(s),\n dl = l != \"dataLayer\" ? \"&l=\" + l : \"\";\n j.async = true;\n j.src = \"https://www.googletagmanager.com/gtm.js?id=\" + i + dl;\n f.parentNode.insertBefore(j, f);\n })(window, document, \"script\", \"dataLayer\", this.containerID);\n }\n\n identify(rudderElement) {\n logger.debug(\"[GTM] identify:: method not supported\");\n }\n\n track(rudderElement) {\n logger.debug(\"===in track GoogleTagManager===\");\n let rudderMessage = rudderElement.message;\n let props = {\n event: rudderMessage.event,\n userId: rudderMessage.userId,\n anonymousId: rudderMessage.anonymousId,\n ...rudderMessage.properties\n };\n this.sendToGTMDatalayer(props);\n }\n\n page(rudderElement) {\n logger.debug(\"===in page GoogleTagManager===\");\n let rudderMessage = rudderElement.message;\n let pageName = rudderMessage.name;\n let pageCategory = rudderMessage.properties\n ? rudderMessage.properties.category\n : undefined;\n\n let eventName;\n\n if (pageName) {\n eventName = \"Viewed \" + pageName + \" page\";\n }\n\n if (pageCategory && pageName) {\n eventName = \"Viewed \" + pageCategory + \" \" + pageName + \" page\";\n }\n\n if(!eventName) {\n eventName = \"Viewed a Page\";\n }\n \n let props = {\n event: eventName,\n userId: rudderMessage.userId,\n anonymousId: rudderMessage.anonymousId,\n ...rudderMessage.properties\n };\n\n this.sendToGTMDatalayer(props);\n }\n\n isLoaded() {\n return !!(\n window.dataLayer && Array.prototype.push !== window.dataLayer.push\n );\n }\n\n sendToGTMDatalayer(props) {\n window.dataLayer.push(props);\n }\n\n isReady() {\n return !!(\n window.dataLayer && Array.prototype.push !== window.dataLayer.push\n );\n }\n}\n\nexport { GoogleTagManager };\n","import logger from \"../../utils/logUtil\";\n\n/*\nE-commerce support required for logPurchase support & other e-commerce events as track with productId changed\n*/\nclass Braze {\n constructor(config, analytics) {\n this.analytics = analytics;\n this.appKey = config.appKey;\n if (!config.appKey) this.appKey = \"\";\n this.endPoint = \"\";\n if (config.dataCenter) {\n let dataCenterArr = config.dataCenter.trim().split(\"-\");\n if (dataCenterArr[0].toLowerCase() === \"eu\") {\n this.endPoint = \"sdk.fra-01.braze.eu\";\n } else {\n this.endPoint = \"sdk.iad-\" + dataCenterArr[1] + \".braze.com\";\n }\n }\n\n this.name = \"BRAZE\";\n\n logger.debug(\"Config \", config);\n }\n\n /** https://js.appboycdn.com/web-sdk/latest/doc/ab.User.html#toc4\n */\n\n formatGender(gender) {\n if (!gender) return;\n if (typeof gender !== \"string\") return;\n\n var femaleGenders = [\"woman\", \"female\", \"w\", \"f\"];\n var maleGenders = [\"man\", \"male\", \"m\"];\n var otherGenders = [\"other\", \"o\"];\n\n if (femaleGenders.indexOf(gender.toLowerCase()) > -1)\n return window.appboy.ab.User.Genders.FEMALE;\n if (maleGenders.indexOf(gender.toLowerCase()) > -1)\n return window.appboy.ab.User.Genders.MALE;\n if (otherGenders.indexOf(gender.toLowerCase()) > -1)\n return window.appboy.ab.User.Genders.OTHER;\n }\n\n init() {\n logger.debug(\"===in init Braze===\");\n\n //load appboy\n +(function(a, p, P, b, y) {\n a.appboy = {};\n a.appboyQueue = [];\n for (\n var s = \"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(\n \" \"\n ),\n i = 0;\n i < s.length;\n i++\n ) {\n for (\n var m = s[i], k = a.appboy, l = m.split(\".\"), j = 0;\n j < l.length - 1;\n j++\n )\n k = k[l[j]];\n k[l[j]] = new Function(\n \"return function \" +\n m.replace(/\\./g, \"_\") +\n \"(){window.appboyQueue.push(arguments); return true}\"\n )();\n }\n window.appboy.getUser = function() {\n return new window.appboy.ab.User();\n };\n window.appboy.getCachedFeed = function() {\n return new window.appboy.ab.Feed();\n };\n window.appboy.getCachedContentCards = function() {\n return new window.appboy.ab.ContentCards();\n };\n (y = p.createElement(P)).type = \"text/javascript\";\n y.src = \"https://js.appboycdn.com/web-sdk/2.4/appboy.min.js\";\n y.async = 1;\n (b = p.getElementsByTagName(P)[0]).parentNode.insertBefore(y, b);\n })(window, document, \"script\");\n\n window.appboy.initialize(this.appKey, {\n enableLogging: true,\n baseUrl: this.endPoint\n });\n window.appboy.display.automaticallyShowNewInAppMessages();\n\n var userId = this.analytics.userId;\n //send userId if you have it https://js.appboycdn.com/web-sdk/latest/doc/module-appboy.html#.changeUser\n if (userId) appboy.changeUser(userId);\n\n window.appboy.openSession();\n }\n\n handleReservedProperties(props) {\n // remove reserved keys from custom event properties\n // https://www.appboy.com/documentation/Platform_Wide/#reserved-keys\n var reserved = [\n \"time\",\n \"product_id\",\n \"quantity\",\n \"event_name\",\n \"price\",\n \"currency\"\n ];\n\n reserved.forEach(element => {\n delete props[element];\n });\n return props;\n }\n\n identify(rudderElement) {\n var userId = rudderElement.message.userId;\n var address = rudderElement.message.context.traits.address;\n var avatar = rudderElement.message.context.traits.avatar;\n var birthday = rudderElement.message.context.traits.birthday;\n var email = rudderElement.message.context.traits.email;\n var firstname = rudderElement.message.context.traits.firstname;\n var gender = rudderElement.message.context.traits.gender;\n var lastname = rudderElement.message.context.traits.lastname;\n var phone = rudderElement.message.context.traits.phone;\n\n // This is a hack to make a deep copy that is not recommended because it will often fail:\n var traits = JSON.parse(\n JSON.stringify(rudderElement.message.context.traits)\n );\n\n window.appboy.changeUser(userId);\n window.appboy.getUser().setAvatarImageUrl(avatar);\n if (email) window.appboy.getUser().setEmail(email);\n if (firstname) window.appboy.getUser().setFirstName(firstname);\n if (gender) window.appboy.getUser().setGender(this.formatGender(gender));\n if (lastname) window.appboy.getUser().setLastName(lastname);\n if (phone) window.appboy.getUser().setPhoneNumber(phone);\n if (address) {\n window.appboy.getUser().setCountry(address.country);\n window.appboy.getUser().setHomeCity(address.city);\n }\n if (birthday) {\n window.appboy\n .getUser()\n .setDateOfBirth(\n birthday.getUTCFullYear(),\n birthday.getUTCMonth() + 1,\n birthday.getUTCDate()\n );\n }\n\n // remove reserved keys https://www.appboy.com/documentation/Platform_Wide/#reserved-keys\n var reserved = [\n \"avatar\",\n \"address\",\n \"birthday\",\n \"email\",\n \"id\",\n \"firstname\",\n \"gender\",\n \"lastname\",\n \"phone\",\n \"facebook\",\n \"twitter\",\n \"first_name\",\n \"last_name\",\n \"dob\",\n \"external_id\",\n \"country\",\n \"home_city\",\n \"bio\",\n \"gender\",\n \"phone\",\n \"email_subscribe\",\n \"push_subscribe\"\n ];\n\n reserved.forEach(element => {\n delete traits[element];\n });\n\n Object.keys(traits).forEach(key => {\n window.appboy.getUser().setCustomUserAttribute(key, traits[key]);\n });\n }\n\n handlePurchase(properties, userId) {\n var products = properties.products;\n var currencyCode = properties.currency;\n\n window.appboy.changeUser(userId);\n\n // del used properties\n del(properties, \"products\");\n del(properties, \"currency\");\n\n // we have to make a separate call to appboy for each product\n products.forEach(product => {\n var productId = product.product_id;\n var price = product.price;\n var quantity = product.quantity;\n if (quantity && price && productId)\n window.appboy.logPurchase(\n productId,\n price,\n currencyCode,\n quantity,\n properties\n );\n });\n }\n\n track(rudderElement) {\n var userId = rudderElement.message.userId;\n var eventName = rudderElement.message.event;\n var properties = rudderElement.message.properties;\n\n window.appboy.changeUser(userId);\n\n if (eventName.toLowerCase() === \"order completed\") {\n this.handlePurchase(properties, userId);\n } else {\n properties = this.handleReservedProperties(properties);\n window.appboy.logCustomEvent(eventName, properties);\n }\n }\n\n page(rudderElement) {\n var userId = rudderElement.message.userId;\n var eventName = rudderElement.message.name;\n var properties = rudderElement.message.properties;\n\n properties = this.handleReservedProperties(properties);\n\n window.appboy.changeUser(userId);\n window.appboy.logCustomEvent(eventName, properties);\n }\n\n isLoaded() {\n return window.appboyQueue === null;\n }\n\n isReady() {\n return window.appboyQueue === null;\n }\n}\n\nexport { Braze };\n","(function() {\n var base64map\n = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n\n crypt = {\n // Bit-wise rotation left\n rotl: function(n, b) {\n return (n << b) | (n >>> (32 - b));\n },\n\n // Bit-wise rotation right\n rotr: function(n, b) {\n return (n << (32 - b)) | (n >>> b);\n },\n\n // Swap big-endian to little-endian and vice versa\n endian: function(n) {\n // If number given, swap endian\n if (n.constructor == Number) {\n return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;\n }\n\n // Else, assume array and swap all items\n for (var i = 0; i < n.length; i++)\n n[i] = crypt.endian(n[i]);\n return n;\n },\n\n // Generate an array of any length of random bytes\n randomBytes: function(n) {\n for (var bytes = []; n > 0; n--)\n bytes.push(Math.floor(Math.random() * 256));\n return bytes;\n },\n\n // Convert a byte array to big-endian 32-bit words\n bytesToWords: function(bytes) {\n for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)\n words[b >>> 5] |= bytes[i] << (24 - b % 32);\n return words;\n },\n\n // Convert big-endian 32-bit words to a byte array\n wordsToBytes: function(words) {\n for (var bytes = [], b = 0; b < words.length * 32; b += 8)\n bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);\n return bytes;\n },\n\n // Convert a byte array to a hex string\n bytesToHex: function(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join('');\n },\n\n // Convert a hex string to a byte array\n hexToBytes: function(hex) {\n for (var bytes = [], c = 0; c < hex.length; c += 2)\n bytes.push(parseInt(hex.substr(c, 2), 16));\n return bytes;\n },\n\n // Convert a byte array to a base-64 string\n bytesToBase64: function(bytes) {\n for (var base64 = [], i = 0; i < bytes.length; i += 3) {\n var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n for (var j = 0; j < 4; j++)\n if (i * 8 + j * 6 <= bytes.length * 8)\n base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));\n else\n base64.push('=');\n }\n return base64.join('');\n },\n\n // Convert a base-64 string to a byte array\n base64ToBytes: function(base64) {\n // Remove non-base-64 characters\n base64 = base64.replace(/[^A-Z0-9+\\/]/ig, '');\n\n for (var bytes = [], i = 0, imod4 = 0; i < base64.length;\n imod4 = ++i % 4) {\n if (imod4 == 0) continue;\n bytes.push(((base64map.indexOf(base64.charAt(i - 1))\n & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))\n | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));\n }\n return bytes;\n }\n };\n\n module.exports = crypt;\n})();\n","var charenc = {\n // UTF-8 encoding\n utf8: {\n // Convert a string to a byte array\n stringToBytes: function(str) {\n return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));\n },\n\n // Convert a byte array to a string\n bytesToString: function(bytes) {\n return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));\n }\n },\n\n // Binary encoding\n bin: {\n // Convert a string to a byte array\n stringToBytes: function(str) {\n for (var bytes = [], i = 0; i < str.length; i++)\n bytes.push(str.charCodeAt(i) & 0xFF);\n return bytes;\n },\n\n // Convert a byte array to a string\n bytesToString: function(bytes) {\n for (var str = [], i = 0; i < bytes.length; i++)\n str.push(String.fromCharCode(bytes[i]));\n return str.join('');\n }\n }\n};\n\nmodule.exports = charenc;\n","/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n// The _isBuffer check is for Safari 5-7 support, because it's missing\n// Object.prototype.constructor. Remove this eventually\nmodule.exports = function (obj) {\n return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)\n}\n\nfunction isBuffer (obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n// For Node v0.10 support. Remove this eventually.\nfunction isSlowBuffer (obj) {\n return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))\n}\n","/* globals window, HTMLElement */\n\n'use strict';\n\n/**!\n * is\n * the definitive JavaScript type testing library\n *\n * @copyright 2013-2014 Enrico Marino / Jordan Harband\n * @license MIT\n */\n\nvar objProto = Object.prototype;\nvar owns = objProto.hasOwnProperty;\nvar toStr = objProto.toString;\nvar symbolValueOf;\nif (typeof Symbol === 'function') {\n symbolValueOf = Symbol.prototype.valueOf;\n}\nvar bigIntValueOf;\nif (typeof BigInt === 'function') {\n bigIntValueOf = BigInt.prototype.valueOf;\n}\nvar isActualNaN = function (value) {\n return value !== value;\n};\nvar NON_HOST_TYPES = {\n 'boolean': 1,\n number: 1,\n string: 1,\n undefined: 1\n};\n\nvar base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;\nvar hexRegex = /^[A-Fa-f0-9]+$/;\n\n/**\n * Expose `is`\n */\n\nvar is = {};\n\n/**\n * Test general.\n */\n\n/**\n * is.type\n * Test if `value` is a type of `type`.\n *\n * @param {*} value value to test\n * @param {String} type type\n * @return {Boolean} true if `value` is a type of `type`, false otherwise\n * @api public\n */\n\nis.a = is.type = function (value, type) {\n return typeof value === type;\n};\n\n/**\n * is.defined\n * Test if `value` is defined.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is defined, false otherwise\n * @api public\n */\n\nis.defined = function (value) {\n return typeof value !== 'undefined';\n};\n\n/**\n * is.empty\n * Test if `value` is empty.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is empty, false otherwise\n * @api public\n */\n\nis.empty = function (value) {\n var type = toStr.call(value);\n var key;\n\n if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {\n return value.length === 0;\n }\n\n if (type === '[object Object]') {\n for (key in value) {\n if (owns.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n return !value;\n};\n\n/**\n * is.equal\n * Test if `value` is equal to `other`.\n *\n * @param {*} value value to test\n * @param {*} other value to compare with\n * @return {Boolean} true if `value` is equal to `other`, false otherwise\n */\n\nis.equal = function equal(value, other) {\n if (value === other) {\n return true;\n }\n\n var type = toStr.call(value);\n var key;\n\n if (type !== toStr.call(other)) {\n return false;\n }\n\n if (type === '[object Object]') {\n for (key in value) {\n if (!is.equal(value[key], other[key]) || !(key in other)) {\n return false;\n }\n }\n for (key in other) {\n if (!is.equal(value[key], other[key]) || !(key in value)) {\n return false;\n }\n }\n return true;\n }\n\n if (type === '[object Array]') {\n key = value.length;\n if (key !== other.length) {\n return false;\n }\n while (key--) {\n if (!is.equal(value[key], other[key])) {\n return false;\n }\n }\n return true;\n }\n\n if (type === '[object Function]') {\n return value.prototype === other.prototype;\n }\n\n if (type === '[object Date]') {\n return value.getTime() === other.getTime();\n }\n\n return false;\n};\n\n/**\n * is.hosted\n * Test if `value` is hosted by `host`.\n *\n * @param {*} value to test\n * @param {*} host host to test with\n * @return {Boolean} true if `value` is hosted by `host`, false otherwise\n * @api public\n */\n\nis.hosted = function (value, host) {\n var type = typeof host[value];\n return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];\n};\n\n/**\n * is.instance\n * Test if `value` is an instance of `constructor`.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an instance of `constructor`\n * @api public\n */\n\nis.instance = is['instanceof'] = function (value, constructor) {\n return value instanceof constructor;\n};\n\n/**\n * is.nil / is.null\n * Test if `value` is null.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is null, false otherwise\n * @api public\n */\n\nis.nil = is['null'] = function (value) {\n return value === null;\n};\n\n/**\n * is.undef / is.undefined\n * Test if `value` is undefined.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is undefined, false otherwise\n * @api public\n */\n\nis.undef = is.undefined = function (value) {\n return typeof value === 'undefined';\n};\n\n/**\n * Test arguments.\n */\n\n/**\n * is.args\n * Test if `value` is an arguments object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an arguments object, false otherwise\n * @api public\n */\n\nis.args = is.arguments = function (value) {\n var isStandardArguments = toStr.call(value) === '[object Arguments]';\n var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);\n return isStandardArguments || isOldArguments;\n};\n\n/**\n * Test array.\n */\n\n/**\n * is.array\n * Test if 'value' is an array.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an array, false otherwise\n * @api public\n */\n\nis.array = Array.isArray || function (value) {\n return toStr.call(value) === '[object Array]';\n};\n\n/**\n * is.arguments.empty\n * Test if `value` is an empty arguments object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an empty arguments object, false otherwise\n * @api public\n */\nis.args.empty = function (value) {\n return is.args(value) && value.length === 0;\n};\n\n/**\n * is.array.empty\n * Test if `value` is an empty array.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an empty array, false otherwise\n * @api public\n */\nis.array.empty = function (value) {\n return is.array(value) && value.length === 0;\n};\n\n/**\n * is.arraylike\n * Test if `value` is an arraylike object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an arguments object, false otherwise\n * @api public\n */\n\nis.arraylike = function (value) {\n return !!value && !is.bool(value)\n && owns.call(value, 'length')\n && isFinite(value.length)\n && is.number(value.length)\n && value.length >= 0;\n};\n\n/**\n * Test boolean.\n */\n\n/**\n * is.bool\n * Test if `value` is a boolean.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a boolean, false otherwise\n * @api public\n */\n\nis.bool = is['boolean'] = function (value) {\n return toStr.call(value) === '[object Boolean]';\n};\n\n/**\n * is.false\n * Test if `value` is false.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is false, false otherwise\n * @api public\n */\n\nis['false'] = function (value) {\n return is.bool(value) && Boolean(Number(value)) === false;\n};\n\n/**\n * is.true\n * Test if `value` is true.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is true, false otherwise\n * @api public\n */\n\nis['true'] = function (value) {\n return is.bool(value) && Boolean(Number(value)) === true;\n};\n\n/**\n * Test date.\n */\n\n/**\n * is.date\n * Test if `value` is a date.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a date, false otherwise\n * @api public\n */\n\nis.date = function (value) {\n return toStr.call(value) === '[object Date]';\n};\n\n/**\n * is.date.valid\n * Test if `value` is a valid date.\n *\n * @param {*} value value to test\n * @returns {Boolean} true if `value` is a valid date, false otherwise\n */\nis.date.valid = function (value) {\n return is.date(value) && !isNaN(Number(value));\n};\n\n/**\n * Test element.\n */\n\n/**\n * is.element\n * Test if `value` is an html element.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an HTML Element, false otherwise\n * @api public\n */\n\nis.element = function (value) {\n return value !== undefined\n && typeof HTMLElement !== 'undefined'\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Test error.\n */\n\n/**\n * is.error\n * Test if `value` is an error object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an error object, false otherwise\n * @api public\n */\n\nis.error = function (value) {\n return toStr.call(value) === '[object Error]';\n};\n\n/**\n * Test function.\n */\n\n/**\n * is.fn / is.function (deprecated)\n * Test if `value` is a function.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a function, false otherwise\n * @api public\n */\n\nis.fn = is['function'] = function (value) {\n var isAlert = typeof window !== 'undefined' && value === window.alert;\n if (isAlert) {\n return true;\n }\n var str = toStr.call(value);\n return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]';\n};\n\n/**\n * Test number.\n */\n\n/**\n * is.number\n * Test if `value` is a number.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a number, false otherwise\n * @api public\n */\n\nis.number = function (value) {\n return toStr.call(value) === '[object Number]';\n};\n\n/**\n * is.infinite\n * Test if `value` is positive or negative infinity.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is positive or negative Infinity, false otherwise\n * @api public\n */\nis.infinite = function (value) {\n return value === Infinity || value === -Infinity;\n};\n\n/**\n * is.decimal\n * Test if `value` is a decimal number.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a decimal number, false otherwise\n * @api public\n */\n\nis.decimal = function (value) {\n return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;\n};\n\n/**\n * is.divisibleBy\n * Test if `value` is divisible by `n`.\n *\n * @param {Number} value value to test\n * @param {Number} n dividend\n * @return {Boolean} true if `value` is divisible by `n`, false otherwise\n * @api public\n */\n\nis.divisibleBy = function (value, n) {\n var isDividendInfinite = is.infinite(value);\n var isDivisorInfinite = is.infinite(n);\n var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;\n return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);\n};\n\n/**\n * is.integer\n * Test if `value` is an integer.\n *\n * @param value to test\n * @return {Boolean} true if `value` is an integer, false otherwise\n * @api public\n */\n\nis.integer = is['int'] = function (value) {\n return is.number(value) && !isActualNaN(value) && value % 1 === 0;\n};\n\n/**\n * is.maximum\n * Test if `value` is greater than 'others' values.\n *\n * @param {Number} value value to test\n * @param {Array} others values to compare with\n * @return {Boolean} true if `value` is greater than `others` values\n * @api public\n */\n\nis.maximum = function (value, others) {\n if (isActualNaN(value)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.arraylike(others)) {\n throw new TypeError('second argument must be array-like');\n }\n var len = others.length;\n\n while (--len >= 0) {\n if (value < others[len]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * is.minimum\n * Test if `value` is less than `others` values.\n *\n * @param {Number} value value to test\n * @param {Array} others values to compare with\n * @return {Boolean} true if `value` is less than `others` values\n * @api public\n */\n\nis.minimum = function (value, others) {\n if (isActualNaN(value)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.arraylike(others)) {\n throw new TypeError('second argument must be array-like');\n }\n var len = others.length;\n\n while (--len >= 0) {\n if (value > others[len]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * is.nan\n * Test if `value` is not a number.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is not a number, false otherwise\n * @api public\n */\n\nis.nan = function (value) {\n return !is.number(value) || value !== value;\n};\n\n/**\n * is.even\n * Test if `value` is an even number.\n *\n * @param {Number} value value to test\n * @return {Boolean} true if `value` is an even number, false otherwise\n * @api public\n */\n\nis.even = function (value) {\n return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);\n};\n\n/**\n * is.odd\n * Test if `value` is an odd number.\n *\n * @param {Number} value value to test\n * @return {Boolean} true if `value` is an odd number, false otherwise\n * @api public\n */\n\nis.odd = function (value) {\n return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);\n};\n\n/**\n * is.ge\n * Test if `value` is greater than or equal to `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean}\n * @api public\n */\n\nis.ge = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value >= other;\n};\n\n/**\n * is.gt\n * Test if `value` is greater than `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean}\n * @api public\n */\n\nis.gt = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value > other;\n};\n\n/**\n * is.le\n * Test if `value` is less than or equal to `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean} if 'value' is less than or equal to 'other'\n * @api public\n */\n\nis.le = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value <= other;\n};\n\n/**\n * is.lt\n * Test if `value` is less than `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean} if `value` is less than `other`\n * @api public\n */\n\nis.lt = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value < other;\n};\n\n/**\n * is.within\n * Test if `value` is within `start` and `finish`.\n *\n * @param {Number} value value to test\n * @param {Number} start lower bound\n * @param {Number} finish upper bound\n * @return {Boolean} true if 'value' is is within 'start' and 'finish'\n * @api public\n */\nis.within = function (value, start, finish) {\n if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.number(value) || !is.number(start) || !is.number(finish)) {\n throw new TypeError('all arguments must be numbers');\n }\n var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);\n return isAnyInfinite || (value >= start && value <= finish);\n};\n\n/**\n * Test object.\n */\n\n/**\n * is.object\n * Test if `value` is an object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an object, false otherwise\n * @api public\n */\nis.object = function (value) {\n return toStr.call(value) === '[object Object]';\n};\n\n/**\n * is.primitive\n * Test if `value` is a primitive.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a primitive, false otherwise\n * @api public\n */\nis.primitive = function isPrimitive(value) {\n if (!value) {\n return true;\n }\n if (typeof value === 'object' || is.object(value) || is.fn(value) || is.array(value)) {\n return false;\n }\n return true;\n};\n\n/**\n * is.hash\n * Test if `value` is a hash - a plain object literal.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a hash, false otherwise\n * @api public\n */\n\nis.hash = function (value) {\n return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;\n};\n\n/**\n * Test regexp.\n */\n\n/**\n * is.regexp\n * Test if `value` is a regular expression.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a regexp, false otherwise\n * @api public\n */\n\nis.regexp = function (value) {\n return toStr.call(value) === '[object RegExp]';\n};\n\n/**\n * Test string.\n */\n\n/**\n * is.string\n * Test if `value` is a string.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is a string, false otherwise\n * @api public\n */\n\nis.string = function (value) {\n return toStr.call(value) === '[object String]';\n};\n\n/**\n * Test base64 string.\n */\n\n/**\n * is.base64\n * Test if `value` is a valid base64 encoded string.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is a base64 encoded string, false otherwise\n * @api public\n */\n\nis.base64 = function (value) {\n return is.string(value) && (!value.length || base64Regex.test(value));\n};\n\n/**\n * Test base64 string.\n */\n\n/**\n * is.hex\n * Test if `value` is a valid hex encoded string.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is a hex encoded string, false otherwise\n * @api public\n */\n\nis.hex = function (value) {\n return is.string(value) && (!value.length || hexRegex.test(value));\n};\n\n/**\n * is.symbol\n * Test if `value` is an ES6 Symbol\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a Symbol, false otherise\n * @api public\n */\n\nis.symbol = function (value) {\n return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';\n};\n\n/**\n * is.bigint\n * Test if `value` is an ES-proposed BigInt\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a BigInt, false otherise\n * @api public\n */\n\nis.bigint = function (value) {\n // eslint-disable-next-line valid-typeof\n return typeof BigInt === 'function' && toStr.call(value) === '[object BigInt]' && typeof bigIntValueOf.call(value) === 'bigint';\n};\n\nmodule.exports = is;\n","(function(){\r\n var crypt = require('crypt'),\r\n utf8 = require('charenc').utf8,\r\n isBuffer = require('is-buffer'),\r\n bin = require('charenc').bin,\r\n\r\n // The core\r\n md5 = function (message, options) {\r\n // Convert to byte array\r\n if (message.constructor == String)\r\n if (options && options.encoding === 'binary')\r\n message = bin.stringToBytes(message);\r\n else\r\n message = utf8.stringToBytes(message);\r\n else if (isBuffer(message))\r\n message = Array.prototype.slice.call(message, 0);\r\n else if (!Array.isArray(message))\r\n message = message.toString();\r\n // else, assume byte array already\r\n\r\n var m = crypt.bytesToWords(message),\r\n l = message.length * 8,\r\n a = 1732584193,\r\n b = -271733879,\r\n c = -1732584194,\r\n d = 271733878;\r\n\r\n // Swap endian\r\n for (var i = 0; i < m.length; i++) {\r\n m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |\r\n ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;\r\n }\r\n\r\n // Padding\r\n m[l >>> 5] |= 0x80 << (l % 32);\r\n m[(((l + 64) >>> 9) << 4) + 14] = l;\r\n\r\n // Method shortcuts\r\n var FF = md5._ff,\r\n GG = md5._gg,\r\n HH = md5._hh,\r\n II = md5._ii;\r\n\r\n for (var i = 0; i < m.length; i += 16) {\r\n\r\n var aa = a,\r\n bb = b,\r\n cc = c,\r\n dd = d;\r\n\r\n a = FF(a, b, c, d, m[i+ 0], 7, -680876936);\r\n d = FF(d, a, b, c, m[i+ 1], 12, -389564586);\r\n c = FF(c, d, a, b, m[i+ 2], 17, 606105819);\r\n b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);\r\n a = FF(a, b, c, d, m[i+ 4], 7, -176418897);\r\n d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);\r\n c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);\r\n b = FF(b, c, d, a, m[i+ 7], 22, -45705983);\r\n a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);\r\n d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);\r\n c = FF(c, d, a, b, m[i+10], 17, -42063);\r\n b = FF(b, c, d, a, m[i+11], 22, -1990404162);\r\n a = FF(a, b, c, d, m[i+12], 7, 1804603682);\r\n d = FF(d, a, b, c, m[i+13], 12, -40341101);\r\n c = FF(c, d, a, b, m[i+14], 17, -1502002290);\r\n b = FF(b, c, d, a, m[i+15], 22, 1236535329);\r\n\r\n a = GG(a, b, c, d, m[i+ 1], 5, -165796510);\r\n d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);\r\n c = GG(c, d, a, b, m[i+11], 14, 643717713);\r\n b = GG(b, c, d, a, m[i+ 0], 20, -373897302);\r\n a = GG(a, b, c, d, m[i+ 5], 5, -701558691);\r\n d = GG(d, a, b, c, m[i+10], 9, 38016083);\r\n c = GG(c, d, a, b, m[i+15], 14, -660478335);\r\n b = GG(b, c, d, a, m[i+ 4], 20, -405537848);\r\n a = GG(a, b, c, d, m[i+ 9], 5, 568446438);\r\n d = GG(d, a, b, c, m[i+14], 9, -1019803690);\r\n c = GG(c, d, a, b, m[i+ 3], 14, -187363961);\r\n b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);\r\n a = GG(a, b, c, d, m[i+13], 5, -1444681467);\r\n d = GG(d, a, b, c, m[i+ 2], 9, -51403784);\r\n c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);\r\n b = GG(b, c, d, a, m[i+12], 20, -1926607734);\r\n\r\n a = HH(a, b, c, d, m[i+ 5], 4, -378558);\r\n d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);\r\n c = HH(c, d, a, b, m[i+11], 16, 1839030562);\r\n b = HH(b, c, d, a, m[i+14], 23, -35309556);\r\n a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);\r\n d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);\r\n c = HH(c, d, a, b, m[i+ 7], 16, -155497632);\r\n b = HH(b, c, d, a, m[i+10], 23, -1094730640);\r\n a = HH(a, b, c, d, m[i+13], 4, 681279174);\r\n d = HH(d, a, b, c, m[i+ 0], 11, -358537222);\r\n c = HH(c, d, a, b, m[i+ 3], 16, -722521979);\r\n b = HH(b, c, d, a, m[i+ 6], 23, 76029189);\r\n a = HH(a, b, c, d, m[i+ 9], 4, -640364487);\r\n d = HH(d, a, b, c, m[i+12], 11, -421815835);\r\n c = HH(c, d, a, b, m[i+15], 16, 530742520);\r\n b = HH(b, c, d, a, m[i+ 2], 23, -995338651);\r\n\r\n a = II(a, b, c, d, m[i+ 0], 6, -198630844);\r\n d = II(d, a, b, c, m[i+ 7], 10, 1126891415);\r\n c = II(c, d, a, b, m[i+14], 15, -1416354905);\r\n b = II(b, c, d, a, m[i+ 5], 21, -57434055);\r\n a = II(a, b, c, d, m[i+12], 6, 1700485571);\r\n d = II(d, a, b, c, m[i+ 3], 10, -1894986606);\r\n c = II(c, d, a, b, m[i+10], 15, -1051523);\r\n b = II(b, c, d, a, m[i+ 1], 21, -2054922799);\r\n a = II(a, b, c, d, m[i+ 8], 6, 1873313359);\r\n d = II(d, a, b, c, m[i+15], 10, -30611744);\r\n c = II(c, d, a, b, m[i+ 6], 15, -1560198380);\r\n b = II(b, c, d, a, m[i+13], 21, 1309151649);\r\n a = II(a, b, c, d, m[i+ 4], 6, -145523070);\r\n d = II(d, a, b, c, m[i+11], 10, -1120210379);\r\n c = II(c, d, a, b, m[i+ 2], 15, 718787259);\r\n b = II(b, c, d, a, m[i+ 9], 21, -343485551);\r\n\r\n a = (a + aa) >>> 0;\r\n b = (b + bb) >>> 0;\r\n c = (c + cc) >>> 0;\r\n d = (d + dd) >>> 0;\r\n }\r\n\r\n return crypt.endian([a, b, c, d]);\r\n };\r\n\r\n // Auxiliary functions\r\n md5._ff = function (a, b, c, d, x, s, t) {\r\n var n = a + (b & c | ~b & d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._gg = function (a, b, c, d, x, s, t) {\r\n var n = a + (b & d | c & ~d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._hh = function (a, b, c, d, x, s, t) {\r\n var n = a + (b ^ c ^ d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._ii = function (a, b, c, d, x, s, t) {\r\n var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n\r\n // Package private blocksize\r\n md5._blocksize = 16;\r\n md5._digestsize = 16;\r\n\r\n module.exports = function (message, options) {\r\n if (message === undefined || message === null)\r\n throw new Error('Illegal argument ' + message);\r\n\r\n var digestbytes = crypt.wordsToBytes(md5(message, options));\r\n return options && options.asBytes ? digestbytes :\r\n options && options.asString ? bin.bytesToString(digestbytes) :\r\n crypt.bytesToHex(digestbytes);\r\n };\r\n\r\n})();\r\n","import logger from \"../../utils/logUtil\";\nimport md5 from \"md5\";\n\nclass INTERCOM {\n constructor(config) {\n this.NAME = \"INTERCOM\";\n this.API_KEY = config.apiKey;\n this.APP_ID = config.appId;\n this.MOBILE_APP_ID = config.mobileAppId;\n logger.debug(\"Config \", config);\n }\n\n init() {\n window.intercomSettings = {\n app_id: this.APP_ID\n };\n\n (function() {\n var w = window;\n var ic = w.Intercom;\n if (typeof ic === \"function\") {\n ic(\"reattach_activator\");\n ic(\"update\", w.intercomSettings);\n } else {\n var d = document;\n var i = function() {\n i.c(arguments);\n };\n i.q = [];\n i.c = function(args) {\n i.q.push(args);\n };\n w.Intercom = i;\n var l = function() {\n var s = d.createElement(\"script\");\n s.type = \"text/javascript\";\n s.async = true;\n s.src =\n \"https://widget.intercom.io/widget/\" +\n window.intercomSettings.app_id;\n var x = d.getElementsByTagName(\"script\")[0];\n x.parentNode.insertBefore(s, x);\n };\n if (document.readyState === \"complete\") {\n l();\n window.intercom_code = true;\n } else if (w.attachEvent) {\n w.attachEvent(\"onload\", l);\n window.intercom_code = true;\n } else {\n w.addEventListener(\"load\", l, false);\n window.intercom_code = true;\n }\n }\n })();\n }\n\n page() {\n // Get new messages of the current user\n window.Intercom(\"update\");\n }\n\n identify(rudderElement) {\n let rawPayload = {};\n const context = rudderElement.message.context;\n\n const identityVerificationProps = context.Intercom\n ? context.Intercom\n : null;\n if (identityVerificationProps != null) {\n // user hash\n const userHash = context.Intercom.user_hash\n ? context.Intercom.user_hash\n : null;\n\n if (userHash != null) {\n rawPayload.user_hash = userHash;\n }\n\n // hide default launcher\n const hideDefaultLauncher = context.Intercom.hideDefaultLauncher\n ? context.Intercom.hideDefaultLauncher\n : null;\n\n if (hideDefaultLauncher != null) {\n rawPayload.hide_default_launcher = hideDefaultLauncher;\n }\n }\n\n // map rudderPayload to desired\n Object.keys(context.traits).forEach(field => {\n if (context.traits.hasOwnProperty(field)) {\n const value = context.traits[field];\n\n if (field === \"company\") {\n let companies = [];\n let company = {};\n // special handling string\n if (typeof context.traits[field] == \"string\") {\n company[\"company_id\"] = md5(context.traits[field]);\n }\n const companyFields =\n (typeof context.traits[field] == \"object\" &&\n Object.keys(context.traits[field])) ||\n [];\n companyFields.forEach(key => {\n if (companyFields.hasOwnProperty(key)) {\n if (key != \"id\") {\n company[key] = context.traits[field][key];\n } else {\n company[\"company_id\"] = context.traits[field][key];\n }\n }\n });\n\n if (\n typeof context.traits[field] == \"object\" &&\n !companyFields.includes(\"id\")\n ) {\n company[\"company_id\"] = md5(company.name);\n }\n\n companies.push(company);\n rawPayload.companies = companies;\n } else {\n rawPayload[field] = context.traits[field];\n }\n\n switch (field) {\n case \"createdAt\":\n rawPayload[\"created_at\"] = value;\n break;\n case \"anonymousId\":\n rawPayload[\"user_id\"] = value;\n break;\n\n default:\n break;\n }\n }\n });\n rawPayload.user_id = rudderElement.message.userId;\n window.Intercom(\"update\", rawPayload);\n }\n\n track(rudderElement) {\n let rawPayload = {};\n const message = rudderElement.message;\n\n const properties = message.properties\n ? Object.keys(message.properties)\n : null;\n properties.forEach(property => {\n const value = message.properties[property];\n rawPayload[property] = value;\n });\n\n if (message.event) {\n rawPayload.event_name = message.event;\n }\n rawPayload.user_id = message.userId ? message.userId : message.anonymousId;\n rawPayload.created_at = Math.floor(\n new Date(message.originalTimestamp).getTime() / 1000\n );\n window.Intercom(\"trackEvent\", rawPayload.event_name, rawPayload);\n }\n\n isLoaded() {\n return !!window.intercom_code;\n }\n\n isReady() {\n return !!window.intercom_code;\n }\n}\n\nexport { INTERCOM };\n","import logger from \"../../utils/logUtil\";\nimport { ScriptLoader } from \"../ScriptLoader\";\nclass Keen {\n constructor(config) {\n this.projectID = config.projectID;\n this.writeKey = config.writeKey;\n this.ipAddon = config.ipAddon;\n this.uaAddon = config.uaAddon;\n this.urlAddon = config.urlAddon;\n this.referrerAddon = config.referrerAddon;\n this.client = null;\n this.name = \"KEEN\";\n }\n\n init() {\n logger.debug(\"===in init Keen===\");\n ScriptLoader(\n \"keen-integration\",\n \"https://cdn.jsdelivr.net/npm/keen-tracking@4\"\n );\n\n var check = setInterval(checkAndInitKeen.bind(this), 1000);\n function initKeen(object) {\n object.client = new window.KeenTracking({\n projectId: object.projectID,\n writeKey: object.writeKey\n });\n return object.client;\n }\n function checkAndInitKeen() {\n if (window.KeenTracking !== undefined && window.KeenTracking !== void 0) {\n this.client = initKeen(this);\n clearInterval(check);\n }\n }\n }\n\n identify(rudderElement) {\n logger.debug(\"in Keen identify\");\n let traits = rudderElement.message.context.traits;\n let userId = rudderElement.message.userId\n ? rudderElement.message.userId\n : rudderElement.message.anonymousId;\n let properties = rudderElement.message.properties\n ? Object.assign(properties, rudderElement.message.properties)\n : {};\n properties.user = {\n userId: userId,\n traits: traits\n };\n properties = this.getAddOn(properties);\n this.client.extendEvents(properties);\n }\n\n track(rudderElement) {\n logger.debug(\"in Keen track\");\n\n var event = rudderElement.message.event;\n var properties = rudderElement.message.properties;\n properties = this.getAddOn(properties);\n this.client.recordEvent(event, properties);\n }\n\n page(rudderElement) {\n logger.debug(\"in Keen page\");\n const pageName = rudderElement.message.name;\n const pageCategory = rudderElement.message.properties\n ? rudderElement.message.properties.category\n : undefined;\n var name = \"Loaded a Page\";\n if (pageName) {\n name = \"Viewed \" + pageName + \" page\";\n }\n if (pageCategory && pageName) {\n name = \"Viewed \" + pageCategory + \" \" + pageName + \" page\";\n }\n\n var properties = rudderElement.message.properties;\n properties = this.getAddOn(properties);\n this.client.recordEvent(name, properties);\n }\n\n isLoaded() {\n logger.debug(\"in Keen isLoaded\");\n return !!(this.client != null);\n }\n\n isReady() {\n return !!(this.client != null);\n }\n\n getAddOn(properties) {\n var addOns = [];\n if (this.ipAddon) {\n properties.ip_address = \"${keen.ip}\";\n addOns.push({\n name: \"keen:ip_to_geo\",\n input: {\n ip: \"ip_address\"\n },\n output: \"ip_geo_info\"\n });\n }\n if (this.uaAddon) {\n properties.user_agent = \"${keen.user_agent}\";\n addOns.push({\n name: \"keen:ua_parser\",\n input: {\n ua_string: \"user_agent\"\n },\n output: \"parsed_user_agent\"\n });\n }\n if (this.urlAddon) {\n properties.page_url = document.location.href;\n addOns.push({\n name: \"keen:url_parser\",\n input: {\n url: \"page_url\"\n },\n output: \"parsed_page_url\"\n });\n }\n if (this.referrerAddon) {\n properties.page_url = document.location.href;\n properties.referrer_url = document.referrer;\n addOns.push({\n name: \"keen:referrer_parser\",\n input: {\n referrer_url: \"referrer_url\",\n page_url: \"page_url\"\n },\n output: \"referrer_info\"\n });\n }\n properties.keen = {\n addons: addOns\n };\n return properties;\n }\n}\n\nexport { Keen };\n","\n/**\n * Module Dependencies\n */\n\nvar expr;\ntry {\n expr = require('props');\n} catch(e) {\n expr = require('component-props');\n}\n\n/**\n * Expose `toFunction()`.\n */\n\nmodule.exports = toFunction;\n\n/**\n * Convert `obj` to a `Function`.\n *\n * @param {Mixed} obj\n * @return {Function}\n * @api private\n */\n\nfunction toFunction(obj) {\n switch ({}.toString.call(obj)) {\n case '[object Object]':\n return objectToFunction(obj);\n case '[object Function]':\n return obj;\n case '[object String]':\n return stringToFunction(obj);\n case '[object RegExp]':\n return regexpToFunction(obj);\n default:\n return defaultToFunction(obj);\n }\n}\n\n/**\n * Default to strict equality.\n *\n * @param {Mixed} val\n * @return {Function}\n * @api private\n */\n\nfunction defaultToFunction(val) {\n return function(obj){\n return val === obj;\n };\n}\n\n/**\n * Convert `re` to a function.\n *\n * @param {RegExp} re\n * @return {Function}\n * @api private\n */\n\nfunction regexpToFunction(re) {\n return function(obj){\n return re.test(obj);\n };\n}\n\n/**\n * Convert property `str` to a function.\n *\n * @param {String} str\n * @return {Function}\n * @api private\n */\n\nfunction stringToFunction(str) {\n // immediate such as \"> 20\"\n if (/^ *\\W+/.test(str)) return new Function('_', 'return _ ' + str);\n\n // properties such as \"name.first\" or \"age > 18\" or \"age > 18 && age < 36\"\n return new Function('_', 'return ' + get(str));\n}\n\n/**\n * Convert `object` to a function.\n *\n * @param {Object} object\n * @return {Function}\n * @api private\n */\n\nfunction objectToFunction(obj) {\n var match = {};\n for (var key in obj) {\n match[key] = typeof obj[key] === 'string'\n ? defaultToFunction(obj[key])\n : toFunction(obj[key]);\n }\n return function(val){\n if (typeof val !== 'object') return false;\n for (var key in match) {\n if (!(key in val)) return false;\n if (!match[key](val[key])) return false;\n }\n return true;\n };\n}\n\n/**\n * Built the getter function. Supports getter style functions\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction get(str) {\n var props = expr(str);\n if (!props.length) return '_.' + str;\n\n var val, i, prop;\n for (i = 0; i < props.length; i++) {\n prop = props[i];\n val = '_.' + prop;\n val = \"('function' == typeof \" + val + \" ? \" + val + \"() : \" + val + \")\";\n\n // mimic negative lookbehind to avoid problems with nested properties\n str = stripNested(prop, str, val);\n }\n\n return str;\n}\n\n/**\n * Mimic negative lookbehind to avoid problems with nested properties.\n *\n * See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript\n *\n * @param {String} prop\n * @param {String} str\n * @param {String} val\n * @return {String}\n * @api private\n */\n\nfunction stripNested (prop, str, val) {\n return str.replace(new RegExp('(\\\\.)?' + prop, 'g'), function($0, $1) {\n return $1 ? $0 : val;\n });\n}\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Copy the properties of one or more `objects` onto a destination object. Input objects are iterated over\n * in left-to-right order, so duplicate properties on later objects will overwrite those from\n * erevious ones. Only enumerable and own properties of the input objects are copied onto the\n * resulting object.\n *\n * @name extend\n * @api public\n * @category Object\n * @param {Object} dest The destination object.\n * @param {...Object} sources The source objects.\n * @return {Object} `dest`, extended with the properties of all `sources`.\n * @example\n * var a = { a: 'a' };\n * var b = { b: 'b' };\n * var c = { c: 'c' };\n *\n * extend(a, b, c);\n * //=> { a: 'a', b: 'b', c: 'c' };\n */\nvar extend = function extend(dest /*, sources */) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n for (var i = 0; i < sources.length; i += 1) {\n for (var key in sources[i]) {\n if (has.call(sources[i], key)) {\n dest[key] = sources[i][key];\n }\n }\n }\n\n return dest;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = extend;\n","\nvar identity = function(_){ return _; };\n\n\n/**\n * Module exports, export\n */\n\nmodule.exports = multiple(find);\nmodule.exports.find = module.exports;\n\n\n/**\n * Export the replacement function, return the modified object\n */\n\nmodule.exports.replace = function (obj, key, val, options) {\n multiple(replace).call(this, obj, key, val, options);\n return obj;\n};\n\n\n/**\n * Export the delete function, return the modified object\n */\n\nmodule.exports.del = function (obj, key, options) {\n multiple(del).call(this, obj, key, null, options);\n return obj;\n};\n\n\n/**\n * Compose applying the function to a nested key\n */\n\nfunction multiple (fn) {\n return function (obj, path, val, options) {\n normalize = options && isFunction(options.normalizer) ? options.normalizer : defaultNormalize;\n path = normalize(path);\n\n var key;\n var finished = false;\n\n while (!finished) loop();\n\n function loop() {\n for (key in obj) {\n var normalizedKey = normalize(key);\n if (0 === path.indexOf(normalizedKey)) {\n var temp = path.substr(normalizedKey.length);\n if (temp.charAt(0) === '.' || temp.length === 0) {\n path = temp.substr(1);\n var child = obj[key];\n\n // we're at the end and there is nothing.\n if (null == child) {\n finished = true;\n return;\n }\n\n // we're at the end and there is something.\n if (!path.length) {\n finished = true;\n return;\n }\n\n // step into child\n obj = child;\n\n // but we're done here\n return;\n }\n }\n }\n\n key = undefined;\n // if we found no matching properties\n // on the current object, there's no match.\n finished = true;\n }\n\n if (!key) return;\n if (null == obj) return obj;\n\n // the `obj` and `key` is one above the leaf object and key, so\n // start object: { a: { 'b.c': 10 } }\n // end object: { 'b.c': 10 }\n // end key: 'b.c'\n // this way, you can do `obj[key]` and get `10`.\n return fn(obj, key, val);\n };\n}\n\n\n/**\n * Find an object by its key\n *\n * find({ first_name : 'Calvin' }, 'firstName')\n */\n\nfunction find (obj, key) {\n if (obj.hasOwnProperty(key)) return obj[key];\n}\n\n\n/**\n * Delete a value for a given key\n *\n * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' }\n */\n\nfunction del (obj, key) {\n if (obj.hasOwnProperty(key)) delete obj[key];\n return obj;\n}\n\n\n/**\n * Replace an objects existing value with a new one\n *\n * replace({ a : 'b' }, 'a', 'c') -> { a : 'c' }\n */\n\nfunction replace (obj, key, val) {\n if (obj.hasOwnProperty(key)) obj[key] = val;\n return obj;\n}\n\n/**\n * Normalize a `dot.separated.path`.\n *\n * A.HELL(!*&#(!)O_WOR LD.bar => ahelloworldbar\n *\n * @param {String} path\n * @return {String}\n */\n\nfunction defaultNormalize(path) {\n return path.replace(/[^a-zA-Z0-9\\.]+/g, '').toLowerCase();\n}\n\n/**\n * Check if a value is a function.\n *\n * @param {*} val\n * @return {boolean} Returns `true` if `val` is a function, otherwise `false`.\n */\n\nfunction isFunction(val) {\n return typeof val === 'function';\n}\n","\n/**\n * toString ref.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n *\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nmodule.exports = function(val){\n switch (toString.call(val)) {\n case '[object Function]': return 'function';\n case '[object Date]': return 'date';\n case '[object RegExp]': return 'regexp';\n case '[object Arguments]': return 'arguments';\n case '[object Array]': return 'array';\n case '[object String]': return 'string';\n }\n\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (val && val.nodeType === 1) return 'element';\n if (val === Object(val)) return 'object';\n\n return typeof val;\n};\n","/**\n * Global Names\n */\n\nvar globals = /\\b(Array|Date|Object|Math|JSON)\\b/g;\n\n/**\n * Return immediate identifiers parsed from `str`.\n *\n * @param {String} str\n * @param {String|Function} map function or prefix\n * @return {Array}\n * @api public\n */\n\nmodule.exports = function(str, fn){\n var p = unique(props(str));\n if (fn && 'string' == typeof fn) fn = prefixed(fn);\n if (fn) return map(str, p, fn);\n return p;\n};\n\n/**\n * Return immediate identifiers in `str`.\n *\n * @param {String} str\n * @return {Array}\n * @api private\n */\n\nfunction props(str) {\n return str\n .replace(/\\.\\w+|\\w+ *\\(|\"[^\"]*\"|'[^']*'|\\/([^/]+)\\//g, '')\n .replace(globals, '')\n .match(/[a-zA-Z_]\\w*/g)\n || [];\n}\n\n/**\n * Return `str` with `props` mapped with `fn`.\n *\n * @param {String} str\n * @param {Array} props\n * @param {Function} fn\n * @return {String}\n * @api private\n */\n\nfunction map(str, props, fn) {\n var re = /\\.\\w+|\\w+ *\\(|\"[^\"]*\"|'[^']*'|\\/([^/]+)\\/|[a-zA-Z_]\\w*/g;\n return str.replace(re, function(_){\n if ('(' == _[_.length - 1]) return fn(_);\n if (!~props.indexOf(_)) return _;\n return fn(_);\n });\n}\n\n/**\n * Return unique array.\n *\n * @param {Array} arr\n * @return {Array}\n * @api private\n */\n\nfunction unique(arr) {\n var ret = [];\n\n for (var i = 0; i < arr.length; i++) {\n if (~ret.indexOf(arr[i])) continue;\n ret.push(arr[i]);\n }\n\n return ret;\n}\n\n/**\n * Map with prefix `str`.\n */\n\nfunction prefixed(str) {\n return function(_){\n return str + _;\n };\n}\n","\n/**\n * Module dependencies.\n */\n\ntry {\n var type = require('type');\n} catch (err) {\n var type = require('component-type');\n}\n\nvar toFunction = require('to-function');\n\n/**\n * HOP reference.\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Iterate the given `obj` and invoke `fn(val, i)`\n * in optional context `ctx`.\n *\n * @param {String|Array|Object} obj\n * @param {Function} fn\n * @param {Object} [ctx]\n * @api public\n */\n\nmodule.exports = function(obj, fn, ctx){\n fn = toFunction(fn);\n ctx = ctx || this;\n switch (type(obj)) {\n case 'array':\n return array(obj, fn, ctx);\n case 'object':\n if ('number' == typeof obj.length) return array(obj, fn, ctx);\n return object(obj, fn, ctx);\n case 'string':\n return string(obj, fn, ctx);\n }\n};\n\n/**\n * Iterate string chars.\n *\n * @param {String} obj\n * @param {Function} fn\n * @param {Object} ctx\n * @api private\n */\n\nfunction string(obj, fn, ctx) {\n for (var i = 0; i < obj.length; ++i) {\n fn.call(ctx, obj.charAt(i), i);\n }\n}\n\n/**\n * Iterate object keys.\n *\n * @param {Object} obj\n * @param {Function} fn\n * @param {Object} ctx\n * @api private\n */\n\nfunction object(obj, fn, ctx) {\n for (var key in obj) {\n if (has.call(obj, key)) {\n fn.call(ctx, key, obj[key]);\n }\n }\n}\n\n/**\n * Iterate array-ish.\n *\n * @param {Array|Object} obj\n * @param {Function} fn\n * @param {Object} ctx\n * @api private\n */\n\nfunction array(obj, fn, ctx) {\n for (var i = 0; i < obj.length; ++i) {\n fn.call(ctx, obj[i], i);\n }\n}\n","import logger from \"../../utils/logUtil\";\nimport { getRevenue } from \"../../utils/utils\";\nimport is from \"is\";\nimport extend from \"@ndhoule/extend\";\nimport { del } from \"obj-case\";\nimport each from \"component-each\";\n\nclass Kissmetrics {\n constructor(config) {\n this.apiKey = config.apiKey;\n this.prefixProperties = config.prefixProperties;\n this.name = \"KISSMETRICS\";\n }\n\n init() {\n logger.debug(\"===in init Kissmetrics===\");\n window._kmq = window._kmq || [];\n\n var _kmk = window._kmk || this.apiKey;\n function _kms(u) {\n setTimeout(function() {\n var d = document,\n f = d.getElementsByTagName(\"script\")[0],\n s = d.createElement(\"script\");\n s.type = \"text/javascript\";\n s.async = true;\n s.src = u;\n f.parentNode.insertBefore(s, f);\n }, 1);\n }\n _kms(\"//i.kissmetrics.com/i.js\");\n _kms(\"//scripts.kissmetrics.com/\" + _kmk + \".2.js\");\n\n if (this.isEnvMobile()) {\n window._kmq.push([\"set\", { \"Mobile Session\": \"Yes\" }]);\n }\n }\n\n isEnvMobile() {\n return (\n navigator.userAgent.match(/Android/i) ||\n navigator.userAgent.match(/BlackBerry/i) ||\n navigator.userAgent.match(/IEMobile/i) ||\n navigator.userAgent.match(/Opera Mini/i) ||\n navigator.userAgent.match(/iPad/i) ||\n navigator.userAgent.match(/iPhone|iPod/i)\n );\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n toUnixTimestamp(date) {\n date = new Date(date);\n return Math.floor(date.getTime() / 1000);\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n clean(obj) {\n var ret = {};\n\n for (var k in obj) {\n if (obj.hasOwnProperty(k)) {\n var value = obj[k];\n if (value === null || typeof value === \"undefined\") continue;\n\n // convert date to unix\n if (is.date(value)) {\n ret[k] = this.toUnixTimestamp(value);\n continue;\n }\n\n // leave boolean as is\n if (is.bool(value)) {\n ret[k] = value;\n continue;\n }\n\n // leave numbers as is\n if (is.number(value)) {\n ret[k] = value;\n continue;\n }\n\n // convert non objects to strings\n logger.debug(value.toString());\n if (value.toString() !== \"[object Object]\") {\n ret[k] = value.toString();\n continue;\n }\n\n // json\n // must flatten including the name of the original trait/property\n var nestedObj = {};\n nestedObj[k] = value;\n var flattenedObj = this.flatten(nestedObj, { safe: true });\n\n // stringify arrays inside nested object to be consistent with top level behavior of arrays\n for (var key in flattenedObj) {\n if (is.array(flattenedObj[key])) {\n flattenedObj[key] = flattenedObj[key].toString();\n }\n }\n\n ret = extend(ret, flattenedObj);\n delete ret[k];\n }\n }\n return ret;\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n flatten(target, opts) {\n opts = opts || {};\n\n var delimiter = opts.delimiter || \".\";\n var maxDepth = opts.maxDepth;\n var currentDepth = 1;\n var output = {};\n\n function step(object, prev) {\n for (var key in object) {\n if (object.hasOwnProperty(key)) {\n var value = object[key];\n var isarray = opts.safe && is.array(value);\n var type = Object.prototype.toString.call(value);\n var isobject =\n type === \"[object Object]\" || type === \"[object Array]\";\n var arr = [];\n\n var newKey = prev ? prev + delimiter + key : key;\n\n if (!opts.maxDepth) {\n maxDepth = currentDepth + 1;\n }\n\n for (var keys in value) {\n if (value.hasOwnProperty(keys)) {\n arr.push(keys);\n }\n }\n\n if (!isarray && isobject && arr.length && currentDepth < maxDepth) {\n ++currentDepth;\n return step(value, newKey);\n }\n\n output[newKey] = value;\n }\n }\n }\n\n step(target);\n\n return output;\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n prefix(event, properties) {\n var prefixed = {};\n each(properties, function(key, val) {\n if (key === \"Billing Amount\") {\n prefixed[key] = val;\n } else if (key === \"revenue\") {\n prefixed[event + \" - \" + key] = val;\n prefixed[\"Billing Amount\"] = val;\n } else {\n prefixed[event + \" - \" + key] = val;\n }\n });\n return prefixed;\n }\n\n identify(rudderElement) {\n logger.debug(\"in Kissmetrics identify\");\n let traits = this.clean(rudderElement.message.context.traits);\n let userId =\n rudderElement.message.userId && rudderElement.message.userId != \"\"\n ? rudderElement.message.userId\n : undefined;\n\n if (userId) {\n window._kmq.push([\"identify\", userId]);\n }\n if (traits) {\n window._kmq.push([\"set\", traits]);\n }\n }\n\n track(rudderElement) {\n logger.debug(\"in Kissmetrics track\");\n\n let event = rudderElement.message.event;\n let properties = JSON.parse(\n JSON.stringify(rudderElement.message.properties)\n );\n let timestamp = this.toUnixTimestamp(new Date());\n\n let revenue = getRevenue(properties);\n if (revenue) {\n properties.revenue = revenue;\n }\n\n let products = properties.products;\n if (products) {\n delete properties.products;\n }\n\n properties = this.clean(properties);\n logger.debug(JSON.stringify(properties));\n\n if (this.prefixProperties) {\n properties = this.prefix(event, properties);\n }\n window._kmq.push([\"record\", event, properties]);\n\n let iterator = function pushItem(product, i) {\n let item = product;\n if (this.prefixProperties) item = this.prefix(event, item);\n item._t = timestamp + i;\n item._d = 1;\n window.KM.set(item);\n }.bind(this);\n\n if (products) {\n window._kmq.push(() => {\n each(products, iterator);\n });\n }\n }\n\n page(rudderElement) {\n logger.debug(\"in Kissmetrics page\");\n const pageName = rudderElement.message.name;\n const pageCategory = rudderElement.message.properties\n ? rudderElement.message.properties.category\n : undefined;\n var name = \"Loaded a Page\";\n if (pageName) {\n name = \"Viewed \" + pageName + \" page\";\n }\n if (pageCategory && pageName) {\n name = \"Viewed \" + pageCategory + \" \" + pageName + \" page\";\n }\n\n var properties = rudderElement.message.properties;\n if (this.prefixProperties) {\n properties = this.prefix(\"Page\", properties);\n }\n\n window._kmq.push([\"record\", name, properties]);\n }\n\n alias(rudderElement) {\n var prev = rudderElement.message.previousId;\n var userId = rudderElement.message.userId;\n window._kmq.push([\"alias\", userId, prev]);\n }\n\n group(rudderElement) {\n let groupId = rudderElement.message.groupId;\n let groupTraits = rudderElement.message.traits;\n groupTraits = this.prefix(\"Group\", groupTraits);\n if(groupId){\n groupTraits[\"Group - id\"] = groupId;\n }\n window._kmq.push([\"set\", groupTraits]);\n logger.debug(\"in Kissmetrics group\");\n }\n\n isLoaded() {\n return is.object(window.KM);\n }\n\n isReady() {\n return is.object(window.KM);\n }\n}\n\nexport { Kissmetrics };\n","import logger from \"../../utils/logUtil\";\nclass CustomerIO {\n constructor(config) {\n this.siteID = config.siteID;\n this.apiKey = config.apiKey;\n\n this.name = \"CUSTOMERIO\";\n }\n\n init() {\n logger.debug(\"===in init Customer IO init===\");\n window._cio = window._cio || [];\n let siteID = this.siteID;\n (function() {\n var a, b, c;\n a = function(f) {\n return function() {\n window._cio.push(\n [f].concat(Array.prototype.slice.call(arguments, 0))\n );\n };\n };\n b = [\"load\", \"identify\", \"sidentify\", \"track\", \"page\"];\n for (c = 0; c < b.length; c++) {\n window._cio[b[c]] = a(b[c]);\n }\n var t = document.createElement(\"script\"),\n s = document.getElementsByTagName(\"script\")[0];\n t.async = true;\n t.id = \"cio-tracker\";\n t.setAttribute(\"data-site-id\", siteID);\n t.src = \"https://assets.customer.io/assets/track.js\";\n s.parentNode.insertBefore(t, s);\n })();\n }\n\n identify(rudderElement) {\n logger.debug(\"in Customer IO identify\");\n let userId = rudderElement.message.userId\n ? rudderElement.message.userId\n : rudderElement.message.anonymousId;\n let traits = rudderElement.message.context.traits\n ? rudderElement.message.context.traits\n : {};\n if (!traits.created_at) {\n traits.created_at = Math.floor(new Date().getTime() / 1000);\n }\n traits.id = userId;\n window._cio.identify(traits);\n }\n\n track(rudderElement) {\n logger.debug(\"in Customer IO track\");\n\n let eventName = rudderElement.message.event;\n let properties = rudderElement.message.properties;\n window._cio.track(eventName, properties);\n }\n\n page(rudderElement) {\n logger.debug(\"in Customer IO page\");\n\n var name =\n rudderElement.message.name || rudderElement.message.properties.url;\n window._cio.page(name, rudderElement.message.properties);\n }\n\n isLoaded() {\n return !!(window._cio && window._cio.push !== Array.prototype.push);\n }\n\n isReady() {\n return !!(window._cio && window._cio.push !== Array.prototype.push);\n }\n}\n\nexport { CustomerIO };\n","var each = require('each');\n\n\n/**\n * Cache whether `` exists.\n */\n\nvar body = false;\n\n\n/**\n * Callbacks to call when the body exists.\n */\n\nvar callbacks = [];\n\n\n/**\n * Export a way to add handlers to be invoked once the body exists.\n *\n * @param {Function} callback A function to call when the body exists.\n */\n\nmodule.exports = function onBody (callback) {\n if (body) {\n call(callback);\n } else {\n callbacks.push(callback);\n }\n};\n\n\n/**\n * Set an interval to check for `document.body`.\n */\n\nvar interval = setInterval(function () {\n if (!document.body) return;\n body = true;\n each(callbacks, call);\n clearInterval(interval);\n}, 5);\n\n\n/**\n * Call a callback, passing it the body.\n *\n * @param {Function} callback The callback to call.\n */\n\nfunction call (callback) {\n callback(document.body);\n}","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","import logger from \"../../utils/logUtil\";\nimport onBody from \"on-body\";\nimport {\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL\n} from \"../../utils/constants\";\n\nclass Chartbeat {\n constructor(config, analytics) {\n this.analytics = analytics; // use this to modify failed integrations or for passing events from callback to other destinations\n this._sf_async_config = window._sf_async_config =\n window._sf_async_config || {};\n window._sf_async_config.useCanonical = true;\n window._sf_async_config.uid = config.uid;\n window._sf_async_config.domain = config.domain;\n this.isVideo = config.video ? true : false;\n this.sendNameAndCategoryAsTitle = config.sendNameAndCategoryAsTitle || true;\n this.subscriberEngagementKeys = config.subscriberEngagementKeys || [];\n this.replayEvents = [];\n this.failed = false;\n this.isFirstPageCallMade = false;\n this.name = \"CHARTBEAT\";\n }\n\n init() {\n logger.debug(\"===in init Chartbeat===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"in Chartbeat identify\");\n }\n\n track(rudderElement) {\n logger.debug(\"in Chartbeat track\");\n }\n\n page(rudderElement) {\n logger.debug(\"in Chartbeat page\");\n this.loadConfig(rudderElement);\n\n if (!this.isFirstPageCallMade) {\n this.isFirstPageCallMade = true;\n this.initAfterPage();\n } else {\n if (this.failed) {\n logger.debug(\"===ignoring cause failed integration===\");\n this.replayEvents = [];\n return;\n }\n if (!this.isLoaded() && !this.failed) {\n logger.debug(\"===pushing to replay queue for chartbeat===\");\n this.replayEvents.push([\"page\", rudderElement]);\n return;\n }\n logger.debug(\"===processing page event in chartbeat===\");\n let properties = rudderElement.message.properties;\n window.pSUPERFLY.virtualPage(properties.path);\n }\n }\n\n isLoaded() {\n logger.debug(\"in Chartbeat isLoaded\");\n if (!this.isFirstPageCallMade) {\n return true;\n } else {\n return !!window.pSUPERFLY;\n }\n }\n\n isFailed() {\n return this.failed;\n }\n\n isReady() {\n return !!window.pSUPERFLY;\n }\n\n loadConfig(rudderElement) {\n let properties = rudderElement.message.properties;\n let category = properties ? properties.category : undefined;\n let name = rudderElement.message.name;\n let author = properties ? properties.author : undefined;\n let title;\n if (this.sendNameAndCategoryAsTitle) {\n title = category && name ? category + \" \" + name : name;\n }\n if (category) window._sf_async_config.sections = category;\n if (author) window._sf_async_config.authors = author;\n if (title) window._sf_async_config.title = title;\n\n var _cbq = (window._cbq = window._cbq || []);\n\n for (var key in properties) {\n if (!properties.hasOwnProperty(key)) continue;\n if (this.subscriberEngagementKeys.indexOf(key) > -1) {\n _cbq.push([key, properties[key]]);\n }\n }\n }\n\n initAfterPage() {\n onBody(() => {\n var script = this.isVideo ? \"chartbeat_video.js\" : \"chartbeat.js\";\n function loadChartbeat() {\n var e = document.createElement(\"script\");\n var n = document.getElementsByTagName(\"script\")[0];\n e.type = \"text/javascript\";\n e.async = true;\n e.src = \"//static.chartbeat.com/js/\" + script;\n n.parentNode.insertBefore(e, n);\n }\n loadChartbeat();\n });\n\n this._isReady(this).then(instance => {\n logger.debug(\"===replaying on chartbeat===\");\n instance.replayEvents.forEach(event => {\n instance[event[0]](event[1]);\n });\n });\n }\n\n pause(time) {\n return new Promise(resolve => {\n setTimeout(resolve, time);\n });\n }\n\n _isReady(instance, time = 0) {\n return new Promise(resolve => {\n if (this.isLoaded()) {\n this.failed = false;\n logger.debug(\"===chartbeat loaded successfully===\");\n instance.analytics.emit(\"ready\");\n return resolve(instance);\n }\n if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {\n this.failed = true;\n logger.debug(\"===chartbeat failed===\");\n return resolve(instance);\n }\n this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() => {\n return this._isReady(\n instance,\n time + INTEGRATION_LOAD_CHECK_INTERVAL\n ).then(resolve);\n });\n });\n }\n}\n\nexport { Chartbeat };\n","import logger from \"../../utils/logUtil\";\nimport {\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL\n} from \"../../utils/constants\";\nclass Comscore {\n constructor(config, analytics) {\n this.c2ID = config.c2ID;\n this.analytics = analytics;\n this.comScoreBeaconParam = config.comScoreBeaconParam\n ? config.comScoreBeaconParam\n : {};\n this.isFirstPageCallMade = false;\n this.failed = false;\n this.comScoreParams = {};\n this.replayEvents = [];\n this.name = \"COMSCORE\";\n }\n\n init() {\n logger.debug(\"===in init Comscore init===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"in Comscore identify\");\n }\n\n track(rudderElement) {\n logger.debug(\"in Comscore track\");\n }\n\n page(rudderElement) {\n logger.debug(\"in Comscore page\");\n\n this.loadConfig(rudderElement);\n\n if (!this.isFirstPageCallMade) {\n this.isFirstPageCallMade = true;\n this.initAfterPage();\n } else {\n if (this.failed) {\n this.replayEvents = [];\n return;\n }\n if (!this.isLoaded() && !this.failed) {\n this.replayEvents.push([\"page\", rudderElement]);\n return;\n }\n let properties = rudderElement.message.properties;\n //window.COMSCORE.beacon({c1:\"2\", c2: \"\"});\n //this.comScoreParams = this.mapComscoreParams(properties);\n window.COMSCORE.beacon(this.comScoreParams);\n }\n }\n\n loadConfig(rudderElement) {\n logger.debug(\"=====in loadConfig=====\");\n this.comScoreParams = this.mapComscoreParams(\n rudderElement.message.properties\n );\n window._comscore = window._comscore || [];\n window._comscore.push(this.comScoreParams);\n }\n\n initAfterPage() {\n logger.debug(\"=====in initAfterPage=====\");\n (function() {\n var s = document.createElement(\"script\"),\n el = document.getElementsByTagName(\"script\")[0];\n s.async = true;\n s.src =\n (document.location.protocol == \"https:\" ? \"https://sb\" : \"http://b\") +\n \".scorecardresearch.com/beacon.js\";\n el.parentNode.insertBefore(s, el);\n })();\n\n this._isReady(this).then(instance => {\n instance.replayEvents.forEach(event => {\n instance[event[0]](event[1]);\n });\n });\n }\n\n pause(time) {\n return new Promise(resolve => {\n setTimeout(resolve, time);\n });\n }\n\n _isReady(instance, time = 0) {\n return new Promise(resolve => {\n if (this.isLoaded()) {\n this.failed = false;\n instance.analytics.emit(\"ready\");\n return resolve(instance);\n }\n if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {\n this.failed = true;\n return resolve(instance);\n }\n this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() => {\n return this._isReady(\n instance,\n time + INTEGRATION_LOAD_CHECK_INTERVAL\n ).then(resolve);\n });\n });\n }\n\n mapComscoreParams(properties) {\n logger.debug(\"=====in mapComscoreParams=====\");\n let comScoreBeaconParamsMap = this.comScoreBeaconParam;\n\n var comScoreParams = {};\n\n Object.keys(comScoreBeaconParamsMap).forEach(function(property) {\n if (property in properties) {\n var key = comScoreBeaconParamsMap[property];\n var value = properties[property];\n comScoreParams[key] = value;\n }\n });\n\n comScoreParams.c1 = \"2\";\n comScoreParams.c2 = this.c2ID;\n /* if (this.options.comscorekw.length) {\n comScoreParams.comscorekw = this.options.comscorekw;\n } */\n logger.debug(\"=====in mapComscoreParams=====\", comScoreParams);\n return comScoreParams;\n }\n\n isLoaded() {\n logger.debug(\"in Comscore isLoaded\");\n if (!this.isFirstPageCallMade) {\n return true;\n } else {\n return !!window.COMSCORE;\n }\n }\n\n isReady() {\n return !!window.COMSCORE;\n }\n}\n\nexport { Comscore };\n","'use strict';\n\nvar hop = Object.prototype.hasOwnProperty;\nvar strCharAt = String.prototype.charAt;\nvar toStr = Object.prototype.toString;\n\n/**\n * Returns the character at a given index.\n *\n * @param {string} str\n * @param {number} index\n * @return {string|undefined}\n */\n// TODO: Move to a library\nvar charAt = function(str, index) {\n return strCharAt.call(str, index);\n};\n\n/**\n * hasOwnProperty, wrapped as a function.\n *\n * @name has\n * @api private\n * @param {*} context\n * @param {string|number} prop\n * @return {boolean}\n */\n\n// TODO: Move to a library\nvar has = function has(context, prop) {\n return hop.call(context, prop);\n};\n\n/**\n * Returns true if a value is a string, otherwise false.\n *\n * @name isString\n * @api private\n * @param {*} val\n * @return {boolean}\n */\n\n// TODO: Move to a library\nvar isString = function isString(val) {\n return toStr.call(val) === '[object String]';\n};\n\n/**\n * Returns true if a value is array-like, otherwise false. Array-like means a\n * value is not null, undefined, or a function, and has a numeric `length`\n * property.\n *\n * @name isArrayLike\n * @api private\n * @param {*} val\n * @return {boolean}\n */\n// TODO: Move to a library\nvar isArrayLike = function isArrayLike(val) {\n return val != null && (typeof val !== 'function' && typeof val.length === 'number');\n};\n\n\n/**\n * indexKeys\n *\n * @name indexKeys\n * @api private\n * @param {} target\n * @param {Function} pred\n * @return {Array}\n */\nvar indexKeys = function indexKeys(target, pred) {\n pred = pred || has;\n\n var results = [];\n\n for (var i = 0, len = target.length; i < len; i += 1) {\n if (pred(target, i)) {\n results.push(String(i));\n }\n }\n\n return results;\n};\n\n/**\n * Returns an array of an object's owned keys.\n *\n * @name objectKeys\n * @api private\n * @param {*} target\n * @param {Function} pred Predicate function used to include/exclude values from\n * the resulting array.\n * @return {Array}\n */\nvar objectKeys = function objectKeys(target, pred) {\n pred = pred || has;\n\n var results = [];\n\n for (var key in target) {\n if (pred(target, key)) {\n results.push(String(key));\n }\n }\n\n return results;\n};\n\n/**\n * Creates an array composed of all keys on the input object. Ignores any non-enumerable properties.\n * More permissive than the native `Object.keys` function (non-objects will not throw errors).\n *\n * @name keys\n * @api public\n * @category Object\n * @param {Object} source The value to retrieve keys from.\n * @return {Array} An array containing all the input `source`'s keys.\n * @example\n * keys({ likes: 'avocado', hates: 'pineapple' });\n * //=> ['likes', 'pineapple'];\n *\n * // Ignores non-enumerable properties\n * var hasHiddenKey = { name: 'Tim' };\n * Object.defineProperty(hasHiddenKey, 'hidden', {\n * value: 'i am not enumerable!',\n * enumerable: false\n * })\n * keys(hasHiddenKey);\n * //=> ['name'];\n *\n * // Works on arrays\n * keys(['a', 'b', 'c']);\n * //=> ['0', '1', '2']\n *\n * // Skips unpopulated indices in sparse arrays\n * var arr = [1];\n * arr[4] = 4;\n * keys(arr);\n * //=> ['0', '4']\n */\nvar keys = function keys(source) {\n if (source == null) {\n return [];\n }\n\n // IE6-8 compatibility (string)\n if (isString(source)) {\n return indexKeys(source, charAt);\n }\n\n // IE6-8 compatibility (arguments)\n if (isArrayLike(source)) {\n return indexKeys(source, has);\n }\n\n return objectKeys(source);\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = keys;\n","'use strict';\n\n/*\n * Module dependencies.\n */\n\nvar keys = require('@ndhoule/keys');\n\nvar objToString = Object.prototype.toString;\n\n/**\n * Tests if a value is a number.\n *\n * @name isNumber\n * @api private\n * @param {*} val The value to test.\n * @return {boolean} Returns `true` if `val` is a number, otherwise `false`.\n */\n// TODO: Move to library\nvar isNumber = function isNumber(val) {\n var type = typeof val;\n return type === 'number' || (type === 'object' && objToString.call(val) === '[object Number]');\n};\n\n/**\n * Tests if a value is an array.\n *\n * @name isArray\n * @api private\n * @param {*} val The value to test.\n * @return {boolean} Returns `true` if the value is an array, otherwise `false`.\n */\n// TODO: Move to library\nvar isArray = typeof Array.isArray === 'function' ? Array.isArray : function isArray(val) {\n return objToString.call(val) === '[object Array]';\n};\n\n/**\n * Tests if a value is array-like. Array-like means the value is not a function and has a numeric\n * `.length` property.\n *\n * @name isArrayLike\n * @api private\n * @param {*} val\n * @return {boolean}\n */\n// TODO: Move to library\nvar isArrayLike = function isArrayLike(val) {\n return val != null && (isArray(val) || (val !== 'function' && isNumber(val.length)));\n};\n\n/**\n * Internal implementation of `each`. Works on arrays and array-like data structures.\n *\n * @name arrayEach\n * @api private\n * @param {Function(value, key, collection)} iterator The function to invoke per iteration.\n * @param {Array} array The array(-like) structure to iterate over.\n * @return {undefined}\n */\nvar arrayEach = function arrayEach(iterator, array) {\n for (var i = 0; i < array.length; i += 1) {\n // Break iteration early if `iterator` returns `false`\n if (iterator(array[i], i, array) === false) {\n break;\n }\n }\n};\n\n/**\n * Internal implementation of `each`. Works on objects.\n *\n * @name baseEach\n * @api private\n * @param {Function(value, key, collection)} iterator The function to invoke per iteration.\n * @param {Object} object The object to iterate over.\n * @return {undefined}\n */\nvar baseEach = function baseEach(iterator, object) {\n var ks = keys(object);\n\n for (var i = 0; i < ks.length; i += 1) {\n // Break iteration early if `iterator` returns `false`\n if (iterator(object[ks[i]], ks[i], object) === false) {\n break;\n }\n }\n};\n\n/**\n * Iterate over an input collection, invoking an `iterator` function for each element in the\n * collection and passing to it three arguments: `(value, index, collection)`. The `iterator`\n * function can end iteration early by returning `false`.\n *\n * @name each\n * @api public\n * @param {Function(value, key, collection)} iterator The function to invoke per iteration.\n * @param {Array|Object|string} collection The collection to iterate over.\n * @return {undefined} Because `each` is run only for side effects, always returns `undefined`.\n * @example\n * var log = console.log.bind(console);\n *\n * each(log, ['a', 'b', 'c']);\n * //-> 'a', 0, ['a', 'b', 'c']\n * //-> 'b', 1, ['a', 'b', 'c']\n * //-> 'c', 2, ['a', 'b', 'c']\n * //=> undefined\n *\n * each(log, 'tim');\n * //-> 't', 2, 'tim'\n * //-> 'i', 1, 'tim'\n * //-> 'm', 0, 'tim'\n * //=> undefined\n *\n * // Note: Iteration order not guaranteed across environments\n * each(log, { name: 'tim', occupation: 'enchanter' });\n * //-> 'tim', 'name', { name: 'tim', occupation: 'enchanter' }\n * //-> 'enchanter', 'occupation', { name: 'tim', occupation: 'enchanter' }\n * //=> undefined\n */\nvar each = function each(iterator, collection) {\n return (isArrayLike(collection) ? arrayEach : baseEach).call(this, iterator, collection);\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = each;\n","import { ScriptLoader } from \"../ScriptLoader\";\nimport logger from \"../../utils/logUtil\";\nimport is from \"is\";\nimport each from \"@ndhoule/each\";\n\nclass FBPixel {\n constructor(config) {\n this.blacklistPiiProperties = config.blacklistPiiProperties;\n this.categoryToContent = config.categoryToContent;\n this.pixelId = config.pixelId;\n this.eventsToEvents = config.eventsToEvents;\n this.eventCustomProperties = config.eventCustomProperties;\n this.valueFieldIdentifier = config.valueFieldIdentifier;\n this.advancedMapping = config.advancedMapping;\n this.traitKeyToExternalId = config.traitKeyToExternalId;\n this.legacyConversionPixelId = config.legacyConversionPixelId;\n this.userIdAsPixelId = config.userIdAsPixelId;\n this.whitelistPiiProperties = config.whitelistPiiProperties;\n this.name = \"FB_PIXEL\";\n }\n\n init() {\n if (this.categoryToContent === undefined) {\n this.categoryToContent = [];\n }\n if (this.legacyConversionPixelId === undefined) {\n this.legacyConversionPixelId = [];\n }\n if (this.userIdAsPixelId === undefined) {\n this.userIdAsPixelId = [];\n }\n\n logger.debug(\"===in init FbPixel===\");\n\n window._fbq = function () {\n if (window.fbq.callMethod) {\n window.fbq.callMethod.apply(window.fbq, arguments);\n } else {\n window.fbq.queue.push(arguments);\n }\n };\n\n window.fbq = window.fbq || window._fbq;\n window.fbq.push = window.fbq;\n window.fbq.loaded = true;\n window.fbq.disablePushState = true; // disables automatic pageview tracking\n window.fbq.allowDuplicatePageViews = true; // enables fb\n window.fbq.version = \"2.0\";\n window.fbq.queue = [];\n\n window.fbq(\"init\", this.pixelId);\n ScriptLoader(\n \"fbpixel-integration\",\n \"//connect.facebook.net/en_US/fbevents.js\"\n );\n }\n\n isLoaded() {\n logger.debug(\"in FBPixel isLoaded\");\n return !!(window.fbq && window.fbq.callMethod);\n }\n\n isReady() {\n logger.debug(\"in FBPixel isReady\");\n return !!(window.fbq && window.fbq.callMethod);\n }\n\n page(rudderElement) {\n window.fbq(\"track\", \"PageView\");\n }\n\n identify(rudderElement) {\n if (this.advancedMapping) {\n window.fbq(\"init\", this.pixelId, rudderElement.message.context.traits);\n }\n }\n\n track(rudderElement) {\n let self = this;\n var event = rudderElement.message.event;\n var revenue = this.formatRevenue(rudderElement.message.properties.revenue);\n var payload = this.buildPayLoad(rudderElement, true);\n\n if (this.categoryToContent === undefined) {\n this.categoryToContent = [];\n }\n if (this.legacyConversionPixelId === undefined) {\n this.legacyConversionPixelId = [];\n }\n if (this.userIdAsPixelId === undefined) {\n this.userIdAsPixelId = [];\n }\n\n payload.value = revenue;\n var standard = this.eventsToEvents;\n var legacy = this.legacyConversionPixelId;\n var standardTo;\n var legacyTo;\n\n standardTo = standard.reduce((filtered, standard) => {\n if (standard.from === event) {\n filtered.push(standard.to);\n }\n return filtered;\n }, []);\n\n legacyTo = legacy.reduce((filtered, legacy) => {\n if (legacy.from === event) {\n filtered.push(legacy.to);\n }\n return filtered;\n }, []);\n\n each((event) => {\n payload.currency = rudderElement.message.properties.currency || \"USD\";\n\n window.fbq(\"trackSingle\", self.pixelId, event, payload, {\n eventID: rudderElement.message.messageId,\n });\n }, standardTo);\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: revenue,\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n\n if (event === \"Product List Viewed\") {\n var contentType;\n var contentIds;\n var contents = [];\n var products = rudderElement.message.properties.products;\n var customProperties = this.buildPayLoad(rudderElement, true);\n\n if (Array.isArray(products)) {\n products.forEach(function (product) {\n var productId = product.product_id;\n if (productId) {\n contentIds.push(productId);\n contents.push({\n id: productId,\n quantity: rudderElement.message.properties.quantity,\n });\n }\n });\n }\n\n if (contentIds.length) {\n contentType = [\"product\"];\n } else {\n contentIds.push(rudderElement.message.properties.category || \"\");\n contents.push({\n id: rudderElement.message.properties.category || \"\",\n quantity: 1,\n });\n contentType = [\"product_group\"];\n }\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"ViewContent\",\n this.merge(\n {\n content_ids: contentIds,\n content_type: this.getContentType(rudderElement, contentType),\n contents: contents,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: this.formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Product Viewed\") {\n var useValue = this.valueFieldIdentifier === \"properties.value\";\n var customProperties = this.buildPayLoad(rudderElement, true);\n\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"ViewContent\",\n this.merge(\n {\n content_ids: [\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n ],\n content_type: this.getContentType(rudderElement, [\"product\"]),\n content_name: rudderElement.message.properties.product_name || \"\",\n content_category: rudderElement.message.properties.category || \"\",\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n contents: [\n {\n id:\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n },\n ],\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Product Added\") {\n var useValue = this.valueFieldIdentifier === \"properties.value\";\n var customProperties = this.buildPayLoad(rudderElement, true);\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"AddToCart\",\n this.merge(\n {\n content_ids: [\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n ],\n content_type: this.getContentType(rudderElement, [\"product\"]),\n\n content_name: rudderElement.message.properties.product_name || \"\",\n content_category: rudderElement.message.properties.category || \"\",\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n contents: [\n {\n id:\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n },\n ],\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n this.merge(\n {\n content_ids: [\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n ],\n content_type: this.getContentType(rudderElement, [\"product\"]),\n\n content_name: rudderElement.message.properties.product_name || \"\",\n content_category: rudderElement.message.properties.category || \"\",\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n contents: [\n {\n id:\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n },\n ],\n },\n customProperties\n );\n } else if (event === \"Order Completed\") {\n var products = rudderElement.message.properties.products;\n var customProperties = this.buildPayLoad(rudderElement, true);\n var revenue = this.formatRevenue(\n rudderElement.message.properties.revenue\n );\n\n var contentType = this.getContentType(rudderElement, [\"product\"]);\n var contentIds = [];\n var contents = [];\n\n for (var i = 0; i < products.length; i++) {\n var pId = product.product_id;\n contentIds.push(pId);\n var content = {\n id: pId,\n quantity: rudderElement.message.properties.quantity,\n };\n if (rudderElement.message.properties.price) {\n content.item_price = rudderElement.message.properties.price;\n }\n contents.push(content);\n }\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"Purchase\",\n this.merge(\n {\n content_ids: contentIds,\n content_type: contentType,\n currency: rudderElement.message.properties.currency,\n value: revenue,\n contents: contents,\n num_items: contentIds.length,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: this.formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Products Searched\") {\n var customProperties = this.buildPayLoad(rudderElement, true);\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"Search\",\n this.merge(\n {\n search_string: rudderElement.message.properties.query,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Checkout Started\") {\n var products = rudderElement.message.properties.products;\n var customProperties = this.buildPayLoad(rudderElement, true);\n var revenue = this.formatRevenue(\n rudderElement.message.properties.revenue\n );\n var contentCategory = rudderElement.message.properties.category;\n var contentIds = [];\n var contents = [];\n\n for (var i = 0; i < products.length; i++) {\n let product = products[i];\n var pId = product.product_id;\n contentIds.push(pId);\n var content = {\n id: pId,\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n };\n if (rudderElement.message.properties.price) {\n content.item_price = rudderElement.message.properties.price;\n }\n contents.push(content);\n }\n if (!contentCategory && products[0] && products[0].category) {\n contentCategory = products[0].category;\n }\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"InitiateCheckout\",\n this.merge(\n {\n content_category: contentCategory,\n content_ids: contentIds,\n content_type: this.getContentType(rudderElement, [\"product\"]),\n currency: rudderElement.message.properties.currency,\n value: revenue,\n contents: contents,\n num_items: contentIds.length,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: this.formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n }\n }\n\n getContentType(rudderElement, defaultValue) {\n var options = rudderElement.message.options;\n if (options && options.contentType) {\n return [options.contentType];\n }\n\n var category = rudderElement.message.properties.category;\n if (!category) {\n var products = rudderElement.message.properties.products;\n if (products && products.length) {\n category = products[0].category;\n }\n }\n if (category) {\n var mapped = this.categoryToContent;\n var mappedTo;\n mappedTo = mapped.reduce((filtered, mapped) => {\n if (mapped.from == category) {\n filtered.push(mapped.to);\n }\n return filtered;\n }, []);\n if (mappedTo.length) {\n return mappedTo;\n }\n }\n return defaultValue;\n }\n\n merge(obj1, obj2) {\n var res = {};\n\n // All properties of obj1\n for (var propObj1 in obj1) {\n if (obj1.hasOwnProperty(propObj1)) {\n res[propObj1] = obj1[propObj1];\n }\n }\n\n // Extra properties of obj2\n for (var propObj2 in obj2) {\n if (obj2.hasOwnProperty(propObj2) && !res.hasOwnProperty(propObj2)) {\n res[propObj2] = obj2[propObj2];\n }\n }\n\n return res;\n }\n\n formatRevenue(revenue) {\n return Number(revenue || 0).toFixed(2);\n }\n\n buildPayLoad(rudderElement, isStandardEvent) {\n var dateFields = [\n \"checkinDate\",\n \"checkoutDate\",\n \"departingArrivalDate\",\n \"departingDepartureDate\",\n \"returningArrivalDate\",\n \"returningDepartureDate\",\n \"travelEnd\",\n \"travelStart\",\n ];\n var defaultPiiProperties = [\n \"email\",\n \"firstName\",\n \"lastName\",\n \"gender\",\n \"city\",\n \"country\",\n \"phone\",\n \"state\",\n \"zip\",\n \"birthday\",\n ];\n var whitelistPiiProperties = this.whitelistPiiProperties || [];\n var blacklistPiiProperties = this.blacklistPiiProperties || [];\n var eventCustomProperties = this.eventCustomProperties || [];\n var customPiiProperties = {};\n for (var i = 0; i < blacklistPiiProperties[i]; i++) {\n var configuration = blacklistPiiProperties[i];\n customPiiProperties[configuration.blacklistPiiProperties] =\n configuration.blacklistPiiHash;\n }\n var payload = {};\n var properties = rudderElement.message.properties;\n\n for (var property in properties) {\n if (!properties.hasOwnProperty(property)) {\n continue;\n }\n\n if (isStandardEvent && eventCustomProperties.indexOf(property) < 0) {\n continue;\n }\n var value = properties[property];\n\n if (dateFields.indexOf(properties) >= 0) {\n if (is.date(value)) {\n payload[property] = value.toISOTring().split(\"T\")[0];\n continue;\n }\n }\n if (customPiiProperties.hasOwnProperty(property)) {\n if (customPiiProperties[property] && typeof value == \"string\") {\n payload[property] = sha256(value);\n }\n continue;\n }\n var isPropertyPii = defaultPiiProperties.indexOf(property) >= 0;\n var isProperyWhiteListed = whitelistPiiProperties.indexOf(property) >= 0;\n if (!isPropertyPii || isProperyWhiteListed) {\n payload[property] = value;\n }\n }\n return payload;\n }\n}\n\nexport { FBPixel };\n","import logger from \"../../utils/logUtil\";\nimport Storage from \"../../utils/storage\";\n\nlet defaults = {\n lotame_synch_time_key: \"lt_synch_timestamp\"\n};\n\nclass LotameStorage {\n constructor() {\n this.storage = Storage;//new Storage();\n }\n\n setLotameSynchTime(value) {\n this.storage.setItem(defaults.lotame_synch_time_key, value);\n }\n\n getLotameSynchTime() {\n return this.storage.getItem(defaults.lotame_synch_time_key);\n }\n}\nlet lotameStorage = new LotameStorage();\nexport {lotameStorage as LotameStorage};","import * as HubSpot from \"./HubSpot\";\nimport * as GA from \"./GA\";\nimport * as Hotjar from \"./Hotjar\";\nimport * as GoogleAds from \"./GoogleAds\";\nimport * as VWO from \"./VWO\";\nimport * as GoogleTagManager from \"./GoogleTagManager\";\nimport * as Braze from \"./Braze\";\nimport * as INTERCOM from \"./INTERCOM\";\nimport * as Keen from \"./Keen\";\nimport * as Kissmetrics from \"./Kissmetrics\";\nimport * as CustomerIO from \"./CustomerIO\";\nimport * as Chartbeat from \"./Chartbeat\";\nimport * as Comscore from \"./Comscore\";\nimport * as FBPixel from \"./FBPixel\";\nimport * as Lotame from \"./Lotame\";\n\n// the key names should match the destination.name value to keep partity everywhere \n// (config-plan name, native destination.name , exported integration name(this one below))\n\nlet integrations = {\n HS: HubSpot.default,\n GA: GA.default,\n HOTJAR: Hotjar.default,\n GOOGLEADS: GoogleAds.default,\n VWO: VWO.default,\n GTM: GoogleTagManager.default,\n BRAZE: Braze.default,\n INTERCOM: INTERCOM.default,\n KEEN: Keen.default,\n KISSMETRICS: Kissmetrics.default,\n CUSTOMERIO: CustomerIO.default,\n CHARTBEAT: Chartbeat.default,\n COMSCORE: Comscore.default,\n FACEBOOK_PIXEL: FBPixel.default,\n LOTAME: Lotame.default\n};\n\nexport { integrations };\n","import logger from \"../../utils/logUtil\";\nimport { LotameStorage } from \"./LotameStorage\";\nclass Lotame {\n constructor(config, analytics) {\n this.name = \"LOTAME\";\n this.analytics = analytics;\n this.storage = LotameStorage;\n this.bcpUrlSettingsPixel = config.bcpUrlSettingsPixel;\n this.bcpUrlSettingsIframe = config.bcpUrlSettingsIframe;\n this.dspUrlSettingsPixel = config.dspUrlSettingsPixel;\n this.dspUrlSettingsIframe = config.dspUrlSettingsIframe;\n this.mappings = {};\n config.mappings.forEach(mapping => {\n let key = mapping.key;\n let value = mapping.value;\n this.mappings[key] = value;\n });\n }\n\n init() {\n logger.debug(\"===in init Lotame===\");\n window.LOTAME_SYNCH_CALLBACK = () => {};\n }\n\n addPixel(source, width, height) {\n logger.debug(\"Adding pixel for :: \" + source);\n\n let image = document.createElement(\"img\");\n image.src = source;\n image.setAttribute(\"width\", width);\n image.setAttribute(\"height\", height);\n\n logger.debug(\"Image Pixel :: \" + image);\n document.getElementsByTagName(\"body\")[0].appendChild(image);\n }\n\n addIFrame(source) {\n logger.debug(\"Adding iframe for :: \" + source);\n\n let iframe = document.createElement(\"iframe\");\n iframe.src = source;\n iframe.title = \"empty\";\n iframe.setAttribute(\"id\", \"LOTCCFrame\");\n iframe.setAttribute(\"tabindex\", \"-1\");\n iframe.setAttribute(\"role\", \"presentation\");\n iframe.setAttribute(\"aria-hidden\", \"true\");\n iframe.setAttribute(\"style\", \"border: 0px; width: 0px; height: 0px; display: block;\");\n\n logger.debug(\"IFrame :: \" + iframe);\n document.getElementsByTagName(\"body\")[0].appendChild(iframe);\n }\n\n syncPixel(userId) {\n logger.debug(\"===== in syncPixel ======\");\n\n logger.debug(\"Firing DSP Pixel URLs\");\n if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) {\n let currentTime = Date.now();\n this.dspUrlSettingsPixel.forEach(urlSettings => {\n let dspUrl = this.compileUrl(\n { ...this.mappings, userId: userId, random: currentTime },\n urlSettings.dspUrlTemplate\n );\n this.addPixel(dspUrl, \"1\", \"1\");\n });\n }\n\n logger.debug(\"Firing DSP IFrame URLs\");\n if (this.dspUrlSettingsIframe && this.dspUrlSettingsIframe.length > 0) {\n let currentTime = Date.now();\n this.dspUrlSettingsIframe.forEach(urlSettings => {\n let dspUrl = this.compileUrl(\n { ...this.mappings, userId: userId, random: currentTime },\n urlSettings.dspUrlTemplate\n );\n this.addIFrame(dspUrl);\n });\n }\n\n this.storage.setLotameSynchTime(Date.now());\n // emit on syncPixel\n if (this.analytics.methodToCallbackMapping[\"syncPixel\"]) {\n this.analytics.emit(\"syncPixel\", {\n destination: this.name\n });\n }\n }\n\n compileUrl(map, url) {\n Object.keys(map).forEach(key => {\n if (map.hasOwnProperty(key)) {\n let replaceKey = \"{{\" + key + \"}}\";\n let regex = new RegExp(replaceKey, \"gi\");\n url = url.replace(regex, map[key]);\n }\n });\n return url;\n }\n\n identify(rudderElement) {\n logger.debug(\"in Lotame identify\");\n let userId = rudderElement.message.userId;\n this.syncPixel(userId);\n }\n\n track(rudderElement) {\n logger.debug(\"track not supported for lotame\");\n }\n\n page(rudderElement) {\n logger.debug(\"in Lotame page\");\n\n logger.debug(\"Firing BCP Pixel URLs\");\n if (this.bcpUrlSettingsPixel && this.bcpUrlSettingsPixel.length > 0) {\n let currentTime = Date.now();\n this.bcpUrlSettingsPixel.forEach(urlSettings => {\n let bcpUrl = this.compileUrl(\n { ...this.mappings, random: currentTime},\n urlSettings.bcpUrlTemplate\n );\n this.addPixel(bcpUrl, \"1\", \"1\");\n });\n }\n\n logger.debug(\"Firing BCP IFrame URLs\");\n if (this.bcpUrlSettingsIframe && this.bcpUrlSettingsIframe.length > 0) {\n let currentTime = Date.now();\n this.bcpUrlSettingsIframe.forEach(urlSettings => {\n let bcpUrl = this.compileUrl(\n { ...this.mappings, random: currentTime},\n urlSettings.bcpUrlTemplate\n );\n this.addIFrame(bcpUrl);\n });\n }\n\n if (rudderElement.message.userId && this.isPixelToBeSynched()) {\n this.syncPixel(rudderElement.message.userId);\n }\n }\n\n isPixelToBeSynched() {\n let lastSynchedTime = this.storage.getLotameSynchTime();\n let currentTime = Date.now();\n if (!lastSynchedTime) {\n return true;\n }\n\n let difference = Math.floor(\n (currentTime - lastSynchedTime) / (1000 * 3600 * 24)\n );\n return difference >= 7;\n }\n\n isLoaded() {\n logger.debug(\"in Lotame isLoaded\");\n return true;\n }\n\n isReady() {\n return true;\n }\n}\n\nexport { Lotame };\n","//Application class\nclass RudderApp {\n constructor() {\n this.build = \"1.0.0\";\n this.name = \"RudderLabs JavaScript SDK\";\n this.namespace = \"com.rudderlabs.javascript\";\n this.version = \"process.package_version\";\n }\n}\nexport default RudderApp;\n","//Library information class\nclass RudderLibraryInfo {\n constructor() {\n this.name = \"RudderLabs JavaScript SDK\";\n this.version = \"process.package_version\";\n }\n}\n//Operating System information class\nclass RudderOSInfo {\n constructor() {\n this.name = \"\";\n this.version = \"\";\n }\n}\n//Screen information class\nclass RudderScreenInfo {\n constructor() {\n this.density = 0;\n this.width = 0;\n this.height = 0;\n }\n}\n//Device information class\nclass RudderDeviceInfo {\n constructor() {\n this.id = \"\";\n this.manufacturer = \"\";\n this.model = \"\";\n this.name = \"\";\n }\n}\n//Carrier information\nclass RudderNetwork {\n constructor() {\n this.carrier = \"\";\n }\n}\nexport {\n RudderLibraryInfo,\n RudderOSInfo,\n RudderScreenInfo,\n RudderDeviceInfo,\n RudderNetwork\n};\n","//Context class\nimport RudderApp from \"./RudderApp\";\nimport {\n RudderLibraryInfo,\n RudderOSInfo,\n RudderScreenInfo\n} from \"./RudderInfo\";\nclass RudderContext {\n constructor() {\n this.app = new RudderApp();\n this.traits = null;\n this.library = new RudderLibraryInfo();\n //this.os = null;\n let os = new RudderOSInfo();\n os.version = \"\"; //skipping version for simplicity now\n let screen = new RudderScreenInfo();\n\n //Depending on environment within which the code is executing, screen\n //dimensions can be set\n //User agent and locale can be retrieved only for browser\n //For server-side integration, same needs to be set by calling program\n if (!process.browser) {\n //server-side integration\n screen.width = 0;\n screen.height = 0;\n screen.density = 0;\n os.version = \"\";\n os.name = \"\";\n this.userAgent = null;\n this.locale = null;\n } else {\n //running within browser\n screen.width = window.width;\n screen.height = window.height;\n screen.density = window.devicePixelRatio;\n this.userAgent = navigator.userAgent;\n //property name differs based on browser version\n this.locale = navigator.language || navigator.browserLanguage;\n }\n this.os = os;\n this.screen = screen;\n this.device = null;\n this.network = null;\n }\n}\nexport default RudderContext;\n","//Core message class with default values\nimport { generateUUID } from \"./utils\";\nimport { MessageType, ECommerceEvents } from \"./constants\";\nimport RudderContext from \"./RudderContext\";\nclass RudderMessage {\n constructor() {\n this.channel = \"web\";\n this.context = new RudderContext();\n this.type = null;\n this.action = null;\n this.messageId = generateUUID().toString();\n this.originalTimestamp = new Date().toISOString();\n this.anonymousId = null;\n this.userId = null;\n this.event = null;\n this.properties = {};\n this.integrations = {};\n //By default, all integrations will be set as enabled from client\n //Decision to route to specific destinations will be taken at server end\n this.integrations[\"All\"] = true;\n }\n\n //Get property\n getProperty(key) {\n return this.properties[key];\n }\n\n //Add property\n addProperty(key, value) {\n this.properties[key] = value;\n }\n\n //Validate whether this message is semantically valid for the type mentioned\n validateFor(messageType) {\n //First check that properties is populated\n if (!this.properties) {\n throw new Error(\"Key properties is required\");\n }\n //Event type specific checks\n switch (messageType) {\n case MessageType.TRACK:\n //check if event is present\n if (!this.event) {\n throw new Error(\"Key event is required for track event\");\n }\n //Next make specific checks for e-commerce events\n if (this.event in Object.values(ECommerceEvents)) {\n switch (this.event) {\n case ECommerceEvents.CHECKOUT_STEP_VIEWED:\n case ECommerceEvents.CHECKOUT_STEP_COMPLETED:\n case ECommerceEvents.PAYMENT_INFO_ENTERED:\n this.checkForKey(\"checkout_id\");\n this.checkForKey(\"step\");\n break;\n case ECommerceEvents.PROMOTION_VIEWED:\n case ECommerceEvents.PROMOTION_CLICKED:\n this.checkForKey(\"promotion_id\");\n break;\n case ECommerceEvents.ORDER_REFUNDED:\n this.checkForKey(\"order_id\");\n break;\n default:\n }\n } else if (!this.properties[\"category\"]) {\n //if category is not there, set to event\n this.properties[\"category\"] = this.event;\n }\n\n break;\n case MessageType.PAGE:\n break;\n case MessageType.SCREEN:\n if (!this.properties[\"name\"]) {\n throw new Error(\"Key 'name' is required in properties\");\n }\n break;\n }\n }\n\n //Function for checking existence of a particular property\n checkForKey(propertyName) {\n if (!this.properties[propertyName]) {\n throw new Error(\"Key '\" + propertyName + \"' is required in properties\");\n }\n }\n}\nexport default RudderMessage;\n","import RudderMessage from \"./RudderMessage\";\n//Individual element class containing Rudder Message\nclass RudderElement {\n constructor() {\n this.message = new RudderMessage();\n }\n\n //Setters that in turn set the field values for the contained object\n setType(type) {\n this.message.type = type;\n }\n\n setProperty(rudderProperty) {\n this.message.properties = rudderProperty;\n }\n\n setUserProperty(rudderUserProperty) {\n this.message.user_properties = rudderUserProperty;\n }\n\n setUserId(userId) {\n this.message.userId = userId;\n }\n\n setEventName(eventName) {\n this.message.event = eventName;\n }\n\n updateTraits(traits) {\n this.message.context.traits = traits;\n }\n\n getElementContent() {\n return this.message;\n }\n}\nexport default RudderElement;\n","//Class responsible for building up the individual elements in a batch\n//that is transmitted by the SDK\nimport RudderElement from \"./RudderElement.js\";\nclass RudderElementBuilder {\n constructor() {\n this.rudderProperty = null;\n this.rudderUserProperty = null;\n this.event = null;\n this.userId = null;\n this.channel = null;\n this.type = null;\n }\n\n //Set the property\n setProperty(inputRudderProperty) {\n this.rudderProperty = inputRudderProperty;\n return this;\n }\n\n //Build and set the property object\n setPropertyBuilder(rudderPropertyBuilder) {\n this.rudderProperty = rudderPropertyBuilder.build();\n return this;\n }\n\n setUserProperty(inputRudderUserProperty) {\n this.rudderUserProperty = inputRudderUserProperty;\n return this;\n }\n\n setUserPropertyBuilder(rudderUserPropertyBuilder) {\n this.rudderUserProperty = rudderUserPropertyBuilder.build();\n return this;\n }\n\n //Setter methods for all variables. Instance is returned for each call in\n //accordance with the Builder pattern\n\n setEvent(event) {\n this.event = event;\n return this;\n }\n\n setUserId(userId) {\n this.userId = userId;\n return this;\n }\n\n setChannel(channel) {\n this.channel = channel;\n return this;\n }\n\n setType(eventType) {\n this.type = eventType;\n return this;\n }\n\n build() {\n let element = new RudderElement();\n element.setUserId(this.userId);\n element.setType(this.type);\n element.setEventName(this.event);\n element.setProperty(this.rudderProperty);\n element.setUserProperty(this.rudderUserProperty);\n return element;\n }\n}\nexport default RudderElementBuilder;\n","//Payload class, contains batch of Elements\nclass RudderPayload {\n constructor() {\n this.batch = null;\n this.writeKey = null;\n }\n}\nexport { RudderPayload };\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","'use strict';\n\nvar keys = require('@ndhoule/keys');\nvar uuid = require('uuid').v4;\n\nvar inMemoryStore = {\n _data: {},\n length: 0,\n setItem: function(key, value) {\n this._data[key] = value;\n this.length = keys(this._data).length;\n return value;\n },\n getItem: function(key) {\n if (key in this._data) {\n return this._data[key];\n }\n return null;\n },\n removeItem: function(key) {\n if (key in this._data) {\n delete this._data[key];\n }\n this.length = keys(this._data).length;\n return null;\n },\n clear: function() {\n this._data = {};\n this.length = 0;\n },\n key: function(index) {\n return keys(this._data)[index];\n }\n};\n\nfunction isSupportedNatively() {\n try {\n if (!window.localStorage) return false;\n var key = uuid();\n window.localStorage.setItem(key, 'test_value');\n var value = window.localStorage.getItem(key);\n window.localStorage.removeItem(key);\n\n // handle localStorage silently failing\n return value === 'test_value';\n } catch (e) {\n // Can throw if localStorage is disabled\n return false;\n }\n}\n\nfunction pickStorage() {\n if (isSupportedNatively()) {\n return window.localStorage;\n }\n // fall back to in-memory\n return inMemoryStore;\n}\n\n// Return a shared instance\nmodule.exports.defaultEngine = pickStorage();\n// Expose the in-memory store explicitly for testing\nmodule.exports.inMemoryEngine = inMemoryStore;\n","'use strict';\n\nvar defaultEngine = require('./engine').defaultEngine;\nvar inMemoryEngine = require('./engine').inMemoryEngine;\nvar each = require('@ndhoule/each');\nvar keys = require('@ndhoule/keys');\nvar json = require('json3');\n\n/**\n* Store Implementation with dedicated\n*/\n\nfunction Store(name, id, keys, optionalEngine) {\n this.id = id;\n this.name = name;\n this.keys = keys || {};\n this.engine = optionalEngine || defaultEngine;\n}\n\n/**\n* Set value by key.\n*/\n\nStore.prototype.set = function(key, value) {\n var compoundKey = this._createValidKey(key);\n if (!compoundKey) return;\n try {\n this.engine.setItem(compoundKey, json.stringify(value));\n } catch (err) {\n if (isQuotaExceeded(err)) {\n // switch to inMemory engine\n this._swapEngine();\n // and save it there\n this.set(key, value);\n }\n }\n};\n\n/**\n* Get by Key.\n*/\n\nStore.prototype.get = function(key) {\n try {\n var str = this.engine.getItem(this._createValidKey(key));\n if (str === null) {\n return null;\n }\n return json.parse(str);\n } catch (err) {\n return null;\n }\n};\n\n/**\n* Remove by Key.\n*/\n\nStore.prototype.remove = function(key) {\n this.engine.removeItem(this._createValidKey(key));\n};\n\n/**\n* Ensure the key is valid\n*/\n\nStore.prototype._createValidKey = function(key) {\n var name = this.name;\n var id = this.id;\n\n if (!keys(this.keys).length) return [name, id, key].join('.');\n\n // validate and return undefined if invalid key\n var compoundKey;\n each(function(value) {\n if (value === key) {\n compoundKey = [name, id, key].join('.');\n }\n }, this.keys);\n return compoundKey;\n};\n\n/**\n* Switch to inMemoryEngine, bringing any existing data with.\n*/\n\nStore.prototype._swapEngine = function() {\n var self = this;\n\n // grab existing data, but only for this page's queue instance, not all\n // better to keep other queues in localstorage to be flushed later\n // than to pull them into memory and remove them from durable storage\n each(function(key) {\n var value = self.get(key);\n inMemoryEngine.setItem([self.name, self.id, key].join('.'), value);\n self.remove(key);\n }, this.keys);\n\n this.engine = inMemoryEngine;\n};\n\nmodule.exports = Store;\n\nfunction isQuotaExceeded(e) {\n var quotaExceeded = false;\n if (e.code) {\n switch (e.code) {\n case 22:\n quotaExceeded = true;\n break;\n case 1014:\n // Firefox\n if (e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {\n quotaExceeded = true;\n }\n break;\n default:\n break;\n }\n } else if (e.number === -2147024882) {\n // Internet Explorer 8\n quotaExceeded = true;\n }\n return quotaExceeded;\n}\n","'use strict';\n\nvar each = require('@ndhoule/each');\n\nvar defaultClock = {\n setTimeout: function(fn, ms) {\n return window.setTimeout(fn, ms);\n },\n clearTimeout: function(id) {\n return window.clearTimeout(id);\n },\n Date: window.Date\n};\n\nvar clock = defaultClock;\n\nfunction Schedule() {\n this.tasks = {};\n this.nextId = 1;\n}\n\nSchedule.prototype.now = function() {\n return +new clock.Date();\n};\n\nSchedule.prototype.run = function(task, timeout) {\n var id = this.nextId++;\n this.tasks[id] = clock.setTimeout(this._handle(id, task), timeout);\n return id;\n};\n\nSchedule.prototype.cancel = function(id) {\n if (this.tasks[id]) {\n clock.clearTimeout(this.tasks[id]);\n delete this.tasks[id];\n }\n};\n\nSchedule.prototype.cancelAll = function() {\n each(clock.clearTimeout, this.tasks);\n this.tasks = {};\n};\n\nSchedule.prototype._handle = function(id, callback) {\n var self = this;\n return function() {\n delete self.tasks[id];\n return callback();\n };\n};\n\nSchedule.setClock = function(newClock) {\n clock = newClock;\n};\n\nSchedule.resetClock = function() {\n clock = defaultClock;\n};\n\nmodule.exports = Schedule;\n","\n/**\n * Expose `debug()` as the module.\n */\n\nmodule.exports = debug;\n\n/**\n * Create a debugger with the given `name`.\n *\n * @param {String} name\n * @return {Type}\n * @api public\n */\n\nfunction debug(name) {\n if (!debug.enabled(name)) return function(){};\n\n return function(fmt){\n fmt = coerce(fmt);\n\n var curr = new Date;\n var ms = curr - (debug[name] || curr);\n debug[name] = curr;\n\n fmt = name\n + ' '\n + fmt\n + ' +' + debug.humanize(ms);\n\n // This hackery is required for IE8\n // where `console.log` doesn't have 'apply'\n window.console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n }\n}\n\n/**\n * The currently active debug mode names.\n */\n\ndebug.names = [];\ndebug.skips = [];\n\n/**\n * Enables a debug mode by name. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} name\n * @api public\n */\n\ndebug.enable = function(name) {\n try {\n localStorage.debug = name;\n } catch(e){}\n\n var split = (name || '').split(/[\\s,]+/)\n , len = split.length;\n\n for (var i = 0; i < len; i++) {\n name = split[i].replace('*', '.*?');\n if (name[0] === '-') {\n debug.skips.push(new RegExp('^' + name.substr(1) + '$'));\n }\n else {\n debug.names.push(new RegExp('^' + name + '$'));\n }\n }\n};\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\ndebug.disable = function(){\n debug.enable('');\n};\n\n/**\n * Humanize the given `ms`.\n *\n * @param {Number} m\n * @return {String}\n * @api private\n */\n\ndebug.humanize = function(ms) {\n var sec = 1000\n , min = 60 * 1000\n , hour = 60 * min;\n\n if (ms >= hour) return (ms / hour).toFixed(1) + 'h';\n if (ms >= min) return (ms / min).toFixed(1) + 'm';\n if (ms >= sec) return (ms / sec | 0) + 's';\n return ms + 'ms';\n};\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\ndebug.enabled = function(name) {\n for (var i = 0, len = debug.skips.length; i < len; i++) {\n if (debug.skips[i].test(name)) {\n return false;\n }\n }\n for (var i = 0, len = debug.names.length; i < len; i++) {\n if (debug.names[i].test(name)) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Coerce `val`.\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n\n// persist\n\ntry {\n if (window.localStorage) debug.enable(localStorage.debug);\n} catch(e){}\n","\n/**\n * Expose `Emitter`.\n */\n\nif (typeof module !== 'undefined') {\n module.exports = Emitter;\n}\n\n/**\n * Initialize a new `Emitter`.\n *\n * @api public\n */\n\nfunction Emitter(obj) {\n if (obj) return mixin(obj);\n};\n\n/**\n * Mixin the emitter properties.\n *\n * @param {Object} obj\n * @return {Object}\n * @api private\n */\n\nfunction mixin(obj) {\n for (var key in Emitter.prototype) {\n obj[key] = Emitter.prototype[key];\n }\n return obj;\n}\n\n/**\n * Listen on the given `event` with `fn`.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.on =\nEmitter.prototype.addEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\n .push(fn);\n return this;\n};\n\n/**\n * Adds an `event` listener that will be invoked a single\n * time then automatically removed.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.once = function(event, fn){\n function on() {\n this.off(event, on);\n fn.apply(this, arguments);\n }\n\n on.fn = fn;\n this.on(event, on);\n return this;\n};\n\n/**\n * Remove the given callback for `event` or all\n * registered callbacks.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.off =\nEmitter.prototype.removeListener =\nEmitter.prototype.removeAllListeners =\nEmitter.prototype.removeEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n\n // all\n if (0 == arguments.length) {\n this._callbacks = {};\n return this;\n }\n\n // specific event\n var callbacks = this._callbacks['$' + event];\n if (!callbacks) return this;\n\n // remove all handlers\n if (1 == arguments.length) {\n delete this._callbacks['$' + event];\n return this;\n }\n\n // remove specific handler\n var cb;\n for (var i = 0; i < callbacks.length; i++) {\n cb = callbacks[i];\n if (cb === fn || cb.fn === fn) {\n callbacks.splice(i, 1);\n break;\n }\n }\n\n // Remove event specific arrays for event types that no\n // one is subscribed for to avoid memory leak.\n if (callbacks.length === 0) {\n delete this._callbacks['$' + event];\n }\n\n return this;\n};\n\n/**\n * Emit `event` with the given args.\n *\n * @param {String} event\n * @param {Mixed} ...\n * @return {Emitter}\n */\n\nEmitter.prototype.emit = function(event){\n this._callbacks = this._callbacks || {};\n\n var args = new Array(arguments.length - 1)\n , callbacks = this._callbacks['$' + event];\n\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n\n if (callbacks) {\n callbacks = callbacks.slice(0);\n for (var i = 0, len = callbacks.length; i < len; ++i) {\n callbacks[i].apply(this, args);\n }\n }\n\n return this;\n};\n\n/**\n * Return array of callbacks for `event`.\n *\n * @param {String} event\n * @return {Array}\n * @api public\n */\n\nEmitter.prototype.listeners = function(event){\n this._callbacks = this._callbacks || {};\n return this._callbacks['$' + event] || [];\n};\n\n/**\n * Check if this emitter has `event` handlers.\n *\n * @param {String} event\n * @return {Boolean}\n * @api public\n */\n\nEmitter.prototype.hasListeners = function(event){\n return !! this.listeners(event).length;\n};\n","'use strict';\n\nvar uuid = require('uuid').v4;\nvar Store = require('./store');\nvar each = require('@ndhoule/each');\nvar Schedule = require('./schedule');\nvar debug = require('debug')('localstorage-retry');\nvar Emitter = require('component-emitter');\n\n// Some browsers don't support Function.prototype.bind, so just including a simplified version here\nfunction bind(func, obj) {\n return function() {\n return func.apply(obj, arguments);\n };\n}\n\n/**\n * @callback processFunc\n * @param {Mixed} item The item added to the queue to process\n * @param {Function} done A function to call when processing is completed.\n * @param {Error} Optional error parameter if the processing failed\n * @param {Response} Optional response parameter to emit for async handling\n */\n\n/**\n * Constructs a Queue backed by localStorage\n *\n * @constructor\n * @param {String} name The name of the queue. Will be used to find abandoned queues and retry their items\n * @param {processFunc} fn The function to call in order to process an item added to the queue\n */\nfunction Queue(name, opts, fn) {\n if (typeof opts === 'function') fn = opts;\n this.name = name;\n this.id = uuid();\n this.fn = fn;\n this.maxItems = opts.maxItems || Infinity;\n this.maxAttempts = opts.maxAttempts || Infinity;\n\n this.backoff = {\n MIN_RETRY_DELAY: opts.minRetryDelay || 1000,\n MAX_RETRY_DELAY: opts.maxRetryDelay || 30000,\n FACTOR: opts.backoffFactor || 2,\n JITTER: opts.backoffJitter || 0\n };\n\n // painstakingly tuned. that's why they're not \"easily\" configurable\n this.timeouts = {\n ACK_TIMER: 1000,\n RECLAIM_TIMER: 3000,\n RECLAIM_TIMEOUT: 10000,\n RECLAIM_WAIT: 500\n };\n\n this.keys = {\n IN_PROGRESS: 'inProgress',\n QUEUE: 'queue',\n ACK: 'ack',\n RECLAIM_START: 'reclaimStart',\n RECLAIM_END: 'reclaimEnd'\n };\n\n this._schedule = new Schedule();\n this._processId = 0;\n\n // Set up our empty queues\n this._store = new Store(this.name, this.id, this.keys);\n this._store.set(this.keys.IN_PROGRESS, {});\n this._store.set(this.keys.QUEUE, []);\n\n // bind recurring tasks for ease of use\n this._ack = bind(this._ack, this);\n this._checkReclaim = bind(this._checkReclaim, this);\n this._processHead = bind(this._processHead, this);\n\n this._running = false;\n}\n\n/**\n * Mix in event emitter\n */\n\nEmitter(Queue.prototype);\n\n/**\n * Starts processing the queue\n */\nQueue.prototype.start = function() {\n if (this._running) {\n this.stop();\n }\n this._running = true;\n this._ack();\n this._checkReclaim();\n this._processHead();\n};\n\n/**\n * Stops processing the queue\n */\nQueue.prototype.stop = function() {\n this._schedule.cancelAll();\n this._running = false;\n};\n\n/**\n * Decides whether to retry. Overridable.\n *\n * @param {Object} item The item being processed\n * @param {Number} attemptNumber The attemptNumber (1 for first retry)\n * @param {Error} error The error from previous attempt, if there was one\n * @return {Boolean} Whether to requeue the message\n */\nQueue.prototype.shouldRetry = function(_, attemptNumber) {\n if (attemptNumber > this.maxAttempts) return false;\n return true;\n};\n\n/**\n * Calculates the delay (in ms) for a retry attempt\n *\n * @param {Number} attemptNumber The attemptNumber (1 for first retry)\n * @return {Number} The delay in milliseconds to wait before attempting a retry\n */\nQueue.prototype.getDelay = function(attemptNumber) {\n var ms = this.backoff.MIN_RETRY_DELAY * Math.pow(this.backoff.FACTOR, attemptNumber);\n if (this.backoff.JITTER) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.backoff.JITTER * ms);\n if (Math.floor(rand * 10) < 5) {\n ms -= deviation;\n } else {\n ms += deviation;\n }\n }\n return Number(Math.min(ms, this.backoff.MAX_RETRY_DELAY).toPrecision(1));\n};\n\n/**\n * Adds an item to the queue\n *\n * @param {Mixed} item The item to process\n */\nQueue.prototype.addItem = function(item) {\n this._enqueue({\n item: item,\n attemptNumber: 0,\n time: this._schedule.now()\n });\n};\n\n/**\n * Adds an item to the retry queue\n *\n * @param {Mixed} item The item to retry\n * @param {Number} attemptNumber The attempt number (1 for first retry)\n * @param {Error} [error] The error from previous attempt, if there was one\n */\nQueue.prototype.requeue = function(item, attemptNumber, error) {\n if (this.shouldRetry(item, attemptNumber, error)) {\n this._enqueue({\n item: item,\n attemptNumber: attemptNumber,\n time: this._schedule.now() + this.getDelay(attemptNumber)\n });\n } else {\n this.emit('discard', item, attemptNumber);\n }\n};\n\nQueue.prototype._enqueue = function(entry) {\n var queue = this._store.get(this.keys.QUEUE) || [];\n queue = queue.slice(-(this.maxItems - 1));\n queue.push(entry);\n queue = queue.sort(function(a,b) {\n return a.time - b.time;\n });\n\n this._store.set(this.keys.QUEUE, queue);\n\n if (this._running) {\n this._processHead();\n }\n};\n\nQueue.prototype._processHead = function() {\n var self = this;\n var store = this._store;\n\n // cancel the scheduled task if it exists\n this._schedule.cancel(this._processId);\n\n // Pop the head off the queue\n var queue = store.get(this.keys.QUEUE) || [];\n var inProgress = store.get(this.keys.IN_PROGRESS) || {};\n var now = this._schedule.now();\n var toRun = [];\n\n function enqueue(el, id) {\n toRun.push({\n item: el.item,\n done: function handle(err, res) {\n var inProgress = store.get(self.keys.IN_PROGRESS) || {};\n delete inProgress[id];\n store.set(self.keys.IN_PROGRESS, inProgress);\n self.emit('processed', err, res, el.item);\n if (err) {\n self.requeue(el.item, el.attemptNumber + 1, err);\n }\n }\n });\n }\n\n var inProgressSize = Object.keys(inProgress).length;\n\n while (queue.length && queue[0].time <= now && inProgressSize++ < self.maxItems) {\n var el = queue.shift();\n var id = uuid();\n\n // Save this to the in progress map\n inProgress[id] = {\n item: el.item,\n attemptNumber: el.attemptNumber,\n time: self._schedule.now()\n };\n\n enqueue(el, id);\n }\n\n store.set(this.keys.QUEUE, queue);\n store.set(this.keys.IN_PROGRESS, inProgress);\n\n each(function(el) {\n // TODO: handle fn timeout\n try {\n self.fn(el.item, el.done);\n } catch (err) {\n debug('Process function threw error: ' + err);\n }\n }, toRun);\n\n // re-read the queue in case the process function finished immediately or added another item\n queue = store.get(this.keys.QUEUE) || [];\n this._schedule.cancel(this._processId);\n if (queue.length > 0) {\n this._processId = this._schedule.run(this._processHead, queue[0].time - now);\n }\n};\n\n// Ack continuously to prevent other tabs from claiming our queue\nQueue.prototype._ack = function() {\n this._store.set(this.keys.ACK, this._schedule.now());\n this._store.set(this.keys.RECLAIM_START, null);\n this._store.set(this.keys.RECLAIM_END, null);\n this._schedule.run(this._ack, this.timeouts.ACK_TIMER);\n};\n\nQueue.prototype._checkReclaim = function() {\n var self = this;\n\n function tryReclaim(store) {\n store.set(self.keys.RECLAIM_START, self.id);\n store.set(self.keys.ACK, self._schedule.now());\n\n self._schedule.run(function() {\n if (store.get(self.keys.RECLAIM_START) !== self.id) return;\n store.set(self.keys.RECLAIM_END, self.id);\n\n self._schedule.run(function() {\n if (store.get(self.keys.RECLAIM_END) !== self.id) return;\n if (store.get(self.keys.RECLAIM_START) !== self.id) return;\n self._reclaim(store.id);\n }, self.timeouts.RECLAIM_WAIT);\n }, self.timeouts.RECLAIM_WAIT);\n }\n\n function findOtherQueues(name) {\n var res = [];\n var storage = self._store.engine;\n for (var i = 0; i < storage.length; i++) {\n var k = storage.key(i);\n var parts = k.split('.');\n if (parts.length !== 3) continue;\n if (parts[0] !== name) continue;\n if (parts[2] !== 'ack') continue;\n res.push(new Store(name, parts[1], self.keys));\n }\n return res;\n }\n\n each(function(store) {\n if (store.id === self.id) return;\n if (self._schedule.now() - store.get(self.keys.ACK) < self.timeouts.RECLAIM_TIMEOUT) return;\n tryReclaim(store);\n }, findOtherQueues(this.name));\n\n this._schedule.run(this._checkReclaim, this.timeouts.RECLAIM_TIMER);\n};\n\nQueue.prototype._reclaim = function(id) {\n var self = this;\n var other = new Store(this.name, id, this.keys);\n\n var our = {\n queue: this._store.get(this.keys.QUEUE) || []\n };\n\n var their = {\n inProgress: other.get(this.keys.IN_PROGRESS) || {},\n queue: other.get(this.keys.QUEUE) || []\n };\n\n // add their queue to ours, resetting run-time to immediate and copying the attempt#\n each(function(el) {\n our.queue.push({\n item: el.item,\n attemptNumber: el.attemptNumber,\n time: self._schedule.now()\n });\n }, their.queue);\n\n // if the queue is abandoned, all the in-progress are failed. retry them immediately and increment the attempt#\n each(function(el) {\n our.queue.push({\n item: el.item,\n attemptNumber: el.attemptNumber + 1,\n time: self._schedule.now()\n });\n }, their.inProgress);\n\n our.queue = our.queue.sort(function(a,b) {\n return a.time - b.time;\n });\n\n this._store.set(this.keys.QUEUE, our.queue);\n\n // remove all keys\n other.remove(this.keys.ACK);\n other.remove(this.keys.RECLAIM_START);\n other.remove(this.keys.RECLAIM_END);\n other.remove(this.keys.IN_PROGRESS);\n other.remove(this.keys.QUEUE);\n\n // process the new items we claimed\n this._processHead();\n};\n\nmodule.exports = Queue;\n","import {\n BASE_URL,\n FLUSH_QUEUE_SIZE,\n FLUSH_INTERVAL_DEFAULT\n} from \"./constants\";\nimport { getCurrentTimeFormatted, handleError } from \"./utils\";\nimport { replacer } from \"./utils\";\nimport { RudderPayload } from \"./RudderPayload\";\nimport Queue from \"@segment/localstorage-retry\";\nimport logger from \"./logUtil\";\n//import * as XMLHttpRequestNode from \"Xmlhttprequest\";\n\nlet XMLHttpRequestNode;\nif (!process.browser) {\n XMLHttpRequestNode = require(\"Xmlhttprequest\");\n}\n\nlet btoaNode;\nif (!process.browser) {\n btoaNode = require(\"btoa\");\n}\n\nvar queueOptions = {\n maxRetryDelay: 360000,\n minRetryDelay: 1000,\n backoffFactor: 2,\n maxAttempts: 10,\n maxItems: 100\n};\n\nconst MESSAGE_LENGTH = 32 * 1000; // ~32 Kb\n\n/**\n *\n * @class EventRepository responsible for adding events into\n * flush queue and sending data to rudder backend\n * in batch and maintains order of the event.\n */\nclass EventRepository {\n /**\n *Creates an instance of EventRepository.\n * @memberof EventRepository\n */\n constructor() {\n this.eventsBuffer = [];\n this.writeKey = \"\";\n this.url = BASE_URL;\n this.state = \"READY\";\n this.batchSize = 0;\n\n // previous implementation\n //setInterval(this.preaparePayloadAndFlush, FLUSH_INTERVAL_DEFAULT, this);\n\n this.payloadQueue = new Queue(\"rudder\", queueOptions, function(item, done) {\n // apply sentAt at flush time and reset on each retry\n item.message.sentAt = getCurrentTimeFormatted();\n //send this item for processing, with a callback to enable queue to get the done status\n eventRepository.processQueueElement(\n item.url,\n item.headers,\n item.message,\n 10 * 1000,\n function(err, res) {\n if (err) {\n return done(err);\n }\n done(null, res);\n }\n );\n });\n\n //start queue\n this.payloadQueue.start();\n }\n\n /**\n *\n *\n * @param {EventRepository} repo\n * @returns\n * @memberof EventRepository\n */\n preaparePayloadAndFlush(repo) {\n //construct payload\n logger.debug(\"==== in preaparePayloadAndFlush with state: \" + repo.state);\n logger.debug(repo.eventsBuffer);\n if (repo.eventsBuffer.length == 0 || repo.state === \"PROCESSING\") {\n return;\n }\n var eventsPayload = repo.eventsBuffer;\n var payload = new RudderPayload();\n payload.batch = eventsPayload;\n payload.writeKey = repo.writeKey;\n payload.sentAt = getCurrentTimeFormatted();\n\n //add sentAt to individual events as well\n payload.batch.forEach(event => {\n event.sentAt = payload.sentAt;\n });\n\n repo.batchSize = repo.eventsBuffer.length;\n //server-side integration, XHR is node module\n\n if (process.browser) {\n var xhr = new XMLHttpRequest();\n } else {\n var xhr = new XMLHttpRequestNode.XMLHttpRequest();\n }\n\n logger.debug(\"==== in flush sending to Rudder BE ====\");\n logger.debug(JSON.stringify(payload, replacer));\n\n xhr.open(\"POST\", repo.url, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\n if (process.browser) {\n xhr.setRequestHeader(\n \"Authorization\",\n \"Basic \" + btoa(payload.writeKey + \":\")\n );\n } else {\n xhr.setRequestHeader(\n \"Authorization\",\n \"Basic \" + btoaNode(payload.writeKey + \":\")\n );\n }\n\n //register call back to reset event buffer on successfull POST\n xhr.onreadystatechange = function() {\n if (xhr.readyState === 4 && xhr.status === 200) {\n logger.debug(\"====== request processed successfully: \" + xhr.status);\n repo.eventsBuffer = repo.eventsBuffer.slice(repo.batchSize);\n logger.debug(repo.eventsBuffer.length);\n } else if (xhr.readyState === 4 && xhr.status !== 200) {\n handleError(\n new Error(\n \"request failed with status: \" +\n xhr.status +\n \" for url: \" +\n repo.url\n )\n );\n }\n repo.state = \"READY\";\n };\n xhr.send(JSON.stringify(payload, replacer));\n repo.state = \"PROCESSING\";\n }\n\n /**\n * the queue item proceesor\n * @param {*} url to send requests to\n * @param {*} headers\n * @param {*} message\n * @param {*} timeout\n * @param {*} queueFn the function to call after request completion\n */\n processQueueElement(url, headers, message, timeout, queueFn) {\n try {\n var xhr = new XMLHttpRequest();\n xhr.open(\"POST\", url, true);\n for (var k in headers) {\n xhr.setRequestHeader(k, headers[k]);\n }\n xhr.timeout = timeout;\n xhr.ontimeout = queueFn;\n xhr.onerror = queueFn;\n xhr.onreadystatechange = function() {\n if (xhr.readyState === 4) {\n if (xhr.status === 429 || (xhr.status >= 500 && xhr.status < 600)) {\n handleError(\n new Error(\n \"request failed with status: \" +\n xhr.status +\n xhr.statusText +\n \" for url: \" +\n url\n )\n );\n queueFn(\n new Error(\n \"request failed with status: \" +\n xhr.status +\n xhr.statusText +\n \" for url: \" +\n url\n )\n );\n } else {\n logger.debug(\n \"====== request processed successfully: \" + xhr.status\n );\n queueFn(null, xhr.status);\n }\n }\n };\n\n xhr.send(JSON.stringify(message, replacer));\n } catch (error) {\n queueFn(error);\n }\n }\n\n /**\n *\n *\n * @param {RudderElement} rudderElement\n * @memberof EventRepository\n */\n enqueue(rudderElement, type) {\n var message = rudderElement.getElementContent();\n\n var headers = {\n \"Content-Type\": \"application/json\",\n Authorization: \"Basic \" + btoa(this.writeKey + \":\"),\n AnonymousId: btoa(message.anonymousId)\n };\n\n message.originalTimestamp = getCurrentTimeFormatted();\n message.sentAt = getCurrentTimeFormatted(); // add this, will get modified when actually being sent\n\n // check message size, if greater log an error\n if (JSON.stringify(message).length > MESSAGE_LENGTH) {\n logger.error(\"[EventRepository] enqueue:: message length greater 32 Kb \", message);\n }\n\n //modify the url for event specific endpoints\n var url = this.url.slice(-1) == \"/\" ? this.url.slice(0, -1) : this.url;\n // add items to the queue\n this.payloadQueue.addItem({\n url: url + \"/v1/\" + type,\n headers: headers,\n message: message\n });\n }\n}\nlet eventRepository = new EventRepository();\nexport { eventRepository as EventRepository };\n","import { getDefaultPageProperties } from \"./utils\";\nimport logger from \"./logUtil\";\n\nfunction addDomEventHandlers(rudderanalytics) {\n var handler = e => {\n e = e || window.event;\n var target = e.target || e.srcElement;\n\n if (isTextNode(target)) {\n target = target.parentNode;\n }\n if (shouldTrackDomEvent(target, e)) {\n logger.debug(\"to be tracked \", e.type);\n } else {\n logger.debug(\"not to be tracked \", e.type);\n }\n trackWindowEvent(e, rudderanalytics);\n };\n register_event(document, \"submit\", handler, true);\n register_event(document, \"change\", handler, true);\n register_event(document, \"click\", handler, true);\n rudderanalytics.page();\n}\n\nfunction register_event(element, type, handler, useCapture) {\n if (!element) {\n logger.error(\"[Autotrack] register_event:: No valid element provided to register_event\");\n return;\n }\n element.addEventListener(type, handler, !!useCapture);\n}\n\nfunction shouldTrackDomEvent(el, event) {\n if (!el || isTag(el, \"html\") || !isElementNode(el)) {\n return false;\n }\n var tag = el.tagName.toLowerCase();\n switch (tag) {\n case \"html\":\n return false;\n case \"form\":\n return event.type === \"submit\";\n case \"input\":\n if ([\"button\", \"submit\"].indexOf(el.getAttribute(\"type\")) === -1) {\n return event.type === \"change\";\n } else {\n return event.type === \"click\";\n }\n case \"select\":\n case \"textarea\":\n return event.type === \"change\";\n default:\n return event.type === \"click\";\n }\n}\n\nfunction isTag(el, tag) {\n return el && el.tagName && el.tagName.toLowerCase() === tag.toLowerCase();\n}\n\nfunction isElementNode(el) {\n return el && el.nodeType === 1; // Node.ELEMENT_NODE - use integer constant for browser portability\n}\n\nfunction isTextNode(el) {\n return el && el.nodeType === 3; // Node.TEXT_NODE - use integer constant for browser portability\n}\n\nfunction shouldTrackElement(el) {\n if (!el.parentNode || isTag(el, \"body\")) return false;\n return true;\n}\n\nfunction getClassName(el) {\n switch (typeof el.className) {\n case \"string\":\n return el.className;\n case \"object\": // handle cases where className might be SVGAnimatedString or some other type\n return el.className.baseVal || el.getAttribute(\"class\") || \"\";\n default:\n // future proof\n return \"\";\n }\n}\n\nfunction trackWindowEvent(e, rudderanalytics) {\n var target = e.target || e.srcElement;\n var formValues = undefined;\n if (isTextNode(target)) {\n target = target.parentNode;\n }\n\n if (shouldTrackDomEvent(target, e)) {\n if (target.tagName.toLowerCase() == \"form\") {\n formValues = {};\n for (var i = 0; i < target.elements.length; i++) {\n var formElement = target.elements[i];\n if (\n isElToBeTracked(formElement) &&\n isElValueToBeTracked(formElement, rudderanalytics.trackValues)\n ) {\n let name = formElement.id ? formElement.id : formElement.name;\n if (name && typeof name === \"string\") {\n var key = formElement.id ? formElement.id : formElement.name;\n // formElement.value gives the same thing\n var value = formElement.id\n ? document.getElementById(formElement.id).value\n : document.getElementsByName(formElement.name)[0].value;\n if (\n formElement.type === \"checkbox\" ||\n formElement.type === \"radio\"\n ) {\n value = formElement.checked;\n }\n if (key.trim() !== \"\") {\n formValues[encodeURIComponent(key)] = encodeURIComponent(value);\n }\n }\n }\n }\n }\n var targetElementList = [target];\n var curEl = target;\n while (curEl.parentNode && !isTag(curEl, \"body\")) {\n targetElementList.push(curEl.parentNode);\n curEl = curEl.parentNode;\n }\n\n var elementsJson = [];\n var href,\n explicitNoTrack = false;\n\n targetElementList.forEach(el => {\n var shouldTrackEl = shouldTrackElement(el);\n\n // if the element or a parent element is an anchor tag\n // include the href as a property\n if (el.tagName.toLowerCase() === \"a\") {\n href = el.getAttribute(\"href\");\n href = shouldTrackEl && href;\n }\n\n // allow users to programatically prevent tracking of elements by adding class 'rudder-no-track'\n\n explicitNoTrack = explicitNoTrack || !isElToBeTracked(el);\n\n //explicitNoTrack = !isElToBeTracked(el);\n\n elementsJson.push(getPropertiesFromElement(el, rudderanalytics));\n });\n\n if (explicitNoTrack) {\n return false;\n }\n\n var elementText = \"\";\n var text = getText(target); //target.innerText//target.textContent//getSafeText(target);\n if (text && text.length) {\n elementText = text;\n }\n var props = {\n event_type: e.type,\n page: getDefaultPageProperties(),\n elements: elementsJson,\n el_attr_href: href,\n el_text: elementText\n };\n\n if (formValues) {\n props[\"form_values\"] = formValues;\n }\n\n logger.debug(\"web_event\", props);\n rudderanalytics.track(\"autotrack\", props);\n return true;\n }\n}\n\nfunction isElValueToBeTracked(el, includeList) {\n var elAttributesLength = el.attributes.length;\n for (let i = 0; i < elAttributesLength; i++) {\n let value = el.attributes[i].value;\n if (includeList.indexOf(value) > -1) {\n return true;\n }\n }\n return false;\n}\n\nfunction isElToBeTracked(el) {\n var classes = getClassName(el).split(\" \");\n if (classes.indexOf(\"rudder-no-track\") >= 0) {\n return false;\n }\n return true;\n}\n\nfunction getText(el) {\n var text = \"\";\n el.childNodes.forEach(function(value) {\n if (value.nodeType === Node.TEXT_NODE) {\n text += value.nodeValue;\n }\n });\n return text.trim();\n}\n\nfunction getPropertiesFromElement(elem, rudderanalytics) {\n var props = {\n classes: getClassName(elem).split(\" \"),\n tag_name: elem.tagName.toLowerCase()\n };\n\n let attrLength = elem.attributes.length;\n for (let i = 0; i < attrLength; i++) {\n let name = elem.attributes[i].name;\n let value = elem.attributes[i].value;\n if (value) {\n props[\"attr__\" + name] = value;\n }\n if (\n (name == \"name\" || name == \"id\") &&\n isElValueToBeTracked(elem, rudderanalytics.trackValues)\n ) {\n props[\"field_value\"] =\n name == \"id\"\n ? document.getElementById(value).value\n : document.getElementsByName(value)[0].value;\n\n if (elem.type === \"checkbox\" || elem.type === \"radio\") {\n props[\"field_value\"] = elem.checked;\n }\n }\n }\n\n var nthChild = 1;\n var nthOfType = 1;\n var currentElem = elem;\n while ((currentElem = previousElementSibling(currentElem))) {\n nthChild++;\n if (currentElem.tagName === elem.tagName) {\n nthOfType++;\n }\n }\n props[\"nth_child\"] = nthChild;\n props[\"nth_of_type\"] = nthOfType;\n\n return props;\n}\n\nfunction previousElementSibling(el) {\n if (el.previousElementSibling) {\n return el.previousElementSibling;\n } else {\n do {\n el = el.previousSibling;\n } while (el && !isElementNode(el));\n return el;\n }\n}\nexport { addDomEventHandlers };\n","module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n","import {\n getJSONTrimmed,\n generateUUID,\n handleError,\n getDefaultPageProperties,\n findAllEnabledDestinations,\n tranformToRudderNames,\n transformToServerNames\n} from \"./utils/utils\";\nimport {\n CONFIG_URL,\n ECommerceEvents,\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL\n} from \"./utils/constants\";\nimport { integrations } from \"./integrations\";\nimport RudderElementBuilder from \"./utils/RudderElementBuilder\";\nimport Storage from \"./utils/storage\";\nimport { EventRepository } from \"./utils/EventRepository\";\nimport logger from \"./utils/logUtil\";\nimport { addDomEventHandlers } from \"./utils/autotrack.js\";\nimport Emitter from \"component-emitter\";\nimport after from \"after\";\nimport {ScriptLoader} from \"./integrations/ScriptLoader\"\n\n//https://unpkg.com/test-rudder-sdk@1.0.5/dist/browser.js\n\n/**\n * Add the rudderelement object to flush queue\n *\n * @param {RudderElement} rudderElement\n */\nfunction enqueue(rudderElement, type) {\n if (!this.eventRepository) {\n this.eventRepository = EventRepository;\n }\n this.eventRepository.enqueue(rudderElement, type);\n}\n\n/**\n * class responsible for handling core\n * event tracking functionalities\n */\nclass Analytics {\n /**\n * Creates an instance of Analytics.\n * @memberof Analytics\n */\n constructor() {\n this.autoTrackHandlersRegistered = false;\n this.autoTrackFeatureEnabled = false;\n this.initialized = false;\n this.trackValues = [];\n this.eventsBuffer = [];\n this.clientIntegrations = [];\n this.loadOnlyIntegrations = {};\n this.clientIntegrationObjects = undefined;\n this.successfullyLoadedIntegration = [];\n this.failedToBeLoadedIntegration = [];\n this.toBeProcessedArray = [];\n this.toBeProcessedByIntegrationArray = [];\n this.storage = Storage;\n this.userId =\n this.storage.getUserId() != undefined ? this.storage.getUserId() : \"\";\n\n this.userTraits =\n this.storage.getUserTraits() != undefined\n ? this.storage.getUserTraits()\n : {};\n\n this.groupId =\n this.storage.getGroupId() != undefined ? this.storage.getGroupId() : \"\";\n\n this.groupTraits =\n this.storage.getGroupTraits() != undefined\n ? this.storage.getGroupTraits()\n : {};\n\n this.anonymousId = this.getAnonymousId();\n this.storage.setUserId(this.userId);\n this.eventRepository = EventRepository;\n this.sendAdblockPage = false\n this.sendAdblockPageOptions = {}\n this.clientSuppliedCallbacks = {}\n this.readyCallback = () => {};\n this.executeReadyCallback = undefined;\n this.methodToCallbackMapping = {\n syncPixel: \"syncPixelCallback\"\n };\n }\n\n /**\n * Process the response from control plane and\n * call initialize for integrations\n *\n * @param {*} status\n * @param {*} response\n * @memberof Analytics\n */\n processResponse(status, response) {\n try {\n logger.debug(\"===in process response=== \" + status);\n response = JSON.parse(response);\n if (\n response.source.useAutoTracking &&\n !this.autoTrackHandlersRegistered\n ) {\n this.autoTrackFeatureEnabled = true;\n addDomEventHandlers(this);\n this.autoTrackHandlersRegistered = true;\n }\n response.source.destinations.forEach(function(destination, index) {\n logger.debug(\n \"Destination \" +\n index +\n \" Enabled? \" +\n destination.enabled +\n \" Type: \" +\n destination.destinationDefinition.name +\n \" Use Native SDK? \" +\n destination.config.useNativeSDK\n );\n if (destination.enabled) {\n this.clientIntegrations.push({\"name\": destination.destinationDefinition.name, \"config\": destination.config});\n }\n }, this);\n\n // intersection of config-plane native sdk destinations with sdk load time destination list\n this.clientIntegrations = findAllEnabledDestinations(\n this.loadOnlyIntegrations,\n this.clientIntegrations\n );\n\n // remove from the list which don't have support yet in SDK\n this.clientIntegrations = this.clientIntegrations.filter(intg => {\n return integrations[intg.name] != undefined\n })\n\n this.init(this.clientIntegrations);\n } catch (error) {\n handleError(error);\n logger.debug(\"===handling config BE response processing error===\");\n logger.debug(\n \"autoTrackHandlersRegistered\",\n this.autoTrackHandlersRegistered\n );\n if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {\n addDomEventHandlers(this);\n this.autoTrackHandlersRegistered = true;\n }\n }\n }\n\n /**\n * Initialize integrations by addinfg respective scripts\n * keep the instances reference in core\n *\n * @param {*} intgArray\n * @returns\n * @memberof Analytics\n */\n init(intgArray) {\n let self = this;\n logger.debug(\"supported intgs \", integrations);\n // this.clientIntegrationObjects = [];\n\n if (!intgArray || intgArray.length == 0) {\n if (this.readyCallback) {\n this.readyCallback();\n }\n this.toBeProcessedByIntegrationArray = [];\n return;\n }\n\n intgArray.forEach((intg) => {\n try {\n logger.debug(\"[Analytics] init :: trying to initialize integration name:: \", intg.name)\n let intgClass = integrations[intg.name];\n let destConfig = intg.config;\n let intgInstance = new intgClass(destConfig, self);\n intgInstance.init();\n\n logger.debug(\"initializing destination: \", intg);\n\n this.isInitialized(intgInstance).then(this.replayEvents);\n } catch (e) {\n logger.error(\"[Analytics] initialize integration (integration.init()) failed :: \", intg.name)\n }\n \n\n });\n }\n\n replayEvents(object) {\n if (\n object.successfullyLoadedIntegration.length +\n object.failedToBeLoadedIntegration.length ==\n object.clientIntegrations.length &&\n object.toBeProcessedByIntegrationArray.length > 0\n ) {\n logger.debug(\n \"===replay events called====\",\n object.successfullyLoadedIntegration.length,\n object.failedToBeLoadedIntegration.length\n );\n object.clientIntegrationObjects = [];\n object.clientIntegrationObjects = object.successfullyLoadedIntegration;\n\n logger.debug(\n \"==registering after callback===\",\n object.clientIntegrationObjects.length\n );\n object.executeReadyCallback = after(\n object.clientIntegrationObjects.length,\n object.readyCallback\n );\n\n logger.debug(\"==registering ready callback===\");\n object.on(\"ready\", object.executeReadyCallback);\n\n object.clientIntegrationObjects.forEach(intg => {\n logger.debug(\"===looping over each successful integration====\");\n if (!intg[\"isReady\"] || intg[\"isReady\"]()) {\n logger.debug(\"===letting know I am ready=====\", intg[\"name\"]);\n object.emit(\"ready\");\n }\n });\n\n //send the queued events to the fetched integration\n object.toBeProcessedByIntegrationArray.forEach(event => {\n let methodName = event[0];\n event.shift();\n\n // convert common names to sdk identified name\n if (Object.keys(event[0].message.integrations).length > 0) {\n tranformToRudderNames(event[0].message.integrations);\n }\n \n // if not specified at event level, All: true is default\n var clientSuppliedIntegrations = event[0].message.integrations;\n \n \n\n // get intersection between config plane native enabled destinations\n // (which were able to successfully load on the page) vs user supplied integrations\n var succesfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(\n clientSuppliedIntegrations,\n object.clientIntegrationObjects\n );\n\n //send to all integrations now from the 'toBeProcessedByIntegrationArray' replay queue\n for (let i = 0; i < succesfulLoadedIntersectClientSuppliedIntegrations.length; i++) {\n try {\n if (\n !succesfulLoadedIntersectClientSuppliedIntegrations[i][\"isFailed\"] ||\n !succesfulLoadedIntersectClientSuppliedIntegrations[i][\"isFailed\"]()\n ) {\n if(succesfulLoadedIntersectClientSuppliedIntegrations[i][methodName]) {\n succesfulLoadedIntersectClientSuppliedIntegrations[i][methodName](\n ...event\n );\n }\n \n }\n } catch (error) {\n handleError(error);\n }\n }\n });\n object.toBeProcessedByIntegrationArray = [];\n }\n }\n\n pause(time) {\n return new Promise(resolve => {\n setTimeout(resolve, time);\n });\n }\n\n isInitialized(instance, time = 0) {\n return new Promise(resolve => {\n if (instance.isLoaded()) {\n logger.debug(\n \"===integration loaded successfully====\",\n instance[\"name\"]\n );\n this.successfullyLoadedIntegration.push(instance);\n return resolve(this);\n }\n if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {\n logger.debug(\"====max wait over====\");\n this.failedToBeLoadedIntegration.push(instance);\n return resolve(this);\n }\n\n this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() => {\n logger.debug(\"====after pause, again checking====\");\n return this.isInitialized(\n instance,\n time + INTEGRATION_LOAD_CHECK_INTERVAL\n ).then(resolve);\n });\n });\n }\n\n /**\n * Process page params and forward to page call\n *\n * @param {*} category\n * @param {*} name\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n page(category, name, properties, options, callback) {\n if (typeof options == \"function\") (callback = options), (options = null);\n if (typeof properties == \"function\")\n (callback = properties), (options = properties = null);\n if (typeof name == \"function\")\n (callback = name), (options = properties = name = null);\n if (typeof category === \"object\")\n (options = name), (properties = category), (name = category = null);\n if (typeof name === \"object\")\n (options = properties), (properties = name), (name = null);\n if (typeof category === \"string\" && typeof name !== \"string\")\n (name = category), (category = null);\n if(this.sendAdblockPage && category != \"RudderJS-Initiated\") {\n this.sendSampleRequest()\n }\n this.processPage(category, name, properties, options, callback);\n }\n\n /**\n * Process track params and forward to track call\n *\n * @param {*} event\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n track(event, properties, options, callback) {\n if (typeof options == \"function\") (callback = options), (options = null);\n if (typeof properties == \"function\")\n (callback = properties), (options = null), (properties = null);\n\n this.processTrack(event, properties, options, callback);\n }\n\n /**\n * Process identify params and forward to indentify call\n *\n * @param {*} userId\n * @param {*} traits\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n identify(userId, traits, options, callback) {\n if (typeof options == \"function\") (callback = options), (options = null);\n if (typeof traits == \"function\")\n (callback = traits), (options = null), (traits = null);\n if (typeof userId == \"object\")\n (options = traits), (traits = userId), (userId = this.userId);\n\n this.processIdentify(userId, traits, options, callback);\n }\n\n /**\n *\n * @param {*} to\n * @param {*} from\n * @param {*} options\n * @param {*} callback\n */\n alias(to, from, options, callback) {\n if (typeof options == \"function\") (callback = options), (options = null);\n if (typeof from == \"function\")\n (callback = from), (options = null), (from = null);\n if (typeof from == \"object\") (options = from), (from = null);\n\n let rudderElement = new RudderElementBuilder().setType(\"alias\").build();\n rudderElement.message.previousId =\n from || (this.userId ? this.userId : this.getAnonymousId());\n rudderElement.message.userId = to;\n\n this.processAndSendDataToDestinations(\n \"alias\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n *\n * @param {*} to\n * @param {*} from\n * @param {*} options\n * @param {*} callback\n */\n group(groupId, traits, options, callback) {\n if (!arguments.length) return;\n\n if (typeof options == \"function\") (callback = options), (options = null);\n if (typeof traits == \"function\")\n (callback = traits), (options = null), (traits = null);\n if (typeof groupId == \"object\")\n (options = traits), (traits = groupId), (groupId = this.groupId);\n\n this.groupId = groupId;\n this.storage.setGroupId(this.groupId);\n\n let rudderElement = new RudderElementBuilder().setType(\"group\").build();\n if (traits) {\n for (let key in traits) {\n this.groupTraits[key] = traits[key];\n }\n } else {\n this.groupTraits = {};\n }\n this.storage.setGroupTraits(this.groupTraits);\n\n this.processAndSendDataToDestinations(\n \"group\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Send page call to Rudder BE and to initialized integrations\n *\n * @param {*} category\n * @param {*} name\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n processPage(category, name, properties, options, callback) {\n let rudderElement = new RudderElementBuilder().setType(\"page\").build();\n if (name) {\n rudderElement[\"message\"][\"name\"] = name;\n }\n if (!properties) {\n properties = {};\n }\n if (category) {\n properties[\"category\"] = category;\n }\n if (properties) {\n rudderElement[\"message\"][\"properties\"] = this.getPageProperties(\n properties\n ); //properties;\n }\n\n this.trackPage(rudderElement, options, callback);\n }\n\n /**\n * Send track call to Rudder BE and to initialized integrations\n *\n * @param {*} event\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n processTrack(event, properties, options, callback) {\n let rudderElement = new RudderElementBuilder().setType(\"track\").build();\n if (event) {\n rudderElement.setEventName(event);\n }\n if (properties) {\n rudderElement.setProperty(properties);\n } else {\n rudderElement.setProperty({});\n }\n\n this.trackEvent(rudderElement, options, callback);\n }\n\n /**\n * Send identify call to Rudder BE and to initialized integrations\n *\n * @param {*} userId\n * @param {*} traits\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n processIdentify(userId, traits, options, callback) {\n if (userId && this.userId && userId !== this.userId) {\n this.reset();\n }\n this.userId = userId;\n this.storage.setUserId(this.userId);\n\n let rudderElement = new RudderElementBuilder().setType(\"identify\").build();\n if (traits) {\n for (let key in traits) {\n this.userTraits[key] = traits[key];\n }\n this.storage.setUserTraits(this.userTraits);\n }\n\n this.identifyUser(rudderElement, options, callback);\n }\n\n /**\n * Identify call supporting rudderelement from builder\n *\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n identifyUser(rudderElement, options, callback) {\n if (rudderElement[\"message\"][\"userId\"]) {\n this.userId = rudderElement[\"message\"][\"userId\"];\n this.storage.setUserId(this.userId);\n }\n\n if (\n rudderElement &&\n rudderElement[\"message\"] &&\n rudderElement[\"message\"][\"context\"] &&\n rudderElement[\"message\"][\"context\"][\"traits\"]\n ) {\n this.userTraits = Object.assign(\n {},\n rudderElement[\"message\"][\"context\"][\"traits\"]\n );\n this.storage.setUserTraits(this.userTraits);\n }\n\n this.processAndSendDataToDestinations(\n \"identify\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Page call supporting rudderelement from builder\n *\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n trackPage(rudderElement, options, callback) {\n this.processAndSendDataToDestinations(\n \"page\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Track call supporting rudderelement from builder\n *\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n trackEvent(rudderElement, options, callback) {\n this.processAndSendDataToDestinations(\n \"track\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Process and send data to destinations along with rudder BE\n *\n * @param {*} type\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n processAndSendDataToDestinations(type, rudderElement, options, callback) {\n try {\n if (!this.anonymousId) {\n this.setAnonymousId();\n }\n\n // assign page properties to context\n rudderElement[\"message\"][\"context\"][\"page\"] = getDefaultPageProperties();\n\n rudderElement[\"message\"][\"context\"][\"traits\"] = Object.assign(\n {},\n this.userTraits\n );\n \n logger.debug(\"anonymousId: \", this.anonymousId);\n rudderElement[\"message\"][\"anonymousId\"] = this.anonymousId;\n rudderElement[\"message\"][\"userId\"] = rudderElement[\"message\"][\"userId\"]\n ? rudderElement[\"message\"][\"userId\"]\n : this.userId;\n\n if (type == \"group\") {\n if (this.groupId) {\n rudderElement[\"message\"][\"groupId\"] = this.groupId;\n }\n if (this.groupTraits) {\n rudderElement[\"message\"][\"traits\"] = Object.assign(\n {},\n this.groupTraits\n );\n }\n }\n\n if (options) {\n this.processOptionsParam(rudderElement, options);\n }\n logger.debug(JSON.stringify(rudderElement));\n\n // structure user supplied integrations object to rudder format\n if (Object.keys(rudderElement.message.integrations).length > 0) {\n tranformToRudderNames(rudderElement.message.integrations);\n }\n\n // if not specified at event level, All: true is default\n var clientSuppliedIntegrations = rudderElement.message.integrations;\n\n // get intersection between config plane native enabled destinations\n // (which were able to successfully load on the page) vs user supplied integrations\n var succesfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(\n clientSuppliedIntegrations,\n this.clientIntegrationObjects\n );\n\n //try to first send to all integrations, if list populated from BE\n succesfulLoadedIntersectClientSuppliedIntegrations.forEach(obj => {\n if (!obj[\"isFailed\"] || !obj[\"isFailed\"]()) {\n if(obj[type]) {\n obj[type](rudderElement);\n }\n }\n });\n\n // config plane native enabled destinations, still not completely loaded\n // in the page, add the events to a queue and process later\n if (!this.clientIntegrationObjects) {\n logger.debug(\"pushing in replay queue\");\n //new event processing after analytics initialized but integrations not fetched from BE\n this.toBeProcessedByIntegrationArray.push([type, rudderElement]);\n }\n\n // convert integrations object to server identified names, kind of hack now!\n transformToServerNames(rudderElement.message.integrations)\n \n // self analytics process, send to rudder\n enqueue.call(this, rudderElement, type);\n\n logger.debug(type + \" is called \");\n if (callback) {\n callback();\n }\n } catch (error) {\n handleError(error);\n }\n }\n\n /**\n * process options parameter\n *\n * @param {*} rudderElement\n * @param {*} options\n * @memberof Analytics\n */\n processOptionsParam(rudderElement, options) {\n var toplevelElements = [\"integrations\", \"anonymousId\", \"originalTimestamp\"];\n for (let key in options) {\n if (toplevelElements.includes(key)) {\n rudderElement.message[key] = options[key];\n //special handle for ananymousId as transformation expects anonymousId in traits.\n /* if (key === \"anonymousId\") {\n rudderElement.message.context.traits[\"anonymousId\"] = options[key];\n } */\n } else {\n if (key !== \"context\")\n rudderElement.message.context[key] = options[key];\n else {\n for (let k in options[key]) {\n rudderElement.message.context[k] = options[key][k];\n }\n }\n }\n }\n }\n\n getPageProperties(properties) {\n let defaultPageProperties = getDefaultPageProperties();\n for (let key in defaultPageProperties) {\n if (properties[key] === undefined) {\n properties[key] = defaultPageProperties[key];\n }\n }\n return properties;\n }\n\n /**\n * Clear user information\n *\n * @memberof Analytics\n */\n reset() {\n this.userId = \"\";\n this.userTraits = {};\n this.storage.clear();\n }\n\n getAnonymousId() {\n this.anonymousId = this.storage.getAnonymousId();\n if (!this.anonymousId) {\n this.setAnonymousId();\n }\n return this.anonymousId;\n }\n\n setAnonymousId(anonymousId) {\n this.anonymousId = anonymousId ? anonymousId : generateUUID();\n this.storage.setAnonymousId(this.anonymousId);\n }\n\n /**\n * Call control pane to get client configs\n *\n * @param {*} writeKey\n * @memberof Analytics\n */\n load(writeKey, serverUrl, options) {\n logger.debug(\"inside load \");\n let configUrl = CONFIG_URL;\n if (!writeKey || !serverUrl || serverUrl.length == 0) {\n handleError({\n message:\n \"[Analytics] load:: Unable to load due to wrong writeKey or serverUrl\"\n });\n throw Error(\"failed to initialize\");\n }\n if (options && options.logLevel) {\n logger.setLogLevel(options.logLevel);\n }\n if (options && options.integrations) {\n Object.assign(this.loadOnlyIntegrations, options.integrations);\n tranformToRudderNames(this.loadOnlyIntegrations);\n }\n if (options && options.configUrl) {\n configUrl = options.configUrl;\n }\n if(options && options.sendAdblockPage) {\n this.sendAdblockPage = true\n }\n if(options && options.sendAdblockPageOptions) {\n if(typeof options.sendAdblockPageOptions == \"object\") {\n this.sendAdblockPageOptions = options.sendAdblockPageOptions\n }\n }\n if(options && options.clientSuppliedCallbacks) {\n\n // convert to rudder recognised method names\n let tranformedCallbackMapping = {}\n Object.keys(this.methodToCallbackMapping).forEach(methodName =>{\n if(this.methodToCallbackMapping.hasOwnProperty(methodName)) {\n if(options.clientSuppliedCallbacks[this.methodToCallbackMapping[methodName]]) {\n tranformedCallbackMapping[methodName] = options.clientSuppliedCallbacks[this.methodToCallbackMapping[methodName]]\n }\n }\n })\n Object.assign(this.clientSuppliedCallbacks, tranformedCallbackMapping)\n this.registerCallbacks(true)\n }\n\n this.eventRepository.writeKey = writeKey;\n if (serverUrl) {\n this.eventRepository.url = serverUrl;\n }\n if (\n options &&\n options.valTrackingList &&\n options.valTrackingList.push == Array.prototype.push\n ) {\n this.trackValues = options.valTrackingList;\n }\n if (options && options.useAutoTracking) {\n this.autoTrackFeatureEnabled = true;\n if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {\n addDomEventHandlers(this);\n this.autoTrackHandlersRegistered = true;\n logger.debug(\n \"autoTrackHandlersRegistered\",\n this.autoTrackHandlersRegistered\n );\n }\n }\n try {\n getJSONTrimmed(this, configUrl, writeKey, this.processResponse);\n } catch (error) {\n handleError(error);\n if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {\n addDomEventHandlers(instance);\n }\n }\n }\n\n ready(callback) {\n if (typeof callback == \"function\") {\n this.readyCallback = callback;\n return;\n }\n logger.error(\"ready callback is not a function\");\n }\n\n initializeCallbacks() {\n Object.keys(this.methodToCallbackMapping).forEach(methodName => {\n if (this.methodToCallbackMapping.hasOwnProperty(methodName)) {\n this.on(methodName, () => {});\n }\n })\n }\n\n registerCallbacks(calledFromLoad) {\n\n if(!calledFromLoad) {\n Object.keys(this.methodToCallbackMapping).forEach(methodName => {\n if (this.methodToCallbackMapping.hasOwnProperty(methodName)) {\n if(!!window.rudderanalytics) {\n if (typeof window.rudderanalytics[\n this.methodToCallbackMapping[methodName]\n ] == \"function\") {\n this.clientSuppliedCallbacks[methodName] = window.rudderanalytics[this.methodToCallbackMapping[methodName]]\n }\n }\n // let callback = \n // ? typeof window.rudderanalytics[\n // this.methodToCallbackMapping[methodName]\n // ] == \"function\"\n // ? window.rudderanalytics[this.methodToCallbackMapping[methodName]]\n // : () => {}\n // : () => {};\n \n //logger.debug(\"registerCallbacks\", methodName, callback);\n \n //this.on(methodName, callback);\n }\n });\n }\n \n Object.keys(this.clientSuppliedCallbacks).forEach(methodName => {\n if(this.clientSuppliedCallbacks.hasOwnProperty(methodName)) {\n logger.debug(\"registerCallbacks\", methodName, this.clientSuppliedCallbacks[methodName]);\n this.on(methodName, this.clientSuppliedCallbacks[methodName]);\n }\n })\n }\n\n sendSampleRequest() {\n ScriptLoader(\"ad-block\", \"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\")\n }\n \n}\n\nlet instance = new Analytics();\n\nEmitter(instance);\n\nif (process.browser) {\n window.addEventListener(\n \"error\",\n (e) => {\n handleError(e, instance);\n },\n true\n );\n}\n\nif (process.browser) {\n // test for adblocker\n // instance.sendSampleRequest()\n \n // initialize supported callbacks\n instance.initializeCallbacks()\n\n // register supported callbacks\n instance.registerCallbacks(false);\n let eventsPushedAlready =\n !!window.rudderanalytics &&\n window.rudderanalytics.push == Array.prototype.push;\n\n let methodArg = window.rudderanalytics ? window.rudderanalytics[0] : [];\n if (methodArg.length > 0 && methodArg[0] == \"load\") {\n let method = methodArg[0];\n methodArg.shift();\n logger.debug(\"=====from init, calling method:: \", method);\n instance[method](...methodArg);\n }\n\n if (eventsPushedAlready) {\n for (let i = 1; i < window.rudderanalytics.length; i++) {\n instance.toBeProcessedArray.push(window.rudderanalytics[i]);\n }\n\n for (let i = 0; i < instance.toBeProcessedArray.length; i++) {\n let event = [...instance.toBeProcessedArray[i]];\n let method = event[0];\n event.shift();\n logger.debug(\"=====from init, calling method:: \", method);\n instance[method](...event);\n }\n instance.toBeProcessedArray = [];\n }\n}\n\nlet ready = instance.ready.bind(instance);\nlet identify = instance.identify.bind(instance);\nlet page = instance.page.bind(instance);\nlet track = instance.track.bind(instance);\nlet alias = instance.alias.bind(instance);\nlet group = instance.group.bind(instance);\nlet reset = instance.reset.bind(instance);\nlet load = instance.load.bind(instance);\nlet initialized = (instance.initialized = true);\nlet getAnonymousId = instance.getAnonymousId.bind(instance);\nlet setAnonymousId = instance.setAnonymousId.bind(instance);\n\nexport {\n initialized,\n ready,\n page,\n track,\n load,\n identify,\n reset,\n alias,\n group,\n getAnonymousId,\n setAnonymousId\n};\n"],"names":["LOG_LEVEL","logger","logLevel","toUpperCase","console","debug","arguments","error","commonNames","clientToServerNames","replacer","key","value","generateUUID","d","Date","getTime","performance","now","replace","c","r","Math","random","floor","toString","getCurrentTimeFormatted","toISOString","handleError","analyticsInstance","errorMessage","message","undefined","sampleAdBlockTest","Event","target","localName","src","id","includes","page","path","title","sendAdblockPageOptions","e","getDefaultPageProperties","canonicalUrl","getCanonicalUrl","pathname","window","location","referrer","document","search","url","indexOf","href","hashIndex","slice","getUrl","tag","tags","getElementsByTagName","i","getAttribute","getRevenue","properties","eventName","revenue","match","total","val","parseFloat","isNaN","getCurrency","tranformToRudderNames","integrationObject","Object","keys","forEach","hasOwnProperty","findAllEnabledDestinations","sdkSuppliedIntegrations","configPlaneEnabledIntegrations","enabledList","length","allValue","intg","intgValue","push","_typeof","name","MessageType","TRACK","PAGE","IDENTIFY","ECommerceEvents","PRODUCTS_SEARCHED","PRODUCT_LIST_VIEWED","PRODUCT_LIST_FILTERED","PROMOTION_VIEWED","PROMOTION_CLICKED","PRODUCT_CLICKED","PRODUCT_VIEWED","PRODUCT_ADDED","PRODUCT_REMOVED","CART_VIEWED","CHECKOUT_STARTED","CHECKOUT_STEP_VIEWED","CHECKOUT_STEP_COMPLETED","PAYMENT_INFO_ENTERED","ORDER_UPDATED","ORDER_COMPLETED","ORDER_REFUNDED","ORDER_CANCELLED","COUPON_ENTERED","COUPON_APPLIED","COUPON_DENIED","COUPON_REMOVED","PRODUCT_ADDED_TO_WISHLIST","PRODUCT_REMOVED_FROM_WISHLIST","WISH_LIST_PRODUCT_ADDED_TO_CART","PRODUCT_SHARED","CART_SHARED","PRODUCT_REVIEWED","ScriptLoader","js","createElement","async","type","parentNode","insertBefore","config","hubId","hubID","this","rudderElement","traits","context","traitsValue","k","getOwnPropertyDescriptor","hubspotkey","call","userProperties","user_properties","_hsq","eventValue","event","Array","prototype","clone","obj","t","nodeType","_isBuffer","constructor","isBuffer","valueOf","apply","copy","l","flags","multiline","global","ignoreCase","RegExp","source","s","m","h","options","str","exec","n","toLowerCase","parse","long","ms","plural","round","short","ceil","exports","module","namespace","disabled","enabled","self","curr","prevTime","diff","prev","useColors","color","selectColor","args","coerce","concat","index","format","formatter","formatters","splice","formatArgs","logFn","log","bind","fn","Error","stack","enable","namespaces","save","split","len","skips","substr","names","test","require$$0","prevColor","colors","load","storage","Function","humanize","lastC","removeItem","documentElement","style","firebug","exception","table","navigator","userAgent","parseInt","$1","chrome","local","localStorage","localstorage","j","v","JSON","stringify","set","get","all","encode","maxage","expires","domain","toUTCString","samesite","secure","cookie","err","pair","pairs","decode","encodeURIComponent","decodeURIComponent","max","count","collection","toDrop","Number","resultsLength","results","has","objToString","isObject","Boolean","isPlainObject","shallowCombiner","deepCombiner","defaultsDeep","defaultsWith","combiner","sources","drop","rest","objectTypes","function","object","freeExports","root","freeGlobal","runInContext","String","SyntaxError","TypeError","nativeJSON","objectProto","getClass","isProperty","attempt","func","errorFunc","isExtended","isSupported","serialized","stringifySupported","toJSON","a","parseSupported","getUTCFullYear","getUTCMonth","getUTCDate","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","charIndexBuggy","forOwn","callback","Properties","dontEnums","property","size","isConstructor","isFunction","hasProperty","Escapes","92","34","8","12","10","13","9","toPaddedString","width","serializeDate","getData","year","month","date","time","hours","minutes","seconds","milliseconds","Months","getDay","dateToJSON","nativeStringify","filter","nativeToJSON","result","escapeChar","character","charCode","charCodeAt","escaped","reEscape","quote","lastIndex","serialize","whitespace","indentation","className","element","prefix","join","pop","Index","Source","fromCharCode","Unescapes","47","98","116","110","102","114","abort","lex","begin","position","isSigned","charAt","temp","hasMembers","update","walk","previousJSON","JSON3","isRestored","noConflict","port","protocol","host","hash","hostname","query","isAbsolute","levels","opts","parts","last","Cookie","_options","topDomain","defaults","remove","json","store","win","doc","version","defaultVal","clear","transact","transactionFn","getAll","ret","deserialize","isLocalStorageNameSupported","setItem","getItem","addBehavior","storageOwner","storageContainer","ActiveXObject","open","write","close","w","frames","body","withIEStorage","storeFunction","unshift","appendChild","removeChild","forbiddenCharsRegex","ieKeyFix","setAttribute","removeAttribute","attributes","XMLDocument","attr","testKey","Store","trackingID","allowLinker","o","g","q","ga","userId","Storage","getUserId","anonymousId","eventCategory","eventAction","eventLabel","category","label","hitType","gaplugins","siteId","siteID","_ready","hotjarSiteId","hj","_hjSettings","hjid","hjsv","conversionId","conversionID","pageLoadConversions","clickEventConversions","defaultPageConversion","dataLayer","gtag","conversionData","getConversionData","conversionLabel","sendToValue","send_to","eventTypeConversions","eventTypeConversion","VWO","analytics","accountId","settingsTolerance","isSPA","libraryTolerance","useExistingJquery","sendExperimentTrack","sendExperimentIdentify","account_id","settings_tolerance","library_tolerance","use_existing_jquery","_vwo_code","f","finish","getElementById","finished","b","innerText","onerror","init","settings_timer","setTimeout","styleSheet","cssText","createTextNode","URL","_vwo_settings_timer","experimentViewedIdentify","experimentViewed","data","expId","variationId","_vwo_exp","comb_n","_this","track","experimentId","variationName","identify","GoogleTagManager","containerID","rudderMessage","props","sendToGTMDatalayer","pageName","pageCategory","Braze","appKey","endPoint","dataCenter","dataCenterArr","trim","gender","appboy","ab","User","Genders","FEMALE","MALE","OTHER","p","P","y","appboyQueue","getUser","getCachedFeed","Feed","getCachedContentCards","ContentCards","initialize","enableLogging","baseUrl","display","automaticallyShowNewInAppMessages","changeUser","openSession","address","avatar","birthday","email","firstname","lastname","phone","setAvatarImageUrl","setEmail","setFirstName","setGender","formatGender","setLastName","setPhoneNumber","setCountry","country","setHomeCity","city","setDateOfBirth","setCustomUserAttribute","products","currencyCode","currency","del","product","productId","product_id","price","quantity","logPurchase","handlePurchase","handleReservedProperties","logCustomEvent","base64map","crypt","rotl","rotr","endian","randomBytes","bytes","bytesToWords","words","wordsToBytes","bytesToHex","hex","hexToBytes","bytesToBase64","base64","triplet","base64ToBytes","imod4","pow","charenc","utf8","stringToBytes","bin","unescape","bytesToString","escape","readFloatLE","isSlowBuffer","symbolValueOf","bigIntValueOf","require$$1","require$$2","md5","encoding","isArray","FF","_ff","GG","_gg","HH","_hh","II","_ii","aa","bb","cc","dd","x","_blocksize","_digestsize","digestbytes","asBytes","asString","INTERCOM","NAME","API_KEY","apiKey","APP_ID","appId","MOBILE_APP_ID","mobileAppId","intercomSettings","app_id","ic","Intercom","readyState","intercom_code","attachEvent","addEventListener","rawPayload","userHash","user_hash","hideDefaultLauncher","hide_default_launcher","field","companies","company","companyFields","user_id","event_name","created_at","originalTimestamp","Keen","projectID","writeKey","ipAddon","uaAddon","urlAddon","referrerAddon","client","check","setInterval","KeenTracking","projectId","initKeen","clearInterval","assign","user","getAddOn","extendEvents","recordEvent","addOns","ip_address","input","ip","output","user_agent","ua_string","page_url","referrer_url","keen","addons","objProto","owns","toStr","Symbol","BigInt","isActualNaN","NON_HOST_TYPES","boolean","number","string","base64Regex","hexRegex","is","defined","empty","equal","other","hosted","instance","nil","undef","isStandardArguments","isOldArguments","array","arraylike","callee","bool","isFinite","valid","HTMLElement","alert","infinite","Infinity","decimal","divisibleBy","isDividendInfinite","isDivisorInfinite","isNonZeroNumber","integer","maximum","others","minimum","nan","even","odd","ge","gt","le","lt","within","start","primitive","regexp","symbol","bigint","expr","dest","multiple","normalize","normalizer","defaultNormalize","loop","normalizedKey","child","globals","arr","unique","_","prefixed","map","toFunction","defaultToFunction","objectToFunction","prop","stripNested","re","$0","ctx","Kissmetrics","prefixProperties","_kmq","_kmk","_kms","u","isEnvMobile","toUnixTimestamp","nestedObj","flattenedObj","flatten","safe","extend","delimiter","maxDepth","currentDepth","step","isarray","isobject","newKey","each","clean","timestamp","iterator","item","_t","_d","KM","previousId","groupId","groupTraits","CustomerIO","_cio","callbacks","interval","Chartbeat","_sf_async_config","useCanonical","uid","isVideo","video","sendNameAndCategoryAsTitle","subscriberEngagementKeys","replayEvents","failed","isFirstPageCallMade","loadConfig","isLoaded","pSUPERFLY","virtualPage","initAfterPage","author","sections","authors","_cbq","script","_isReady","then","Promise","resolve","_this2","emit","pause","Comscore","c2ID","comScoreBeaconParam","comScoreParams","COMSCORE","beacon","mapComscoreParams","_comscore","el","comScoreBeaconParamsMap","c1","c2","hop","strCharAt","indexKeys","pred","isArrayLike","objectKeys","isNumber","arrayEach","baseEach","ks","FBPixel","blacklistPiiProperties","categoryToContent","pixelId","eventsToEvents","eventCustomProperties","valueFieldIdentifier","advancedMapping","traitKeyToExternalId","legacyConversionPixelId","userIdAsPixelId","whitelistPiiProperties","_fbq","fbq","callMethod","queue","loaded","disablePushState","allowDuplicatePageViews","formatRevenue","payload","buildPayLoad","standardTo","legacyTo","standard","legacy","reduce","filtered","from","to","eventID","messageId","contents","customProperties","contentIds","contentType","merge","content_ids","content_type","getContentType","useValue","sku","content_name","product_name","content_category","item_price","pId","content","num_items","search_string","contentCategory","defaultValue","mappedTo","mapped","obj1","obj2","res","propObj1","propObj2","toFixed","isStandardEvent","dateFields","defaultPiiProperties","customPiiProperties","configuration","blacklistPiiHash","toISOTring","sha256","isPropertyPii","isProperyWhiteListed","lotameStorage","integrations","HS","HubSpot","GA","HOTJAR","Hotjar","GOOGLEADS","GoogleAds","GTM","BRAZE","KEEN","KISSMETRICS","CUSTOMERIO","CHARTBEAT","FACEBOOK_PIXEL","LOTAME","LotameStorage","bcpUrlSettingsPixel","bcpUrlSettingsIframe","dspUrlSettingsPixel","dspUrlSettingsIframe","mappings","mapping","LOTAME_SYNCH_CALLBACK","height","image","iframe","currentTime","urlSettings","dspUrl","compileUrl","dspUrlTemplate","addPixel","addIFrame","setLotameSynchTime","methodToCallbackMapping","destination","regex","syncPixel","bcpUrl","_this3","bcpUrlTemplate","isPixelToBeSynched","lastSynchedTime","getLotameSynchTime","RudderApp","build","RudderLibraryInfo","RudderOSInfo","RudderScreenInfo","density","RudderContext","app","library","os","screen","devicePixelRatio","locale","language","browserLanguage","device","network","RudderMessage","channel","action","messageType","values","checkForKey","SCREEN","propertyName","RudderElement","rudderProperty","rudderUserProperty","RudderElementBuilder","inputRudderProperty","rudderPropertyBuilder","inputRudderUserProperty","rudderUserPropertyBuilder","eventType","setUserId","setType","setEventName","setProperty","setUserProperty","RudderPayload","batch","getRandomValues","crypto","msCrypto","rnds8","Uint8Array","rnds","byteToHex","_nodeId","_clockseq","buf","offset","bth","_lastMSecs","_lastNSecs","node","clockseq","seedBytes","rng","msecs","nsecs","dt","tl","tmh","bytesToUuid","ii","uuid","v4","v1","inMemoryStore","_data","isSupportedNatively","defaultEngine","inMemoryEngine","optionalEngine","engine","compoundKey","_createValidKey","quotaExceeded","code","isQuotaExceeded","_swapEngine","defaultClock","clearTimeout","clock","Schedule","tasks","nextId","run","task","timeout","_handle","cancel","cancelAll","setClock","newClock","resetClock","fmt","disable","Emitter","mixin","on","_callbacks","once","off","removeListener","removeAllListeners","removeEventListener","cb","listeners","hasListeners","Queue","maxItems","maxAttempts","backoff","MIN_RETRY_DELAY","minRetryDelay","MAX_RETRY_DELAY","maxRetryDelay","FACTOR","backoffFactor","JITTER","backoffJitter","timeouts","ACK_TIMER","RECLAIM_TIMER","RECLAIM_TIMEOUT","RECLAIM_WAIT","IN_PROGRESS","QUEUE","ACK","RECLAIM_START","RECLAIM_END","_schedule","_processId","_store","_ack","_checkReclaim","_processHead","_running","stop","shouldRetry","attemptNumber","getDelay","rand","deviation","min","toPrecision","addItem","_enqueue","requeue","entry","sort","inProgress","toRun","enqueue","done","inProgressSize","shift","_reclaim","tryReclaim","findOtherQueues","our","their","queueOptions","eventRepository","eventsBuffer","state","batchSize","payloadQueue","sentAt","processQueueElement","headers","repo","eventsPayload","xhr","XMLHttpRequest","setRequestHeader","btoa","onreadystatechange","status","send","queueFn","ontimeout","statusText","getElementContent","Authorization","AnonymousId","addDomEventHandlers","rudderanalytics","handler","srcElement","isTextNode","shouldTrackDomEvent","formValues","tagName","elements","formElement","isElToBeTracked","isElValueToBeTracked","trackValues","getElementsByName","checked","targetElementList","curEl","isTag","elementsJson","explicitNoTrack","shouldTrackEl","shouldTrackElement","elem","classes","getClassName","tag_name","attrLength","nthChild","nthOfType","currentElem","previousElementSibling","getPropertiesFromElement","elementText","text","childNodes","Node","TEXT_NODE","nodeValue","getText","event_type","el_attr_href","el_text","trackWindowEvent","register_event","useCapture","isElementNode","baseVal","includeList","elAttributesLength","previousSibling","err_cb","bail","noop","proxy","EventRepository","autoTrackHandlersRegistered","autoTrackFeatureEnabled","initialized","clientIntegrations","loadOnlyIntegrations","clientIntegrationObjects","successfullyLoadedIntegration","failedToBeLoadedIntegration","toBeProcessedArray","toBeProcessedByIntegrationArray","userTraits","getUserTraits","getGroupId","getGroupTraits","getAnonymousId","sendAdblockPage","clientSuppliedCallbacks","readyCallback","executeReadyCallback","response","useAutoTracking","destinations","destinationDefinition","useNativeSDK","intgArray","intgInstance","intgClass","isInitialized","after","methodName","succesfulLoadedIntersectClientSuppliedIntegrations","sendSampleRequest","processPage","processTrack","processIdentify","processAndSendDataToDestinations","setGroupId","setGroupTraits","getPageProperties","trackPage","trackEvent","reset","setUserTraits","identifyUser","setAnonymousId","processOptionsParam","toplevelElements","defaultPageProperties","serverUrl","configUrl","tranformedCallbackMapping","registerCallbacks","valTrackingList","cb_","onload","responseText","getJSONTrimmed","processResponse","_this4","calledFromLoad","_this5","initializeCallbacks","eventsPushedAlready","methodArg","method","ready","alias","group"],"mappings":"g/DAAA,IAIIA,EADkB,EAGlBC,EAEc,SAASC,UACZA,EAASC,mBACP,mBACDH,EAXK,OAaJ,oBACDA,EAbM,OAeL,mBACDA,EAfK,KAIjBC,EAsBQ,iBACDD,GA5BW,MA6BVI,SAAQC,cAASC,YAxBzBL,EAkCQ,iBACDD,GAtCW,MAuCVI,SAAQG,cAASD,YCxCzBE,EAAc,KACV,yBACa,qBACD,QACb,kBACQ,sBACD,sBACA,kBACJ,cACA,kBACI,sBACA,qBACD,oBACA,sBACE,2BACC,wBACH,kCACM,0BACN,sCACU,uBACf,aACG,gBACA,gBACA,iBACC,aACA,cACC,oBACA,gBACJ,iBACG,YACH,mBACO,0BACA,qBACL,gBACA,oCACkB,UACrB,OCpCJC,EAAsB,KACf,SACD,6BACO,mBACJ,kBACI,qBACD,sBACE,6BACI,qBACX,4BACG,YACJ,mBACM,gBACJ,mBACO,sBACL,aACH,OCIX,SAASC,EAASC,EAAKC,UACjBA,MAAAA,SAGKA,EASX,SAASC,QAEHC,GAAI,IAAIC,MAAOC,gBAEM,oBAAhBC,aACoB,mBAApBA,YAAYC,MAEnBJ,GAAKG,YAAYC,OAEZ,uCAAuCC,QAAQ,SAAS,SAASC,OAClEC,GAAKP,EAAoB,GAAhBQ,KAAKC,UAAiB,GAAK,SACxCT,EAAIQ,KAAKE,MAAMV,EAAI,KACL,MAANM,EAAYC,EAAS,EAAJA,EAAW,GAAKI,SAAS,OAStD,SAASC,WACW,IAAIX,MAAOY,cAiF/B,SAASC,EAAYrB,EAAOsB,OACtBC,EAAevB,EAAMwB,QAAUxB,EAAMwB,aAAUC,EAC/CC,OAAoBD,MAElBzB,aAAiB2B,OACf3B,EAAM4B,QAAoC,UAA1B5B,EAA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S0jB,MAAMjkC,KAAKugB,IAC5B2jB,GAAQ3jB,GAAS2jB,MAAMlkC,KAAKugB,IAC5BiiB,GAAQjiB,GAASiiB,MAAMxiC,KAAKugB,IAC5Bvf,GAAOuf,GAASvf,KAAKhB,KAAKugB,IAC1B0f,GAAe1f,GAAS0f,aAAc,EACtCY,GAAiBtgB,GAASsgB,eAAe7gC,KAAKugB,IAC9CoiB,GAAiBpiB,GAASoiB,eAAe3iC,KAAKugB"} \ No newline at end of file +{"version":3,"file":"rudder-analytics.min.js","sources":["../node_modules/component-emitter/index.js","../node_modules/after/index.js","../node_modules/trim/index.js","../node_modules/component-querystring/index.js","../node_modules/component-querystring/node_modules/component-type/index.js","../node_modules/component-url/index.js","../utils/logUtil.js","../integrations/integration_cname.js","../integrations/client_server_name.js","../utils/constants.js","../utils/utils.js","../integrations/ScriptLoader.js","../node_modules/is/index.js","../integrations/HubSpot/browser.js","../node_modules/to-function/index.js","../node_modules/component-each/node_modules/component-type/index.js","../node_modules/component-props/index.js","../node_modules/component-each/index.js","../integrations/GA/browser.js","../integrations/Hotjar/browser.js","../integrations/GoogleAds/browser.js","../integrations/VWO/browser.js","../integrations/GoogleTagManager/browser.js","../integrations/Braze/browser.js","../node_modules/crypt/crypt.js","../node_modules/charenc/charenc.js","../node_modules/is-buffer/index.js","../node_modules/md5/md5.js","../integrations/INTERCOM/browser.js","../integrations/Keen/browser.js","../node_modules/@ndhoule/extend/index.js","../node_modules/obj-case/index.js","../integrations/Kissmetrics/browser.js","../integrations/CustomerIO/browser.js","../node_modules/on-body/index.js","../integrations/Chartbeat/browser.js","../integrations/Comscore/browser.js","../node_modules/@ndhoule/keys/index.js","../node_modules/@ndhoule/each/index.js","../integrations/FacebookPixel/browser.js","../node_modules/crypto-js/core.js","../node_modules/crypto-js/enc-base64.js","../node_modules/crypto-js/md5.js","../node_modules/crypto-js/sha1.js","../node_modules/crypto-js/hmac.js","../node_modules/crypto-js/evpkdf.js","../node_modules/crypto-js/cipher-core.js","../node_modules/crypto-js/aes.js","../node_modules/crypto-js/enc-utf8.js","../node_modules/component-type/index.js","../node_modules/@ndhoule/clone/index.js","../node_modules/ms/index.js","../node_modules/rudder-component-cookie/node_modules/debug/debug.js","../node_modules/rudder-component-cookie/node_modules/debug/browser.js","../node_modules/rudder-component-cookie/index.js","../node_modules/@ndhoule/drop/index.js","../node_modules/@ndhoule/rest/index.js","../node_modules/@ndhoule/defaults/index.js","../node_modules/json3/lib/json3.js","../node_modules/component-cookie/node_modules/debug/debug.js","../node_modules/component-cookie/node_modules/debug/browser.js","../node_modules/component-cookie/index.js","../node_modules/@segment/top-domain/lib/index.js","../utils/storage/cookie.js","../node_modules/@segment/store/src/store.js","../utils/storage/store.js","../utils/storage/storage.js","../utils/storage/index.js","../integrations/Lotame/LotameStorage.js","../integrations/Lotame/browser.js","../integrations/Optimizely/browser.js","../integrations/Bugsnag/browser.js","../node_modules/camelcase/index.js","../node_modules/uuid/lib/bytesToUuid.js","../integrations/index.js","../integrations/Fullstory/browser.js","../integrations/TVSquared/browser.js","../utils/RudderApp.js","../utils/RudderInfo.js","../utils/RudderContext.js","../utils/RudderMessage.js","../utils/RudderElement.js","../utils/RudderElementBuilder.js","../node_modules/uuid/lib/rng-browser.js","../node_modules/uuid/v1.js","../node_modules/uuid/v4.js","../node_modules/uuid/index.js","../node_modules/@segment/localstorage-retry/lib/engine.js","../node_modules/@segment/localstorage-retry/lib/store.js","../node_modules/@segment/localstorage-retry/lib/schedule.js","../node_modules/debug/debug.js","../node_modules/@segment/localstorage-retry/lib/index.js","../utils/RudderPayload.js","../utils/EventRepository.js","../utils/autotrack.js","../analytics.js"],"sourcesContent":["\n/**\n * Expose `Emitter`.\n */\n\nif (typeof module !== 'undefined') {\n module.exports = Emitter;\n}\n\n/**\n * Initialize a new `Emitter`.\n *\n * @api public\n */\n\nfunction Emitter(obj) {\n if (obj) return mixin(obj);\n};\n\n/**\n * Mixin the emitter properties.\n *\n * @param {Object} obj\n * @return {Object}\n * @api private\n */\n\nfunction mixin(obj) {\n for (var key in Emitter.prototype) {\n obj[key] = Emitter.prototype[key];\n }\n return obj;\n}\n\n/**\n * Listen on the given `event` with `fn`.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.on =\nEmitter.prototype.addEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n (this._callbacks['$' + event] = this._callbacks['$' + event] || [])\n .push(fn);\n return this;\n};\n\n/**\n * Adds an `event` listener that will be invoked a single\n * time then automatically removed.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.once = function(event, fn){\n function on() {\n this.off(event, on);\n fn.apply(this, arguments);\n }\n\n on.fn = fn;\n this.on(event, on);\n return this;\n};\n\n/**\n * Remove the given callback for `event` or all\n * registered callbacks.\n *\n * @param {String} event\n * @param {Function} fn\n * @return {Emitter}\n * @api public\n */\n\nEmitter.prototype.off =\nEmitter.prototype.removeListener =\nEmitter.prototype.removeAllListeners =\nEmitter.prototype.removeEventListener = function(event, fn){\n this._callbacks = this._callbacks || {};\n\n // all\n if (0 == arguments.length) {\n this._callbacks = {};\n return this;\n }\n\n // specific event\n var callbacks = this._callbacks['$' + event];\n if (!callbacks) return this;\n\n // remove all handlers\n if (1 == arguments.length) {\n delete this._callbacks['$' + event];\n return this;\n }\n\n // remove specific handler\n var cb;\n for (var i = 0; i < callbacks.length; i++) {\n cb = callbacks[i];\n if (cb === fn || cb.fn === fn) {\n callbacks.splice(i, 1);\n break;\n }\n }\n\n // Remove event specific arrays for event types that no\n // one is subscribed for to avoid memory leak.\n if (callbacks.length === 0) {\n delete this._callbacks['$' + event];\n }\n\n return this;\n};\n\n/**\n * Emit `event` with the given args.\n *\n * @param {String} event\n * @param {Mixed} ...\n * @return {Emitter}\n */\n\nEmitter.prototype.emit = function(event){\n this._callbacks = this._callbacks || {};\n\n var args = new Array(arguments.length - 1)\n , callbacks = this._callbacks['$' + event];\n\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n\n if (callbacks) {\n callbacks = callbacks.slice(0);\n for (var i = 0, len = callbacks.length; i < len; ++i) {\n callbacks[i].apply(this, args);\n }\n }\n\n return this;\n};\n\n/**\n * Return array of callbacks for `event`.\n *\n * @param {String} event\n * @return {Array}\n * @api public\n */\n\nEmitter.prototype.listeners = function(event){\n this._callbacks = this._callbacks || {};\n return this._callbacks['$' + event] || [];\n};\n\n/**\n * Check if this emitter has `event` handlers.\n *\n * @param {String} event\n * @return {Boolean}\n * @api public\n */\n\nEmitter.prototype.hasListeners = function(event){\n return !! this.listeners(event).length;\n};\n","module.exports = after\n\nfunction after(count, callback, err_cb) {\n var bail = false\n err_cb = err_cb || noop\n proxy.count = count\n\n return (count === 0) ? callback() : proxy\n\n function proxy(err, result) {\n if (proxy.count <= 0) {\n throw new Error('after called too many times')\n }\n --proxy.count\n\n // after first error, rest are passed to err_cb\n if (err) {\n bail = true\n callback(err)\n // future error callbacks will go to error handler\n callback = err_cb\n } else if (proxy.count === 0 && !bail) {\n callback(null, result)\n }\n }\n}\n\nfunction noop() {}\n","\nexports = module.exports = trim;\n\nfunction trim(str){\n return str.replace(/^\\s*|\\s*$/g, '');\n}\n\nexports.left = function(str){\n return str.replace(/^\\s*/, '');\n};\n\nexports.right = function(str){\n return str.replace(/\\s*$/, '');\n};\n","\n/**\n * Module dependencies.\n */\n\nvar trim = require('trim');\nvar type = require('type');\n\nvar pattern = /(\\w+)\\[(\\d+)\\]/\n\n/**\n * Safely encode the given string\n * \n * @param {String} str\n * @return {String}\n * @api private\n */\n\nvar encode = function(str) {\n try {\n return encodeURIComponent(str);\n } catch (e) {\n return str;\n }\n};\n\n/**\n * Safely decode the string\n * \n * @param {String} str\n * @return {String}\n * @api private\n */\n\nvar decode = function(str) {\n try {\n return decodeURIComponent(str.replace(/\\+/g, ' '));\n } catch (e) {\n return str;\n }\n}\n\n/**\n * Parse the given query `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api public\n */\n\nexports.parse = function(str){\n if ('string' != typeof str) return {};\n\n str = trim(str);\n if ('' == str) return {};\n if ('?' == str.charAt(0)) str = str.slice(1);\n\n var obj = {};\n var pairs = str.split('&');\n for (var i = 0; i < pairs.length; i++) {\n var parts = pairs[i].split('=');\n var key = decode(parts[0]);\n var m;\n\n if (m = pattern.exec(key)) {\n obj[m[1]] = obj[m[1]] || [];\n obj[m[1]][m[2]] = decode(parts[1]);\n continue;\n }\n\n obj[parts[0]] = null == parts[1]\n ? ''\n : decode(parts[1]);\n }\n\n return obj;\n};\n\n/**\n * Stringify the given `obj`.\n *\n * @param {Object} obj\n * @return {String}\n * @api public\n */\n\nexports.stringify = function(obj){\n if (!obj) return '';\n var pairs = [];\n\n for (var key in obj) {\n var value = obj[key];\n\n if ('array' == type(value)) {\n for (var i = 0; i < value.length; ++i) {\n pairs.push(encode(key + '[' + i + ']') + '=' + encode(value[i]));\n }\n continue;\n }\n\n pairs.push(encode(key) + '=' + encode(obj[key]));\n }\n\n return pairs.join('&');\n};\n","/**\n * toString ref.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n *\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nmodule.exports = function(val){\n switch (toString.call(val)) {\n case '[object Date]': return 'date';\n case '[object RegExp]': return 'regexp';\n case '[object Arguments]': return 'arguments';\n case '[object Array]': return 'array';\n case '[object Error]': return 'error';\n }\n\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (val !== val) return 'nan';\n if (val && val.nodeType === 1) return 'element';\n\n val = val.valueOf\n ? val.valueOf()\n : Object.prototype.valueOf.apply(val)\n\n return typeof val;\n};\n","\n/**\n * Parse the given `url`.\n *\n * @param {String} str\n * @return {Object}\n * @api public\n */\n\nexports.parse = function(url){\n var a = document.createElement('a');\n a.href = url;\n return {\n href: a.href,\n host: a.host || location.host,\n port: ('0' === a.port || '' === a.port) ? port(a.protocol) : a.port,\n hash: a.hash,\n hostname: a.hostname || location.hostname,\n pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname,\n protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol,\n search: a.search,\n query: a.search.slice(1)\n };\n};\n\n/**\n * Check if `url` is absolute.\n *\n * @param {String} url\n * @return {Boolean}\n * @api public\n */\n\nexports.isAbsolute = function(url){\n return 0 == url.indexOf('//') || !!~url.indexOf('://');\n};\n\n/**\n * Check if `url` is relative.\n *\n * @param {String} url\n * @return {Boolean}\n * @api public\n */\n\nexports.isRelative = function(url){\n return !exports.isAbsolute(url);\n};\n\n/**\n * Check if `url` is cross domain.\n *\n * @param {String} url\n * @return {Boolean}\n * @api public\n */\n\nexports.isCrossDomain = function(url){\n url = exports.parse(url);\n var location = exports.parse(window.location.href);\n return url.hostname !== location.hostname\n || url.port !== location.port\n || url.protocol !== location.protocol;\n};\n\n/**\n * Return default port for `protocol`.\n *\n * @param {String} protocol\n * @return {String}\n * @api private\n */\nfunction port (protocol){\n switch (protocol) {\n case 'http:':\n return 80;\n case 'https:':\n return 443;\n default:\n return location.port;\n }\n}\n","const LOG_LEVEL_INFO = 1;\nconst LOG_LEVEL_DEBUG = 2;\nconst LOG_LEVEL_WARN = 3;\nconst LOG_LEVEL_ERROR = 4;\nlet LOG_LEVEL = LOG_LEVEL_ERROR;\n\nconst logger = {\n setLogLevel(logLevel) {\n switch (logLevel.toUpperCase()) {\n case \"INFO\":\n LOG_LEVEL = LOG_LEVEL_INFO;\n return;\n case \"DEBUG\":\n LOG_LEVEL = LOG_LEVEL_DEBUG;\n return;\n case \"WARN\":\n LOG_LEVEL = LOG_LEVEL_WARN;\n }\n },\n\n info() {\n if (LOG_LEVEL <= LOG_LEVEL_INFO) {\n console.log(...arguments);\n }\n },\n\n debug() {\n if (LOG_LEVEL <= LOG_LEVEL_DEBUG) {\n console.log(...arguments);\n }\n },\n\n warn() {\n if (LOG_LEVEL <= LOG_LEVEL_WARN) {\n console.log(...arguments);\n }\n },\n\n error() {\n if (LOG_LEVEL <= LOG_LEVEL_ERROR) {\n console.log(...arguments);\n }\n },\n};\nexport default logger;\n","// for sdk side native integration identification\n// add a mapping from common names to index.js exported key names as identified by Rudder\nconst commonNames = {\n All: \"All\",\n \"Google Analytics\": \"GA\",\n GoogleAnalytics: \"GA\",\n GA: \"GA\",\n \"Google Ads\": \"GOOGLEADS\",\n GoogleAds: \"GOOGLEADS\",\n GOOGLEADS: \"GOOGLEADS\",\n Braze: \"BRAZE\",\n BRAZE: \"BRAZE\",\n Chartbeat: \"CHARTBEAT\",\n CHARTBEAT: \"CHARTBEAT\",\n Comscore: \"COMSCORE\",\n COMSCORE: \"COMSCORE\",\n Customerio: \"CUSTOMERIO\",\n \"Customer.io\": \"CUSTOMERIO\",\n \"FB Pixel\": \"FACEBOOK_PIXEL\",\n \"Facebook Pixel\": \"FACEBOOK_PIXEL\",\n FB_PIXEL: \"FACEBOOK_PIXEL\",\n \"Google Tag Manager\": \"GOOGLETAGMANAGER\",\n GTM: \"GTM\",\n Hotjar: \"HOTJAR\",\n hotjar: \"HOTJAR\",\n HOTJAR: \"HOTJAR\",\n Hubspot: \"HS\",\n HUBSPOT: \"HS\",\n Intercom: \"INTERCOM\",\n INTERCOM: \"INTERCOM\",\n Keen: \"KEEN\",\n \"Keen.io\": \"KEEN\",\n KEEN: \"KEEN\",\n Kissmetrics: \"KISSMETRICS\",\n KISSMETRICS: \"KISSMETRICS\",\n Lotame: \"LOTAME\",\n LOTAME: \"LOTAME\",\n \"Visual Website Optimizer\": \"VWO\",\n VWO: \"VWO\",\n OPTIMIZELY: \"OPTIMIZELY\",\n Optimizely: \"OPTIMIZELY\",\n FULLSTORY: \"FULLSTORY\",\n Fullstory: \"FULLSTORY\",\n BUGSNAG: \"BUGSNAG\",\n TVSQUARED: \"TVSQUARED\",\n};\n\nexport { commonNames };\n","// from client native integration name to server identified display name\n// add a mapping from Rudder identified key names to Rudder server recognizable names\nconst clientToServerNames = {\n All: \"All\",\n GA: \"Google Analytics\",\n GOOGLEADS: \"Google Ads\",\n BRAZE: \"Braze\",\n CHARTBEAT: \"Chartbeat\",\n COMSCORE: \"Comscore\",\n CUSTOMERIO: \"Customer IO\",\n FACEBOOK_PIXEL: \"Facebook Pixel\",\n GTM: \"Google Tag Manager\",\n HOTJAR: \"Hotjar\",\n HS: \"HubSpot\",\n INTERCOM: \"Intercom\",\n KEEN: \"Keen\",\n KISSMETRICS: \"Kiss Metrics\",\n LOTAME: \"Lotame\",\n VWO: \"VWO\",\n OPTIMIZELY: \"Optimizely\",\n FULLSTORY: \"Fullstory\",\n TVSQUUARED: \"TVSquared\"\n};\n\nexport { clientToServerNames };\n","// Message Type enumeration\nconst MessageType = {\n TRACK: \"track\",\n PAGE: \"page\",\n // SCREEN: \"screen\",\n IDENTIFY: \"identify\",\n};\n\n// ECommerce Parameter Names Enumeration\nconst ECommerceParamNames = {\n QUERY: \"query\",\n PRICE: \"price\",\n PRODUCT_ID: \"product_id\",\n CATEGORY: \"category\",\n CURRENCY: \"currency\",\n LIST_ID: \"list_id\",\n PRODUCTS: \"products\",\n WISHLIST_ID: \"wishlist_id\",\n WISHLIST_NAME: \"wishlist_name\",\n QUANTITY: \"quantity\",\n CART_ID: \"cart_id\",\n CHECKOUT_ID: \"checkout_id\",\n TOTAL: \"total\",\n REVENUE: \"revenue\",\n ORDER_ID: \"order_id\",\n FILTERS: \"filters\",\n SORTS: \"sorts\",\n SHARE_VIA: \"share_via\",\n SHARE_MESSAGE: \"share_message\",\n RECIPIENT: \"recipient\",\n};\n// ECommerce Events Enumeration\nconst ECommerceEvents = {\n PRODUCTS_SEARCHED: \"Products Searched\",\n PRODUCT_LIST_VIEWED: \"Product List Viewed\",\n PRODUCT_LIST_FILTERED: \"Product List Filtered\",\n PROMOTION_VIEWED: \"Promotion Viewed\",\n PROMOTION_CLICKED: \"Promotion Clicked\",\n PRODUCT_CLICKED: \"Product Clicked\",\n PRODUCT_VIEWED: \"Product Viewed\",\n PRODUCT_ADDED: \"Product Added\",\n PRODUCT_REMOVED: \"Product Removed\",\n CART_VIEWED: \"Cart Viewed\",\n CHECKOUT_STARTED: \"Checkout Started\",\n CHECKOUT_STEP_VIEWED: \"Checkout Step Viewed\",\n CHECKOUT_STEP_COMPLETED: \"Checkout Step Completed\",\n PAYMENT_INFO_ENTERED: \"Payment Info Entered\",\n ORDER_UPDATED: \"Order Updated\",\n ORDER_COMPLETED: \"Order Completed\",\n ORDER_REFUNDED: \"Order Refunded\",\n ORDER_CANCELLED: \"Order Cancelled\",\n COUPON_ENTERED: \"Coupon Entered\",\n COUPON_APPLIED: \"Coupon Applied\",\n COUPON_DENIED: \"Coupon Denied\",\n COUPON_REMOVED: \"Coupon Removed\",\n PRODUCT_ADDED_TO_WISHLIST: \"Product Added to Wishlist\",\n PRODUCT_REMOVED_FROM_WISHLIST: \"Product Removed from Wishlist\",\n WISH_LIST_PRODUCT_ADDED_TO_CART: \"Wishlist Product Added to Cart\",\n PRODUCT_SHARED: \"Product Shared\",\n CART_SHARED: \"Cart Shared\",\n PRODUCT_REVIEWED: \"Product Reviewed\",\n};\n\n// Enumeration for integrations supported\nconst RudderIntegrationPlatform = {\n RUDDERLABS: \"rudderlabs\",\n GA: \"ga\",\n AMPLITUDE: \"amplitude\",\n};\n\nconst BASE_URL = \"https://hosted.rudderlabs.com\"; // default to RudderStack\nconst CONFIG_URL = \"https://api.rudderlabs.com/sourceConfig/?p=process.module_type&v=process.package_version\";\n\nconst FLUSH_QUEUE_SIZE = 30;\n\nconst FLUSH_INTERVAL_DEFAULT = 5000;\n\nconst MAX_WAIT_FOR_INTEGRATION_LOAD = 10000;\nconst INTEGRATION_LOAD_CHECK_INTERVAL = 1000;\n\nexport {\n MessageType,\n ECommerceParamNames,\n ECommerceEvents,\n RudderIntegrationPlatform,\n BASE_URL,\n CONFIG_URL,\n FLUSH_QUEUE_SIZE,\n FLUSH_INTERVAL_DEFAULT,\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL,\n};\n/* module.exports = {\n MessageType: MessageType,\n ECommerceParamNames: ECommerceParamNames,\n ECommerceEvents: ECommerceEvents,\n RudderIntegrationPlatform: RudderIntegrationPlatform,\n BASE_URL: BASE_URL,\n CONFIG_URL: CONFIG_URL,\n FLUSH_QUEUE_SIZE: FLUSH_QUEUE_SIZE\n}; */\n","// import * as XMLHttpRequestNode from \"Xmlhttprequest\";\nimport { parse } from \"component-url\";\nimport logger from \"./logUtil\";\nimport { commonNames } from \"../integrations/integration_cname\";\nimport { clientToServerNames } from \"../integrations/client_server_name\";\nimport { CONFIG_URL } from \"./constants\";\n\n/**\n *\n * Utility method for excluding null and empty values in JSON\n * @param {*} key\n * @param {*} value\n * @returns\n */\nfunction replacer(key, value) {\n if (value === null || value === undefined) {\n return undefined;\n }\n return value;\n}\n\n/**\n *\n * Utility function for UUID genration\n * @returns\n */\nfunction generateUUID() {\n // Public Domain/MIT\n let d = new Date().getTime();\n if (\n typeof performance !== \"undefined\" &&\n typeof performance.now === \"function\"\n ) {\n d += performance.now(); // use high-precision timer if available\n }\n return \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n const r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === \"x\" ? r : (r & 0x3) | 0x8).toString(16);\n });\n}\n\n/**\n *\n * Utility function to get current time (formatted) for including in sent_at field\n * @returns\n */\nfunction getCurrentTimeFormatted() {\n const curDateTime = new Date().toISOString();\n // Keeping same as iso string\n /* let curDate = curDateTime.split(\"T\")[0];\n let curTimeExceptMillis = curDateTime\n .split(\"T\")[1]\n .split(\"Z\")[0]\n .split(\".\")[0];\n let curTimeMillis = curDateTime.split(\"Z\")[0].split(\".\")[1];\n return curDate + \" \" + curTimeExceptMillis + \"+\" + curTimeMillis; */\n return curDateTime;\n}\n\n/**\n *\n * Utility function to retrieve configuration JSON from server\n * @param {*} url\n * @param {*} wrappers\n * @param {*} isLoaded\n * @param {*} callback\n */\nfunction getJSON(url, wrappers, isLoaded, callback) {\n // server-side integration, XHR is node module\n\n const xhr = new XMLHttpRequest();\n\n xhr.open(\"GET\", url, false);\n xhr.onload = function () {\n const { status } = xhr;\n if (status == 200) {\n logger.debug(\"status 200\");\n callback(null, xhr.responseText, wrappers, isLoaded);\n } else {\n callback(status);\n }\n };\n xhr.send();\n}\n\n/**\n *\n * Utility function to retrieve configuration JSON from server\n * @param {*} context\n * @param {*} url\n * @param {*} callback\n */\nfunction getJSONTrimmed(context, url, writeKey, callback) {\n // server-side integration, XHR is node module\n const cb_ = callback.bind(context);\n\n const xhr = new XMLHttpRequest();\n\n xhr.open(\"GET\", url, true);\n xhr.setRequestHeader(\"Authorization\", `Basic ${btoa(`${writeKey}:`)}`);\n\n xhr.onload = function () {\n const { status } = xhr;\n if (status == 200) {\n logger.debug(\"status 200 \" + \"calling callback\");\n cb_(200, xhr.responseText);\n } else {\n handleError(\n new Error(`request failed with status: ${xhr.status} for url: ${url}`)\n );\n cb_(status);\n }\n };\n xhr.send();\n}\n\nfunction handleError(error, analyticsInstance) {\n let errorMessage = error.message ? error.message : undefined;\n let sampleAdBlockTest;\n try {\n if (error instanceof Event) {\n if (error.target && error.target.localName == \"script\") {\n errorMessage = `error in script loading:: src:: ${error.target.src} id:: ${error.target.id}`;\n if (analyticsInstance && error.target.src.includes(\"adsbygoogle\")) {\n sampleAdBlockTest = true;\n analyticsInstance.page(\n \"RudderJS-Initiated\",\n \"ad-block page request\",\n { path: \"/ad-blocked\", title: errorMessage },\n analyticsInstance.sendAdblockPageOptions\n );\n }\n }\n }\n if (errorMessage && !sampleAdBlockTest) {\n logger.error(\"[Util] handleError:: \", errorMessage);\n }\n } catch (e) {\n logger.error(\"[Util] handleError:: \", e);\n }\n}\n\nfunction getDefaultPageProperties() {\n const canonicalUrl = getCanonicalUrl();\n const path = canonicalUrl\n ? parse(canonicalUrl).pathname\n : window.location.pathname;\n const { referrer } = document;\n const { search } = window.location;\n const { title } = document;\n const url = getUrl(search);\n\n return {\n path,\n referrer,\n search,\n title,\n url,\n };\n}\n\nfunction getUrl(search) {\n const canonicalUrl = getCanonicalUrl();\n const url = canonicalUrl\n ? canonicalUrl.indexOf(\"?\") > -1\n ? canonicalUrl\n : canonicalUrl + search\n : window.location.href;\n const hashIndex = url.indexOf(\"#\");\n return hashIndex > -1 ? url.slice(0, hashIndex) : url;\n}\n\nfunction getCanonicalUrl() {\n const tags = document.getElementsByTagName(\"link\");\n for (var i = 0, tag; (tag = tags[i]); i++) {\n if (tag.getAttribute(\"rel\") === \"canonical\") {\n return tag.getAttribute(\"href\");\n }\n }\n}\n\nfunction getCurrency(val) {\n if (!val) return;\n if (typeof val === \"number\") {\n return val;\n }\n if (typeof val !== \"string\") {\n return;\n }\n\n val = val.replace(/\\$/g, \"\");\n val = parseFloat(val);\n\n if (!isNaN(val)) {\n return val;\n }\n}\n\nfunction getRevenue(properties, eventName) {\n let { revenue } = properties;\n const orderCompletedRegExp = /^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;\n\n // it's always revenue, unless it's called during an order completion.\n if (!revenue && eventName && eventName.match(orderCompletedRegExp)) {\n revenue = properties.total;\n }\n\n return getCurrency(revenue);\n}\n\n/**\n *\n *\n * @param {*} integrationObject\n */\nfunction tranformToRudderNames(integrationObject) {\n Object.keys(integrationObject).forEach((key) => {\n if (integrationObject.hasOwnProperty(key)) {\n if (commonNames[key]) {\n integrationObject[commonNames[key]] = integrationObject[key];\n }\n if (key != \"All\") {\n // delete user supplied keys except All and if except those where oldkeys are not present or oldkeys are same as transformed keys\n if (commonNames[key] != undefined && commonNames[key] != key) {\n delete integrationObject[key];\n }\n }\n }\n });\n}\n\nfunction transformToServerNames(integrationObject) {\n Object.keys(integrationObject).forEach((key) => {\n if (integrationObject.hasOwnProperty(key)) {\n if (clientToServerNames[key]) {\n integrationObject[clientToServerNames[key]] = integrationObject[key];\n }\n if (key != \"All\") {\n // delete user supplied keys except All and if except those where oldkeys are not present or oldkeys are same as transformed keys\n if (\n clientToServerNames[key] != undefined &&\n clientToServerNames[key] != key\n ) {\n delete integrationObject[key];\n }\n }\n }\n });\n}\n\n/**\n *\n * @param {*} sdkSuppliedIntegrations\n * @param {*} configPlaneEnabledIntegrations\n */\nfunction findAllEnabledDestinations(\n sdkSuppliedIntegrations,\n configPlaneEnabledIntegrations\n) {\n const enabledList = [];\n if (\n !configPlaneEnabledIntegrations ||\n configPlaneEnabledIntegrations.length == 0\n ) {\n return enabledList;\n }\n let allValue = true;\n if (typeof configPlaneEnabledIntegrations[0] === \"string\") {\n if (sdkSuppliedIntegrations.All != undefined) {\n allValue = sdkSuppliedIntegrations.All;\n }\n configPlaneEnabledIntegrations.forEach((intg) => {\n if (!allValue) {\n // All false ==> check if intg true supplied\n if (\n sdkSuppliedIntegrations[intg] != undefined &&\n sdkSuppliedIntegrations[intg] == true\n ) {\n enabledList.push(intg);\n }\n } else {\n // All true ==> intg true by default\n let intgValue = true;\n // check if intg false supplied\n if (\n sdkSuppliedIntegrations[intg] != undefined &&\n sdkSuppliedIntegrations[intg] == false\n ) {\n intgValue = false;\n }\n if (intgValue) {\n enabledList.push(intg);\n }\n }\n });\n\n return enabledList;\n }\n\n if (typeof configPlaneEnabledIntegrations[0] === \"object\") {\n if (sdkSuppliedIntegrations.All != undefined) {\n allValue = sdkSuppliedIntegrations.All;\n }\n configPlaneEnabledIntegrations.forEach((intg) => {\n if (!allValue) {\n // All false ==> check if intg true supplied\n if (\n sdkSuppliedIntegrations[intg.name] != undefined &&\n sdkSuppliedIntegrations[intg.name] == true\n ) {\n enabledList.push(intg);\n }\n } else {\n // All true ==> intg true by default\n let intgValue = true;\n // check if intg false supplied\n if (\n sdkSuppliedIntegrations[intg.name] != undefined &&\n sdkSuppliedIntegrations[intg.name] == false\n ) {\n intgValue = false;\n }\n if (intgValue) {\n enabledList.push(intg);\n }\n }\n });\n\n return enabledList;\n }\n}\n\n/**\n * reject all null values from array/object\n * @param {} obj\n * @param {} fn\n */\nfunction rejectArr(obj, fn) {\n fn = fn || compact;\n return type(obj) == \"array\" ? rejectarray(obj, fn) : rejectobject(obj, fn);\n}\n\n/**\n * particular case when rejecting an array\n * @param {} arr\n * @param {} fn\n */\nvar rejectarray = function (arr, fn) {\n const ret = [];\n\n for (let i = 0; i < arr.length; ++i) {\n if (!fn(arr[i], i)) ret[ret.length] = arr[i];\n }\n\n return ret;\n};\n\n/**\n * Rejecting null from any object other than arrays\n * @param {} obj\n * @param {} fn\n *\n */\nvar rejectobject = function (obj, fn) {\n const ret = {};\n\n for (const k in obj) {\n if (obj.hasOwnProperty(k) && !fn(obj[k], k)) {\n ret[k] = obj[k];\n }\n }\n\n return ret;\n};\n\nfunction compact(value) {\n return value == null;\n}\n\n/**\n * check type of object incoming in the rejectArr function\n * @param {} val\n */\nfunction type(val) {\n switch (Object.prototype.toString.call(val)) {\n case \"[object Function]\":\n return \"function\";\n case \"[object Date]\":\n return \"date\";\n case \"[object RegExp]\":\n return \"regexp\";\n case \"[object Arguments]\":\n return \"arguments\";\n case \"[object Array]\":\n return \"array\";\n }\n\n if (val === null) return \"null\";\n if (val === undefined) return \"undefined\";\n if (val === Object(val)) return \"object\";\n\n return typeof val;\n}\n\nfunction getUserProvidedConfigUrl(configUrl) {\n let url = configUrl;\n if (configUrl.indexOf(\"sourceConfig\") == -1) {\n url = url.slice(-1) == \"/\" ? url.slice(0, -1) : url;\n url = `${url}/sourceConfig/`;\n }\n url = url.slice(-1) == \"/\" ? url : `${url}/`;\n if (url.indexOf(\"?\") > -1) {\n if (url.split(\"?\")[1] !== CONFIG_URL.split(\"?\")[1]) {\n url = `${url.split(\"?\")[0]}?${CONFIG_URL.split(\"?\")[1]}`;\n }\n } else {\n url = `${url}?${CONFIG_URL.split(\"?\")[1]}`;\n }\n return url;\n}\n\nexport {\n replacer,\n generateUUID,\n getCurrentTimeFormatted,\n getJSONTrimmed,\n getJSON,\n getRevenue,\n getDefaultPageProperties,\n getUserProvidedConfigUrl,\n findAllEnabledDestinations,\n tranformToRudderNames,\n transformToServerNames,\n handleError,\n rejectArr,\n};\n","import logger from \"../utils/logUtil\";\n\nconst ScriptLoader = (id, src) => {\n logger.debug(`in script loader=== ${id}`);\n const js = document.createElement(\"script\");\n js.src = src;\n js.async = true;\n js.type = \"text/javascript\";\n js.id = id;\n const e = document.getElementsByTagName(\"script\")[0];\n logger.debug(\"==script==\", e);\n e.parentNode.insertBefore(js, e);\n};\n\nexport default ScriptLoader;\n","/* globals window, HTMLElement */\n\n'use strict';\n\n/**!\n * is\n * the definitive JavaScript type testing library\n *\n * @copyright 2013-2014 Enrico Marino / Jordan Harband\n * @license MIT\n */\n\nvar objProto = Object.prototype;\nvar owns = objProto.hasOwnProperty;\nvar toStr = objProto.toString;\nvar symbolValueOf;\nif (typeof Symbol === 'function') {\n symbolValueOf = Symbol.prototype.valueOf;\n}\nvar bigIntValueOf;\nif (typeof BigInt === 'function') {\n bigIntValueOf = BigInt.prototype.valueOf;\n}\nvar isActualNaN = function (value) {\n return value !== value;\n};\nvar NON_HOST_TYPES = {\n 'boolean': 1,\n number: 1,\n string: 1,\n undefined: 1\n};\n\nvar base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;\nvar hexRegex = /^[A-Fa-f0-9]+$/;\n\n/**\n * Expose `is`\n */\n\nvar is = {};\n\n/**\n * Test general.\n */\n\n/**\n * is.type\n * Test if `value` is a type of `type`.\n *\n * @param {*} value value to test\n * @param {String} type type\n * @return {Boolean} true if `value` is a type of `type`, false otherwise\n * @api public\n */\n\nis.a = is.type = function (value, type) {\n return typeof value === type;\n};\n\n/**\n * is.defined\n * Test if `value` is defined.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is defined, false otherwise\n * @api public\n */\n\nis.defined = function (value) {\n return typeof value !== 'undefined';\n};\n\n/**\n * is.empty\n * Test if `value` is empty.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is empty, false otherwise\n * @api public\n */\n\nis.empty = function (value) {\n var type = toStr.call(value);\n var key;\n\n if (type === '[object Array]' || type === '[object Arguments]' || type === '[object String]') {\n return value.length === 0;\n }\n\n if (type === '[object Object]') {\n for (key in value) {\n if (owns.call(value, key)) {\n return false;\n }\n }\n return true;\n }\n\n return !value;\n};\n\n/**\n * is.equal\n * Test if `value` is equal to `other`.\n *\n * @param {*} value value to test\n * @param {*} other value to compare with\n * @return {Boolean} true if `value` is equal to `other`, false otherwise\n */\n\nis.equal = function equal(value, other) {\n if (value === other) {\n return true;\n }\n\n var type = toStr.call(value);\n var key;\n\n if (type !== toStr.call(other)) {\n return false;\n }\n\n if (type === '[object Object]') {\n for (key in value) {\n if (!is.equal(value[key], other[key]) || !(key in other)) {\n return false;\n }\n }\n for (key in other) {\n if (!is.equal(value[key], other[key]) || !(key in value)) {\n return false;\n }\n }\n return true;\n }\n\n if (type === '[object Array]') {\n key = value.length;\n if (key !== other.length) {\n return false;\n }\n while (key--) {\n if (!is.equal(value[key], other[key])) {\n return false;\n }\n }\n return true;\n }\n\n if (type === '[object Function]') {\n return value.prototype === other.prototype;\n }\n\n if (type === '[object Date]') {\n return value.getTime() === other.getTime();\n }\n\n return false;\n};\n\n/**\n * is.hosted\n * Test if `value` is hosted by `host`.\n *\n * @param {*} value to test\n * @param {*} host host to test with\n * @return {Boolean} true if `value` is hosted by `host`, false otherwise\n * @api public\n */\n\nis.hosted = function (value, host) {\n var type = typeof host[value];\n return type === 'object' ? !!host[value] : !NON_HOST_TYPES[type];\n};\n\n/**\n * is.instance\n * Test if `value` is an instance of `constructor`.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an instance of `constructor`\n * @api public\n */\n\nis.instance = is['instanceof'] = function (value, constructor) {\n return value instanceof constructor;\n};\n\n/**\n * is.nil / is.null\n * Test if `value` is null.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is null, false otherwise\n * @api public\n */\n\nis.nil = is['null'] = function (value) {\n return value === null;\n};\n\n/**\n * is.undef / is.undefined\n * Test if `value` is undefined.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is undefined, false otherwise\n * @api public\n */\n\nis.undef = is.undefined = function (value) {\n return typeof value === 'undefined';\n};\n\n/**\n * Test arguments.\n */\n\n/**\n * is.args\n * Test if `value` is an arguments object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an arguments object, false otherwise\n * @api public\n */\n\nis.args = is.arguments = function (value) {\n var isStandardArguments = toStr.call(value) === '[object Arguments]';\n var isOldArguments = !is.array(value) && is.arraylike(value) && is.object(value) && is.fn(value.callee);\n return isStandardArguments || isOldArguments;\n};\n\n/**\n * Test array.\n */\n\n/**\n * is.array\n * Test if 'value' is an array.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an array, false otherwise\n * @api public\n */\n\nis.array = Array.isArray || function (value) {\n return toStr.call(value) === '[object Array]';\n};\n\n/**\n * is.arguments.empty\n * Test if `value` is an empty arguments object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an empty arguments object, false otherwise\n * @api public\n */\nis.args.empty = function (value) {\n return is.args(value) && value.length === 0;\n};\n\n/**\n * is.array.empty\n * Test if `value` is an empty array.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an empty array, false otherwise\n * @api public\n */\nis.array.empty = function (value) {\n return is.array(value) && value.length === 0;\n};\n\n/**\n * is.arraylike\n * Test if `value` is an arraylike object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an arguments object, false otherwise\n * @api public\n */\n\nis.arraylike = function (value) {\n return !!value && !is.bool(value)\n && owns.call(value, 'length')\n && isFinite(value.length)\n && is.number(value.length)\n && value.length >= 0;\n};\n\n/**\n * Test boolean.\n */\n\n/**\n * is.bool\n * Test if `value` is a boolean.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a boolean, false otherwise\n * @api public\n */\n\nis.bool = is['boolean'] = function (value) {\n return toStr.call(value) === '[object Boolean]';\n};\n\n/**\n * is.false\n * Test if `value` is false.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is false, false otherwise\n * @api public\n */\n\nis['false'] = function (value) {\n return is.bool(value) && Boolean(Number(value)) === false;\n};\n\n/**\n * is.true\n * Test if `value` is true.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is true, false otherwise\n * @api public\n */\n\nis['true'] = function (value) {\n return is.bool(value) && Boolean(Number(value)) === true;\n};\n\n/**\n * Test date.\n */\n\n/**\n * is.date\n * Test if `value` is a date.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a date, false otherwise\n * @api public\n */\n\nis.date = function (value) {\n return toStr.call(value) === '[object Date]';\n};\n\n/**\n * is.date.valid\n * Test if `value` is a valid date.\n *\n * @param {*} value value to test\n * @returns {Boolean} true if `value` is a valid date, false otherwise\n */\nis.date.valid = function (value) {\n return is.date(value) && !isNaN(Number(value));\n};\n\n/**\n * Test element.\n */\n\n/**\n * is.element\n * Test if `value` is an html element.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an HTML Element, false otherwise\n * @api public\n */\n\nis.element = function (value) {\n return value !== undefined\n && typeof HTMLElement !== 'undefined'\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Test error.\n */\n\n/**\n * is.error\n * Test if `value` is an error object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an error object, false otherwise\n * @api public\n */\n\nis.error = function (value) {\n return toStr.call(value) === '[object Error]';\n};\n\n/**\n * Test function.\n */\n\n/**\n * is.fn / is.function (deprecated)\n * Test if `value` is a function.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a function, false otherwise\n * @api public\n */\n\nis.fn = is['function'] = function (value) {\n var isAlert = typeof window !== 'undefined' && value === window.alert;\n if (isAlert) {\n return true;\n }\n var str = toStr.call(value);\n return str === '[object Function]' || str === '[object GeneratorFunction]' || str === '[object AsyncFunction]';\n};\n\n/**\n * Test number.\n */\n\n/**\n * is.number\n * Test if `value` is a number.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a number, false otherwise\n * @api public\n */\n\nis.number = function (value) {\n return toStr.call(value) === '[object Number]';\n};\n\n/**\n * is.infinite\n * Test if `value` is positive or negative infinity.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is positive or negative Infinity, false otherwise\n * @api public\n */\nis.infinite = function (value) {\n return value === Infinity || value === -Infinity;\n};\n\n/**\n * is.decimal\n * Test if `value` is a decimal number.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a decimal number, false otherwise\n * @api public\n */\n\nis.decimal = function (value) {\n return is.number(value) && !isActualNaN(value) && !is.infinite(value) && value % 1 !== 0;\n};\n\n/**\n * is.divisibleBy\n * Test if `value` is divisible by `n`.\n *\n * @param {Number} value value to test\n * @param {Number} n dividend\n * @return {Boolean} true if `value` is divisible by `n`, false otherwise\n * @api public\n */\n\nis.divisibleBy = function (value, n) {\n var isDividendInfinite = is.infinite(value);\n var isDivisorInfinite = is.infinite(n);\n var isNonZeroNumber = is.number(value) && !isActualNaN(value) && is.number(n) && !isActualNaN(n) && n !== 0;\n return isDividendInfinite || isDivisorInfinite || (isNonZeroNumber && value % n === 0);\n};\n\n/**\n * is.integer\n * Test if `value` is an integer.\n *\n * @param value to test\n * @return {Boolean} true if `value` is an integer, false otherwise\n * @api public\n */\n\nis.integer = is['int'] = function (value) {\n return is.number(value) && !isActualNaN(value) && value % 1 === 0;\n};\n\n/**\n * is.maximum\n * Test if `value` is greater than 'others' values.\n *\n * @param {Number} value value to test\n * @param {Array} others values to compare with\n * @return {Boolean} true if `value` is greater than `others` values\n * @api public\n */\n\nis.maximum = function (value, others) {\n if (isActualNaN(value)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.arraylike(others)) {\n throw new TypeError('second argument must be array-like');\n }\n var len = others.length;\n\n while (--len >= 0) {\n if (value < others[len]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * is.minimum\n * Test if `value` is less than `others` values.\n *\n * @param {Number} value value to test\n * @param {Array} others values to compare with\n * @return {Boolean} true if `value` is less than `others` values\n * @api public\n */\n\nis.minimum = function (value, others) {\n if (isActualNaN(value)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.arraylike(others)) {\n throw new TypeError('second argument must be array-like');\n }\n var len = others.length;\n\n while (--len >= 0) {\n if (value > others[len]) {\n return false;\n }\n }\n\n return true;\n};\n\n/**\n * is.nan\n * Test if `value` is not a number.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is not a number, false otherwise\n * @api public\n */\n\nis.nan = function (value) {\n return !is.number(value) || value !== value;\n};\n\n/**\n * is.even\n * Test if `value` is an even number.\n *\n * @param {Number} value value to test\n * @return {Boolean} true if `value` is an even number, false otherwise\n * @api public\n */\n\nis.even = function (value) {\n return is.infinite(value) || (is.number(value) && value === value && value % 2 === 0);\n};\n\n/**\n * is.odd\n * Test if `value` is an odd number.\n *\n * @param {Number} value value to test\n * @return {Boolean} true if `value` is an odd number, false otherwise\n * @api public\n */\n\nis.odd = function (value) {\n return is.infinite(value) || (is.number(value) && value === value && value % 2 !== 0);\n};\n\n/**\n * is.ge\n * Test if `value` is greater than or equal to `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean}\n * @api public\n */\n\nis.ge = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value >= other;\n};\n\n/**\n * is.gt\n * Test if `value` is greater than `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean}\n * @api public\n */\n\nis.gt = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value > other;\n};\n\n/**\n * is.le\n * Test if `value` is less than or equal to `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean} if 'value' is less than or equal to 'other'\n * @api public\n */\n\nis.le = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value <= other;\n};\n\n/**\n * is.lt\n * Test if `value` is less than `other`.\n *\n * @param {Number} value value to test\n * @param {Number} other value to compare with\n * @return {Boolean} if `value` is less than `other`\n * @api public\n */\n\nis.lt = function (value, other) {\n if (isActualNaN(value) || isActualNaN(other)) {\n throw new TypeError('NaN is not a valid value');\n }\n return !is.infinite(value) && !is.infinite(other) && value < other;\n};\n\n/**\n * is.within\n * Test if `value` is within `start` and `finish`.\n *\n * @param {Number} value value to test\n * @param {Number} start lower bound\n * @param {Number} finish upper bound\n * @return {Boolean} true if 'value' is is within 'start' and 'finish'\n * @api public\n */\nis.within = function (value, start, finish) {\n if (isActualNaN(value) || isActualNaN(start) || isActualNaN(finish)) {\n throw new TypeError('NaN is not a valid value');\n } else if (!is.number(value) || !is.number(start) || !is.number(finish)) {\n throw new TypeError('all arguments must be numbers');\n }\n var isAnyInfinite = is.infinite(value) || is.infinite(start) || is.infinite(finish);\n return isAnyInfinite || (value >= start && value <= finish);\n};\n\n/**\n * Test object.\n */\n\n/**\n * is.object\n * Test if `value` is an object.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is an object, false otherwise\n * @api public\n */\nis.object = function (value) {\n return toStr.call(value) === '[object Object]';\n};\n\n/**\n * is.primitive\n * Test if `value` is a primitive.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a primitive, false otherwise\n * @api public\n */\nis.primitive = function isPrimitive(value) {\n if (!value) {\n return true;\n }\n if (typeof value === 'object' || is.object(value) || is.fn(value) || is.array(value)) {\n return false;\n }\n return true;\n};\n\n/**\n * is.hash\n * Test if `value` is a hash - a plain object literal.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a hash, false otherwise\n * @api public\n */\n\nis.hash = function (value) {\n return is.object(value) && value.constructor === Object && !value.nodeType && !value.setInterval;\n};\n\n/**\n * Test regexp.\n */\n\n/**\n * is.regexp\n * Test if `value` is a regular expression.\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a regexp, false otherwise\n * @api public\n */\n\nis.regexp = function (value) {\n return toStr.call(value) === '[object RegExp]';\n};\n\n/**\n * Test string.\n */\n\n/**\n * is.string\n * Test if `value` is a string.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is a string, false otherwise\n * @api public\n */\n\nis.string = function (value) {\n return toStr.call(value) === '[object String]';\n};\n\n/**\n * Test base64 string.\n */\n\n/**\n * is.base64\n * Test if `value` is a valid base64 encoded string.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is a base64 encoded string, false otherwise\n * @api public\n */\n\nis.base64 = function (value) {\n return is.string(value) && (!value.length || base64Regex.test(value));\n};\n\n/**\n * Test base64 string.\n */\n\n/**\n * is.hex\n * Test if `value` is a valid hex encoded string.\n *\n * @param {*} value value to test\n * @return {Boolean} true if 'value' is a hex encoded string, false otherwise\n * @api public\n */\n\nis.hex = function (value) {\n return is.string(value) && (!value.length || hexRegex.test(value));\n};\n\n/**\n * is.symbol\n * Test if `value` is an ES6 Symbol\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a Symbol, false otherise\n * @api public\n */\n\nis.symbol = function (value) {\n return typeof Symbol === 'function' && toStr.call(value) === '[object Symbol]' && typeof symbolValueOf.call(value) === 'symbol';\n};\n\n/**\n * is.bigint\n * Test if `value` is an ES-proposed BigInt\n *\n * @param {*} value value to test\n * @return {Boolean} true if `value` is a BigInt, false otherise\n * @api public\n */\n\nis.bigint = function (value) {\n // eslint-disable-next-line valid-typeof\n return typeof BigInt === 'function' && toStr.call(value) === '[object BigInt]' && typeof bigIntValueOf.call(value) === 'bigint';\n};\n\nmodule.exports = is;\n","import ScriptLoader from \"../ScriptLoader\";\nimport logger from \"../../utils/logUtil\";\n\nclass HubSpot {\n constructor(config) {\n this.hubId = config.hubID; // 6405167\n this.name = \"HS\";\n }\n\n init() {\n const hubspotJs = `http://js.hs-scripts.com/${this.hubId}.js`;\n ScriptLoader(\"hubspot-integration\", hubspotJs);\n\n logger.debug(\"===in init HS===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"in HubspotAnalyticsManager identify\");\n\n const { traits } = rudderElement.message.context;\n const traitsValue = {};\n\n for (const k in traits) {\n if (!!Object.getOwnPropertyDescriptor(traits, k) && traits[k]) {\n const hubspotkey = k; // k.startsWith(\"rl_\") ? k.substring(3, k.length) : k;\n if (Object.prototype.toString.call(traits[k]) == \"[object Date]\") {\n traitsValue[hubspotkey] = traits[k].getTime();\n } else {\n traitsValue[hubspotkey] = traits[k];\n }\n }\n }\n /* if (traitsValue[\"address\"]) {\n let address = traitsValue[\"address\"];\n //traitsValue.delete(address)\n delete traitsValue[\"address\"];\n for (let k in address) {\n if (!!Object.getOwnPropertyDescriptor(address, k) && address[k]) {\n let hubspotkey = k;//k.startsWith(\"rl_\") ? k.substring(3, k.length) : k;\n hubspotkey = hubspotkey == \"street\" ? \"address\" : hubspotkey;\n traitsValue[hubspotkey] = address[k];\n }\n }\n } */\n const userProperties = rudderElement.message.context.user_properties;\n for (const k in userProperties) {\n if (\n !!Object.getOwnPropertyDescriptor(userProperties, k) &&\n userProperties[k]\n ) {\n const hubspotkey = k; // k.startsWith(\"rl_\") ? k.substring(3, k.length) : k;\n traitsValue[hubspotkey] = userProperties[k];\n }\n }\n\n logger.debug(traitsValue);\n\n if (typeof window !== undefined) {\n const _hsq = (window._hsq = window._hsq || []);\n _hsq.push([\"identify\", traitsValue]);\n }\n }\n\n track(rudderElement) {\n logger.debug(\"in HubspotAnalyticsManager track\");\n const _hsq = (window._hsq = window._hsq || []);\n const eventValue = {};\n eventValue.id = rudderElement.message.event;\n if (\n rudderElement.message.properties &&\n (rudderElement.message.properties.revenue ||\n rudderElement.message.properties.value)\n ) {\n eventValue.value =\n rudderElement.message.properties.revenue ||\n rudderElement.message.properties.value;\n }\n _hsq.push([\"trackEvent\", eventValue]);\n }\n\n page(rudderElement) {\n logger.debug(\"in HubspotAnalyticsManager page\");\n const _hsq = (window._hsq = window._hsq || []);\n // logger.debug(\"path: \" + rudderElement.message.properties.path);\n // _hsq.push([\"setPath\", rudderElement.message.properties.path]);\n /* _hsq.push([\"identify\",{\n email: \"testtrackpage@email.com\"\n }]); */\n if (\n rudderElement.message.properties &&\n rudderElement.message.properties.path\n ) {\n _hsq.push([\"setPath\", rudderElement.message.properties.path]);\n }\n _hsq.push([\"trackPageView\"]);\n }\n\n isLoaded() {\n logger.debug(\"in hubspot isLoaded\");\n return !!(window._hsq && window._hsq.push !== Array.prototype.push);\n }\n\n isReady() {\n return !!(window._hsq && window._hsq.push !== Array.prototype.push);\n }\n}\n\nexport { HubSpot };\n","\n/**\n * Module Dependencies\n */\n\nvar expr;\ntry {\n expr = require('props');\n} catch(e) {\n expr = require('component-props');\n}\n\n/**\n * Expose `toFunction()`.\n */\n\nmodule.exports = toFunction;\n\n/**\n * Convert `obj` to a `Function`.\n *\n * @param {Mixed} obj\n * @return {Function}\n * @api private\n */\n\nfunction toFunction(obj) {\n switch ({}.toString.call(obj)) {\n case '[object Object]':\n return objectToFunction(obj);\n case '[object Function]':\n return obj;\n case '[object String]':\n return stringToFunction(obj);\n case '[object RegExp]':\n return regexpToFunction(obj);\n default:\n return defaultToFunction(obj);\n }\n}\n\n/**\n * Default to strict equality.\n *\n * @param {Mixed} val\n * @return {Function}\n * @api private\n */\n\nfunction defaultToFunction(val) {\n return function(obj){\n return val === obj;\n };\n}\n\n/**\n * Convert `re` to a function.\n *\n * @param {RegExp} re\n * @return {Function}\n * @api private\n */\n\nfunction regexpToFunction(re) {\n return function(obj){\n return re.test(obj);\n };\n}\n\n/**\n * Convert property `str` to a function.\n *\n * @param {String} str\n * @return {Function}\n * @api private\n */\n\nfunction stringToFunction(str) {\n // immediate such as \"> 20\"\n if (/^ *\\W+/.test(str)) return new Function('_', 'return _ ' + str);\n\n // properties such as \"name.first\" or \"age > 18\" or \"age > 18 && age < 36\"\n return new Function('_', 'return ' + get(str));\n}\n\n/**\n * Convert `object` to a function.\n *\n * @param {Object} object\n * @return {Function}\n * @api private\n */\n\nfunction objectToFunction(obj) {\n var match = {};\n for (var key in obj) {\n match[key] = typeof obj[key] === 'string'\n ? defaultToFunction(obj[key])\n : toFunction(obj[key]);\n }\n return function(val){\n if (typeof val !== 'object') return false;\n for (var key in match) {\n if (!(key in val)) return false;\n if (!match[key](val[key])) return false;\n }\n return true;\n };\n}\n\n/**\n * Built the getter function. Supports getter style functions\n *\n * @param {String} str\n * @return {String}\n * @api private\n */\n\nfunction get(str) {\n var props = expr(str);\n if (!props.length) return '_.' + str;\n\n var val, i, prop;\n for (i = 0; i < props.length; i++) {\n prop = props[i];\n val = '_.' + prop;\n val = \"('function' == typeof \" + val + \" ? \" + val + \"() : \" + val + \")\";\n\n // mimic negative lookbehind to avoid problems with nested properties\n str = stripNested(prop, str, val);\n }\n\n return str;\n}\n\n/**\n * Mimic negative lookbehind to avoid problems with nested properties.\n *\n * See: http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript\n *\n * @param {String} prop\n * @param {String} str\n * @param {String} val\n * @return {String}\n * @api private\n */\n\nfunction stripNested (prop, str, val) {\n return str.replace(new RegExp('(\\\\.)?' + prop, 'g'), function($0, $1) {\n return $1 ? $0 : val;\n });\n}\n","\n/**\n * toString ref.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n *\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nmodule.exports = function(val){\n switch (toString.call(val)) {\n case '[object Function]': return 'function';\n case '[object Date]': return 'date';\n case '[object RegExp]': return 'regexp';\n case '[object Arguments]': return 'arguments';\n case '[object Array]': return 'array';\n case '[object String]': return 'string';\n }\n\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (val && val.nodeType === 1) return 'element';\n if (val === Object(val)) return 'object';\n\n return typeof val;\n};\n","/**\n * Global Names\n */\n\nvar globals = /\\b(Array|Date|Object|Math|JSON)\\b/g;\n\n/**\n * Return immediate identifiers parsed from `str`.\n *\n * @param {String} str\n * @param {String|Function} map function or prefix\n * @return {Array}\n * @api public\n */\n\nmodule.exports = function(str, fn){\n var p = unique(props(str));\n if (fn && 'string' == typeof fn) fn = prefixed(fn);\n if (fn) return map(str, p, fn);\n return p;\n};\n\n/**\n * Return immediate identifiers in `str`.\n *\n * @param {String} str\n * @return {Array}\n * @api private\n */\n\nfunction props(str) {\n return str\n .replace(/\\.\\w+|\\w+ *\\(|\"[^\"]*\"|'[^']*'|\\/([^/]+)\\//g, '')\n .replace(globals, '')\n .match(/[a-zA-Z_]\\w*/g)\n || [];\n}\n\n/**\n * Return `str` with `props` mapped with `fn`.\n *\n * @param {String} str\n * @param {Array} props\n * @param {Function} fn\n * @return {String}\n * @api private\n */\n\nfunction map(str, props, fn) {\n var re = /\\.\\w+|\\w+ *\\(|\"[^\"]*\"|'[^']*'|\\/([^/]+)\\/|[a-zA-Z_]\\w*/g;\n return str.replace(re, function(_){\n if ('(' == _[_.length - 1]) return fn(_);\n if (!~props.indexOf(_)) return _;\n return fn(_);\n });\n}\n\n/**\n * Return unique array.\n *\n * @param {Array} arr\n * @return {Array}\n * @api private\n */\n\nfunction unique(arr) {\n var ret = [];\n\n for (var i = 0; i < arr.length; i++) {\n if (~ret.indexOf(arr[i])) continue;\n ret.push(arr[i]);\n }\n\n return ret;\n}\n\n/**\n * Map with prefix `str`.\n */\n\nfunction prefixed(str) {\n return function(_){\n return str + _;\n };\n}\n","\n/**\n * Module dependencies.\n */\n\ntry {\n var type = require('type');\n} catch (err) {\n var type = require('component-type');\n}\n\nvar toFunction = require('to-function');\n\n/**\n * HOP reference.\n */\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Iterate the given `obj` and invoke `fn(val, i)`\n * in optional context `ctx`.\n *\n * @param {String|Array|Object} obj\n * @param {Function} fn\n * @param {Object} [ctx]\n * @api public\n */\n\nmodule.exports = function(obj, fn, ctx){\n fn = toFunction(fn);\n ctx = ctx || this;\n switch (type(obj)) {\n case 'array':\n return array(obj, fn, ctx);\n case 'object':\n if ('number' == typeof obj.length) return array(obj, fn, ctx);\n return object(obj, fn, ctx);\n case 'string':\n return string(obj, fn, ctx);\n }\n};\n\n/**\n * Iterate string chars.\n *\n * @param {String} obj\n * @param {Function} fn\n * @param {Object} ctx\n * @api private\n */\n\nfunction string(obj, fn, ctx) {\n for (var i = 0; i < obj.length; ++i) {\n fn.call(ctx, obj.charAt(i), i);\n }\n}\n\n/**\n * Iterate object keys.\n *\n * @param {Object} obj\n * @param {Function} fn\n * @param {Object} ctx\n * @api private\n */\n\nfunction object(obj, fn, ctx) {\n for (var key in obj) {\n if (has.call(obj, key)) {\n fn.call(ctx, key, obj[key]);\n }\n }\n}\n\n/**\n * Iterate array-ish.\n *\n * @param {Array|Object} obj\n * @param {Function} fn\n * @param {Object} ctx\n * @api private\n */\n\nfunction array(obj, fn, ctx) {\n for (var i = 0; i < obj.length; ++i) {\n fn.call(ctx, obj[i], i);\n }\n}\n","/* eslint-disable class-methods-use-this */\nimport is from \"is\";\nimport each from \"component-each\";\nimport logger from \"../../utils/logUtil\";\nimport { rejectArr } from \"../../utils/utils\";\nimport ScriptLoader from \"../ScriptLoader\";\n\nexport default class GA {\n constructor(config) {\n this.trackingID = config.trackingID;\n this.sendUserId = config.sendUserId || false;\n this.dimensions = config.dimensions || [];\n this.metrics = config.metrics || [];\n this.contentGroupings = config.contentGroupings || [];\n this.nonInteraction = config.nonInteraction || false;\n this.anonymizeIp = config.anonymizeIp || false;\n this.useGoogleAmpClientId = config.useGoogleAmpClientId || false;\n\n this.domain = config.domain || \"auto\";\n this.doubleClick = config.doubleClick || false;\n this.enhancedEcommerce = config.enhancedEcommerce || false;\n this.enhancedLinkAttribution = config.enhancedLinkAttribution || false;\n\n this.includeSearch = config.includeSearch || false;\n this.setAllMappedProps = config.setAllMappedProps || true;\n this.siteSpeedSampleRate = config.siteSpeedSampleRate || 1;\n this.sampleRate = config.sampleRate || 100;\n this.trackCategorizedPages = config.trackCategorizedPages || true;\n this.trackNamedPages = config.trackNamedPages || true;\n this.optimizeContainerId = config.optimize || \"\";\n this.resetCustomDimensionsOnPage = config.resetCustomDimensionsOnPage || [];\n this.enhancedEcommerceLoaded = 0;\n this.name = \"GA\";\n this.eventWithCategoryFieldProductScoped = [\n \"product clicked\",\n \"product added\",\n \"product viewed\",\n \"product removed\",\n ];\n }\n\n loadScript() {\n ScriptLoader(\n \"google-analytics\",\n \"https://www.google-analytics.com/analytics.js\"\n );\n }\n\n init() {\n this.pageCalled = false;\n this.dimensionsArray = {};\n let elementTo;\n this.dimensions.forEach((element) => {\n if (element.to.startsWith(\"dimension\")) {\n this.dimensionsArray[element.from] = element.to;\n } else {\n /* eslint-disable no-param-reassign */\n elementTo = element.to.replace(/cd/g, \"dimension\");\n this.dimensionsArray[element.from] = elementTo;\n }\n });\n this.metricsArray = {};\n this.metrics.forEach((element) => {\n if (element.to.startsWith(\"dimension\")) {\n this.metricsArray[element.from] = element.to;\n } else {\n elementTo = element.to.replace(/cm/g, \"metric\");\n this.metricsArray[element.from] = elementTo;\n }\n });\n this.contentGroupingsArray = {};\n this.contentGroupings.forEach((element) => {\n this.contentGroupingsArray[element.from] = element.to;\n });\n window.GoogleAnalyticsObject = \"ga\";\n window.ga =\n window.ga ||\n function a() {\n window.ga.q = window.ga.q || [];\n window.ga.q.push(arguments);\n };\n window.ga.l = new Date().getTime();\n\n this.loadScript();\n\n // create ga with these properties. if the properties are empty it will take default values.\n const config = {\n cookieDomain: this.domain || GA.prototype.defaults.domain,\n siteSpeedSampleRate: this.siteSpeedSampleRate,\n sampleRate: this.sampleRate,\n allowLinker: true,\n useAmpClientId: this.useGoogleAmpClientId,\n };\n\n window.ga(\"create\", this.trackingID, config);\n\n if (this.optimizeContainerId) {\n window.ga(\"require\", this.optimizeContainerId);\n }\n\n // ecommerce is required\n if (!this.ecommerce) {\n window.ga(\"require\", \"ecommerce\");\n this.ecommerce = true;\n }\n\n // this is to display advertising\n if (this.doubleClick) {\n window.ga(\"require\", \"displayfeatures\");\n }\n\n // https://support.google.com/analytics/answer/2558867?hl=en\n if (this.enhancedLinkAttribution) {\n window.ga(\"require\", \"linkid\");\n }\n\n // a warning is in ga debugger if anonymize is false after initialization\n if (this.anonymizeIp) {\n window.ga(\"set\", \"anonymizeIp\", true);\n }\n\n logger.debug(\"===in init GA===\");\n }\n\n identify(rudderElement) {\n // send global id\n if (this.sendUserId && rudderElement.message.userId) {\n window.ga(\"set\", \"userId\", rudderElement.message.userId);\n }\n\n // custom dimensions and metrics\n const custom = this.metricsFunction(\n rudderElement.message.context.traits,\n this.dimensionsArray,\n this.metricsArray,\n this.contentGroupingsArray\n );\n\n if (Object.keys(custom).length) {\n window.ga(\"set\", custom);\n }\n\n logger.debug(\"in GoogleAnalyticsManager identify\");\n }\n\n track(rudderElement) {\n const self = this;\n // Ecommerce events\n const { event, properties, name } = rudderElement.message;\n const options = this.extractCheckoutOptions(rudderElement);\n const props = rudderElement.message.properties;\n const { products } = properties;\n let { total } = properties;\n const data = {};\n const eventCategory = rudderElement.message.properties.category;\n const orderId = properties.order_id;\n const eventAction = event || name || \"\";\n const eventLabel = rudderElement.message.properties.label;\n let eventValue = \"\";\n let payload;\n const { campaign } = rudderElement.message.context;\n let params;\n let filters;\n let sorts;\n if (event === \"Order Completed\" && !this.enhancedEcommerce) {\n // order_id is required\n if (!orderId) {\n logger.debug(\"order_id not present events are not sent to GA\");\n return;\n }\n\n // add transaction\n window.ga(\"ecommerce:addTransaction\", {\n affiliation: properties.affiliation,\n shipping: properties.shipping,\n revenue: total,\n tax: properties.tax,\n id: orderId,\n currency: properties.currency,\n });\n\n // products added\n products.forEach((product) => {\n const productTrack = self.createProductTrack(rudderElement, product);\n\n window.ga(\"ecommerce:addItem\", {\n category: productTrack.properties.category,\n quantity: productTrack.properties.quantity,\n price: productTrack.properties.price,\n name: productTrack.properties.name,\n sku: productTrack.properties.sku,\n id: orderId,\n currency: productTrack.properties.currency,\n });\n });\n\n window.ga(\"ecommerce:send\");\n }\n\n // enhanced ecommerce events\n else if (this.enhancedEcommerce) {\n switch (event) {\n case \"Checkout Started\":\n case \"Checkout Step Viewed\":\n case \"Order Updated\":\n this.loadEnhancedEcommerce(rudderElement);\n each(products, (product) => {\n let productTrack = self.createProductTrack(rudderElement, product);\n productTrack = { message: productTrack };\n\n self.enhancedEcommerceTrackProduct(productTrack);\n });\n\n window.ga(\"ec:setAction\", \"checkout\", {\n step: properties.step || 1,\n option: options || undefined,\n });\n\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Checkout Step Completed\":\n if (!props.step) {\n logger.debug(\"step not present events are not sent to GA\");\n return;\n }\n params = {\n step: props.step || 1,\n option: options || undefined,\n };\n\n this.loadEnhancedEcommerce(rudderElement);\n\n window.ga(\"ec:setAction\", \"checkout_option\", params);\n window.ga(\"send\", \"event\", \"Checkout\", \"Option\");\n break;\n case \"Order Completed\":\n total =\n rudderElement.message.properties.total ||\n rudderElement.message.properties.revenue ||\n 0;\n\n if (!orderId) {\n logger.debug(\"order_id not present events are not sent to GA\");\n return;\n }\n this.loadEnhancedEcommerce(rudderElement);\n\n each(products, (product) => {\n let productTrack = self.createProductTrack(rudderElement, product);\n productTrack = { message: productTrack };\n self.enhancedEcommerceTrackProduct(productTrack);\n });\n window.ga(\"ec:setAction\", \"purchase\", {\n id: orderId,\n affiliation: props.affiliation,\n revenue: total,\n tax: props.tax,\n shipping: props.shipping,\n coupon: props.coupon,\n });\n\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Order Refunded\":\n if (!orderId) {\n logger.debug(\"order_id not present events are not sent to GA\");\n return;\n }\n this.loadEnhancedEcommerce(rudderElement);\n\n each(products, (product) => {\n const track = { properties: product };\n window.ga(\"ec:addProduct\", {\n id:\n track.properties.product_id ||\n track.properties.id ||\n track.properties.sku,\n quantity: track.properties.quantity,\n });\n });\n\n window.ga(\"ec:setAction\", \"refund\", {\n id: orderId,\n });\n\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Product Added\":\n this.loadEnhancedEcommerce(rudderElement);\n this.enhancedEcommerceTrackProductAction(rudderElement, \"add\", null);\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Product Removed\":\n this.loadEnhancedEcommerce(rudderElement);\n this.enhancedEcommerceTrackProductAction(\n rudderElement,\n \"remove\",\n null\n );\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Product Viewed\":\n this.loadEnhancedEcommerce(rudderElement);\n\n if (props.list) data.list = props.list;\n this.enhancedEcommerceTrackProductAction(\n rudderElement,\n \"detail\",\n data\n );\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Product Clicked\":\n this.loadEnhancedEcommerce(rudderElement);\n\n if (props.list) data.list = props.list;\n this.enhancedEcommerceTrackProductAction(\n rudderElement,\n \"click\",\n data\n );\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Promotion Viewed\":\n this.loadEnhancedEcommerce(rudderElement);\n window.ga(\"ec:addPromo\", {\n id: props.promotion_id || props.id,\n name: props.name,\n creative: props.creative,\n position: props.position,\n });\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Promotion Clicked\":\n this.loadEnhancedEcommerce(rudderElement);\n\n window.ga(\"ec:addPromo\", {\n id: props.promotion_id || props.id,\n name: props.name,\n creative: props.creative,\n position: props.position,\n });\n window.ga(\"ec:setAction\", \"promo_click\", {});\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Product List Viewed\":\n this.loadEnhancedEcommerce(rudderElement);\n\n each(products, (product) => {\n const item = { properties: product };\n if (\n !(item.properties.product_id || item.properties.sku) &&\n !item.properties.name\n ) {\n logger.debug(\n \"product_id/sku/name of product not present events are not sent to GA\"\n );\n return;\n }\n let impressionObj = {\n id: item.properties.product_id || item.properties.sku,\n name: item.properties.name,\n category: item.properties.category || props.category,\n list: props.list_id || props.category || \"products\",\n brand: item.properties.band,\n variant: item.properties.variant,\n price: item.properties.price,\n position: self.getProductPosition(item, products),\n };\n impressionObj = {\n ...impressionObj,\n ...self.metricsFunction(\n item.properties,\n self.dimensionsArray,\n self.metricsArray,\n self.contentGroupingsArray\n ),\n };\n Object.keys(impressionObj).forEach((key) => {\n if (impressionObj[key] === undefined) delete impressionObj[key];\n });\n window.ga(\"ec:addImpression\", impressionObj);\n });\n this.pushEnhancedEcommerce(rudderElement);\n break;\n case \"Product List Filtered\":\n props.filters = props.filters || [];\n props.sorters = props.sorters || [];\n filters = props.filters\n .map((obj) => {\n return `${obj.type}:${obj.value}`;\n })\n .join();\n sorts = props.sorters\n .map((obj) => {\n return `${obj.type}:${obj.value}`;\n })\n .join();\n\n this.loadEnhancedEcommerce(rudderElement);\n\n each(products, (product) => {\n const item = { properties: product };\n\n if (\n !(item.properties.product_id || item.properties.sku) &&\n !item.properties.name\n ) {\n logger.debug(\n \"product_id/sku/name of product not present events are not sent to GA\"\n );\n return;\n }\n\n let impressionObj = {\n id: item.properties.product_id || item.sku,\n name: item.name,\n category: item.category || props.category,\n list: props.list_id || props.category || \"search results\",\n brand: props.brand,\n variant: `${filters}::${sorts}`,\n price: item.price,\n position: self.getProductPosition(item, products),\n };\n\n impressionObj = {\n impressionObj,\n ...self.metricsFunction(\n item.properties,\n self.dimensionsArray,\n self.metricsArray,\n self.contentGroupingsArray\n ),\n };\n Object.keys(impressionObj).forEach((key) => {\n if (impressionObj[key] === undefined) delete impressionObj[key];\n });\n window.ga(\"ec:addImpression\", impressionObj);\n });\n this.pushEnhancedEcommerce(rudderElement);\n break;\n default:\n if (rudderElement.message.properties) {\n eventValue = rudderElement.message.properties.value\n ? rudderElement.message.properties.value\n : rudderElement.message.properties.revenue;\n }\n\n payload = {\n eventCategory: eventCategory || \"All\",\n eventAction,\n eventLabel,\n eventValue: this.formatValue(eventValue),\n // Allow users to override their nonInteraction integration setting for any single particluar event.\n nonInteraction:\n rudderElement.message.properties.nonInteraction !== undefined\n ? !!rudderElement.message.properties.nonInteraction\n : !!this.nonInteraction,\n };\n\n if (campaign) {\n if (campaign.name) payload.campaignName = campaign.name;\n if (campaign.source) payload.campaignSource = campaign.source;\n if (campaign.medium) payload.campaignMedium = campaign.medium;\n if (campaign.content) payload.campaignContent = campaign.content;\n if (campaign.term) payload.campaignKeyword = campaign.term;\n }\n\n payload = {\n payload,\n ...this.setCustomDimenionsAndMetrics(\n rudderElement.message.properties\n ),\n };\n\n window.ga(\"send\", \"event\", payload.payload);\n logger.debug(\"in GoogleAnalyticsManager track\");\n }\n } else {\n if (rudderElement.message.properties) {\n eventValue = rudderElement.message.properties.value\n ? rudderElement.message.properties.value\n : rudderElement.message.properties.revenue;\n }\n\n payload = {\n eventCategory: eventCategory || \"All\",\n eventAction,\n eventLabel,\n eventValue: this.formatValue(eventValue),\n // Allow users to override their nonInteraction integration setting for any single particluar event.\n nonInteraction:\n rudderElement.message.properties.nonInteraction !== undefined\n ? !!rudderElement.message.properties.nonInteraction\n : !!this.nonInteraction,\n };\n\n if (campaign) {\n if (campaign.name) payload.campaignName = campaign.name;\n if (campaign.source) payload.campaignSource = campaign.source;\n if (campaign.medium) payload.campaignMedium = campaign.medium;\n if (campaign.content) payload.campaignContent = campaign.content;\n if (campaign.term) payload.campaignKeyword = campaign.term;\n }\n\n payload = {\n payload,\n ...this.setCustomDimenionsAndMetrics(rudderElement.message.properties),\n };\n\n window.ga(\"send\", \"event\", payload.payload);\n logger.debug(\"in GoogleAnalyticsManager track\");\n }\n }\n\n page(rudderElement) {\n logger.debug(\"in GoogleAnalyticsManager page\");\n\n const { category } = rudderElement.message.properties;\n const eventProperties = rudderElement.message.properties;\n let name;\n if (\n rudderElement.message.properties.category &&\n rudderElement.message.name\n ) {\n name = `${rudderElement.message.properties.category} ${rudderElement.message.name}`;\n } else if (\n !rudderElement.message.properties.category &&\n !rudderElement.message.name\n ) {\n name = \"\";\n } else {\n name =\n rudderElement.message.name || rudderElement.message.properties.category;\n }\n\n const campaign = rudderElement.message.context.campaign || {};\n let pageview = {};\n const pagePath = this.path(eventProperties, this.includeSearch);\n const pageReferrer = rudderElement.message.properties.referrer || \"\";\n let pageTitle;\n if (\n !rudderElement.message.properties.category &&\n !rudderElement.message.name\n )\n pageTitle = eventProperties.title;\n else if (!rudderElement.message.properties.category)\n pageTitle = rudderElement.message.name;\n else if (!rudderElement.message.name)\n pageTitle = rudderElement.message.properties.category;\n else pageTitle = name;\n\n pageview.page = pagePath;\n pageview.title = pageTitle;\n pageview.location = eventProperties.url;\n\n if (campaign) {\n if (campaign.name) pageview.campaignName = campaign.name;\n if (campaign.source) pageview.campaignSource = campaign.source;\n if (campaign.medium) pageview.campaignMedium = campaign.medium;\n if (campaign.content) pageview.campaignContent = campaign.content;\n if (campaign.term) pageview.campaignKeyword = campaign.term;\n }\n\n const resetCustomDimensions = {};\n for (let i = 0; i < this.resetCustomDimensionsOnPage.length; i += 1) {\n const property = this.resetCustomDimensionsOnPage[i]\n .resetCustomDimensionsOnPage;\n if (this.dimensionsArray[property]) {\n resetCustomDimensions[this.dimensionsArray[property]] = null;\n }\n }\n window.ga(\"set\", resetCustomDimensions);\n\n // adds more properties to pageview which will be sent\n pageview = {\n ...pageview,\n ...this.setCustomDimenionsAndMetrics(eventProperties),\n };\n const payload = {\n page: pagePath,\n title: pageTitle,\n };\n logger.debug(pageReferrer);\n logger.debug(document.referrer);\n if (pageReferrer !== document.referrer) payload.referrer = pageReferrer;\n\n window.ga(\"set\", payload);\n\n if (this.pageCalled) delete pageview.location;\n\n window.ga(\"send\", \"pageview\", pageview);\n\n // categorized pages\n if (category && this.trackCategorizedPages) {\n this.track(rudderElement, { nonInteraction: 1 });\n }\n\n // named pages\n if (name && this.trackNamedPages) {\n this.track(rudderElement, { nonInteraction: 1 });\n }\n this.pageCalled = true;\n }\n\n isLoaded() {\n logger.debug(\"in GA isLoaded\");\n return !!window.gaplugins;\n }\n\n isReady() {\n return !!window.gaplugins;\n }\n\n /**\n *\n *\n * @param {} obj incoming properties\n * @param {} dimensions the dimension mapping which is entered by the user in the ui. Eg: firstName : dimension1\n * @param {} metrics the metrics mapping which is entered by the user in the ui. Eg: age : metrics1\n * @param {} contentGroupings the contentGrouping mapping which is entered by the user in the ui. Eg: section : contentGrouping1\n *\n * This function maps these dimensions,metrics and contentGroupings with the incoming properties to send it to GA where the user has to set the corresponding dimension/metric/content group.\n * For example if:\n * if obj -> {age: 24}\n * metrics -> {age: metric1}\n * then the function will return {metric1:24} and it will be shown sent to GA if metric1 is set there.\n *\n * if obj -> {age: 24}\n * metrics - {revenue: metric2}\n * then the function will return {} as there is no corresponding mapping of metric.\n *\n */\n metricsFunction(obj, dimensions, metrics, contentGroupings) {\n const ret = {};\n\n each([metrics, dimensions, contentGroupings], (group) => {\n each(group, (prop, key) => {\n let value = obj[prop];\n if (is.boolean(value)) value = value.toString();\n if (value || value === 0) ret[key] = value;\n });\n });\n\n return ret;\n }\n\n formatValue(value) {\n if (!value || value < 0) return 0;\n return Math.round(value);\n }\n\n /**\n * @param {} props\n * @param {} inputs\n */\n setCustomDimenionsAndMetrics(props) {\n const ret = {};\n const custom = this.metricsFunction(\n props,\n this.dimensionsArray,\n this.metricsArray,\n this.contentGroupingsArray\n );\n if (Object.keys(custom).length) {\n if (this.setAllMappedProps) {\n window.ga(\"set\", custom);\n } else {\n Object.keys(custom).forEach((key) => {\n ret[key] = custom[key];\n });\n // each(custom, (key, value) => {\n // ret[key] = value;\n // });\n }\n }\n return ret;\n }\n\n /**\n * Return the path based on `properties` and `options`\n *\n * @param {} properties\n * @param {} includeSearch\n */\n path(properties, includeSearch) {\n let str = properties.path;\n if (properties) {\n if (includeSearch && properties.search) {\n str += properties.search;\n }\n }\n return str;\n }\n\n /**\n * Creates a track out of product properties\n * @param {} rudderElement\n * @param {} properties\n */\n createProductTrack(rudderElement, properties) {\n const props = properties || {};\n props.currency =\n properties.currency || rudderElement.message.properties.currency;\n return { properties: props };\n }\n\n /**\n * Loads ec.js (unless already loaded)\n * @param {} rudderElement\n * @param {} a\n */\n loadEnhancedEcommerce(rudderElement) {\n if (this.enhancedEcommerceLoaded === 0) {\n window.ga(\"require\", \"ec\");\n this.enhancedEcommerceLoaded = 1;\n }\n\n window.ga(\"set\", \"&cu\", rudderElement.message.properties.currency);\n }\n\n /**\n * helper class to not repeat `ec:addProduct`\n * @param {} rudderElement\n * @param {} inputs\n */\n enhancedEcommerceTrackProduct(rudderElement) {\n const props = rudderElement.message.properties;\n\n let product = {\n id: props.product_id || props.id || props.sku,\n name: props.name,\n category: props.category,\n quantity: props.quantity,\n price: props.price,\n brand: props.brand,\n variant: props.variant,\n currency: props.currency,\n };\n\n if (props.position != null) {\n product.position = Math.round(props.position);\n }\n\n const { coupon } = props;\n if (coupon) product.coupon = coupon;\n product = {\n ...product,\n ...this.metricsFunction(\n props,\n this.dimensionsArray,\n this.metricsArray,\n this.contentGroupingsArray\n ),\n };\n\n window.ga(\"ec:addProduct\", product);\n }\n\n /**\n * set action with data\n * @param {} rudderElement\n * @param {} action\n * @param {} data\n * @param {} inputs\n */\n enhancedEcommerceTrackProductAction(rudderElement, action, data) {\n this.enhancedEcommerceTrackProduct(rudderElement);\n window.ga(\"ec:setAction\", action, data || {});\n }\n\n /**\n * @param {} rudderElement\n * @param {} inputs\n */\n pushEnhancedEcommerce(rudderElement) {\n const args = rejectArr([\n \"send\",\n \"event\",\n rudderElement.message.properties.category || \"EnhancedEcommerce\",\n rudderElement.message.event || \"Action not defined\",\n rudderElement.message.properties.label,\n {\n nonInteraction: 1,\n ...this.setCustomDimenionsAndMetrics(rudderElement.message.properties),\n },\n ]);\n\n let { event } = rudderElement.message;\n event = event.toLowerCase();\n\n if (this.eventWithCategoryFieldProductScoped.includes(event)) {\n args[2] = \"EnhancedEcommerce\";\n }\n\n window.ga.call(window, ...args);\n }\n\n /**\n * @param {} item\n * @param {} products\n */\n getProductPosition(item, products) {\n const { position } = item.properties;\n\n if (\n typeof position !== \"undefined\" &&\n !Number.isNaN(Number(position)) &&\n Number(position) > -1\n ) {\n return position;\n }\n\n return (\n products\n .map((x) => {\n return x.product_id;\n })\n .indexOf(item.properties.product_id) + 1\n );\n }\n\n /**\n *extracts checkout options\n * @param {} rudderElement\n */\n extractCheckoutOptions(rudderElement) {\n const options = [\n rudderElement.message.properties.paymentMethod,\n rudderElement.message.properties.shippingMethod,\n ];\n // remove all nulls and join with commas.\n const valid = rejectArr(options);\n return valid.length > 0 ? valid.join(\", \") : null;\n }\n}\n","import logger from \"../../utils/logUtil\";\n\nclass Hotjar {\n constructor(config) {\n this.siteId = config.siteID; // 1549611\n this.name = \"HOTJAR\";\n this._ready = false;\n }\n\n init() {\n window.hotjarSiteId = this.siteId;\n (function (h, o, t, j, a, r) {\n h.hj =\n h.hj ||\n function () {\n (h.hj.q = h.hj.q || []).push(arguments);\n };\n h._hjSettings = { hjid: h.hotjarSiteId, hjsv: 6 };\n a = o.getElementsByTagName(\"head\")[0];\n r = o.createElement(\"script\");\n r.async = 1;\n r.src = t + h._hjSettings.hjid + j + h._hjSettings.hjsv;\n a.appendChild(r);\n })(window, document, \"https://static.hotjar.com/c/hotjar-\", \".js?sv=\");\n this._ready = true;\n\n logger.debug(\"===in init Hotjar===\");\n }\n\n identify(rudderElement) {\n const userId =\n rudderElement.message.userId || rudderElement.message.anonymousId;\n if (!userId) {\n logger.debug(\"[Hotjar] identify:: user id is required\");\n return;\n }\n\n const { traits } = rudderElement.message.context;\n\n window.hj(\"identify\", rudderElement.message.userId, traits);\n }\n\n track(rudderElement) {\n logger.debug(\"[Hotjar] track:: method not supported\");\n }\n\n page(rudderElement) {\n logger.debug(\"[Hotjar] page:: method not supported\");\n }\n\n isLoaded() {\n return this._ready;\n }\n\n isReady() {\n return this._ready;\n }\n}\n\nexport { Hotjar };\n","import logger from \"../../utils/logUtil\";\n\nclass GoogleAds {\n constructor(config) {\n // this.accountId = config.accountId;//AW-696901813\n this.conversionId = config.conversionID;\n this.pageLoadConversions = config.pageLoadConversions;\n this.clickEventConversions = config.clickEventConversions;\n this.defaultPageConversion = config.defaultPageConversion;\n\n this.name = \"GOOGLEADS\";\n }\n\n init() {\n const sourceUrl = `https://www.googletagmanager.com/gtag/js?id=${this.conversionId}`;\n (function (id, src, document) {\n logger.debug(`in script loader=== ${id}`);\n const js = document.createElement(\"script\");\n js.src = src;\n js.async = 1;\n js.type = \"text/javascript\";\n js.id = id;\n const e = document.getElementsByTagName(\"head\")[0];\n logger.debug(\"==script==\", e);\n e.appendChild(js);\n })(\"googleAds-integration\", sourceUrl, document);\n\n window.dataLayer = window.dataLayer || [];\n window.gtag = function () {\n window.dataLayer.push(arguments);\n };\n window.gtag(\"js\", new Date());\n window.gtag(\"config\", this.conversionId);\n\n logger.debug(\"===in init Google Ads===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"[GoogleAds] identify:: method not supported\");\n }\n\n // https://developers.google.com/gtagjs/reference/event\n track(rudderElement) {\n logger.debug(\"in GoogleAdsAnalyticsManager track\");\n const conversionData = this.getConversionData(\n this.clickEventConversions,\n rudderElement.message.event\n );\n if (conversionData.conversionLabel) {\n const { conversionLabel } = conversionData;\n const { eventName } = conversionData;\n const sendToValue = `${this.conversionId}/${conversionLabel}`;\n const properties = {};\n if (rudderElement.properties) {\n properties.value = rudderElement.properties.revenue;\n properties.currency = rudderElement.properties.currency;\n properties.transaction_id = rudderElement.properties.order_id;\n }\n properties.send_to = sendToValue;\n window.gtag(\"event\", eventName, properties);\n }\n }\n\n page(rudderElement) {\n logger.debug(\"in GoogleAdsAnalyticsManager page\");\n const conversionData = this.getConversionData(\n this.pageLoadConversions,\n rudderElement.message.name\n );\n if (conversionData.conversionLabel) {\n const { conversionLabel } = conversionData;\n const { eventName } = conversionData;\n window.gtag(\"event\", eventName, {\n send_to: `${this.conversionId}/${conversionLabel}`,\n });\n }\n }\n\n getConversionData(eventTypeConversions, eventName) {\n const conversionData = {};\n if (eventTypeConversions) {\n if (eventName) {\n eventTypeConversions.forEach((eventTypeConversion) => {\n if (\n eventTypeConversion.name.toLowerCase() === eventName.toLowerCase()\n ) {\n // rudderElement[\"message\"][\"name\"]\n conversionData.conversionLabel =\n eventTypeConversion.conversionLabel;\n conversionData.eventName = eventTypeConversion.name;\n }\n });\n } else if (this.defaultPageConversion) {\n conversionData.conversionLabel = this.defaultPageConversion;\n conversionData.eventName = \"Viewed a Page\";\n }\n }\n return conversionData;\n }\n\n isLoaded() {\n return window.dataLayer.push !== Array.prototype.push;\n }\n\n isReady() {\n return window.dataLayer.push !== Array.prototype.push;\n }\n}\n\nexport { GoogleAds };\n","import logger from \"../../utils/logUtil\";\n\nclass VWO {\n constructor(config, analytics) {\n this.accountId = config.accountId; // 1549611\n this.settingsTolerance = config.settingsTolerance;\n this.isSPA = config.isSPA;\n this.libraryTolerance = config.libraryTolerance;\n this.useExistingJquery = config.useExistingJquery;\n this.sendExperimentTrack = config.sendExperimentTrack;\n this.sendExperimentIdentify = config.sendExperimentIdentify;\n this.name = \"VWO\";\n this.analytics = analytics;\n logger.debug(\"Config \", config);\n }\n\n init() {\n logger.debug(\"===in init VWO===\");\n const account_id = this.accountId;\n const settings_tolerance = this.settingsTolerance;\n const library_tolerance = this.libraryTolerance;\n const use_existing_jquery = this.useExistingJquery;\n const { isSPA } = this;\n window._vwo_code = (function () {\n let f = false;\n const d = document;\n return {\n use_existing_jquery() {\n return use_existing_jquery;\n },\n library_tolerance() {\n return library_tolerance;\n },\n finish() {\n if (!f) {\n f = true;\n const a = d.getElementById(\"_vis_opt_path_hides\");\n if (a) a.parentNode.removeChild(a);\n }\n },\n finished() {\n return f;\n },\n load(a) {\n const b = d.createElement(\"script\");\n b.src = a;\n b.type = \"text/javascript\";\n b.innerText;\n b.onerror = function () {\n _vwo_code.finish();\n };\n d.getElementsByTagName(\"head\")[0].appendChild(b);\n },\n init() {\n const settings_timer = setTimeout(\n \"_vwo_code.finish()\",\n settings_tolerance\n );\n const a = d.createElement(\"style\");\n const b =\n \"body{opacity:0 !important;filter:alpha(opacity=0) !important;background:none !important;}\";\n const h = d.getElementsByTagName(\"head\")[0];\n a.setAttribute(\"id\", \"_vis_opt_path_hides\");\n a.setAttribute(\"type\", \"text/css\");\n if (a.styleSheet) a.styleSheet.cssText = b;\n else a.appendChild(d.createTextNode(b));\n h.appendChild(a);\n this.load(\n `//dev.visualwebsiteoptimizer.com/j.php?a=${account_id}&u=${encodeURIComponent(\n d.URL\n )}&r=${Math.random()}&f=${+isSPA}`\n );\n return settings_timer;\n },\n };\n })();\n window._vwo_settings_timer = window._vwo_code.init();\n\n // Send track or iddentify when\n if (this.sendExperimentTrack || this.experimentViewedIdentify) {\n this.experimentViewed();\n }\n }\n\n experimentViewed() {\n window.VWO = window.VWO || [];\n const self = this;\n window.VWO.push([\n \"onVariationApplied\",\n (data) => {\n if (!data) {\n return;\n }\n logger.debug(\"Variation Applied\");\n const expId = data[1];\n const variationId = data[2];\n logger.debug(\n \"experiment id:\",\n expId,\n \"Variation Name:\",\n _vwo_exp[expId].comb_n[variationId]\n );\n if (\n typeof _vwo_exp[expId].comb_n[variationId] !== \"undefined\" &&\n [\"VISUAL_AB\", \"VISUAL\", \"SPLIT_URL\", \"SURVEY\"].indexOf(\n _vwo_exp[expId].type\n ) > -1\n ) {\n try {\n if (self.sendExperimentTrack) {\n logger.debug(\"Tracking...\");\n this.analytics.track(\"Experiment Viewed\", {\n experimentId: expId,\n variationName: _vwo_exp[expId].comb_n[variationId],\n });\n }\n } catch (error) {\n logger.error(\"[VWO] experimentViewed:: \", error);\n }\n try {\n if (self.sendExperimentIdentify) {\n logger.debug(\"Identifying...\");\n this.analytics.identify({\n [`Experiment: ${expId}`]: _vwo_exp[expId].comb_n[variationId],\n });\n }\n } catch (error) {\n logger.error(\"[VWO] experimentViewed:: \", error);\n }\n }\n },\n ]);\n }\n\n identify(rudderElement) {\n logger.debug(\"method not supported\");\n }\n\n track(rudderElement) {\n const eventName = rudderElement.message.event;\n if (eventName === \"Order Completed\") {\n const total = rudderElement.message.properties\n ? rudderElement.message.properties.total ||\n rudderElement.message.properties.revenue\n : 0;\n logger.debug(\"Revenue\", total);\n window.VWO = window.VWO || [];\n window.VWO.push([\"track.revenueConversion\", total]);\n }\n }\n\n page(rudderElement) {\n logger.debug(\"method not supported\");\n }\n\n isLoaded() {\n return !!window._vwo_code;\n }\n\n isReady() {\n return !!window._vwo_code;\n }\n}\n\nexport { VWO };\n","import logger from \"../../utils/logUtil\";\n\nclass GoogleTagManager {\n constructor(config) {\n this.containerID = config.containerID;\n this.name = \"GOOGLETAGMANAGER\";\n }\n\n init() {\n logger.debug(\"===in init GoogleTagManager===\");\n (function (w, d, s, l, i) {\n w[l] = w[l] || [];\n w[l].push({ \"gtm.start\": new Date().getTime(), event: \"gtm.js\" });\n const f = d.getElementsByTagName(s)[0];\n const j = d.createElement(s);\n const dl = l != \"dataLayer\" ? `&l=${l}` : \"\";\n j.async = true;\n j.src = `https://www.googletagmanager.com/gtm.js?id=${i}${dl}`;\n f.parentNode.insertBefore(j, f);\n })(window, document, \"script\", \"dataLayer\", this.containerID);\n }\n\n identify(rudderElement) {\n logger.debug(\"[GTM] identify:: method not supported\");\n }\n\n track(rudderElement) {\n logger.debug(\"===in track GoogleTagManager===\");\n const rudderMessage = rudderElement.message;\n const props = {\n event: rudderMessage.event,\n userId: rudderMessage.userId,\n anonymousId: rudderMessage.anonymousId,\n ...rudderMessage.properties,\n };\n this.sendToGTMDatalayer(props);\n }\n\n page(rudderElement) {\n logger.debug(\"===in page GoogleTagManager===\");\n const rudderMessage = rudderElement.message;\n const pageName = rudderMessage.name;\n const pageCategory = rudderMessage.properties\n ? rudderMessage.properties.category\n : undefined;\n\n let eventName;\n\n if (pageName) {\n eventName = `Viewed ${pageName} page`;\n }\n\n if (pageCategory && pageName) {\n eventName = `Viewed ${pageCategory} ${pageName} page`;\n }\n if (!eventName) {\n eventName = \"Viewed a Page\";\n }\n const props = {\n event: eventName,\n userId: rudderMessage.userId,\n anonymousId: rudderMessage.anonymousId,\n ...rudderMessage.properties,\n };\n\n this.sendToGTMDatalayer(props);\n }\n\n isLoaded() {\n return !!(\n window.dataLayer && Array.prototype.push !== window.dataLayer.push\n );\n }\n\n sendToGTMDatalayer(props) {\n window.dataLayer.push(props);\n }\n\n isReady() {\n return !!(\n window.dataLayer && Array.prototype.push !== window.dataLayer.push\n );\n }\n}\n\nexport { GoogleTagManager };\n","import logger from \"../../utils/logUtil\";\n\n/*\nE-commerce support required for logPurchase support & other e-commerce events as track with productId changed\n*/\nclass Braze {\n constructor(config, analytics) {\n this.analytics = analytics;\n this.appKey = config.appKey;\n if (!config.appKey) this.appKey = \"\";\n this.endPoint = \"\";\n if (config.dataCenter) {\n const dataCenterArr = config.dataCenter.trim().split(\"-\");\n if (dataCenterArr[0].toLowerCase() === \"eu\") {\n this.endPoint = \"sdk.fra-01.braze.eu\";\n } else {\n this.endPoint = `sdk.iad-${dataCenterArr[1]}.braze.com`;\n }\n }\n\n this.name = \"BRAZE\";\n\n logger.debug(\"Config \", config);\n }\n\n /** https://js.appboycdn.com/web-sdk/latest/doc/ab.User.html#toc4\n */\n\n formatGender(gender) {\n if (!gender) return;\n if (typeof gender !== \"string\") return;\n\n const femaleGenders = [\"woman\", \"female\", \"w\", \"f\"];\n const maleGenders = [\"man\", \"male\", \"m\"];\n const otherGenders = [\"other\", \"o\"];\n\n if (femaleGenders.indexOf(gender.toLowerCase()) > -1)\n return window.appboy.ab.User.Genders.FEMALE;\n if (maleGenders.indexOf(gender.toLowerCase()) > -1)\n return window.appboy.ab.User.Genders.MALE;\n if (otherGenders.indexOf(gender.toLowerCase()) > -1)\n return window.appboy.ab.User.Genders.OTHER;\n }\n\n init() {\n logger.debug(\"===in init Braze===\");\n\n // load appboy\n +(function (a, p, P, b, y) {\n a.appboy = {};\n a.appboyQueue = [];\n for (\n let s = \"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(\n \" \"\n ),\n i = 0;\n i < s.length;\n i++\n ) {\n for (\n var m = s[i], k = a.appboy, l = m.split(\".\"), j = 0;\n j < l.length - 1;\n j++\n )\n k = k[l[j]];\n k[l[j]] = new Function(\n `return function ${m.replace(\n /\\./g,\n \"_\"\n )}(){window.appboyQueue.push(arguments); return true}`\n )();\n }\n window.appboy.getUser = function () {\n return new window.appboy.ab.User();\n };\n window.appboy.getCachedFeed = function () {\n return new window.appboy.ab.Feed();\n };\n window.appboy.getCachedContentCards = function () {\n return new window.appboy.ab.ContentCards();\n };\n (y = p.createElement(P)).type = \"text/javascript\";\n y.src = \"https://js.appboycdn.com/web-sdk/2.4/appboy.min.js\";\n y.async = 1;\n (b = p.getElementsByTagName(P)[0]).parentNode.insertBefore(y, b);\n })(window, document, \"script\");\n\n window.appboy.initialize(this.appKey, {\n enableLogging: true,\n baseUrl: this.endPoint,\n });\n window.appboy.display.automaticallyShowNewInAppMessages();\n\n const { userId } = this.analytics;\n // send userId if you have it https://js.appboycdn.com/web-sdk/latest/doc/module-appboy.html#.changeUser\n if (userId) appboy.changeUser(userId);\n\n window.appboy.openSession();\n }\n\n handleReservedProperties(props) {\n // remove reserved keys from custom event properties\n // https://www.appboy.com/documentation/Platform_Wide/#reserved-keys\n const reserved = [\n \"time\",\n \"product_id\",\n \"quantity\",\n \"event_name\",\n \"price\",\n \"currency\",\n ];\n\n reserved.forEach((element) => {\n delete props[element];\n });\n return props;\n }\n\n identify(rudderElement) {\n const { userId } = rudderElement.message;\n const { address } = rudderElement.message.context.traits;\n const { avatar } = rudderElement.message.context.traits;\n const { birthday } = rudderElement.message.context.traits;\n const { email } = rudderElement.message.context.traits;\n const { firstname } = rudderElement.message.context.traits;\n const { gender } = rudderElement.message.context.traits;\n const { lastname } = rudderElement.message.context.traits;\n const { phone } = rudderElement.message.context.traits;\n\n // This is a hack to make a deep copy that is not recommended because it will often fail:\n const traits = JSON.parse(\n JSON.stringify(rudderElement.message.context.traits)\n );\n\n window.appboy.changeUser(userId);\n window.appboy.getUser().setAvatarImageUrl(avatar);\n if (email) window.appboy.getUser().setEmail(email);\n if (firstname) window.appboy.getUser().setFirstName(firstname);\n if (gender) window.appboy.getUser().setGender(this.formatGender(gender));\n if (lastname) window.appboy.getUser().setLastName(lastname);\n if (phone) window.appboy.getUser().setPhoneNumber(phone);\n if (address) {\n window.appboy.getUser().setCountry(address.country);\n window.appboy.getUser().setHomeCity(address.city);\n }\n if (birthday) {\n window.appboy\n .getUser()\n .setDateOfBirth(\n birthday.getUTCFullYear(),\n birthday.getUTCMonth() + 1,\n birthday.getUTCDate()\n );\n }\n\n // remove reserved keys https://www.appboy.com/documentation/Platform_Wide/#reserved-keys\n const reserved = [\n \"avatar\",\n \"address\",\n \"birthday\",\n \"email\",\n \"id\",\n \"firstname\",\n \"gender\",\n \"lastname\",\n \"phone\",\n \"facebook\",\n \"twitter\",\n \"first_name\",\n \"last_name\",\n \"dob\",\n \"external_id\",\n \"country\",\n \"home_city\",\n \"bio\",\n \"gender\",\n \"phone\",\n \"email_subscribe\",\n \"push_subscribe\",\n ];\n\n reserved.forEach((element) => {\n delete traits[element];\n });\n\n Object.keys(traits).forEach((key) => {\n window.appboy.getUser().setCustomUserAttribute(key, traits[key]);\n });\n }\n\n handlePurchase(properties, userId) {\n const { products } = properties;\n const currencyCode = properties.currency;\n\n window.appboy.changeUser(userId);\n\n // del used properties\n del(properties, \"products\");\n del(properties, \"currency\");\n\n // we have to make a separate call to appboy for each product\n products.forEach((product) => {\n const productId = product.product_id;\n const { price } = product;\n const { quantity } = product;\n if (quantity && price && productId)\n window.appboy.logPurchase(\n productId,\n price,\n currencyCode,\n quantity,\n properties\n );\n });\n }\n\n track(rudderElement) {\n const { userId } = rudderElement.message;\n const eventName = rudderElement.message.event;\n let { properties } = rudderElement.message;\n\n window.appboy.changeUser(userId);\n\n if (eventName.toLowerCase() === \"order completed\") {\n this.handlePurchase(properties, userId);\n } else {\n properties = this.handleReservedProperties(properties);\n window.appboy.logCustomEvent(eventName, properties);\n }\n }\n\n page(rudderElement) {\n const { userId } = rudderElement.message;\n const eventName = rudderElement.message.name;\n let { properties } = rudderElement.message;\n\n properties = this.handleReservedProperties(properties);\n\n window.appboy.changeUser(userId);\n window.appboy.logCustomEvent(eventName, properties);\n }\n\n isLoaded() {\n return window.appboyQueue === null;\n }\n\n isReady() {\n return window.appboyQueue === null;\n }\n}\n\nexport { Braze };\n","(function() {\n var base64map\n = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',\n\n crypt = {\n // Bit-wise rotation left\n rotl: function(n, b) {\n return (n << b) | (n >>> (32 - b));\n },\n\n // Bit-wise rotation right\n rotr: function(n, b) {\n return (n << (32 - b)) | (n >>> b);\n },\n\n // Swap big-endian to little-endian and vice versa\n endian: function(n) {\n // If number given, swap endian\n if (n.constructor == Number) {\n return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;\n }\n\n // Else, assume array and swap all items\n for (var i = 0; i < n.length; i++)\n n[i] = crypt.endian(n[i]);\n return n;\n },\n\n // Generate an array of any length of random bytes\n randomBytes: function(n) {\n for (var bytes = []; n > 0; n--)\n bytes.push(Math.floor(Math.random() * 256));\n return bytes;\n },\n\n // Convert a byte array to big-endian 32-bit words\n bytesToWords: function(bytes) {\n for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)\n words[b >>> 5] |= bytes[i] << (24 - b % 32);\n return words;\n },\n\n // Convert big-endian 32-bit words to a byte array\n wordsToBytes: function(words) {\n for (var bytes = [], b = 0; b < words.length * 32; b += 8)\n bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);\n return bytes;\n },\n\n // Convert a byte array to a hex string\n bytesToHex: function(bytes) {\n for (var hex = [], i = 0; i < bytes.length; i++) {\n hex.push((bytes[i] >>> 4).toString(16));\n hex.push((bytes[i] & 0xF).toString(16));\n }\n return hex.join('');\n },\n\n // Convert a hex string to a byte array\n hexToBytes: function(hex) {\n for (var bytes = [], c = 0; c < hex.length; c += 2)\n bytes.push(parseInt(hex.substr(c, 2), 16));\n return bytes;\n },\n\n // Convert a byte array to a base-64 string\n bytesToBase64: function(bytes) {\n for (var base64 = [], i = 0; i < bytes.length; i += 3) {\n var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];\n for (var j = 0; j < 4; j++)\n if (i * 8 + j * 6 <= bytes.length * 8)\n base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));\n else\n base64.push('=');\n }\n return base64.join('');\n },\n\n // Convert a base-64 string to a byte array\n base64ToBytes: function(base64) {\n // Remove non-base-64 characters\n base64 = base64.replace(/[^A-Z0-9+\\/]/ig, '');\n\n for (var bytes = [], i = 0, imod4 = 0; i < base64.length;\n imod4 = ++i % 4) {\n if (imod4 == 0) continue;\n bytes.push(((base64map.indexOf(base64.charAt(i - 1))\n & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))\n | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));\n }\n return bytes;\n }\n };\n\n module.exports = crypt;\n})();\n","var charenc = {\n // UTF-8 encoding\n utf8: {\n // Convert a string to a byte array\n stringToBytes: function(str) {\n return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));\n },\n\n // Convert a byte array to a string\n bytesToString: function(bytes) {\n return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));\n }\n },\n\n // Binary encoding\n bin: {\n // Convert a string to a byte array\n stringToBytes: function(str) {\n for (var bytes = [], i = 0; i < str.length; i++)\n bytes.push(str.charCodeAt(i) & 0xFF);\n return bytes;\n },\n\n // Convert a byte array to a string\n bytesToString: function(bytes) {\n for (var str = [], i = 0; i < bytes.length; i++)\n str.push(String.fromCharCode(bytes[i]));\n return str.join('');\n }\n }\n};\n\nmodule.exports = charenc;\n","/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\n// The _isBuffer check is for Safari 5-7 support, because it's missing\n// Object.prototype.constructor. Remove this eventually\nmodule.exports = function (obj) {\n return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)\n}\n\nfunction isBuffer (obj) {\n return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n\n// For Node v0.10 support. Remove this eventually.\nfunction isSlowBuffer (obj) {\n return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))\n}\n","(function(){\r\n var crypt = require('crypt'),\r\n utf8 = require('charenc').utf8,\r\n isBuffer = require('is-buffer'),\r\n bin = require('charenc').bin,\r\n\r\n // The core\r\n md5 = function (message, options) {\r\n // Convert to byte array\r\n if (message.constructor == String)\r\n if (options && options.encoding === 'binary')\r\n message = bin.stringToBytes(message);\r\n else\r\n message = utf8.stringToBytes(message);\r\n else if (isBuffer(message))\r\n message = Array.prototype.slice.call(message, 0);\r\n else if (!Array.isArray(message) && message.constructor !== Uint8Array)\r\n message = message.toString();\r\n // else, assume byte array already\r\n\r\n var m = crypt.bytesToWords(message),\r\n l = message.length * 8,\r\n a = 1732584193,\r\n b = -271733879,\r\n c = -1732584194,\r\n d = 271733878;\r\n\r\n // Swap endian\r\n for (var i = 0; i < m.length; i++) {\r\n m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |\r\n ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;\r\n }\r\n\r\n // Padding\r\n m[l >>> 5] |= 0x80 << (l % 32);\r\n m[(((l + 64) >>> 9) << 4) + 14] = l;\r\n\r\n // Method shortcuts\r\n var FF = md5._ff,\r\n GG = md5._gg,\r\n HH = md5._hh,\r\n II = md5._ii;\r\n\r\n for (var i = 0; i < m.length; i += 16) {\r\n\r\n var aa = a,\r\n bb = b,\r\n cc = c,\r\n dd = d;\r\n\r\n a = FF(a, b, c, d, m[i+ 0], 7, -680876936);\r\n d = FF(d, a, b, c, m[i+ 1], 12, -389564586);\r\n c = FF(c, d, a, b, m[i+ 2], 17, 606105819);\r\n b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);\r\n a = FF(a, b, c, d, m[i+ 4], 7, -176418897);\r\n d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);\r\n c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);\r\n b = FF(b, c, d, a, m[i+ 7], 22, -45705983);\r\n a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);\r\n d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);\r\n c = FF(c, d, a, b, m[i+10], 17, -42063);\r\n b = FF(b, c, d, a, m[i+11], 22, -1990404162);\r\n a = FF(a, b, c, d, m[i+12], 7, 1804603682);\r\n d = FF(d, a, b, c, m[i+13], 12, -40341101);\r\n c = FF(c, d, a, b, m[i+14], 17, -1502002290);\r\n b = FF(b, c, d, a, m[i+15], 22, 1236535329);\r\n\r\n a = GG(a, b, c, d, m[i+ 1], 5, -165796510);\r\n d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);\r\n c = GG(c, d, a, b, m[i+11], 14, 643717713);\r\n b = GG(b, c, d, a, m[i+ 0], 20, -373897302);\r\n a = GG(a, b, c, d, m[i+ 5], 5, -701558691);\r\n d = GG(d, a, b, c, m[i+10], 9, 38016083);\r\n c = GG(c, d, a, b, m[i+15], 14, -660478335);\r\n b = GG(b, c, d, a, m[i+ 4], 20, -405537848);\r\n a = GG(a, b, c, d, m[i+ 9], 5, 568446438);\r\n d = GG(d, a, b, c, m[i+14], 9, -1019803690);\r\n c = GG(c, d, a, b, m[i+ 3], 14, -187363961);\r\n b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);\r\n a = GG(a, b, c, d, m[i+13], 5, -1444681467);\r\n d = GG(d, a, b, c, m[i+ 2], 9, -51403784);\r\n c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);\r\n b = GG(b, c, d, a, m[i+12], 20, -1926607734);\r\n\r\n a = HH(a, b, c, d, m[i+ 5], 4, -378558);\r\n d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);\r\n c = HH(c, d, a, b, m[i+11], 16, 1839030562);\r\n b = HH(b, c, d, a, m[i+14], 23, -35309556);\r\n a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);\r\n d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);\r\n c = HH(c, d, a, b, m[i+ 7], 16, -155497632);\r\n b = HH(b, c, d, a, m[i+10], 23, -1094730640);\r\n a = HH(a, b, c, d, m[i+13], 4, 681279174);\r\n d = HH(d, a, b, c, m[i+ 0], 11, -358537222);\r\n c = HH(c, d, a, b, m[i+ 3], 16, -722521979);\r\n b = HH(b, c, d, a, m[i+ 6], 23, 76029189);\r\n a = HH(a, b, c, d, m[i+ 9], 4, -640364487);\r\n d = HH(d, a, b, c, m[i+12], 11, -421815835);\r\n c = HH(c, d, a, b, m[i+15], 16, 530742520);\r\n b = HH(b, c, d, a, m[i+ 2], 23, -995338651);\r\n\r\n a = II(a, b, c, d, m[i+ 0], 6, -198630844);\r\n d = II(d, a, b, c, m[i+ 7], 10, 1126891415);\r\n c = II(c, d, a, b, m[i+14], 15, -1416354905);\r\n b = II(b, c, d, a, m[i+ 5], 21, -57434055);\r\n a = II(a, b, c, d, m[i+12], 6, 1700485571);\r\n d = II(d, a, b, c, m[i+ 3], 10, -1894986606);\r\n c = II(c, d, a, b, m[i+10], 15, -1051523);\r\n b = II(b, c, d, a, m[i+ 1], 21, -2054922799);\r\n a = II(a, b, c, d, m[i+ 8], 6, 1873313359);\r\n d = II(d, a, b, c, m[i+15], 10, -30611744);\r\n c = II(c, d, a, b, m[i+ 6], 15, -1560198380);\r\n b = II(b, c, d, a, m[i+13], 21, 1309151649);\r\n a = II(a, b, c, d, m[i+ 4], 6, -145523070);\r\n d = II(d, a, b, c, m[i+11], 10, -1120210379);\r\n c = II(c, d, a, b, m[i+ 2], 15, 718787259);\r\n b = II(b, c, d, a, m[i+ 9], 21, -343485551);\r\n\r\n a = (a + aa) >>> 0;\r\n b = (b + bb) >>> 0;\r\n c = (c + cc) >>> 0;\r\n d = (d + dd) >>> 0;\r\n }\r\n\r\n return crypt.endian([a, b, c, d]);\r\n };\r\n\r\n // Auxiliary functions\r\n md5._ff = function (a, b, c, d, x, s, t) {\r\n var n = a + (b & c | ~b & d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._gg = function (a, b, c, d, x, s, t) {\r\n var n = a + (b & d | c & ~d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._hh = function (a, b, c, d, x, s, t) {\r\n var n = a + (b ^ c ^ d) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n md5._ii = function (a, b, c, d, x, s, t) {\r\n var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;\r\n return ((n << s) | (n >>> (32 - s))) + b;\r\n };\r\n\r\n // Package private blocksize\r\n md5._blocksize = 16;\r\n md5._digestsize = 16;\r\n\r\n module.exports = function (message, options) {\r\n if (message === undefined || message === null)\r\n throw new Error('Illegal argument ' + message);\r\n\r\n var digestbytes = crypt.wordsToBytes(md5(message, options));\r\n return options && options.asBytes ? digestbytes :\r\n options && options.asString ? bin.bytesToString(digestbytes) :\r\n crypt.bytesToHex(digestbytes);\r\n };\r\n\r\n})();\r\n","import md5 from \"md5\";\nimport logger from \"../../utils/logUtil\";\n\nclass INTERCOM {\n constructor(config) {\n this.NAME = \"INTERCOM\";\n this.API_KEY = config.apiKey;\n this.APP_ID = config.appId;\n this.MOBILE_APP_ID = config.mobileAppId;\n logger.debug(\"Config \", config);\n }\n\n init() {\n window.intercomSettings = {\n app_id: this.APP_ID,\n };\n\n (function () {\n const w = window;\n const ic = w.Intercom;\n if (typeof ic === \"function\") {\n ic(\"reattach_activator\");\n ic(\"update\", w.intercomSettings);\n } else {\n const d = document;\n var i = function () {\n i.c(arguments);\n };\n i.q = [];\n i.c = function (args) {\n i.q.push(args);\n };\n w.Intercom = i;\n const l = function () {\n const s = d.createElement(\"script\");\n s.type = \"text/javascript\";\n s.async = true;\n s.src = `https://widget.intercom.io/widget/${window.intercomSettings.app_id}`;\n const x = d.getElementsByTagName(\"script\")[0];\n x.parentNode.insertBefore(s, x);\n };\n if (document.readyState === \"complete\") {\n l();\n window.intercom_code = true;\n } else if (w.attachEvent) {\n w.attachEvent(\"onload\", l);\n window.intercom_code = true;\n } else {\n w.addEventListener(\"load\", l, false);\n window.intercom_code = true;\n }\n }\n })();\n }\n\n page() {\n // Get new messages of the current user\n window.Intercom(\"update\");\n }\n\n identify(rudderElement) {\n const rawPayload = {};\n const { context } = rudderElement.message;\n\n const identityVerificationProps = context.Intercom\n ? context.Intercom\n : null;\n if (identityVerificationProps != null) {\n // user hash\n const userHash = context.Intercom.user_hash\n ? context.Intercom.user_hash\n : null;\n\n if (userHash != null) {\n rawPayload.user_hash = userHash;\n }\n\n // hide default launcher\n const hideDefaultLauncher = context.Intercom.hideDefaultLauncher\n ? context.Intercom.hideDefaultLauncher\n : null;\n\n if (hideDefaultLauncher != null) {\n rawPayload.hide_default_launcher = hideDefaultLauncher;\n }\n }\n\n // map rudderPayload to desired\n Object.keys(context.traits).forEach((field) => {\n if (context.traits.hasOwnProperty(field)) {\n const value = context.traits[field];\n\n if (field === \"company\") {\n const companies = [];\n const company = {};\n // special handling string\n if (typeof context.traits[field] === \"string\") {\n company.company_id = md5(context.traits[field]);\n }\n const companyFields =\n (typeof context.traits[field] === \"object\" &&\n Object.keys(context.traits[field])) ||\n [];\n companyFields.forEach((key) => {\n if (companyFields.hasOwnProperty(key)) {\n if (key != \"id\") {\n company[key] = context.traits[field][key];\n } else {\n company.company_id = context.traits[field][key];\n }\n }\n });\n\n if (\n typeof context.traits[field] === \"object\" &&\n !companyFields.includes(\"id\")\n ) {\n company.company_id = md5(company.name);\n }\n\n companies.push(company);\n rawPayload.companies = companies;\n } else {\n rawPayload[field] = context.traits[field];\n }\n\n switch (field) {\n case \"createdAt\":\n rawPayload.created_at = value;\n break;\n case \"anonymousId\":\n rawPayload.user_id = value;\n break;\n\n default:\n break;\n }\n }\n });\n rawPayload.user_id = rudderElement.message.userId;\n window.Intercom(\"update\", rawPayload);\n }\n\n track(rudderElement) {\n const rawPayload = {};\n const { message } = rudderElement;\n\n const properties = message.properties\n ? Object.keys(message.properties)\n : null;\n properties.forEach((property) => {\n const value = message.properties[property];\n rawPayload[property] = value;\n });\n\n if (message.event) {\n rawPayload.event_name = message.event;\n }\n rawPayload.user_id = message.userId ? message.userId : message.anonymousId;\n rawPayload.created_at = Math.floor(\n new Date(message.originalTimestamp).getTime() / 1000\n );\n window.Intercom(\"trackEvent\", rawPayload.event_name, rawPayload);\n }\n\n isLoaded() {\n return !!window.intercom_code;\n }\n\n isReady() {\n return !!window.intercom_code;\n }\n}\n\nexport { INTERCOM };\n","import logger from \"../../utils/logUtil\";\nimport ScriptLoader from \"../ScriptLoader\";\n\nclass Keen {\n constructor(config) {\n this.projectID = config.projectID;\n this.writeKey = config.writeKey;\n this.ipAddon = config.ipAddon;\n this.uaAddon = config.uaAddon;\n this.urlAddon = config.urlAddon;\n this.referrerAddon = config.referrerAddon;\n this.client = null;\n this.name = \"KEEN\";\n }\n\n init() {\n logger.debug(\"===in init Keen===\");\n ScriptLoader(\n \"keen-integration\",\n \"https://cdn.jsdelivr.net/npm/keen-tracking@4\"\n );\n\n const check = setInterval(checkAndInitKeen.bind(this), 1000);\n function initKeen(object) {\n object.client = new window.KeenTracking({\n projectId: object.projectID,\n writeKey: object.writeKey,\n });\n return object.client;\n }\n function checkAndInitKeen() {\n if (window.KeenTracking !== undefined && window.KeenTracking !== void 0) {\n this.client = initKeen(this);\n clearInterval(check);\n }\n }\n }\n\n identify(rudderElement) {\n logger.debug(\"in Keen identify\");\n const { traits } = rudderElement.message.context;\n const userId = rudderElement.message.userId\n ? rudderElement.message.userId\n : rudderElement.message.anonymousId;\n let properties = rudderElement.message.properties\n ? Object.assign(properties, rudderElement.message.properties)\n : {};\n properties.user = {\n userId,\n traits,\n };\n properties = this.getAddOn(properties);\n this.client.extendEvents(properties);\n }\n\n track(rudderElement) {\n logger.debug(\"in Keen track\");\n\n const { event } = rudderElement.message;\n let { properties } = rudderElement.message;\n properties = this.getAddOn(properties);\n this.client.recordEvent(event, properties);\n }\n\n page(rudderElement) {\n logger.debug(\"in Keen page\");\n const pageName = rudderElement.message.name;\n const pageCategory = rudderElement.message.properties\n ? rudderElement.message.properties.category\n : undefined;\n let name = \"Loaded a Page\";\n if (pageName) {\n name = `Viewed ${pageName} page`;\n }\n if (pageCategory && pageName) {\n name = `Viewed ${pageCategory} ${pageName} page`;\n }\n\n let { properties } = rudderElement.message;\n properties = this.getAddOn(properties);\n this.client.recordEvent(name, properties);\n }\n\n isLoaded() {\n logger.debug(\"in Keen isLoaded\");\n return !!(this.client != null);\n }\n\n isReady() {\n return !!(this.client != null);\n }\n\n getAddOn(properties) {\n const addOns = [];\n if (this.ipAddon) {\n properties.ip_address = \"${keen.ip}\";\n addOns.push({\n name: \"keen:ip_to_geo\",\n input: {\n ip: \"ip_address\",\n },\n output: \"ip_geo_info\",\n });\n }\n if (this.uaAddon) {\n properties.user_agent = \"${keen.user_agent}\";\n addOns.push({\n name: \"keen:ua_parser\",\n input: {\n ua_string: \"user_agent\",\n },\n output: \"parsed_user_agent\",\n });\n }\n if (this.urlAddon) {\n properties.page_url = document.location.href;\n addOns.push({\n name: \"keen:url_parser\",\n input: {\n url: \"page_url\",\n },\n output: \"parsed_page_url\",\n });\n }\n if (this.referrerAddon) {\n properties.page_url = document.location.href;\n properties.referrer_url = document.referrer;\n addOns.push({\n name: \"keen:referrer_parser\",\n input: {\n referrer_url: \"referrer_url\",\n page_url: \"page_url\",\n },\n output: \"referrer_info\",\n });\n }\n properties.keen = {\n addons: addOns,\n };\n return properties;\n }\n}\n\nexport { Keen };\n","'use strict';\n\nvar has = Object.prototype.hasOwnProperty;\n\n/**\n * Copy the properties of one or more `objects` onto a destination object. Input objects are iterated over\n * in left-to-right order, so duplicate properties on later objects will overwrite those from\n * erevious ones. Only enumerable and own properties of the input objects are copied onto the\n * resulting object.\n *\n * @name extend\n * @api public\n * @category Object\n * @param {Object} dest The destination object.\n * @param {...Object} sources The source objects.\n * @return {Object} `dest`, extended with the properties of all `sources`.\n * @example\n * var a = { a: 'a' };\n * var b = { b: 'b' };\n * var c = { c: 'c' };\n *\n * extend(a, b, c);\n * //=> { a: 'a', b: 'b', c: 'c' };\n */\nvar extend = function extend(dest /*, sources */) {\n var sources = Array.prototype.slice.call(arguments, 1);\n\n for (var i = 0; i < sources.length; i += 1) {\n for (var key in sources[i]) {\n if (has.call(sources[i], key)) {\n dest[key] = sources[i][key];\n }\n }\n }\n\n return dest;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = extend;\n","\nvar identity = function(_){ return _; };\n\n\n/**\n * Module exports, export\n */\n\nmodule.exports = multiple(find);\nmodule.exports.find = module.exports;\n\n\n/**\n * Export the replacement function, return the modified object\n */\n\nmodule.exports.replace = function (obj, key, val, options) {\n multiple(replace).call(this, obj, key, val, options);\n return obj;\n};\n\n\n/**\n * Export the delete function, return the modified object\n */\n\nmodule.exports.del = function (obj, key, options) {\n multiple(del).call(this, obj, key, null, options);\n return obj;\n};\n\n\n/**\n * Compose applying the function to a nested key\n */\n\nfunction multiple (fn) {\n return function (obj, path, val, options) {\n normalize = options && isFunction(options.normalizer) ? options.normalizer : defaultNormalize;\n path = normalize(path);\n\n var key;\n var finished = false;\n\n while (!finished) loop();\n\n function loop() {\n for (key in obj) {\n var normalizedKey = normalize(key);\n if (0 === path.indexOf(normalizedKey)) {\n var temp = path.substr(normalizedKey.length);\n if (temp.charAt(0) === '.' || temp.length === 0) {\n path = temp.substr(1);\n var child = obj[key];\n\n // we're at the end and there is nothing.\n if (null == child) {\n finished = true;\n return;\n }\n\n // we're at the end and there is something.\n if (!path.length) {\n finished = true;\n return;\n }\n\n // step into child\n obj = child;\n\n // but we're done here\n return;\n }\n }\n }\n\n key = undefined;\n // if we found no matching properties\n // on the current object, there's no match.\n finished = true;\n }\n\n if (!key) return;\n if (null == obj) return obj;\n\n // the `obj` and `key` is one above the leaf object and key, so\n // start object: { a: { 'b.c': 10 } }\n // end object: { 'b.c': 10 }\n // end key: 'b.c'\n // this way, you can do `obj[key]` and get `10`.\n return fn(obj, key, val);\n };\n}\n\n\n/**\n * Find an object by its key\n *\n * find({ first_name : 'Calvin' }, 'firstName')\n */\n\nfunction find (obj, key) {\n if (obj.hasOwnProperty(key)) return obj[key];\n}\n\n\n/**\n * Delete a value for a given key\n *\n * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' }\n */\n\nfunction del (obj, key) {\n if (obj.hasOwnProperty(key)) delete obj[key];\n return obj;\n}\n\n\n/**\n * Replace an objects existing value with a new one\n *\n * replace({ a : 'b' }, 'a', 'c') -> { a : 'c' }\n */\n\nfunction replace (obj, key, val) {\n if (obj.hasOwnProperty(key)) obj[key] = val;\n return obj;\n}\n\n/**\n * Normalize a `dot.separated.path`.\n *\n * A.HELL(!*&#(!)O_WOR LD.bar => ahelloworldbar\n *\n * @param {String} path\n * @return {String}\n */\n\nfunction defaultNormalize(path) {\n return path.replace(/[^a-zA-Z0-9\\.]+/g, '').toLowerCase();\n}\n\n/**\n * Check if a value is a function.\n *\n * @param {*} val\n * @return {boolean} Returns `true` if `val` is a function, otherwise `false`.\n */\n\nfunction isFunction(val) {\n return typeof val === 'function';\n}\n","import is from \"is\";\nimport extend from \"@ndhoule/extend\";\nimport { del } from \"obj-case\";\nimport each from \"component-each\";\nimport { getRevenue } from \"../../utils/utils\";\nimport logger from \"../../utils/logUtil\";\n\nclass Kissmetrics {\n constructor(config) {\n this.apiKey = config.apiKey;\n this.prefixProperties = config.prefixProperties;\n this.name = \"KISSMETRICS\";\n }\n\n init() {\n logger.debug(\"===in init Kissmetrics===\");\n window._kmq = window._kmq || [];\n\n const _kmk = window._kmk || this.apiKey;\n function _kms(u) {\n setTimeout(function () {\n const d = document;\n const f = d.getElementsByTagName(\"script\")[0];\n const s = d.createElement(\"script\");\n s.type = \"text/javascript\";\n s.async = true;\n s.src = u;\n f.parentNode.insertBefore(s, f);\n }, 1);\n }\n _kms(\"//i.kissmetrics.com/i.js\");\n _kms(`//scripts.kissmetrics.com/${_kmk}.2.js`);\n\n if (this.isEnvMobile()) {\n window._kmq.push([\"set\", { \"Mobile Session\": \"Yes\" }]);\n }\n }\n\n isEnvMobile() {\n return (\n navigator.userAgent.match(/Android/i) ||\n navigator.userAgent.match(/BlackBerry/i) ||\n navigator.userAgent.match(/IEMobile/i) ||\n navigator.userAgent.match(/Opera Mini/i) ||\n navigator.userAgent.match(/iPad/i) ||\n navigator.userAgent.match(/iPhone|iPod/i)\n );\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n toUnixTimestamp(date) {\n date = new Date(date);\n return Math.floor(date.getTime() / 1000);\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n clean(obj) {\n let ret = {};\n\n for (const k in obj) {\n if (obj.hasOwnProperty(k)) {\n const value = obj[k];\n if (value === null || typeof value === \"undefined\") continue;\n\n // convert date to unix\n if (is.date(value)) {\n ret[k] = this.toUnixTimestamp(value);\n continue;\n }\n\n // leave boolean as is\n if (is.bool(value)) {\n ret[k] = value;\n continue;\n }\n\n // leave numbers as is\n if (is.number(value)) {\n ret[k] = value;\n continue;\n }\n\n // convert non objects to strings\n logger.debug(value.toString());\n if (value.toString() !== \"[object Object]\") {\n ret[k] = value.toString();\n continue;\n }\n\n // json\n // must flatten including the name of the original trait/property\n const nestedObj = {};\n nestedObj[k] = value;\n const flattenedObj = this.flatten(nestedObj, { safe: true });\n\n // stringify arrays inside nested object to be consistent with top level behavior of arrays\n for (const key in flattenedObj) {\n if (is.array(flattenedObj[key])) {\n flattenedObj[key] = flattenedObj[key].toString();\n }\n }\n\n ret = extend(ret, flattenedObj);\n delete ret[k];\n }\n }\n return ret;\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n flatten(target, opts) {\n opts = opts || {};\n\n const delimiter = opts.delimiter || \".\";\n let { maxDepth } = opts;\n let currentDepth = 1;\n const output = {};\n\n function step(object, prev) {\n for (const key in object) {\n if (object.hasOwnProperty(key)) {\n const value = object[key];\n const isarray = opts.safe && is.array(value);\n const type = Object.prototype.toString.call(value);\n const isobject =\n type === \"[object Object]\" || type === \"[object Array]\";\n const arr = [];\n\n const newKey = prev ? prev + delimiter + key : key;\n\n if (!opts.maxDepth) {\n maxDepth = currentDepth + 1;\n }\n\n for (const keys in value) {\n if (value.hasOwnProperty(keys)) {\n arr.push(keys);\n }\n }\n\n if (!isarray && isobject && arr.length && currentDepth < maxDepth) {\n ++currentDepth;\n return step(value, newKey);\n }\n\n output[newKey] = value;\n }\n }\n }\n\n step(target);\n\n return output;\n }\n\n // source : https://github.com/segment-integrations/analytics.js-integration-kissmetrics/blob/master/lib/index.js\n prefix(event, properties) {\n const prefixed = {};\n each(properties, function (key, val) {\n if (key === \"Billing Amount\") {\n prefixed[key] = val;\n } else if (key === \"revenue\") {\n prefixed[`${event} - ${key}`] = val;\n prefixed[\"Billing Amount\"] = val;\n } else {\n prefixed[`${event} - ${key}`] = val;\n }\n });\n return prefixed;\n }\n\n identify(rudderElement) {\n logger.debug(\"in Kissmetrics identify\");\n const traits = this.clean(rudderElement.message.context.traits);\n const userId =\n rudderElement.message.userId && rudderElement.message.userId != \"\"\n ? rudderElement.message.userId\n : undefined;\n\n if (userId) {\n window._kmq.push([\"identify\", userId]);\n }\n if (traits) {\n window._kmq.push([\"set\", traits]);\n }\n }\n\n track(rudderElement) {\n logger.debug(\"in Kissmetrics track\");\n\n const { event } = rudderElement.message;\n let properties = JSON.parse(\n JSON.stringify(rudderElement.message.properties)\n );\n const timestamp = this.toUnixTimestamp(new Date());\n\n const revenue = getRevenue(properties);\n if (revenue) {\n properties.revenue = revenue;\n }\n\n const { products } = properties;\n if (products) {\n delete properties.products;\n }\n\n properties = this.clean(properties);\n logger.debug(JSON.stringify(properties));\n\n if (this.prefixProperties) {\n properties = this.prefix(event, properties);\n }\n window._kmq.push([\"record\", event, properties]);\n\n const iterator = function pushItem(product, i) {\n let item = product;\n if (this.prefixProperties) item = this.prefix(event, item);\n item._t = timestamp + i;\n item._d = 1;\n window.KM.set(item);\n }.bind(this);\n\n if (products) {\n window._kmq.push(() => {\n each(products, iterator);\n });\n }\n }\n\n page(rudderElement) {\n logger.debug(\"in Kissmetrics page\");\n const pageName = rudderElement.message.name;\n const pageCategory = rudderElement.message.properties\n ? rudderElement.message.properties.category\n : undefined;\n let name = \"Loaded a Page\";\n if (pageName) {\n name = `Viewed ${pageName} page`;\n }\n if (pageCategory && pageName) {\n name = `Viewed ${pageCategory} ${pageName} page`;\n }\n\n let { properties } = rudderElement.message;\n if (this.prefixProperties) {\n properties = this.prefix(\"Page\", properties);\n }\n\n window._kmq.push([\"record\", name, properties]);\n }\n\n alias(rudderElement) {\n const prev = rudderElement.message.previousId;\n const { userId } = rudderElement.message;\n window._kmq.push([\"alias\", userId, prev]);\n }\n\n group(rudderElement) {\n const { groupId } = rudderElement.message;\n let groupTraits = rudderElement.message.traits;\n groupTraits = this.prefix(\"Group\", groupTraits);\n if (groupId) {\n groupTraits[\"Group - id\"] = groupId;\n }\n window._kmq.push([\"set\", groupTraits]);\n logger.debug(\"in Kissmetrics group\");\n }\n\n isLoaded() {\n return is.object(window.KM);\n }\n\n isReady() {\n return is.object(window.KM);\n }\n}\n\nexport { Kissmetrics };\n","import logger from \"../../utils/logUtil\";\n\nclass CustomerIO {\n constructor(config) {\n this.siteID = config.siteID;\n this.apiKey = config.apiKey;\n\n this.name = \"CUSTOMERIO\";\n }\n\n init() {\n logger.debug(\"===in init Customer IO init===\");\n window._cio = window._cio || [];\n const { siteID } = this;\n (function () {\n let a;\n let b;\n let c;\n a = function (f) {\n return function () {\n window._cio.push(\n [f].concat(Array.prototype.slice.call(arguments, 0))\n );\n };\n };\n b = [\"load\", \"identify\", \"sidentify\", \"track\", \"page\"];\n for (c = 0; c < b.length; c++) {\n window._cio[b[c]] = a(b[c]);\n }\n const t = document.createElement(\"script\");\n const s = document.getElementsByTagName(\"script\")[0];\n t.async = true;\n t.id = \"cio-tracker\";\n t.setAttribute(\"data-site-id\", siteID);\n t.src = \"https://assets.customer.io/assets/track.js\";\n s.parentNode.insertBefore(t, s);\n })();\n }\n\n identify(rudderElement) {\n logger.debug(\"in Customer IO identify\");\n const userId = rudderElement.message.userId\n ? rudderElement.message.userId\n : rudderElement.message.anonymousId;\n const traits = rudderElement.message.context.traits\n ? rudderElement.message.context.traits\n : {};\n if (!traits.created_at) {\n traits.created_at = Math.floor(new Date().getTime() / 1000);\n }\n traits.id = userId;\n window._cio.identify(traits);\n }\n\n track(rudderElement) {\n logger.debug(\"in Customer IO track\");\n\n const eventName = rudderElement.message.event;\n const { properties } = rudderElement.message;\n window._cio.track(eventName, properties);\n }\n\n page(rudderElement) {\n logger.debug(\"in Customer IO page\");\n\n const name =\n rudderElement.message.name || rudderElement.message.properties.url;\n window._cio.page(name, rudderElement.message.properties);\n }\n\n isLoaded() {\n return !!(window._cio && window._cio.push !== Array.prototype.push);\n }\n\n isReady() {\n return !!(window._cio && window._cio.push !== Array.prototype.push);\n }\n}\n\nexport { CustomerIO };\n","var each = require('each');\n\n\n/**\n * Cache whether `` exists.\n */\n\nvar body = false;\n\n\n/**\n * Callbacks to call when the body exists.\n */\n\nvar callbacks = [];\n\n\n/**\n * Export a way to add handlers to be invoked once the body exists.\n *\n * @param {Function} callback A function to call when the body exists.\n */\n\nmodule.exports = function onBody (callback) {\n if (body) {\n call(callback);\n } else {\n callbacks.push(callback);\n }\n};\n\n\n/**\n * Set an interval to check for `document.body`.\n */\n\nvar interval = setInterval(function () {\n if (!document.body) return;\n body = true;\n each(callbacks, call);\n clearInterval(interval);\n}, 5);\n\n\n/**\n * Call a callback, passing it the body.\n *\n * @param {Function} callback The callback to call.\n */\n\nfunction call (callback) {\n callback(document.body);\n}","import onBody from \"on-body\";\nimport logger from \"../../utils/logUtil\";\nimport {\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL,\n} from \"../../utils/constants\";\n\nclass Chartbeat {\n constructor(config, analytics) {\n this.analytics = analytics; // use this to modify failed integrations or for passing events from callback to other destinations\n this._sf_async_config = window._sf_async_config =\n window._sf_async_config || {};\n window._sf_async_config.useCanonical = true;\n window._sf_async_config.uid = config.uid;\n window._sf_async_config.domain = config.domain;\n this.isVideo = !!config.video;\n this.sendNameAndCategoryAsTitle = config.sendNameAndCategoryAsTitle || true;\n this.subscriberEngagementKeys = config.subscriberEngagementKeys || [];\n this.replayEvents = [];\n this.failed = false;\n this.isFirstPageCallMade = false;\n this.name = \"CHARTBEAT\";\n }\n\n init() {\n logger.debug(\"===in init Chartbeat===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"in Chartbeat identify\");\n }\n\n track(rudderElement) {\n logger.debug(\"in Chartbeat track\");\n }\n\n page(rudderElement) {\n logger.debug(\"in Chartbeat page\");\n this.loadConfig(rudderElement);\n\n if (!this.isFirstPageCallMade) {\n this.isFirstPageCallMade = true;\n this.initAfterPage();\n } else {\n if (this.failed) {\n logger.debug(\"===ignoring cause failed integration===\");\n this.replayEvents = [];\n return;\n }\n if (!this.isLoaded() && !this.failed) {\n logger.debug(\"===pushing to replay queue for chartbeat===\");\n this.replayEvents.push([\"page\", rudderElement]);\n return;\n }\n logger.debug(\"===processing page event in chartbeat===\");\n const { properties } = rudderElement.message;\n window.pSUPERFLY.virtualPage(properties.path);\n }\n }\n\n isLoaded() {\n logger.debug(\"in Chartbeat isLoaded\");\n if (!this.isFirstPageCallMade) {\n return true;\n }\n return !!window.pSUPERFLY;\n }\n\n isFailed() {\n return this.failed;\n }\n\n isReady() {\n return !!window.pSUPERFLY;\n }\n\n loadConfig(rudderElement) {\n const { properties } = rudderElement.message;\n const category = properties ? properties.category : undefined;\n const { name } = rudderElement.message;\n const author = properties ? properties.author : undefined;\n let title;\n if (this.sendNameAndCategoryAsTitle) {\n title = category && name ? `${category} ${name}` : name;\n }\n if (category) window._sf_async_config.sections = category;\n if (author) window._sf_async_config.authors = author;\n if (title) window._sf_async_config.title = title;\n\n const _cbq = (window._cbq = window._cbq || []);\n\n for (const key in properties) {\n if (!properties.hasOwnProperty(key)) continue;\n if (this.subscriberEngagementKeys.indexOf(key) > -1) {\n _cbq.push([key, properties[key]]);\n }\n }\n }\n\n initAfterPage() {\n onBody(() => {\n const script = this.isVideo ? \"chartbeat_video.js\" : \"chartbeat.js\";\n function loadChartbeat() {\n const e = document.createElement(\"script\");\n const n = document.getElementsByTagName(\"script\")[0];\n e.type = \"text/javascript\";\n e.async = true;\n e.src = `//static.chartbeat.com/js/${script}`;\n n.parentNode.insertBefore(e, n);\n }\n loadChartbeat();\n });\n\n this._isReady(this).then((instance) => {\n logger.debug(\"===replaying on chartbeat===\");\n instance.replayEvents.forEach((event) => {\n instance[event[0]](event[1]);\n });\n });\n }\n\n pause(time) {\n return new Promise((resolve) => {\n setTimeout(resolve, time);\n });\n }\n\n _isReady(instance, time = 0) {\n return new Promise((resolve) => {\n if (this.isLoaded()) {\n this.failed = false;\n logger.debug(\"===chartbeat loaded successfully===\");\n instance.analytics.emit(\"ready\");\n return resolve(instance);\n }\n if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {\n this.failed = true;\n logger.debug(\"===chartbeat failed===\");\n return resolve(instance);\n }\n this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() => {\n return this._isReady(\n instance,\n time + INTEGRATION_LOAD_CHECK_INTERVAL\n ).then(resolve);\n });\n });\n }\n}\n\nexport { Chartbeat };\n","import logger from \"../../utils/logUtil\";\nimport {\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL,\n} from \"../../utils/constants\";\n\nclass Comscore {\n constructor(config, analytics) {\n this.c2ID = config.c2ID;\n this.analytics = analytics;\n this.comScoreBeaconParam = config.comScoreBeaconParam\n ? config.comScoreBeaconParam\n : {};\n this.isFirstPageCallMade = false;\n this.failed = false;\n this.comScoreParams = {};\n this.replayEvents = [];\n this.name = \"COMSCORE\";\n }\n\n init() {\n logger.debug(\"===in init Comscore init===\");\n }\n\n identify(rudderElement) {\n logger.debug(\"in Comscore identify\");\n }\n\n track(rudderElement) {\n logger.debug(\"in Comscore track\");\n }\n\n page(rudderElement) {\n logger.debug(\"in Comscore page\");\n\n this.loadConfig(rudderElement);\n\n if (!this.isFirstPageCallMade) {\n this.isFirstPageCallMade = true;\n this.initAfterPage();\n } else {\n if (this.failed) {\n this.replayEvents = [];\n return;\n }\n if (!this.isLoaded() && !this.failed) {\n this.replayEvents.push([\"page\", rudderElement]);\n return;\n }\n const { properties } = rudderElement.message;\n // window.COMSCORE.beacon({c1:\"2\", c2: \"\"});\n // this.comScoreParams = this.mapComscoreParams(properties);\n window.COMSCORE.beacon(this.comScoreParams);\n }\n }\n\n loadConfig(rudderElement) {\n logger.debug(\"=====in loadConfig=====\");\n this.comScoreParams = this.mapComscoreParams(\n rudderElement.message.properties\n );\n window._comscore = window._comscore || [];\n window._comscore.push(this.comScoreParams);\n }\n\n initAfterPage() {\n logger.debug(\"=====in initAfterPage=====\");\n (function () {\n const s = document.createElement(\"script\");\n const el = document.getElementsByTagName(\"script\")[0];\n s.async = true;\n s.src = `${\n document.location.protocol == \"https:\" ? \"https://sb\" : \"http://b\"\n }.scorecardresearch.com/beacon.js`;\n el.parentNode.insertBefore(s, el);\n })();\n\n this._isReady(this).then((instance) => {\n instance.replayEvents.forEach((event) => {\n instance[event[0]](event[1]);\n });\n });\n }\n\n pause(time) {\n return new Promise((resolve) => {\n setTimeout(resolve, time);\n });\n }\n\n _isReady(instance, time = 0) {\n return new Promise((resolve) => {\n if (this.isLoaded()) {\n this.failed = false;\n instance.analytics.emit(\"ready\");\n return resolve(instance);\n }\n if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {\n this.failed = true;\n return resolve(instance);\n }\n this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() => {\n return this._isReady(\n instance,\n time + INTEGRATION_LOAD_CHECK_INTERVAL\n ).then(resolve);\n });\n });\n }\n\n mapComscoreParams(properties) {\n logger.debug(\"=====in mapComscoreParams=====\");\n const comScoreBeaconParamsMap = this.comScoreBeaconParam;\n\n const comScoreParams = {};\n\n Object.keys(comScoreBeaconParamsMap).forEach(function (property) {\n if (property in properties) {\n const key = comScoreBeaconParamsMap[property];\n const value = properties[property];\n comScoreParams[key] = value;\n }\n });\n\n comScoreParams.c1 = \"2\";\n comScoreParams.c2 = this.c2ID;\n /* if (this.options.comscorekw.length) {\n comScoreParams.comscorekw = this.options.comscorekw;\n } */\n logger.debug(\"=====in mapComscoreParams=====\", comScoreParams);\n return comScoreParams;\n }\n\n isLoaded() {\n logger.debug(\"in Comscore isLoaded\");\n if (!this.isFirstPageCallMade) {\n return true;\n }\n return !!window.COMSCORE;\n }\n\n isReady() {\n return !!window.COMSCORE;\n }\n}\n\nexport { Comscore };\n","'use strict';\n\nvar hop = Object.prototype.hasOwnProperty;\nvar strCharAt = String.prototype.charAt;\nvar toStr = Object.prototype.toString;\n\n/**\n * Returns the character at a given index.\n *\n * @param {string} str\n * @param {number} index\n * @return {string|undefined}\n */\n// TODO: Move to a library\nvar charAt = function(str, index) {\n return strCharAt.call(str, index);\n};\n\n/**\n * hasOwnProperty, wrapped as a function.\n *\n * @name has\n * @api private\n * @param {*} context\n * @param {string|number} prop\n * @return {boolean}\n */\n\n// TODO: Move to a library\nvar has = function has(context, prop) {\n return hop.call(context, prop);\n};\n\n/**\n * Returns true if a value is a string, otherwise false.\n *\n * @name isString\n * @api private\n * @param {*} val\n * @return {boolean}\n */\n\n// TODO: Move to a library\nvar isString = function isString(val) {\n return toStr.call(val) === '[object String]';\n};\n\n/**\n * Returns true if a value is array-like, otherwise false. Array-like means a\n * value is not null, undefined, or a function, and has a numeric `length`\n * property.\n *\n * @name isArrayLike\n * @api private\n * @param {*} val\n * @return {boolean}\n */\n// TODO: Move to a library\nvar isArrayLike = function isArrayLike(val) {\n return val != null && (typeof val !== 'function' && typeof val.length === 'number');\n};\n\n\n/**\n * indexKeys\n *\n * @name indexKeys\n * @api private\n * @param {} target\n * @param {Function} pred\n * @return {Array}\n */\nvar indexKeys = function indexKeys(target, pred) {\n pred = pred || has;\n\n var results = [];\n\n for (var i = 0, len = target.length; i < len; i += 1) {\n if (pred(target, i)) {\n results.push(String(i));\n }\n }\n\n return results;\n};\n\n/**\n * Returns an array of an object's owned keys.\n *\n * @name objectKeys\n * @api private\n * @param {*} target\n * @param {Function} pred Predicate function used to include/exclude values from\n * the resulting array.\n * @return {Array}\n */\nvar objectKeys = function objectKeys(target, pred) {\n pred = pred || has;\n\n var results = [];\n\n for (var key in target) {\n if (pred(target, key)) {\n results.push(String(key));\n }\n }\n\n return results;\n};\n\n/**\n * Creates an array composed of all keys on the input object. Ignores any non-enumerable properties.\n * More permissive than the native `Object.keys` function (non-objects will not throw errors).\n *\n * @name keys\n * @api public\n * @category Object\n * @param {Object} source The value to retrieve keys from.\n * @return {Array} An array containing all the input `source`'s keys.\n * @example\n * keys({ likes: 'avocado', hates: 'pineapple' });\n * //=> ['likes', 'pineapple'];\n *\n * // Ignores non-enumerable properties\n * var hasHiddenKey = { name: 'Tim' };\n * Object.defineProperty(hasHiddenKey, 'hidden', {\n * value: 'i am not enumerable!',\n * enumerable: false\n * })\n * keys(hasHiddenKey);\n * //=> ['name'];\n *\n * // Works on arrays\n * keys(['a', 'b', 'c']);\n * //=> ['0', '1', '2']\n *\n * // Skips unpopulated indices in sparse arrays\n * var arr = [1];\n * arr[4] = 4;\n * keys(arr);\n * //=> ['0', '4']\n */\nvar keys = function keys(source) {\n if (source == null) {\n return [];\n }\n\n // IE6-8 compatibility (string)\n if (isString(source)) {\n return indexKeys(source, charAt);\n }\n\n // IE6-8 compatibility (arguments)\n if (isArrayLike(source)) {\n return indexKeys(source, has);\n }\n\n return objectKeys(source);\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = keys;\n","'use strict';\n\n/*\n * Module dependencies.\n */\n\nvar keys = require('@ndhoule/keys');\n\nvar objToString = Object.prototype.toString;\n\n/**\n * Tests if a value is a number.\n *\n * @name isNumber\n * @api private\n * @param {*} val The value to test.\n * @return {boolean} Returns `true` if `val` is a number, otherwise `false`.\n */\n// TODO: Move to library\nvar isNumber = function isNumber(val) {\n var type = typeof val;\n return type === 'number' || (type === 'object' && objToString.call(val) === '[object Number]');\n};\n\n/**\n * Tests if a value is an array.\n *\n * @name isArray\n * @api private\n * @param {*} val The value to test.\n * @return {boolean} Returns `true` if the value is an array, otherwise `false`.\n */\n// TODO: Move to library\nvar isArray = typeof Array.isArray === 'function' ? Array.isArray : function isArray(val) {\n return objToString.call(val) === '[object Array]';\n};\n\n/**\n * Tests if a value is array-like. Array-like means the value is not a function and has a numeric\n * `.length` property.\n *\n * @name isArrayLike\n * @api private\n * @param {*} val\n * @return {boolean}\n */\n// TODO: Move to library\nvar isArrayLike = function isArrayLike(val) {\n return val != null && (isArray(val) || (val !== 'function' && isNumber(val.length)));\n};\n\n/**\n * Internal implementation of `each`. Works on arrays and array-like data structures.\n *\n * @name arrayEach\n * @api private\n * @param {Function(value, key, collection)} iterator The function to invoke per iteration.\n * @param {Array} array The array(-like) structure to iterate over.\n * @return {undefined}\n */\nvar arrayEach = function arrayEach(iterator, array) {\n for (var i = 0; i < array.length; i += 1) {\n // Break iteration early if `iterator` returns `false`\n if (iterator(array[i], i, array) === false) {\n break;\n }\n }\n};\n\n/**\n * Internal implementation of `each`. Works on objects.\n *\n * @name baseEach\n * @api private\n * @param {Function(value, key, collection)} iterator The function to invoke per iteration.\n * @param {Object} object The object to iterate over.\n * @return {undefined}\n */\nvar baseEach = function baseEach(iterator, object) {\n var ks = keys(object);\n\n for (var i = 0; i < ks.length; i += 1) {\n // Break iteration early if `iterator` returns `false`\n if (iterator(object[ks[i]], ks[i], object) === false) {\n break;\n }\n }\n};\n\n/**\n * Iterate over an input collection, invoking an `iterator` function for each element in the\n * collection and passing to it three arguments: `(value, index, collection)`. The `iterator`\n * function can end iteration early by returning `false`.\n *\n * @name each\n * @api public\n * @param {Function(value, key, collection)} iterator The function to invoke per iteration.\n * @param {Array|Object|string} collection The collection to iterate over.\n * @return {undefined} Because `each` is run only for side effects, always returns `undefined`.\n * @example\n * var log = console.log.bind(console);\n *\n * each(log, ['a', 'b', 'c']);\n * //-> 'a', 0, ['a', 'b', 'c']\n * //-> 'b', 1, ['a', 'b', 'c']\n * //-> 'c', 2, ['a', 'b', 'c']\n * //=> undefined\n *\n * each(log, 'tim');\n * //-> 't', 2, 'tim'\n * //-> 'i', 1, 'tim'\n * //-> 'm', 0, 'tim'\n * //=> undefined\n *\n * // Note: Iteration order not guaranteed across environments\n * each(log, { name: 'tim', occupation: 'enchanter' });\n * //-> 'tim', 'name', { name: 'tim', occupation: 'enchanter' }\n * //-> 'enchanter', 'occupation', { name: 'tim', occupation: 'enchanter' }\n * //=> undefined\n */\nvar each = function each(iterator, collection) {\n return (isArrayLike(collection) ? arrayEach : baseEach).call(this, iterator, collection);\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = each;\n","import is from \"is\";\nimport each from \"@ndhoule/each\";\nimport ScriptLoader from \"../ScriptLoader\";\nimport logger from \"../../utils/logUtil\";\n\nclass FacebookPixel {\n constructor(config) {\n this.blacklistPiiProperties = config.blacklistPiiProperties;\n this.categoryToContent = config.categoryToContent;\n this.pixelId = config.pixelId;\n this.eventsToEvents = config.eventsToEvents;\n this.eventCustomProperties = config.eventCustomProperties;\n this.valueFieldIdentifier = config.valueFieldIdentifier;\n this.advancedMapping = config.advancedMapping;\n this.traitKeyToExternalId = config.traitKeyToExternalId;\n this.legacyConversionPixelId = config.legacyConversionPixelId;\n this.userIdAsPixelId = config.userIdAsPixelId;\n this.whitelistPiiProperties = config.whitelistPiiProperties;\n this.name = \"FB_PIXEL\";\n }\n\n init() {\n if (this.categoryToContent === undefined) {\n this.categoryToContent = [];\n }\n if (this.legacyConversionPixelId === undefined) {\n this.legacyConversionPixelId = [];\n }\n if (this.userIdAsPixelId === undefined) {\n this.userIdAsPixelId = [];\n }\n\n logger.debug(\"===in init FbPixel===\");\n\n window._fbq = function () {\n if (window.fbq.callMethod) {\n window.fbq.callMethod.apply(window.fbq, arguments);\n } else {\n window.fbq.queue.push(arguments);\n }\n };\n\n window.fbq = window.fbq || window._fbq;\n window.fbq.push = window.fbq;\n window.fbq.loaded = true;\n window.fbq.disablePushState = true; // disables automatic pageview tracking\n window.fbq.allowDuplicatePageViews = true; // enables fb\n window.fbq.version = \"2.0\";\n window.fbq.queue = [];\n\n window.fbq(\"init\", this.pixelId);\n ScriptLoader(\n \"fbpixel-integration\",\n \"https://connect.facebook.net/en_US/fbevents.js\"\n );\n }\n\n isLoaded() {\n logger.debug(\"in FBPixel isLoaded\");\n return !!(window.fbq && window.fbq.callMethod);\n }\n\n isReady() {\n logger.debug(\"in FBPixel isReady\");\n return !!(window.fbq && window.fbq.callMethod);\n }\n\n page(rudderElement) {\n window.fbq(\"track\", \"PageView\");\n }\n\n identify(rudderElement) {\n if (this.advancedMapping) {\n window.fbq(\"init\", this.pixelId, rudderElement.message.context.traits);\n }\n }\n\n track(rudderElement) {\n const self = this;\n const { event } = rudderElement.message;\n var revenue = this.formatRevenue(rudderElement.message.properties.revenue);\n const payload = this.buildPayLoad(rudderElement, true);\n\n if (this.categoryToContent === undefined) {\n this.categoryToContent = [];\n }\n if (this.legacyConversionPixelId === undefined) {\n this.legacyConversionPixelId = [];\n }\n if (this.userIdAsPixelId === undefined) {\n this.userIdAsPixelId = [];\n }\n\n payload.value = revenue;\n const standard = this.eventsToEvents;\n const legacy = this.legacyConversionPixelId;\n let standardTo;\n let legacyTo;\n\n standardTo = standard.reduce((filtered, standard) => {\n if (standard.from === event) {\n filtered.push(standard.to);\n }\n return filtered;\n }, []);\n\n legacyTo = legacy.reduce((filtered, legacy) => {\n if (legacy.from === event) {\n filtered.push(legacy.to);\n }\n return filtered;\n }, []);\n\n each((event) => {\n payload.currency = rudderElement.message.properties.currency || \"USD\";\n\n window.fbq(\"trackSingle\", self.pixelId, event, payload, {\n eventID: rudderElement.message.messageId,\n });\n }, standardTo);\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: revenue,\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n\n if (event === \"Product List Viewed\") {\n var contentType;\n var contentIds;\n var contents = [];\n var { products } = rudderElement.message.properties;\n var customProperties = this.buildPayLoad(rudderElement, true);\n\n if (Array.isArray(products)) {\n products.forEach(function (product) {\n const productId = product.product_id;\n if (productId) {\n contentIds.push(productId);\n contents.push({\n id: productId,\n quantity: rudderElement.message.properties.quantity,\n });\n }\n });\n }\n\n if (contentIds.length) {\n contentType = [\"product\"];\n } else {\n contentIds.push(rudderElement.message.properties.category || \"\");\n contents.push({\n id: rudderElement.message.properties.category || \"\",\n quantity: 1,\n });\n contentType = [\"product_group\"];\n }\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"ViewContent\",\n this.merge(\n {\n content_ids: contentIds,\n content_type: this.getContentType(rudderElement, contentType),\n contents,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: this.formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Product Viewed\") {\n var useValue = this.valueFieldIdentifier === \"properties.value\";\n var customProperties = this.buildPayLoad(rudderElement, true);\n\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"ViewContent\",\n this.merge(\n {\n content_ids: [\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n ],\n content_type: this.getContentType(rudderElement, [\"product\"]),\n content_name: rudderElement.message.properties.product_name || \"\",\n content_category: rudderElement.message.properties.category || \"\",\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n contents: [\n {\n id:\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n },\n ],\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Product Added\") {\n var useValue = this.valueFieldIdentifier === \"properties.value\";\n var customProperties = this.buildPayLoad(rudderElement, true);\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"AddToCart\",\n this.merge(\n {\n content_ids: [\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n ],\n content_type: this.getContentType(rudderElement, [\"product\"]),\n\n content_name: rudderElement.message.properties.product_name || \"\",\n content_category: rudderElement.message.properties.category || \"\",\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n contents: [\n {\n id:\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n },\n ],\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n this.merge(\n {\n content_ids: [\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n ],\n content_type: this.getContentType(rudderElement, [\"product\"]),\n\n content_name: rudderElement.message.properties.product_name || \"\",\n content_category: rudderElement.message.properties.category || \"\",\n currency: rudderElement.message.properties.currency,\n value: useValue\n ? this.formatRevenue(rudderElement.message.properties.value)\n : this.formatRevenue(rudderElement.message.properties.price),\n contents: [\n {\n id:\n rudderElement.message.properties.product_id ||\n rudderElement.message.properties.id ||\n rudderElement.message.properties.sku ||\n \"\",\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n },\n ],\n },\n customProperties\n );\n } else if (event === \"Order Completed\") {\n var { products } = rudderElement.message.properties;\n var customProperties = this.buildPayLoad(rudderElement, true);\n var revenue = this.formatRevenue(\n rudderElement.message.properties.revenue\n );\n\n var contentType = this.getContentType(rudderElement, [\"product\"]);\n var contentIds = [];\n var contents = [];\n\n for (var i = 0; i < products.length; i++) {\n var pId = product.product_id;\n contentIds.push(pId);\n var content = {\n id: pId,\n quantity: rudderElement.message.properties.quantity,\n };\n if (rudderElement.message.properties.price) {\n content.item_price = rudderElement.message.properties.price;\n }\n contents.push(content);\n }\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"Purchase\",\n this.merge(\n {\n content_ids: contentIds,\n content_type: contentType,\n currency: rudderElement.message.properties.currency,\n value: revenue,\n contents,\n num_items: contentIds.length,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: this.formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Products Searched\") {\n var customProperties = this.buildPayLoad(rudderElement, true);\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"Search\",\n this.merge(\n {\n search_string: rudderElement.message.properties.query,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n } else if (event === \"Checkout Started\") {\n var { products } = rudderElement.message.properties;\n var customProperties = this.buildPayLoad(rudderElement, true);\n var revenue = this.formatRevenue(\n rudderElement.message.properties.revenue\n );\n let contentCategory = rudderElement.message.properties.category;\n var contentIds = [];\n var contents = [];\n\n for (var i = 0; i < products.length; i++) {\n const product = products[i];\n var pId = product.product_id;\n contentIds.push(pId);\n var content = {\n id: pId,\n quantity: rudderElement.message.properties.quantity,\n item_price: rudderElement.message.properties.price,\n };\n if (rudderElement.message.properties.price) {\n content.item_price = rudderElement.message.properties.price;\n }\n contents.push(content);\n }\n if (!contentCategory && products[0] && products[0].category) {\n contentCategory = products[0].category;\n }\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n \"InitiateCheckout\",\n this.merge(\n {\n content_category: contentCategory,\n content_ids: contentIds,\n content_type: this.getContentType(rudderElement, [\"product\"]),\n currency: rudderElement.message.properties.currency,\n value: revenue,\n contents,\n num_items: contentIds.length,\n },\n customProperties\n ),\n {\n eventID: rudderElement.message.messageId,\n }\n );\n\n each((event) => {\n window.fbq(\n \"trackSingle\",\n self.pixelId,\n event,\n {\n currency: rudderElement.message.properties.currency,\n value: this.formatRevenue(rudderElement.message.properties.revenue),\n },\n {\n eventID: rudderElement.message.messageId,\n }\n );\n }, legacyTo);\n }\n }\n\n getContentType(rudderElement, defaultValue) {\n const { options } = rudderElement.message;\n if (options && options.contentType) {\n return [options.contentType];\n }\n\n let { category } = rudderElement.message.properties;\n if (!category) {\n const { products } = rudderElement.message.properties;\n if (products && products.length) {\n category = products[0].category;\n }\n }\n if (category) {\n const mapped = this.categoryToContent;\n let mappedTo;\n mappedTo = mapped.reduce((filtered, mapped) => {\n if (mapped.from == category) {\n filtered.push(mapped.to);\n }\n return filtered;\n }, []);\n if (mappedTo.length) {\n return mappedTo;\n }\n }\n return defaultValue;\n }\n\n merge(obj1, obj2) {\n const res = {};\n\n // All properties of obj1\n for (const propObj1 in obj1) {\n if (obj1.hasOwnProperty(propObj1)) {\n res[propObj1] = obj1[propObj1];\n }\n }\n\n // Extra properties of obj2\n for (const propObj2 in obj2) {\n if (obj2.hasOwnProperty(propObj2) && !res.hasOwnProperty(propObj2)) {\n res[propObj2] = obj2[propObj2];\n }\n }\n\n return res;\n }\n\n formatRevenue(revenue) {\n return Number(revenue || 0).toFixed(2);\n }\n\n buildPayLoad(rudderElement, isStandardEvent) {\n const dateFields = [\n \"checkinDate\",\n \"checkoutDate\",\n \"departingArrivalDate\",\n \"departingDepartureDate\",\n \"returningArrivalDate\",\n \"returningDepartureDate\",\n \"travelEnd\",\n \"travelStart\",\n ];\n const defaultPiiProperties = [\n \"email\",\n \"firstName\",\n \"lastName\",\n \"gender\",\n \"city\",\n \"country\",\n \"phone\",\n \"state\",\n \"zip\",\n \"birthday\",\n ];\n const whitelistPiiProperties = this.whitelistPiiProperties || [];\n const blacklistPiiProperties = this.blacklistPiiProperties || [];\n const eventCustomProperties = this.eventCustomProperties || [];\n const customPiiProperties = {};\n for (let i = 0; i < blacklistPiiProperties[i]; i++) {\n const configuration = blacklistPiiProperties[i];\n customPiiProperties[configuration.blacklistPiiProperties] =\n configuration.blacklistPiiHash;\n }\n const payload = {};\n const { properties } = rudderElement.message;\n\n for (const property in properties) {\n if (!properties.hasOwnProperty(property)) {\n continue;\n }\n\n if (isStandardEvent && eventCustomProperties.indexOf(property) < 0) {\n continue;\n }\n const value = properties[property];\n\n if (dateFields.indexOf(properties) >= 0) {\n if (is.date(value)) {\n payload[property] = value.toISOTring().split(\"T\")[0];\n continue;\n }\n }\n if (customPiiProperties.hasOwnProperty(property)) {\n if (customPiiProperties[property] && typeof value === \"string\") {\n payload[property] = sha256(value);\n }\n continue;\n }\n const isPropertyPii = defaultPiiProperties.indexOf(property) >= 0;\n const isProperyWhiteListed =\n whitelistPiiProperties.indexOf(property) >= 0;\n if (!isPropertyPii || isProperyWhiteListed) {\n payload[property] = value;\n }\n }\n return payload;\n }\n}\n\nexport { FacebookPixel };\n",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\t /*\n\t * Local polyfil of Object.create\n\t */\n\t var create = Object.create || (function () {\n\t function F() {};\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }())\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t var r = (function (m_w) {\n\t var m_w = m_w;\n\t var m_z = 0x3ade68b1;\n\t var mask = 0xffffffff;\n\n\t return function () {\n\t m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n\t m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n\t var result = ((m_z << 0x10) + m_w) & mask;\n\t result /= 0x100000000;\n\t result += 0.5;\n\t return result * (Math.random() > .5 ? 1 : -1);\n\t }\n\t });\n\n\t for (var i = 0, rcache; i < nBytes; i += 4) {\n\t var _r = r((rcache || Math.random()) * 0x100000000);\n\n\t rcache = _r() * 0x3ade67b7;\n\t words.push((_r() * 0x100000000) | 0);\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t var processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var C_enc = C.enc;\n\n\t /**\n\t * Base64 encoding strategy.\n\t */\n\t var Base64 = C_enc.Base64 = {\n\t /**\n\t * Converts a word array to a Base64 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Base64 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var base64String = CryptoJS.enc.Base64.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\t var map = this._map;\n\n\t // Clamp excess bits\n\t wordArray.clamp();\n\n\t // Convert\n\t var base64Chars = [];\n\t for (var i = 0; i < sigBytes; i += 3) {\n\t var byte1 = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t var byte2 = (words[(i + 1) >>> 2] >>> (24 - ((i + 1) % 4) * 8)) & 0xff;\n\t var byte3 = (words[(i + 2) >>> 2] >>> (24 - ((i + 2) % 4) * 8)) & 0xff;\n\n\t var triplet = (byte1 << 16) | (byte2 << 8) | byte3;\n\n\t for (var j = 0; (j < 4) && (i + j * 0.75 < sigBytes); j++) {\n\t base64Chars.push(map.charAt((triplet >>> (6 * (3 - j))) & 0x3f));\n\t }\n\t }\n\n\t // Add padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t while (base64Chars.length % 4) {\n\t base64Chars.push(paddingChar);\n\t }\n\t }\n\n\t return base64Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Base64 string to a word array.\n\t *\n\t * @param {string} base64Str The Base64 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Base64.parse(base64String);\n\t */\n\t parse: function (base64Str) {\n\t // Shortcuts\n\t var base64StrLength = base64Str.length;\n\t var map = this._map;\n\t var reverseMap = this._reverseMap;\n\n\t if (!reverseMap) {\n\t reverseMap = this._reverseMap = [];\n\t for (var j = 0; j < map.length; j++) {\n\t reverseMap[map.charCodeAt(j)] = j;\n\t }\n\t }\n\n\t // Ignore padding\n\t var paddingChar = map.charAt(64);\n\t if (paddingChar) {\n\t var paddingIndex = base64Str.indexOf(paddingChar);\n\t if (paddingIndex !== -1) {\n\t base64StrLength = paddingIndex;\n\t }\n\t }\n\n\t // Convert\n\t return parseLoop(base64Str, base64StrLength, reverseMap);\n\n\t },\n\n\t _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='\n\t };\n\n\t function parseLoop(base64Str, base64StrLength, reverseMap) {\n\t var words = [];\n\t var nBytes = 0;\n\t for (var i = 0; i < base64StrLength; i++) {\n\t if (i % 4) {\n\t var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << ((i % 4) * 2);\n\t var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> (6 - (i % 4) * 2);\n\t words[nBytes >>> 2] |= (bits1 | bits2) << (24 - (nBytes % 4) * 8);\n\t nBytes++;\n\t }\n\t }\n\t return WordArray.create(words, nBytes);\n\t }\n\t}());\n\n\n\treturn CryptoJS.enc.Base64;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Constants table\n\t var T = [];\n\n\t // Compute constants\n\t (function () {\n\t for (var i = 0; i < 64; i++) {\n\t T[i] = (Math.abs(Math.sin(i + 1)) * 0x100000000) | 0;\n\t }\n\t }());\n\n\t /**\n\t * MD5 hash algorithm.\n\t */\n\t var MD5 = C_algo.MD5 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Swap endian\n\t for (var i = 0; i < 16; i++) {\n\t // Shortcuts\n\t var offset_i = offset + i;\n\t var M_offset_i = M[offset_i];\n\n\t M[offset_i] = (\n\t (((M_offset_i << 8) | (M_offset_i >>> 24)) & 0x00ff00ff) |\n\t (((M_offset_i << 24) | (M_offset_i >>> 8)) & 0xff00ff00)\n\t );\n\t }\n\n\t // Shortcuts\n\t var H = this._hash.words;\n\n\t var M_offset_0 = M[offset + 0];\n\t var M_offset_1 = M[offset + 1];\n\t var M_offset_2 = M[offset + 2];\n\t var M_offset_3 = M[offset + 3];\n\t var M_offset_4 = M[offset + 4];\n\t var M_offset_5 = M[offset + 5];\n\t var M_offset_6 = M[offset + 6];\n\t var M_offset_7 = M[offset + 7];\n\t var M_offset_8 = M[offset + 8];\n\t var M_offset_9 = M[offset + 9];\n\t var M_offset_10 = M[offset + 10];\n\t var M_offset_11 = M[offset + 11];\n\t var M_offset_12 = M[offset + 12];\n\t var M_offset_13 = M[offset + 13];\n\t var M_offset_14 = M[offset + 14];\n\t var M_offset_15 = M[offset + 15];\n\n\t // Working varialbes\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\n\t // Computation\n\t a = FF(a, b, c, d, M_offset_0, 7, T[0]);\n\t d = FF(d, a, b, c, M_offset_1, 12, T[1]);\n\t c = FF(c, d, a, b, M_offset_2, 17, T[2]);\n\t b = FF(b, c, d, a, M_offset_3, 22, T[3]);\n\t a = FF(a, b, c, d, M_offset_4, 7, T[4]);\n\t d = FF(d, a, b, c, M_offset_5, 12, T[5]);\n\t c = FF(c, d, a, b, M_offset_6, 17, T[6]);\n\t b = FF(b, c, d, a, M_offset_7, 22, T[7]);\n\t a = FF(a, b, c, d, M_offset_8, 7, T[8]);\n\t d = FF(d, a, b, c, M_offset_9, 12, T[9]);\n\t c = FF(c, d, a, b, M_offset_10, 17, T[10]);\n\t b = FF(b, c, d, a, M_offset_11, 22, T[11]);\n\t a = FF(a, b, c, d, M_offset_12, 7, T[12]);\n\t d = FF(d, a, b, c, M_offset_13, 12, T[13]);\n\t c = FF(c, d, a, b, M_offset_14, 17, T[14]);\n\t b = FF(b, c, d, a, M_offset_15, 22, T[15]);\n\n\t a = GG(a, b, c, d, M_offset_1, 5, T[16]);\n\t d = GG(d, a, b, c, M_offset_6, 9, T[17]);\n\t c = GG(c, d, a, b, M_offset_11, 14, T[18]);\n\t b = GG(b, c, d, a, M_offset_0, 20, T[19]);\n\t a = GG(a, b, c, d, M_offset_5, 5, T[20]);\n\t d = GG(d, a, b, c, M_offset_10, 9, T[21]);\n\t c = GG(c, d, a, b, M_offset_15, 14, T[22]);\n\t b = GG(b, c, d, a, M_offset_4, 20, T[23]);\n\t a = GG(a, b, c, d, M_offset_9, 5, T[24]);\n\t d = GG(d, a, b, c, M_offset_14, 9, T[25]);\n\t c = GG(c, d, a, b, M_offset_3, 14, T[26]);\n\t b = GG(b, c, d, a, M_offset_8, 20, T[27]);\n\t a = GG(a, b, c, d, M_offset_13, 5, T[28]);\n\t d = GG(d, a, b, c, M_offset_2, 9, T[29]);\n\t c = GG(c, d, a, b, M_offset_7, 14, T[30]);\n\t b = GG(b, c, d, a, M_offset_12, 20, T[31]);\n\n\t a = HH(a, b, c, d, M_offset_5, 4, T[32]);\n\t d = HH(d, a, b, c, M_offset_8, 11, T[33]);\n\t c = HH(c, d, a, b, M_offset_11, 16, T[34]);\n\t b = HH(b, c, d, a, M_offset_14, 23, T[35]);\n\t a = HH(a, b, c, d, M_offset_1, 4, T[36]);\n\t d = HH(d, a, b, c, M_offset_4, 11, T[37]);\n\t c = HH(c, d, a, b, M_offset_7, 16, T[38]);\n\t b = HH(b, c, d, a, M_offset_10, 23, T[39]);\n\t a = HH(a, b, c, d, M_offset_13, 4, T[40]);\n\t d = HH(d, a, b, c, M_offset_0, 11, T[41]);\n\t c = HH(c, d, a, b, M_offset_3, 16, T[42]);\n\t b = HH(b, c, d, a, M_offset_6, 23, T[43]);\n\t a = HH(a, b, c, d, M_offset_9, 4, T[44]);\n\t d = HH(d, a, b, c, M_offset_12, 11, T[45]);\n\t c = HH(c, d, a, b, M_offset_15, 16, T[46]);\n\t b = HH(b, c, d, a, M_offset_2, 23, T[47]);\n\n\t a = II(a, b, c, d, M_offset_0, 6, T[48]);\n\t d = II(d, a, b, c, M_offset_7, 10, T[49]);\n\t c = II(c, d, a, b, M_offset_14, 15, T[50]);\n\t b = II(b, c, d, a, M_offset_5, 21, T[51]);\n\t a = II(a, b, c, d, M_offset_12, 6, T[52]);\n\t d = II(d, a, b, c, M_offset_3, 10, T[53]);\n\t c = II(c, d, a, b, M_offset_10, 15, T[54]);\n\t b = II(b, c, d, a, M_offset_1, 21, T[55]);\n\t a = II(a, b, c, d, M_offset_8, 6, T[56]);\n\t d = II(d, a, b, c, M_offset_15, 10, T[57]);\n\t c = II(c, d, a, b, M_offset_6, 15, T[58]);\n\t b = II(b, c, d, a, M_offset_13, 21, T[59]);\n\t a = II(a, b, c, d, M_offset_4, 6, T[60]);\n\t d = II(d, a, b, c, M_offset_11, 10, T[61]);\n\t c = II(c, d, a, b, M_offset_2, 15, T[62]);\n\t b = II(b, c, d, a, M_offset_9, 21, T[63]);\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\n\t var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000);\n\t var nBitsTotalL = nBitsTotal;\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = (\n\t (((nBitsTotalH << 8) | (nBitsTotalH >>> 24)) & 0x00ff00ff) |\n\t (((nBitsTotalH << 24) | (nBitsTotalH >>> 8)) & 0xff00ff00)\n\t );\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = (\n\t (((nBitsTotalL << 8) | (nBitsTotalL >>> 24)) & 0x00ff00ff) |\n\t (((nBitsTotalL << 24) | (nBitsTotalL >>> 8)) & 0xff00ff00)\n\t );\n\n\t data.sigBytes = (dataWords.length + 1) * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Shortcuts\n\t var hash = this._hash;\n\t var H = hash.words;\n\n\t // Swap endian\n\t for (var i = 0; i < 4; i++) {\n\t // Shortcut\n\t var H_i = H[i];\n\n\t H[i] = (((H_i << 8) | (H_i >>> 24)) & 0x00ff00ff) |\n\t (((H_i << 24) | (H_i >>> 8)) & 0xff00ff00);\n\t }\n\n\t // Return final computed hash\n\t return hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t function FF(a, b, c, d, x, s, t) {\n\t var n = a + ((b & c) | (~b & d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function GG(a, b, c, d, x, s, t) {\n\t var n = a + ((b & d) | (c & ~d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function HH(a, b, c, d, x, s, t) {\n\t var n = a + (b ^ c ^ d) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t function II(a, b, c, d, x, s, t) {\n\t var n = a + (c ^ (b | ~d)) + x + t;\n\t return ((n << s) | (n >>> (32 - s))) + b;\n\t }\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.MD5('message');\n\t * var hash = CryptoJS.MD5(wordArray);\n\t */\n\t C.MD5 = Hasher._createHelper(MD5);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacMD5(message, key);\n\t */\n\t C.HmacMD5 = Hasher._createHmacHelper(MD5);\n\t}(Math));\n\n\n\treturn CryptoJS.MD5;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-1 hash algorithm.\n\t */\n\t var SHA1 = C_algo.SHA1 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476,\n\t 0xc3d2e1f0\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\n\t // Computation\n\t for (var i = 0; i < 80; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n\t W[i] = (n << 1) | (n >>> 31);\n\t }\n\n\t var t = ((a << 5) | (a >>> 27)) + e + W[i];\n\t if (i < 20) {\n\t t += ((b & c) | (~b & d)) + 0x5a827999;\n\t } else if (i < 40) {\n\t t += (b ^ c ^ d) + 0x6ed9eba1;\n\t } else if (i < 60) {\n\t t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;\n\t } else /* if (i < 80) */ {\n\t t += (b ^ c ^ d) - 0x359d3e2a;\n\t }\n\n\t e = d;\n\t d = c;\n\t c = (b << 30) | (b >>> 2);\n\t b = a;\n\t a = t;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA1('message');\n\t * var hash = CryptoJS.SHA1(wordArray);\n\t */\n\t C.SHA1 = Hasher._createHelper(SHA1);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA1(message, key);\n\t */\n\t C.HmacSHA1 = Hasher._createHmacHelper(SHA1);\n\t}());\n\n\n\treturn CryptoJS.SHA1;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var C_algo = C.algo;\n\n\t /**\n\t * HMAC algorithm.\n\t */\n\t var HMAC = C_algo.HMAC = Base.extend({\n\t /**\n\t * Initializes a newly created HMAC.\n\t *\n\t * @param {Hasher} hasher The hash algorithm to use.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @example\n\t *\n\t * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key);\n\t */\n\t init: function (hasher, key) {\n\t // Init hasher\n\t hasher = this._hasher = new hasher.init();\n\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof key == 'string') {\n\t key = Utf8.parse(key);\n\t }\n\n\t // Shortcuts\n\t var hasherBlockSize = hasher.blockSize;\n\t var hasherBlockSizeBytes = hasherBlockSize * 4;\n\n\t // Allow arbitrary length keys\n\t if (key.sigBytes > hasherBlockSizeBytes) {\n\t key = hasher.finalize(key);\n\t }\n\n\t // Clamp excess bits\n\t key.clamp();\n\n\t // Clone key for inner and outer pads\n\t var oKey = this._oKey = key.clone();\n\t var iKey = this._iKey = key.clone();\n\n\t // Shortcuts\n\t var oKeyWords = oKey.words;\n\t var iKeyWords = iKey.words;\n\n\t // XOR keys with pad constants\n\t for (var i = 0; i < hasherBlockSize; i++) {\n\t oKeyWords[i] ^= 0x5c5c5c5c;\n\t iKeyWords[i] ^= 0x36363636;\n\t }\n\t oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this HMAC to its initial state.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.reset();\n\t */\n\t reset: function () {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Reset\n\t hasher.reset();\n\t hasher.update(this._iKey);\n\t },\n\n\t /**\n\t * Updates this HMAC with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {HMAC} This HMAC instance.\n\t *\n\t * @example\n\t *\n\t * hmacHasher.update('message');\n\t * hmacHasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t this._hasher.update(messageUpdate);\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the HMAC computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @example\n\t *\n\t * var hmac = hmacHasher.finalize();\n\t * var hmac = hmacHasher.finalize('message');\n\t * var hmac = hmacHasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Shortcut\n\t var hasher = this._hasher;\n\n\t // Compute HMAC\n\t var innerHash = hasher.finalize(messageUpdate);\n\t hasher.reset();\n\t var hmac = hasher.finalize(this._oKey.clone().concat(innerHash));\n\n\t return hmac;\n\t }\n\t });\n\t}());\n\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./sha1\"), require(\"./hmac\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./sha1\", \"./hmac\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var WordArray = C_lib.WordArray;\n\t var C_algo = C.algo;\n\t var MD5 = C_algo.MD5;\n\n\t /**\n\t * This key derivation function is meant to conform with EVP_BytesToKey.\n\t * www.openssl.org/docs/crypto/EVP_BytesToKey.html\n\t */\n\t var EvpKDF = C_algo.EvpKDF = Base.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {number} keySize The key size in words to generate. Default: 4 (128 bits)\n\t * @property {Hasher} hasher The hash algorithm to use. Default: MD5\n\t * @property {number} iterations The number of iterations to perform. Default: 1\n\t */\n\t cfg: Base.extend({\n\t keySize: 128/32,\n\t hasher: MD5,\n\t iterations: 1\n\t }),\n\n\t /**\n\t * Initializes a newly created key derivation function.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for the derivation.\n\t *\n\t * @example\n\t *\n\t * var kdf = CryptoJS.algo.EvpKDF.create();\n\t * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 });\n\t * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 });\n\t */\n\t init: function (cfg) {\n\t this.cfg = this.cfg.extend(cfg);\n\t },\n\n\t /**\n\t * Derives a key from a password.\n\t *\n\t * @param {WordArray|string} password The password.\n\t * @param {WordArray|string} salt A salt.\n\t *\n\t * @return {WordArray} The derived key.\n\t *\n\t * @example\n\t *\n\t * var key = kdf.compute(password, salt);\n\t */\n\t compute: function (password, salt) {\n\t // Shortcut\n\t var cfg = this.cfg;\n\n\t // Init hasher\n\t var hasher = cfg.hasher.create();\n\n\t // Initial values\n\t var derivedKey = WordArray.create();\n\n\t // Shortcuts\n\t var derivedKeyWords = derivedKey.words;\n\t var keySize = cfg.keySize;\n\t var iterations = cfg.iterations;\n\n\t // Generate key\n\t while (derivedKeyWords.length < keySize) {\n\t if (block) {\n\t hasher.update(block);\n\t }\n\t var block = hasher.update(password).finalize(salt);\n\t hasher.reset();\n\n\t // Iterations\n\t for (var i = 1; i < iterations; i++) {\n\t block = hasher.finalize(block);\n\t hasher.reset();\n\t }\n\n\t derivedKey.concat(block);\n\t }\n\t derivedKey.sigBytes = keySize * 4;\n\n\t return derivedKey;\n\t }\n\t });\n\n\t /**\n\t * Derives a key from a password.\n\t *\n\t * @param {WordArray|string} password The password.\n\t * @param {WordArray|string} salt A salt.\n\t * @param {Object} cfg (Optional) The configuration options to use for this computation.\n\t *\n\t * @return {WordArray} The derived key.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var key = CryptoJS.EvpKDF(password, salt);\n\t * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 });\n\t * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 });\n\t */\n\t C.EvpKDF = function (password, salt, cfg) {\n\t return EvpKDF.create(cfg).compute(password, salt);\n\t };\n\t}());\n\n\n\treturn CryptoJS.EvpKDF;\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./evpkdf\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./evpkdf\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t/**\n\t * Cipher core components.\n\t */\n\tCryptoJS.lib.Cipher || (function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var WordArray = C_lib.WordArray;\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm;\n\t var C_enc = C.enc;\n\t var Utf8 = C_enc.Utf8;\n\t var Base64 = C_enc.Base64;\n\t var C_algo = C.algo;\n\t var EvpKDF = C_algo.EvpKDF;\n\n\t /**\n\t * Abstract base cipher template.\n\t *\n\t * @property {number} keySize This cipher's key size. Default: 4 (128 bits)\n\t * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits)\n\t * @property {number} _ENC_XFORM_MODE A constant representing encryption mode.\n\t * @property {number} _DEC_XFORM_MODE A constant representing decryption mode.\n\t */\n\t var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {WordArray} iv The IV to use for this operation.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Creates this cipher in encryption mode.\n\t *\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {Cipher} A cipher instance.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray });\n\t */\n\t createEncryptor: function (key, cfg) {\n\t return this.create(this._ENC_XFORM_MODE, key, cfg);\n\t },\n\n\t /**\n\t * Creates this cipher in decryption mode.\n\t *\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {Cipher} A cipher instance.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray });\n\t */\n\t createDecryptor: function (key, cfg) {\n\t return this.create(this._DEC_XFORM_MODE, key, cfg);\n\t },\n\n\t /**\n\t * Initializes a newly created cipher.\n\t *\n\t * @param {number} xformMode Either the encryption or decryption transormation mode constant.\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @example\n\t *\n\t * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray });\n\t */\n\t init: function (xformMode, key, cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Store transform mode and key\n\t this._xformMode = xformMode;\n\t this._key = key;\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this cipher to its initial state.\n\t *\n\t * @example\n\t *\n\t * cipher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-cipher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Adds data to be encrypted or decrypted.\n\t *\n\t * @param {WordArray|string} dataUpdate The data to encrypt or decrypt.\n\t *\n\t * @return {WordArray} The data after processing.\n\t *\n\t * @example\n\t *\n\t * var encrypted = cipher.process('data');\n\t * var encrypted = cipher.process(wordArray);\n\t */\n\t process: function (dataUpdate) {\n\t // Append\n\t this._append(dataUpdate);\n\n\t // Process available blocks\n\t return this._process();\n\t },\n\n\t /**\n\t * Finalizes the encryption or decryption process.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt.\n\t *\n\t * @return {WordArray} The data after final processing.\n\t *\n\t * @example\n\t *\n\t * var encrypted = cipher.finalize();\n\t * var encrypted = cipher.finalize('data');\n\t * var encrypted = cipher.finalize(wordArray);\n\t */\n\t finalize: function (dataUpdate) {\n\t // Final data update\n\t if (dataUpdate) {\n\t this._append(dataUpdate);\n\t }\n\n\t // Perform concrete-cipher logic\n\t var finalProcessedData = this._doFinalize();\n\n\t return finalProcessedData;\n\t },\n\n\t keySize: 128/32,\n\n\t ivSize: 128/32,\n\n\t _ENC_XFORM_MODE: 1,\n\n\t _DEC_XFORM_MODE: 2,\n\n\t /**\n\t * Creates shortcut functions to a cipher's object interface.\n\t *\n\t * @param {Cipher} cipher The cipher to create a helper for.\n\t *\n\t * @return {Object} An object with encrypt and decrypt shortcut functions.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES);\n\t */\n\t _createHelper: (function () {\n\t function selectCipherStrategy(key) {\n\t if (typeof key == 'string') {\n\t return PasswordBasedCipher;\n\t } else {\n\t return SerializableCipher;\n\t }\n\t }\n\n\t return function (cipher) {\n\t return {\n\t encrypt: function (message, key, cfg) {\n\t return selectCipherStrategy(key).encrypt(cipher, message, key, cfg);\n\t },\n\n\t decrypt: function (ciphertext, key, cfg) {\n\t return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg);\n\t }\n\t };\n\t };\n\t }())\n\t });\n\n\t /**\n\t * Abstract base stream cipher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits)\n\t */\n\t var StreamCipher = C_lib.StreamCipher = Cipher.extend({\n\t _doFinalize: function () {\n\t // Process partial blocks\n\t var finalProcessedBlocks = this._process(!!'flush');\n\n\t return finalProcessedBlocks;\n\t },\n\n\t blockSize: 1\n\t });\n\n\t /**\n\t * Mode namespace.\n\t */\n\t var C_mode = C.mode = {};\n\n\t /**\n\t * Abstract base block cipher mode template.\n\t */\n\t var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({\n\t /**\n\t * Creates this mode for encryption.\n\t *\n\t * @param {Cipher} cipher A block cipher instance.\n\t * @param {Array} iv The IV words.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words);\n\t */\n\t createEncryptor: function (cipher, iv) {\n\t return this.Encryptor.create(cipher, iv);\n\t },\n\n\t /**\n\t * Creates this mode for decryption.\n\t *\n\t * @param {Cipher} cipher A block cipher instance.\n\t * @param {Array} iv The IV words.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words);\n\t */\n\t createDecryptor: function (cipher, iv) {\n\t return this.Decryptor.create(cipher, iv);\n\t },\n\n\t /**\n\t * Initializes a newly created mode.\n\t *\n\t * @param {Cipher} cipher A block cipher instance.\n\t * @param {Array} iv The IV words.\n\t *\n\t * @example\n\t *\n\t * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words);\n\t */\n\t init: function (cipher, iv) {\n\t this._cipher = cipher;\n\t this._iv = iv;\n\t }\n\t });\n\n\t /**\n\t * Cipher Block Chaining mode.\n\t */\n\t var CBC = C_mode.CBC = (function () {\n\t /**\n\t * Abstract base CBC mode.\n\t */\n\t var CBC = BlockCipherMode.extend();\n\n\t /**\n\t * CBC encryptor.\n\t */\n\t CBC.Encryptor = CBC.extend({\n\t /**\n\t * Processes the data block at offset.\n\t *\n\t * @param {Array} words The data words to operate on.\n\t * @param {number} offset The offset where the block starts.\n\t *\n\t * @example\n\t *\n\t * mode.processBlock(data.words, offset);\n\t */\n\t processBlock: function (words, offset) {\n\t // Shortcuts\n\t var cipher = this._cipher;\n\t var blockSize = cipher.blockSize;\n\n\t // XOR and encrypt\n\t xorBlock.call(this, words, offset, blockSize);\n\t cipher.encryptBlock(words, offset);\n\n\t // Remember this block to use with next block\n\t this._prevBlock = words.slice(offset, offset + blockSize);\n\t }\n\t });\n\n\t /**\n\t * CBC decryptor.\n\t */\n\t CBC.Decryptor = CBC.extend({\n\t /**\n\t * Processes the data block at offset.\n\t *\n\t * @param {Array} words The data words to operate on.\n\t * @param {number} offset The offset where the block starts.\n\t *\n\t * @example\n\t *\n\t * mode.processBlock(data.words, offset);\n\t */\n\t processBlock: function (words, offset) {\n\t // Shortcuts\n\t var cipher = this._cipher;\n\t var blockSize = cipher.blockSize;\n\n\t // Remember this block to use with next block\n\t var thisBlock = words.slice(offset, offset + blockSize);\n\n\t // Decrypt and XOR\n\t cipher.decryptBlock(words, offset);\n\t xorBlock.call(this, words, offset, blockSize);\n\n\t // This block becomes the previous block\n\t this._prevBlock = thisBlock;\n\t }\n\t });\n\n\t function xorBlock(words, offset, blockSize) {\n\t // Shortcut\n\t var iv = this._iv;\n\n\t // Choose mixing block\n\t if (iv) {\n\t var block = iv;\n\n\t // Remove IV for subsequent blocks\n\t this._iv = undefined;\n\t } else {\n\t var block = this._prevBlock;\n\t }\n\n\t // XOR blocks\n\t for (var i = 0; i < blockSize; i++) {\n\t words[offset + i] ^= block[i];\n\t }\n\t }\n\n\t return CBC;\n\t }());\n\n\t /**\n\t * Padding namespace.\n\t */\n\t var C_pad = C.pad = {};\n\n\t /**\n\t * PKCS #5/7 padding strategy.\n\t */\n\t var Pkcs7 = C_pad.Pkcs7 = {\n\t /**\n\t * Pads data using the algorithm defined in PKCS #5/7.\n\t *\n\t * @param {WordArray} data The data to pad.\n\t * @param {number} blockSize The multiple that the data should be padded to.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * CryptoJS.pad.Pkcs7.pad(wordArray, 4);\n\t */\n\t pad: function (data, blockSize) {\n\t // Shortcut\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count padding bytes\n\t var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes;\n\n\t // Create padding word\n\t var paddingWord = (nPaddingBytes << 24) | (nPaddingBytes << 16) | (nPaddingBytes << 8) | nPaddingBytes;\n\n\t // Create padding\n\t var paddingWords = [];\n\t for (var i = 0; i < nPaddingBytes; i += 4) {\n\t paddingWords.push(paddingWord);\n\t }\n\t var padding = WordArray.create(paddingWords, nPaddingBytes);\n\n\t // Add padding\n\t data.concat(padding);\n\t },\n\n\t /**\n\t * Unpads data that had been padded using the algorithm defined in PKCS #5/7.\n\t *\n\t * @param {WordArray} data The data to unpad.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * CryptoJS.pad.Pkcs7.unpad(wordArray);\n\t */\n\t unpad: function (data) {\n\t // Get number of padding bytes from last byte\n\t var nPaddingBytes = data.words[(data.sigBytes - 1) >>> 2] & 0xff;\n\n\t // Remove padding\n\t data.sigBytes -= nPaddingBytes;\n\t }\n\t };\n\n\t /**\n\t * Abstract base block cipher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits)\n\t */\n\t var BlockCipher = C_lib.BlockCipher = Cipher.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {Mode} mode The block mode to use. Default: CBC\n\t * @property {Padding} padding The padding strategy to use. Default: Pkcs7\n\t */\n\t cfg: Cipher.cfg.extend({\n\t mode: CBC,\n\t padding: Pkcs7\n\t }),\n\n\t reset: function () {\n\t // Reset cipher\n\t Cipher.reset.call(this);\n\n\t // Shortcuts\n\t var cfg = this.cfg;\n\t var iv = cfg.iv;\n\t var mode = cfg.mode;\n\n\t // Reset block mode\n\t if (this._xformMode == this._ENC_XFORM_MODE) {\n\t var modeCreator = mode.createEncryptor;\n\t } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n\t var modeCreator = mode.createDecryptor;\n\t // Keep at least one block in the buffer for unpadding\n\t this._minBufferSize = 1;\n\t }\n\n\t if (this._mode && this._mode.__creator == modeCreator) {\n\t this._mode.init(this, iv && iv.words);\n\t } else {\n\t this._mode = modeCreator.call(mode, this, iv && iv.words);\n\t this._mode.__creator = modeCreator;\n\t }\n\t },\n\n\t _doProcessBlock: function (words, offset) {\n\t this._mode.processBlock(words, offset);\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcut\n\t var padding = this.cfg.padding;\n\n\t // Finalize\n\t if (this._xformMode == this._ENC_XFORM_MODE) {\n\t // Pad data\n\t padding.pad(this._data, this.blockSize);\n\n\t // Process final blocks\n\t var finalProcessedBlocks = this._process(!!'flush');\n\t } else /* if (this._xformMode == this._DEC_XFORM_MODE) */ {\n\t // Process final blocks\n\t var finalProcessedBlocks = this._process(!!'flush');\n\n\t // Unpad data\n\t padding.unpad(finalProcessedBlocks);\n\t }\n\n\t return finalProcessedBlocks;\n\t },\n\n\t blockSize: 128/32\n\t });\n\n\t /**\n\t * A collection of cipher parameters.\n\t *\n\t * @property {WordArray} ciphertext The raw ciphertext.\n\t * @property {WordArray} key The key to this ciphertext.\n\t * @property {WordArray} iv The IV used in the ciphering operation.\n\t * @property {WordArray} salt The salt used with a key derivation function.\n\t * @property {Cipher} algorithm The cipher algorithm.\n\t * @property {Mode} mode The block mode used in the ciphering operation.\n\t * @property {Padding} padding The padding scheme used in the ciphering operation.\n\t * @property {number} blockSize The block size of the cipher.\n\t * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string.\n\t */\n\t var CipherParams = C_lib.CipherParams = Base.extend({\n\t /**\n\t * Initializes a newly created cipher params object.\n\t *\n\t * @param {Object} cipherParams An object with any of the possible cipher parameters.\n\t *\n\t * @example\n\t *\n\t * var cipherParams = CryptoJS.lib.CipherParams.create({\n\t * ciphertext: ciphertextWordArray,\n\t * key: keyWordArray,\n\t * iv: ivWordArray,\n\t * salt: saltWordArray,\n\t * algorithm: CryptoJS.algo.AES,\n\t * mode: CryptoJS.mode.CBC,\n\t * padding: CryptoJS.pad.PKCS7,\n\t * blockSize: 4,\n\t * formatter: CryptoJS.format.OpenSSL\n\t * });\n\t */\n\t init: function (cipherParams) {\n\t this.mixIn(cipherParams);\n\t },\n\n\t /**\n\t * Converts this cipher params object to a string.\n\t *\n\t * @param {Format} formatter (Optional) The formatting strategy to use.\n\t *\n\t * @return {string} The stringified cipher params.\n\t *\n\t * @throws Error If neither the formatter nor the default formatter is set.\n\t *\n\t * @example\n\t *\n\t * var string = cipherParams + '';\n\t * var string = cipherParams.toString();\n\t * var string = cipherParams.toString(CryptoJS.format.OpenSSL);\n\t */\n\t toString: function (formatter) {\n\t return (formatter || this.formatter).stringify(this);\n\t }\n\t });\n\n\t /**\n\t * Format namespace.\n\t */\n\t var C_format = C.format = {};\n\n\t /**\n\t * OpenSSL formatting strategy.\n\t */\n\t var OpenSSLFormatter = C_format.OpenSSL = {\n\t /**\n\t * Converts a cipher params object to an OpenSSL-compatible string.\n\t *\n\t * @param {CipherParams} cipherParams The cipher params object.\n\t *\n\t * @return {string} The OpenSSL-compatible string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams);\n\t */\n\t stringify: function (cipherParams) {\n\t // Shortcuts\n\t var ciphertext = cipherParams.ciphertext;\n\t var salt = cipherParams.salt;\n\n\t // Format\n\t if (salt) {\n\t var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext);\n\t } else {\n\t var wordArray = ciphertext;\n\t }\n\n\t return wordArray.toString(Base64);\n\t },\n\n\t /**\n\t * Converts an OpenSSL-compatible string to a cipher params object.\n\t *\n\t * @param {string} openSSLStr The OpenSSL-compatible string.\n\t *\n\t * @return {CipherParams} The cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString);\n\t */\n\t parse: function (openSSLStr) {\n\t // Parse base64\n\t var ciphertext = Base64.parse(openSSLStr);\n\n\t // Shortcut\n\t var ciphertextWords = ciphertext.words;\n\n\t // Test for salt\n\t if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) {\n\t // Extract salt\n\t var salt = WordArray.create(ciphertextWords.slice(2, 4));\n\n\t // Remove salt from ciphertext\n\t ciphertextWords.splice(0, 4);\n\t ciphertext.sigBytes -= 16;\n\t }\n\n\t return CipherParams.create({ ciphertext: ciphertext, salt: salt });\n\t }\n\t };\n\n\t /**\n\t * A cipher wrapper that returns ciphertext as a serializable cipher params object.\n\t */\n\t var SerializableCipher = C_lib.SerializableCipher = Base.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL\n\t */\n\t cfg: Base.extend({\n\t format: OpenSSLFormatter\n\t }),\n\n\t /**\n\t * Encrypts a message.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {WordArray|string} message The message to encrypt.\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {CipherParams} A cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key);\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv });\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n\t */\n\t encrypt: function (cipher, message, key, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Encrypt\n\t var encryptor = cipher.createEncryptor(key, cfg);\n\t var ciphertext = encryptor.finalize(message);\n\n\t // Shortcut\n\t var cipherCfg = encryptor.cfg;\n\n\t // Create and return serializable cipher params\n\t return CipherParams.create({\n\t ciphertext: ciphertext,\n\t key: key,\n\t iv: cipherCfg.iv,\n\t algorithm: cipher,\n\t mode: cipherCfg.mode,\n\t padding: cipherCfg.padding,\n\t blockSize: cipher.blockSize,\n\t formatter: cfg.format\n\t });\n\t },\n\n\t /**\n\t * Decrypts serialized ciphertext.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n\t * @param {WordArray} key The key.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {WordArray} The plaintext.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n\t * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL });\n\t */\n\t decrypt: function (cipher, ciphertext, key, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Convert string to CipherParams\n\t ciphertext = this._parse(ciphertext, cfg.format);\n\n\t // Decrypt\n\t var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext);\n\n\t return plaintext;\n\t },\n\n\t /**\n\t * Converts serialized ciphertext to CipherParams,\n\t * else assumed CipherParams already and returns ciphertext unchanged.\n\t *\n\t * @param {CipherParams|string} ciphertext The ciphertext.\n\t * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext.\n\t *\n\t * @return {CipherParams} The unserialized ciphertext.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format);\n\t */\n\t _parse: function (ciphertext, format) {\n\t if (typeof ciphertext == 'string') {\n\t return format.parse(ciphertext, this);\n\t } else {\n\t return ciphertext;\n\t }\n\t }\n\t });\n\n\t /**\n\t * Key derivation function namespace.\n\t */\n\t var C_kdf = C.kdf = {};\n\n\t /**\n\t * OpenSSL key derivation function.\n\t */\n\t var OpenSSLKdf = C_kdf.OpenSSL = {\n\t /**\n\t * Derives a key and IV from a password.\n\t *\n\t * @param {string} password The password to derive from.\n\t * @param {number} keySize The size in words of the key to generate.\n\t * @param {number} ivSize The size in words of the IV to generate.\n\t * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly.\n\t *\n\t * @return {CipherParams} A cipher params object with the key, IV, and salt.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32);\n\t * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt');\n\t */\n\t execute: function (password, keySize, ivSize, salt) {\n\t // Generate random salt\n\t if (!salt) {\n\t salt = WordArray.random(64/8);\n\t }\n\n\t // Derive key and IV\n\t var key = EvpKDF.create({ keySize: keySize + ivSize }).compute(password, salt);\n\n\t // Separate key and IV\n\t var iv = WordArray.create(key.words.slice(keySize), ivSize * 4);\n\t key.sigBytes = keySize * 4;\n\n\t // Return params\n\t return CipherParams.create({ key: key, iv: iv, salt: salt });\n\t }\n\t };\n\n\t /**\n\t * A serializable cipher wrapper that derives the key from a password,\n\t * and returns ciphertext as a serializable cipher params object.\n\t */\n\t var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL\n\t */\n\t cfg: SerializableCipher.cfg.extend({\n\t kdf: OpenSSLKdf\n\t }),\n\n\t /**\n\t * Encrypts a message using a password.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {WordArray|string} message The message to encrypt.\n\t * @param {string} password The password.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {CipherParams} A cipher params object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password');\n\t * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL });\n\t */\n\t encrypt: function (cipher, message, password, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Derive key and other params\n\t var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize);\n\n\t // Add IV to config\n\t cfg.iv = derivedParams.iv;\n\n\t // Encrypt\n\t var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg);\n\n\t // Mix in derived params\n\t ciphertext.mixIn(derivedParams);\n\n\t return ciphertext;\n\t },\n\n\t /**\n\t * Decrypts serialized ciphertext using a password.\n\t *\n\t * @param {Cipher} cipher The cipher algorithm to use.\n\t * @param {CipherParams|string} ciphertext The ciphertext to decrypt.\n\t * @param {string} password The password.\n\t * @param {Object} cfg (Optional) The configuration options to use for this operation.\n\t *\n\t * @return {WordArray} The plaintext.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL });\n\t * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL });\n\t */\n\t decrypt: function (cipher, ciphertext, password, cfg) {\n\t // Apply config defaults\n\t cfg = this.cfg.extend(cfg);\n\n\t // Convert string to CipherParams\n\t ciphertext = this._parse(ciphertext, cfg.format);\n\n\t // Derive key and other params\n\t var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt);\n\n\t // Add IV to config\n\t cfg.iv = derivedParams.iv;\n\n\t // Decrypt\n\t var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg);\n\n\t return plaintext;\n\t }\n\t });\n\t}());\n\n\n}));",";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./enc-base64\"), require(\"./md5\"), require(\"./evpkdf\"), require(\"./cipher-core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./enc-base64\", \"./md5\", \"./evpkdf\", \"./cipher-core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var BlockCipher = C_lib.BlockCipher;\n\t var C_algo = C.algo;\n\n\t // Lookup tables\n\t var SBOX = [];\n\t var INV_SBOX = [];\n\t var SUB_MIX_0 = [];\n\t var SUB_MIX_1 = [];\n\t var SUB_MIX_2 = [];\n\t var SUB_MIX_3 = [];\n\t var INV_SUB_MIX_0 = [];\n\t var INV_SUB_MIX_1 = [];\n\t var INV_SUB_MIX_2 = [];\n\t var INV_SUB_MIX_3 = [];\n\n\t // Compute lookup tables\n\t (function () {\n\t // Compute double table\n\t var d = [];\n\t for (var i = 0; i < 256; i++) {\n\t if (i < 128) {\n\t d[i] = i << 1;\n\t } else {\n\t d[i] = (i << 1) ^ 0x11b;\n\t }\n\t }\n\n\t // Walk GF(2^8)\n\t var x = 0;\n\t var xi = 0;\n\t for (var i = 0; i < 256; i++) {\n\t // Compute sbox\n\t var sx = xi ^ (xi << 1) ^ (xi << 2) ^ (xi << 3) ^ (xi << 4);\n\t sx = (sx >>> 8) ^ (sx & 0xff) ^ 0x63;\n\t SBOX[x] = sx;\n\t INV_SBOX[sx] = x;\n\n\t // Compute multiplication\n\t var x2 = d[x];\n\t var x4 = d[x2];\n\t var x8 = d[x4];\n\n\t // Compute sub bytes, mix columns tables\n\t var t = (d[sx] * 0x101) ^ (sx * 0x1010100);\n\t SUB_MIX_0[x] = (t << 24) | (t >>> 8);\n\t SUB_MIX_1[x] = (t << 16) | (t >>> 16);\n\t SUB_MIX_2[x] = (t << 8) | (t >>> 24);\n\t SUB_MIX_3[x] = t;\n\n\t // Compute inv sub bytes, inv mix columns tables\n\t var t = (x8 * 0x1010101) ^ (x4 * 0x10001) ^ (x2 * 0x101) ^ (x * 0x1010100);\n\t INV_SUB_MIX_0[sx] = (t << 24) | (t >>> 8);\n\t INV_SUB_MIX_1[sx] = (t << 16) | (t >>> 16);\n\t INV_SUB_MIX_2[sx] = (t << 8) | (t >>> 24);\n\t INV_SUB_MIX_3[sx] = t;\n\n\t // Compute next counter\n\t if (!x) {\n\t x = xi = 1;\n\t } else {\n\t x = x2 ^ d[d[d[x8 ^ x2]]];\n\t xi ^= d[d[xi]];\n\t }\n\t }\n\t }());\n\n\t // Precomputed Rcon lookup\n\t var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36];\n\n\t /**\n\t * AES block cipher algorithm.\n\t */\n\t var AES = C_algo.AES = BlockCipher.extend({\n\t _doReset: function () {\n\t // Skip reset of nRounds has been set before and key did not change\n\t if (this._nRounds && this._keyPriorReset === this._key) {\n\t return;\n\t }\n\n\t // Shortcuts\n\t var key = this._keyPriorReset = this._key;\n\t var keyWords = key.words;\n\t var keySize = key.sigBytes / 4;\n\n\t // Compute number of rounds\n\t var nRounds = this._nRounds = keySize + 6;\n\n\t // Compute number of key schedule rows\n\t var ksRows = (nRounds + 1) * 4;\n\n\t // Compute key schedule\n\t var keySchedule = this._keySchedule = [];\n\t for (var ksRow = 0; ksRow < ksRows; ksRow++) {\n\t if (ksRow < keySize) {\n\t keySchedule[ksRow] = keyWords[ksRow];\n\t } else {\n\t var t = keySchedule[ksRow - 1];\n\n\t if (!(ksRow % keySize)) {\n\t // Rot word\n\t t = (t << 8) | (t >>> 24);\n\n\t // Sub word\n\t t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];\n\n\t // Mix Rcon\n\t t ^= RCON[(ksRow / keySize) | 0] << 24;\n\t } else if (keySize > 6 && ksRow % keySize == 4) {\n\t // Sub word\n\t t = (SBOX[t >>> 24] << 24) | (SBOX[(t >>> 16) & 0xff] << 16) | (SBOX[(t >>> 8) & 0xff] << 8) | SBOX[t & 0xff];\n\t }\n\n\t keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t;\n\t }\n\t }\n\n\t // Compute inv key schedule\n\t var invKeySchedule = this._invKeySchedule = [];\n\t for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) {\n\t var ksRow = ksRows - invKsRow;\n\n\t if (invKsRow % 4) {\n\t var t = keySchedule[ksRow];\n\t } else {\n\t var t = keySchedule[ksRow - 4];\n\t }\n\n\t if (invKsRow < 4 || ksRow <= 4) {\n\t invKeySchedule[invKsRow] = t;\n\t } else {\n\t invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[(t >>> 16) & 0xff]] ^\n\t INV_SUB_MIX_2[SBOX[(t >>> 8) & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]];\n\t }\n\t }\n\t },\n\n\t encryptBlock: function (M, offset) {\n\t this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX);\n\t },\n\n\t decryptBlock: function (M, offset) {\n\t // Swap 2nd and 4th rows\n\t var t = M[offset + 1];\n\t M[offset + 1] = M[offset + 3];\n\t M[offset + 3] = t;\n\n\t this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX);\n\n\t // Inv swap 2nd and 4th rows\n\t var t = M[offset + 1];\n\t M[offset + 1] = M[offset + 3];\n\t M[offset + 3] = t;\n\t },\n\n\t _doCryptBlock: function (M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) {\n\t // Shortcut\n\t var nRounds = this._nRounds;\n\n\t // Get input, add round key\n\t var s0 = M[offset] ^ keySchedule[0];\n\t var s1 = M[offset + 1] ^ keySchedule[1];\n\t var s2 = M[offset + 2] ^ keySchedule[2];\n\t var s3 = M[offset + 3] ^ keySchedule[3];\n\n\t // Key schedule row counter\n\t var ksRow = 4;\n\n\t // Rounds\n\t for (var round = 1; round < nRounds; round++) {\n\t // Shift rows, sub bytes, mix columns, add round key\n\t var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[(s1 >>> 16) & 0xff] ^ SUB_MIX_2[(s2 >>> 8) & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++];\n\t var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[(s2 >>> 16) & 0xff] ^ SUB_MIX_2[(s3 >>> 8) & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++];\n\t var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[(s3 >>> 16) & 0xff] ^ SUB_MIX_2[(s0 >>> 8) & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++];\n\t var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[(s0 >>> 16) & 0xff] ^ SUB_MIX_2[(s1 >>> 8) & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++];\n\n\t // Update state\n\t s0 = t0;\n\t s1 = t1;\n\t s2 = t2;\n\t s3 = t3;\n\t }\n\n\t // Shift rows, sub bytes, add round key\n\t var t0 = ((SBOX[s0 >>> 24] << 24) | (SBOX[(s1 >>> 16) & 0xff] << 16) | (SBOX[(s2 >>> 8) & 0xff] << 8) | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++];\n\t var t1 = ((SBOX[s1 >>> 24] << 24) | (SBOX[(s2 >>> 16) & 0xff] << 16) | (SBOX[(s3 >>> 8) & 0xff] << 8) | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++];\n\t var t2 = ((SBOX[s2 >>> 24] << 24) | (SBOX[(s3 >>> 16) & 0xff] << 16) | (SBOX[(s0 >>> 8) & 0xff] << 8) | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++];\n\t var t3 = ((SBOX[s3 >>> 24] << 24) | (SBOX[(s0 >>> 16) & 0xff] << 16) | (SBOX[(s1 >>> 8) & 0xff] << 8) | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++];\n\n\t // Set output\n\t M[offset] = t0;\n\t M[offset + 1] = t1;\n\t M[offset + 2] = t2;\n\t M[offset + 3] = t3;\n\t },\n\n\t keySize: 256/32\n\t });\n\n\t /**\n\t * Shortcut functions to the cipher's object interface.\n\t *\n\t * @example\n\t *\n\t * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg);\n\t * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg);\n\t */\n\t C.AES = BlockCipher._createHelper(AES);\n\t}());\n\n\n\treturn CryptoJS.AES;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\treturn CryptoJS.enc.Utf8;\n\n}));","/**\n * toString ref.\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n *\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nmodule.exports = function(val){\n switch (toString.call(val)) {\n case '[object Date]': return 'date';\n case '[object RegExp]': return 'regexp';\n case '[object Arguments]': return 'arguments';\n case '[object Array]': return 'array';\n case '[object Error]': return 'error';\n }\n\n if (val === null) return 'null';\n if (val === undefined) return 'undefined';\n if (val !== val) return 'nan';\n if (val && val.nodeType === 1) return 'element';\n\n if (isBuffer(val)) return 'buffer';\n\n val = val.valueOf\n ? val.valueOf()\n : Object.prototype.valueOf.apply(val);\n\n return typeof val;\n};\n\n// code borrowed from https://github.com/feross/is-buffer/blob/master/index.js\nfunction isBuffer(obj) {\n return !!(obj != null &&\n (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)\n (obj.constructor &&\n typeof obj.constructor.isBuffer === 'function' &&\n obj.constructor.isBuffer(obj))\n ))\n}\n","'use strict';\n\n/*\n * Module dependencies.\n */\n\nvar type = require('component-type');\n\n/**\n * Deeply clone an object.\n *\n * @param {*} obj Any object.\n */\n\nvar clone = function clone(obj) {\n var t = type(obj);\n\n if (t === 'object') {\n var copy = {};\n for (var key in obj) {\n if (obj.hasOwnProperty(key)) {\n copy[key] = clone(obj[key]);\n }\n }\n return copy;\n }\n\n if (t === 'array') {\n var copy = new Array(obj.length);\n for (var i = 0, l = obj.length; i < l; i++) {\n copy[i] = clone(obj[i]);\n }\n return copy;\n }\n\n if (t === 'regexp') {\n // from millermedeiros/amd-utils - MIT\n var flags = '';\n flags += obj.multiline ? 'm' : '';\n flags += obj.global ? 'g' : '';\n flags += obj.ignoreCase ? 'i' : '';\n return new RegExp(obj.source, flags);\n }\n\n if (t === 'date') {\n return new Date(obj.getTime());\n }\n\n // string, number, boolean, etc.\n return obj;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = clone;\n","/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} options\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function(val, options){\n options = options || {};\n if ('string' == typeof val) return parse(val);\n return options.long\n ? long(val)\n : short(val);\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = '' + str;\n if (str.length > 10000) return;\n var match = /^((?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);\n if (!match) return;\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction short(ms) {\n if (ms >= d) return Math.round(ms / d) + 'd';\n if (ms >= h) return Math.round(ms / h) + 'h';\n if (ms >= m) return Math.round(ms / m) + 'm';\n if (ms >= s) return Math.round(ms / s) + 's';\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction long(ms) {\n return plural(ms, d, 'day')\n || plural(ms, h, 'hour')\n || plural(ms, m, 'minute')\n || plural(ms, s, 'second')\n || ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, n, name) {\n if (ms < n) return;\n if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name;\n return Math.ceil(ms / n) + ' ' + name + 's';\n}\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = debug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lowercased letter, i.e. \"n\".\n */\n\nexports.formatters = {};\n\n/**\n * Previously assigned color.\n */\n\nvar prevColor = 0;\n\n/**\n * Previous log timestamp.\n */\n\nvar prevTime;\n\n/**\n * Select a color.\n *\n * @return {Number}\n * @api private\n */\n\nfunction selectColor() {\n return exports.colors[prevColor++ % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction debug(namespace) {\n\n // define the `disabled` version\n function disabled() {\n }\n disabled.enabled = false;\n\n // define the `enabled` version\n function enabled() {\n\n var self = enabled;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // add the `color` if not set\n if (null == self.useColors) self.useColors = exports.useColors();\n if (null == self.color && self.useColors) self.color = selectColor();\n\n var args = Array.prototype.slice.call(arguments);\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %o\n args = ['%o'].concat(args);\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n if ('function' === typeof exports.formatArgs) {\n args = exports.formatArgs.apply(self, args);\n }\n var logFn = enabled.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n enabled.enabled = true;\n\n var fn = exports.enabled(namespace) ? enabled : disabled;\n\n fn.namespace = namespace;\n\n return fn;\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n var split = (namespaces || '').split(/[\\s,]+/);\n var len = split.length;\n\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n","\n/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n 'lightseagreen',\n 'forestgreen',\n 'goldenrod',\n 'dodgerblue',\n 'darkorchid',\n 'crimson'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // is webkit? http://stackoverflow.com/a/16459606/376773\n return ('WebkitAppearance' in document.documentElement.style) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (window.console && (console.firebug || (console.exception && console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31);\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n return JSON.stringify(v);\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs() {\n var args = arguments;\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return args;\n\n var c = 'color: ' + this.color;\n args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n return args;\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage(){\n try {\n return window.localStorage;\n } catch (e) {}\n}\n","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('cookie');\n\n/**\n * Set or get cookie `name` with `value` and `options` object.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @return {Mixed}\n * @api public\n */\n\nmodule.exports = function(name, value, options){\n switch (arguments.length) {\n case 3:\n case 2:\n return set(name, value, options);\n case 1:\n return get(name);\n default:\n return all();\n }\n};\n\n/**\n * Set cookie `name` to `value`.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @api private\n */\n\nfunction set(name, value, options) {\n options = options || {};\n var str = encode(name) + '=' + encode(value);\n\n if (null == value) options.maxage = -1;\n\n if (options.maxage) {\n options.expires = new Date(+new Date + options.maxage);\n }\n\n if (options.path) str += '; path=' + options.path;\n if (options.domain) str += '; domain=' + options.domain;\n if (options.expires) str += '; expires=' + options.expires.toUTCString();\n if (options.samesite) str += '; samesite=' + options.samesite;\n if (options.secure) str += '; secure';\n\n document.cookie = str;\n}\n\n/**\n * Return all cookies.\n *\n * @return {Object}\n * @api private\n */\n\nfunction all() {\n var str;\n try {\n str = document.cookie;\n } catch (err) {\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(err.stack || err);\n }\n return {};\n }\n return parse(str);\n}\n\n/**\n * Get cookie `name`.\n *\n * @param {String} name\n * @return {String}\n * @api private\n */\n\nfunction get(name) {\n return all()[name];\n}\n\n/**\n * Parse cookie `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parse(str) {\n var obj = {};\n var pairs = str.split(/ *; */);\n var pair;\n if ('' == pairs[0]) return obj;\n for (var i = 0; i < pairs.length; ++i) {\n pair = pairs[i].split('=');\n obj[decode(pair[0])] = decode(pair[1]);\n }\n return obj;\n}\n\n/**\n * Encode.\n */\n\nfunction encode(value){\n try {\n return encodeURIComponent(value);\n } catch (e) {\n debug('error `encode(%o)` - %o', value, e)\n }\n}\n\n/**\n * Decode.\n */\n\nfunction decode(value) {\n try {\n return decodeURIComponent(value);\n } catch (e) {\n debug('error `decode(%o)` - %o', value, e)\n }\n}\n","'use strict';\n\nvar max = Math.max;\n\n/**\n * Produce a new array composed of all but the first `n` elements of an input `collection`.\n *\n * @name drop\n * @api public\n * @param {number} count The number of elements to drop.\n * @param {Array} collection The collection to iterate over.\n * @return {Array} A new array containing all but the first element from `collection`.\n * @example\n * drop(0, [1, 2, 3]); // => [1, 2, 3]\n * drop(1, [1, 2, 3]); // => [2, 3]\n * drop(2, [1, 2, 3]); // => [3]\n * drop(3, [1, 2, 3]); // => []\n * drop(4, [1, 2, 3]); // => []\n */\nvar drop = function drop(count, collection) {\n var length = collection ? collection.length : 0;\n\n if (!length) {\n return [];\n }\n\n // Preallocating an array *significantly* boosts performance when dealing with\n // `arguments` objects on v8. For a summary, see:\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var toDrop = max(Number(count) || 0, 0);\n var resultsLength = max(length - toDrop, 0);\n var results = new Array(resultsLength);\n\n for (var i = 0; i < resultsLength; i += 1) {\n results[i] = collection[i + toDrop];\n }\n\n return results;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = drop;\n","'use strict';\n\nvar max = Math.max;\n\n/**\n * Produce a new array by passing each value in the input `collection` through a transformative\n * `iterator` function. The `iterator` function is passed three arguments:\n * `(value, index, collection)`.\n *\n * @name rest\n * @api public\n * @param {Array} collection The collection to iterate over.\n * @return {Array} A new array containing all but the first element from `collection`.\n * @example\n * rest([1, 2, 3]); // => [2, 3]\n */\nvar rest = function rest(collection) {\n if (collection == null || !collection.length) {\n return [];\n }\n\n // Preallocating an array *significantly* boosts performance when dealing with\n // `arguments` objects on v8. For a summary, see:\n // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments\n var results = new Array(max(collection.length - 2, 0));\n\n for (var i = 1; i < collection.length; i += 1) {\n results[i - 1] = collection[i];\n }\n\n return results;\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = rest;\n","'use strict';\n\n/*\n * Module dependencies.\n */\n\nvar drop = require('@ndhoule/drop');\nvar rest = require('@ndhoule/rest');\n\nvar has = Object.prototype.hasOwnProperty;\nvar objToString = Object.prototype.toString;\n\n/**\n * Returns `true` if a value is an object, otherwise `false`.\n *\n * @name isObject\n * @api private\n * @param {*} val The value to test.\n * @return {boolean}\n */\n// TODO: Move to a library\nvar isObject = function isObject(value) {\n return Boolean(value) && typeof value === 'object';\n};\n\n/**\n * Returns `true` if a value is a plain object, otherwise `false`.\n *\n * @name isPlainObject\n * @api private\n * @param {*} val The value to test.\n * @return {boolean}\n */\n// TODO: Move to a library\nvar isPlainObject = function isPlainObject(value) {\n return Boolean(value) && objToString.call(value) === '[object Object]';\n};\n\n/**\n * Assigns a key-value pair to a target object when the value assigned is owned,\n * and where target[key] is undefined.\n *\n * @name shallowCombiner\n * @api private\n * @param {Object} target\n * @param {Object} source\n * @param {*} value\n * @param {string} key\n */\nvar shallowCombiner = function shallowCombiner(target, source, value, key) {\n if (has.call(source, key) && target[key] === undefined) {\n target[key] = value;\n }\n return source;\n};\n\n/**\n * Assigns a key-value pair to a target object when the value assigned is owned,\n * and where target[key] is undefined; also merges objects recursively.\n *\n * @name deepCombiner\n * @api private\n * @param {Object} target\n * @param {Object} source\n * @param {*} value\n * @param {string} key\n * @return {Object}\n */\nvar deepCombiner = function(target, source, value, key) {\n if (has.call(source, key)) {\n if (isPlainObject(target[key]) && isPlainObject(value)) {\n target[key] = defaultsDeep(target[key], value);\n } else if (target[key] === undefined) {\n target[key] = value;\n }\n }\n\n return source;\n};\n\n/**\n * TODO: Document\n *\n * @name defaultsWith\n * @api private\n * @param {Function} combiner\n * @param {Object} target\n * @param {...Object} sources\n * @return {Object} Return the input `target`.\n */\nvar defaultsWith = function(combiner, target /*, ...sources */) {\n if (!isObject(target)) {\n return target;\n }\n\n combiner = combiner || shallowCombiner;\n var sources = drop(2, arguments);\n\n for (var i = 0; i < sources.length; i += 1) {\n for (var key in sources[i]) {\n combiner(target, sources[i], sources[i][key], key);\n }\n }\n\n return target;\n};\n\n/**\n * Copies owned, enumerable properties from a source object(s) to a target\n * object when the value of that property on the source object is `undefined`.\n * Recurses on objects.\n *\n * @name defaultsDeep\n * @api public\n * @param {Object} target\n * @param {...Object} sources\n * @return {Object} The input `target`.\n */\nvar defaultsDeep = function defaultsDeep(target /*, sources */) {\n // TODO: Replace with `partial` call?\n return defaultsWith.apply(null, [deepCombiner, target].concat(rest(arguments)));\n};\n\n/**\n * Copies owned, enumerable properties from a source object(s) to a target\n * object when the value of that property on the source object is `undefined`.\n *\n * @name defaults\n * @api public\n * @param {Object} target\n * @param {...Object} sources\n * @return {Object}\n * @example\n * var a = { a: 1 };\n * var b = { a: 2, b: 2 };\n *\n * defaults(a, b);\n * console.log(a); //=> { a: 1, b: 2 }\n */\nvar defaults = function(target /*, ...sources */) {\n // TODO: Replace with `partial` call?\n return defaultsWith.apply(null, [null, target].concat(rest(arguments)));\n};\n\n/*\n * Exports.\n */\n\nmodule.exports = defaults;\nmodule.exports.deep = defaultsDeep;\n","/*! JSON v3.3.2 | https://bestiejs.github.io/json3 | Copyright 2012-2015, Kit Cambridge, Benjamin Tan | http://kit.mit-license.org */\n;(function () {\n // Detect the `define` function exposed by asynchronous module loaders. The\n // strict `define` check is necessary for compatibility with `r.js`.\n var isLoader = typeof define === \"function\" && define.amd;\n\n // A set of types used to distinguish objects from primitives.\n var objectTypes = {\n \"function\": true,\n \"object\": true\n };\n\n // Detect the `exports` object exposed by CommonJS implementations.\n var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports;\n\n // Use the `global` object exposed by Node (including Browserify via\n // `insert-module-globals`), Narwhal, and Ringo as the default context,\n // and the `window` object in browsers. Rhino exports a `global` function\n // instead.\n var root = objectTypes[typeof window] && window || this,\n freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == \"object\" && global;\n\n if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) {\n root = freeGlobal;\n }\n\n // Public: Initializes JSON 3 using the given `context` object, attaching the\n // `stringify` and `parse` functions to the specified `exports` object.\n function runInContext(context, exports) {\n context || (context = root.Object());\n exports || (exports = root.Object());\n\n // Native constructor aliases.\n var Number = context.Number || root.Number,\n String = context.String || root.String,\n Object = context.Object || root.Object,\n Date = context.Date || root.Date,\n SyntaxError = context.SyntaxError || root.SyntaxError,\n TypeError = context.TypeError || root.TypeError,\n Math = context.Math || root.Math,\n nativeJSON = context.JSON || root.JSON;\n\n // Delegate to the native `stringify` and `parse` implementations.\n if (typeof nativeJSON == \"object\" && nativeJSON) {\n exports.stringify = nativeJSON.stringify;\n exports.parse = nativeJSON.parse;\n }\n\n // Convenience aliases.\n var objectProto = Object.prototype,\n getClass = objectProto.toString,\n isProperty = objectProto.hasOwnProperty,\n undefined;\n\n // Internal: Contains `try...catch` logic used by other functions.\n // This prevents other functions from being deoptimized.\n function attempt(func, errorFunc) {\n try {\n func();\n } catch (exception) {\n if (errorFunc) {\n errorFunc();\n }\n }\n }\n\n // Test the `Date#getUTC*` methods. Based on work by @Yaffle.\n var isExtended = new Date(-3509827334573292);\n attempt(function () {\n // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical\n // results for certain dates in Opera >= 10.53.\n isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 &&\n isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708;\n });\n\n // Internal: Determines whether the native `JSON.stringify` and `parse`\n // implementations are spec-compliant. Based on work by Ken Snyder.\n function has(name) {\n if (has[name] != null) {\n // Return cached feature test result.\n return has[name];\n }\n var isSupported;\n if (name == \"bug-string-char-index\") {\n // IE <= 7 doesn't support accessing string characters using square\n // bracket notation. IE 8 only supports this for primitives.\n isSupported = \"a\"[0] != \"a\";\n } else if (name == \"json\") {\n // Indicates whether both `JSON.stringify` and `JSON.parse` are\n // supported.\n isSupported = has(\"json-stringify\") && has(\"date-serialization\") && has(\"json-parse\");\n } else if (name == \"date-serialization\") {\n // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`.\n isSupported = has(\"json-stringify\") && isExtended;\n if (isSupported) {\n var stringify = exports.stringify;\n attempt(function () {\n isSupported =\n // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly\n // serialize extended years.\n stringify(new Date(-8.64e15)) == '\"-271821-04-20T00:00:00.000Z\"' &&\n // The milliseconds are optional in ES 5, but required in 5.1.\n stringify(new Date(8.64e15)) == '\"+275760-09-13T00:00:00.000Z\"' &&\n // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative\n // four-digit years instead of six-digit years. Credits: @Yaffle.\n stringify(new Date(-621987552e5)) == '\"-000001-01-01T00:00:00.000Z\"' &&\n // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond\n // values less than 1000. Credits: @Yaffle.\n stringify(new Date(-1)) == '\"1969-12-31T23:59:59.999Z\"';\n });\n }\n } else {\n var value, serialized = '{\"a\":[1,true,false,null,\"\\\\u0000\\\\b\\\\n\\\\f\\\\r\\\\t\"]}';\n // Test `JSON.stringify`.\n if (name == \"json-stringify\") {\n var stringify = exports.stringify, stringifySupported = typeof stringify == \"function\";\n if (stringifySupported) {\n // A test function object with a custom `toJSON` method.\n (value = function () {\n return 1;\n }).toJSON = value;\n attempt(function () {\n stringifySupported =\n // Firefox 3.1b1 and b2 serialize string, number, and boolean\n // primitives as object literals.\n stringify(0) === \"0\" &&\n // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object\n // literals.\n stringify(new Number()) === \"0\" &&\n stringify(new String()) == '\"\"' &&\n // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or\n // does not define a canonical JSON representation (this applies to\n // objects with `toJSON` properties as well, *unless* they are nested\n // within an object or array).\n stringify(getClass) === undefined &&\n // IE 8 serializes `undefined` as `\"undefined\"`. Safari <= 5.1.7 and\n // FF 3.1b3 pass this test.\n stringify(undefined) === undefined &&\n // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s,\n // respectively, if the value is omitted entirely.\n stringify() === undefined &&\n // FF 3.1b1, 2 throw an error if the given value is not a number,\n // string, array, object, Boolean, or `null` literal. This applies to\n // objects with custom `toJSON` methods as well, unless they are nested\n // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON`\n // methods entirely.\n stringify(value) === \"1\" &&\n stringify([value]) == \"[1]\" &&\n // Prototype <= 1.6.1 serializes `[undefined]` as `\"[]\"` instead of\n // `\"[null]\"`.\n stringify([undefined]) == \"[null]\" &&\n // YUI 3.0.0b1 fails to serialize `null` literals.\n stringify(null) == \"null\" &&\n // FF 3.1b1, 2 halts serialization if an array contains a function:\n // `[1, true, getClass, 1]` serializes as \"[1,true,],\". FF 3.1b3\n // elides non-JSON values from objects and arrays, unless they\n // define custom `toJSON` methods.\n stringify([undefined, getClass, null]) == \"[null,null,null]\" &&\n // Simple serialization test. FF 3.1b1 uses Unicode escape sequences\n // where character escape codes are expected (e.g., `\\b` => `\\u0008`).\n stringify({ \"a\": [value, true, false, null, \"\\x00\\b\\n\\f\\r\\t\"] }) == serialized &&\n // FF 3.1b1 and b2 ignore the `filter` and `width` arguments.\n stringify(null, value) === \"1\" &&\n stringify([1, 2], null, 1) == \"[\\n 1,\\n 2\\n]\";\n }, function () {\n stringifySupported = false;\n });\n }\n isSupported = stringifySupported;\n }\n // Test `JSON.parse`.\n if (name == \"json-parse\") {\n var parse = exports.parse, parseSupported;\n if (typeof parse == \"function\") {\n attempt(function () {\n // FF 3.1b1, b2 will throw an exception if a bare literal is provided.\n // Conforming implementations should also coerce the initial argument to\n // a string prior to parsing.\n if (parse(\"0\") === 0 && !parse(false)) {\n // Simple parsing test.\n value = parse(serialized);\n parseSupported = value[\"a\"].length == 5 && value[\"a\"][0] === 1;\n if (parseSupported) {\n attempt(function () {\n // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings.\n parseSupported = !parse('\"\\t\"');\n });\n if (parseSupported) {\n attempt(function () {\n // FF 4.0 and 4.0.1 allow leading `+` signs and leading\n // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow\n // certain octal literals.\n parseSupported = parse(\"01\") !== 1;\n });\n }\n if (parseSupported) {\n attempt(function () {\n // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal\n // points. These environments, along with FF 3.1b1 and 2,\n // also allow trailing commas in JSON objects and arrays.\n parseSupported = parse(\"1.\") !== 1;\n });\n }\n }\n }\n }, function () {\n parseSupported = false;\n });\n }\n isSupported = parseSupported;\n }\n }\n return has[name] = !!isSupported;\n }\n has[\"bug-string-char-index\"] = has[\"date-serialization\"] = has[\"json\"] = has[\"json-stringify\"] = has[\"json-parse\"] = null;\n\n if (!has(\"json\")) {\n // Common `[[Class]]` name aliases.\n var functionClass = \"[object Function]\",\n dateClass = \"[object Date]\",\n numberClass = \"[object Number]\",\n stringClass = \"[object String]\",\n arrayClass = \"[object Array]\",\n booleanClass = \"[object Boolean]\";\n\n // Detect incomplete support for accessing string characters by index.\n var charIndexBuggy = has(\"bug-string-char-index\");\n\n // Internal: Normalizes the `for...in` iteration algorithm across\n // environments. Each enumerated key is yielded to a `callback` function.\n var forOwn = function (object, callback) {\n var size = 0, Properties, dontEnums, property;\n\n // Tests for bugs in the current environment's `for...in` algorithm. The\n // `valueOf` property inherits the non-enumerable flag from\n // `Object.prototype` in older versions of IE, Netscape, and Mozilla.\n (Properties = function () {\n this.valueOf = 0;\n }).prototype.valueOf = 0;\n\n // Iterate over a new instance of the `Properties` class.\n dontEnums = new Properties();\n for (property in dontEnums) {\n // Ignore all properties inherited from `Object.prototype`.\n if (isProperty.call(dontEnums, property)) {\n size++;\n }\n }\n Properties = dontEnums = null;\n\n // Normalize the iteration algorithm.\n if (!size) {\n // A list of non-enumerable properties inherited from `Object.prototype`.\n dontEnums = [\"valueOf\", \"toString\", \"toLocaleString\", \"propertyIsEnumerable\", \"isPrototypeOf\", \"hasOwnProperty\", \"constructor\"];\n // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable\n // properties.\n forOwn = function (object, callback) {\n var isFunction = getClass.call(object) == functionClass, property, length;\n var hasProperty = !isFunction && typeof object.constructor != \"function\" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty;\n for (property in object) {\n // Gecko <= 1.0 enumerates the `prototype` property of functions under\n // certain conditions; IE does not.\n if (!(isFunction && property == \"prototype\") && hasProperty.call(object, property)) {\n callback(property);\n }\n }\n // Manually invoke the callback for each non-enumerable property.\n for (length = dontEnums.length; property = dontEnums[--length];) {\n if (hasProperty.call(object, property)) {\n callback(property);\n }\n }\n };\n } else {\n // No bugs detected; use the standard `for...in` algorithm.\n forOwn = function (object, callback) {\n var isFunction = getClass.call(object) == functionClass, property, isConstructor;\n for (property in object) {\n if (!(isFunction && property == \"prototype\") && isProperty.call(object, property) && !(isConstructor = property === \"constructor\")) {\n callback(property);\n }\n }\n // Manually invoke the callback for the `constructor` property due to\n // cross-environment inconsistencies.\n if (isConstructor || isProperty.call(object, (property = \"constructor\"))) {\n callback(property);\n }\n };\n }\n return forOwn(object, callback);\n };\n\n // Public: Serializes a JavaScript `value` as a JSON string. The optional\n // `filter` argument may specify either a function that alters how object and\n // array members are serialized, or an array of strings and numbers that\n // indicates which properties should be serialized. The optional `width`\n // argument may be either a string or number that specifies the indentation\n // level of the output.\n if (!has(\"json-stringify\") && !has(\"date-serialization\")) {\n // Internal: A map of control characters and their escaped equivalents.\n var Escapes = {\n 92: \"\\\\\\\\\",\n 34: '\\\\\"',\n 8: \"\\\\b\",\n 12: \"\\\\f\",\n 10: \"\\\\n\",\n 13: \"\\\\r\",\n 9: \"\\\\t\"\n };\n\n // Internal: Converts `value` into a zero-padded string such that its\n // length is at least equal to `width`. The `width` must be <= 6.\n var leadingZeroes = \"000000\";\n var toPaddedString = function (width, value) {\n // The `|| 0` expression is necessary to work around a bug in\n // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== \"0\"`.\n return (leadingZeroes + (value || 0)).slice(-width);\n };\n\n // Internal: Serializes a date object.\n var serializeDate = function (value) {\n var getData, year, month, date, time, hours, minutes, seconds, milliseconds;\n // Define additional utility methods if the `Date` methods are buggy.\n if (!isExtended) {\n var floor = Math.floor;\n // A mapping between the months of the year and the number of days between\n // January 1st and the first of the respective month.\n var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];\n // Internal: Calculates the number of days between the Unix epoch and the\n // first day of the given month.\n var getDay = function (year, month) {\n return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400);\n };\n getData = function (value) {\n // Manually compute the year, month, date, hours, minutes,\n // seconds, and milliseconds if the `getUTC*` methods are\n // buggy. Adapted from @Yaffle's `date-shim` project.\n date = floor(value / 864e5);\n for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++);\n for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++);\n date = 1 + date - getDay(year, month);\n // The `time` value specifies the time within the day (see ES\n // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used\n // to compute `A modulo B`, as the `%` operator does not\n // correspond to the `modulo` operation for negative numbers.\n time = (value % 864e5 + 864e5) % 864e5;\n // The hours, minutes, seconds, and milliseconds are obtained by\n // decomposing the time within the day. See section 15.9.1.10.\n hours = floor(time / 36e5) % 24;\n minutes = floor(time / 6e4) % 60;\n seconds = floor(time / 1e3) % 60;\n milliseconds = time % 1e3;\n };\n } else {\n getData = function (value) {\n year = value.getUTCFullYear();\n month = value.getUTCMonth();\n date = value.getUTCDate();\n hours = value.getUTCHours();\n minutes = value.getUTCMinutes();\n seconds = value.getUTCSeconds();\n milliseconds = value.getUTCMilliseconds();\n };\n }\n serializeDate = function (value) {\n if (value > -1 / 0 && value < 1 / 0) {\n // Dates are serialized according to the `Date#toJSON` method\n // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15\n // for the ISO 8601 date time string format.\n getData(value);\n // Serialize extended years correctly.\n value = (year <= 0 || year >= 1e4 ? (year < 0 ? \"-\" : \"+\") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) +\n \"-\" + toPaddedString(2, month + 1) + \"-\" + toPaddedString(2, date) +\n // Months, dates, hours, minutes, and seconds should have two\n // digits; milliseconds should have three.\n \"T\" + toPaddedString(2, hours) + \":\" + toPaddedString(2, minutes) + \":\" + toPaddedString(2, seconds) +\n // Milliseconds are optional in ES 5.0, but required in 5.1.\n \".\" + toPaddedString(3, milliseconds) + \"Z\";\n year = month = date = hours = minutes = seconds = milliseconds = null;\n } else {\n value = null;\n }\n return value;\n };\n return serializeDate(value);\n };\n\n // For environments with `JSON.stringify` but buggy date serialization,\n // we override the native `Date#toJSON` implementation with a\n // spec-compliant one.\n if (has(\"json-stringify\") && !has(\"date-serialization\")) {\n // Internal: the `Date#toJSON` implementation used to override the native one.\n function dateToJSON (key) {\n return serializeDate(this);\n }\n\n // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.\n var nativeStringify = exports.stringify;\n exports.stringify = function (source, filter, width) {\n var nativeToJSON = Date.prototype.toJSON;\n Date.prototype.toJSON = dateToJSON;\n var result = nativeStringify(source, filter, width);\n Date.prototype.toJSON = nativeToJSON;\n return result;\n }\n } else {\n // Internal: Double-quotes a string `value`, replacing all ASCII control\n // characters (characters with code unit values between 0 and 31) with\n // their escaped equivalents. This is an implementation of the\n // `Quote(value)` operation defined in ES 5.1 section 15.12.3.\n var unicodePrefix = \"\\\\u00\";\n var escapeChar = function (character) {\n var charCode = character.charCodeAt(0), escaped = Escapes[charCode];\n if (escaped) {\n return escaped;\n }\n return unicodePrefix + toPaddedString(2, charCode.toString(16));\n };\n var reEscape = /[\\x00-\\x1f\\x22\\x5c]/g;\n var quote = function (value) {\n reEscape.lastIndex = 0;\n return '\"' +\n (\n reEscape.test(value)\n ? value.replace(reEscape, escapeChar)\n : value\n ) +\n '\"';\n };\n\n // Internal: Recursively serializes an object. Implements the\n // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations.\n var serialize = function (property, object, callback, properties, whitespace, indentation, stack) {\n var value, type, className, results, element, index, length, prefix, result;\n attempt(function () {\n // Necessary for host object support.\n value = object[property];\n });\n if (typeof value == \"object\" && value) {\n if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) {\n value = serializeDate(value);\n } else if (typeof value.toJSON == \"function\") {\n value = value.toJSON(property);\n }\n }\n if (callback) {\n // If a replacement function was provided, call it to obtain the value\n // for serialization.\n value = callback.call(object, property, value);\n }\n // Exit early if value is `undefined` or `null`.\n if (value == undefined) {\n return value === undefined ? value : \"null\";\n }\n type = typeof value;\n // Only call `getClass` if the value is an object.\n if (type == \"object\") {\n className = getClass.call(value);\n }\n switch (className || type) {\n case \"boolean\":\n case booleanClass:\n // Booleans are represented literally.\n return \"\" + value;\n case \"number\":\n case numberClass:\n // JSON numbers must be finite. `Infinity` and `NaN` are serialized as\n // `\"null\"`.\n return value > -1 / 0 && value < 1 / 0 ? \"\" + value : \"null\";\n case \"string\":\n case stringClass:\n // Strings are double-quoted and escaped.\n return quote(\"\" + value);\n }\n // Recursively serialize objects and arrays.\n if (typeof value == \"object\") {\n // Check for cyclic structures. This is a linear search; performance\n // is inversely proportional to the number of unique nested objects.\n for (length = stack.length; length--;) {\n if (stack[length] === value) {\n // Cyclic structures cannot be serialized by `JSON.stringify`.\n throw TypeError();\n }\n }\n // Add the object to the stack of traversed objects.\n stack.push(value);\n results = [];\n // Save the current indentation level and indent one additional level.\n prefix = indentation;\n indentation += whitespace;\n if (className == arrayClass) {\n // Recursively serialize array elements.\n for (index = 0, length = value.length; index < length; index++) {\n element = serialize(index, value, callback, properties, whitespace, indentation, stack);\n results.push(element === undefined ? \"null\" : element);\n }\n result = results.length ? (whitespace ? \"[\\n\" + indentation + results.join(\",\\n\" + indentation) + \"\\n\" + prefix + \"]\" : (\"[\" + results.join(\",\") + \"]\")) : \"[]\";\n } else {\n // Recursively serialize object members. Members are selected from\n // either a user-specified list of property names, or the object\n // itself.\n forOwn(properties || value, function (property) {\n var element = serialize(property, value, callback, properties, whitespace, indentation, stack);\n if (element !== undefined) {\n // According to ES 5.1 section 15.12.3: \"If `gap` {whitespace}\n // is not the empty string, let `member` {quote(property) + \":\"}\n // be the concatenation of `member` and the `space` character.\"\n // The \"`space` character\" refers to the literal space\n // character, not the `space` {width} argument provided to\n // `JSON.stringify`.\n results.push(quote(property) + \":\" + (whitespace ? \" \" : \"\") + element);\n }\n });\n result = results.length ? (whitespace ? \"{\\n\" + indentation + results.join(\",\\n\" + indentation) + \"\\n\" + prefix + \"}\" : (\"{\" + results.join(\",\") + \"}\")) : \"{}\";\n }\n // Remove the object from the traversed object stack.\n stack.pop();\n return result;\n }\n };\n\n // Public: `JSON.stringify`. See ES 5.1 section 15.12.3.\n exports.stringify = function (source, filter, width) {\n var whitespace, callback, properties, className;\n if (objectTypes[typeof filter] && filter) {\n className = getClass.call(filter);\n if (className == functionClass) {\n callback = filter;\n } else if (className == arrayClass) {\n // Convert the property names array into a makeshift set.\n properties = {};\n for (var index = 0, length = filter.length, value; index < length;) {\n value = filter[index++];\n className = getClass.call(value);\n if (className == \"[object String]\" || className == \"[object Number]\") {\n properties[value] = 1;\n }\n }\n }\n }\n if (width) {\n className = getClass.call(width);\n if (className == numberClass) {\n // Convert the `width` to an integer and create a string containing\n // `width` number of space characters.\n if ((width -= width % 1) > 0) {\n if (width > 10) {\n width = 10;\n }\n for (whitespace = \"\"; whitespace.length < width;) {\n whitespace += \" \";\n }\n }\n } else if (className == stringClass) {\n whitespace = width.length <= 10 ? width : width.slice(0, 10);\n }\n }\n // Opera <= 7.54u2 discards the values associated with empty string keys\n // (`\"\"`) only if they are used directly within an object member list\n // (e.g., `!(\"\" in { \"\": 1})`).\n return serialize(\"\", (value = {}, value[\"\"] = source, value), callback, properties, whitespace, \"\", []);\n };\n }\n }\n\n // Public: Parses a JSON source string.\n if (!has(\"json-parse\")) {\n var fromCharCode = String.fromCharCode;\n\n // Internal: A map of escaped control characters and their unescaped\n // equivalents.\n var Unescapes = {\n 92: \"\\\\\",\n 34: '\"',\n 47: \"/\",\n 98: \"\\b\",\n 116: \"\\t\",\n 110: \"\\n\",\n 102: \"\\f\",\n 114: \"\\r\"\n };\n\n // Internal: Stores the parser state.\n var Index, Source;\n\n // Internal: Resets the parser state and throws a `SyntaxError`.\n var abort = function () {\n Index = Source = null;\n throw SyntaxError();\n };\n\n // Internal: Returns the next token, or `\"$\"` if the parser has reached\n // the end of the source string. A token may be a string, number, `null`\n // literal, or Boolean literal.\n var lex = function () {\n var source = Source, length = source.length, value, begin, position, isSigned, charCode;\n while (Index < length) {\n charCode = source.charCodeAt(Index);\n switch (charCode) {\n case 9: case 10: case 13: case 32:\n // Skip whitespace tokens, including tabs, carriage returns, line\n // feeds, and space characters.\n Index++;\n break;\n case 123: case 125: case 91: case 93: case 58: case 44:\n // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at\n // the current position.\n value = charIndexBuggy ? source.charAt(Index) : source[Index];\n Index++;\n return value;\n case 34:\n // `\"` delimits a JSON string; advance to the next character and\n // begin parsing the string. String tokens are prefixed with the\n // sentinel `@` character to distinguish them from punctuators and\n // end-of-string tokens.\n for (value = \"@\", Index++; Index < length;) {\n charCode = source.charCodeAt(Index);\n if (charCode < 32) {\n // Unescaped ASCII control characters (those with a code unit\n // less than the space character) are not permitted.\n abort();\n } else if (charCode == 92) {\n // A reverse solidus (`\\`) marks the beginning of an escaped\n // control character (including `\"`, `\\`, and `/`) or Unicode\n // escape sequence.\n charCode = source.charCodeAt(++Index);\n switch (charCode) {\n case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114:\n // Revive escaped control characters.\n value += Unescapes[charCode];\n Index++;\n break;\n case 117:\n // `\\u` marks the beginning of a Unicode escape sequence.\n // Advance to the first character and validate the\n // four-digit code point.\n begin = ++Index;\n for (position = Index + 4; Index < position; Index++) {\n charCode = source.charCodeAt(Index);\n // A valid sequence comprises four hexdigits (case-\n // insensitive) that form a single hexadecimal value.\n if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) {\n // Invalid Unicode escape sequence.\n abort();\n }\n }\n // Revive the escaped character.\n value += fromCharCode(\"0x\" + source.slice(begin, Index));\n break;\n default:\n // Invalid escape sequence.\n abort();\n }\n } else {\n if (charCode == 34) {\n // An unescaped double-quote character marks the end of the\n // string.\n break;\n }\n charCode = source.charCodeAt(Index);\n begin = Index;\n // Optimize for the common case where a string is valid.\n while (charCode >= 32 && charCode != 92 && charCode != 34) {\n charCode = source.charCodeAt(++Index);\n }\n // Append the string as-is.\n value += source.slice(begin, Index);\n }\n }\n if (source.charCodeAt(Index) == 34) {\n // Advance to the next character and return the revived string.\n Index++;\n return value;\n }\n // Unterminated string.\n abort();\n default:\n // Parse numbers and literals.\n begin = Index;\n // Advance past the negative sign, if one is specified.\n if (charCode == 45) {\n isSigned = true;\n charCode = source.charCodeAt(++Index);\n }\n // Parse an integer or floating-point value.\n if (charCode >= 48 && charCode <= 57) {\n // Leading zeroes are interpreted as octal literals.\n if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) {\n // Illegal octal literal.\n abort();\n }\n isSigned = false;\n // Parse the integer component.\n for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++);\n // Floats cannot contain a leading decimal point; however, this\n // case is already accounted for by the parser.\n if (source.charCodeAt(Index) == 46) {\n position = ++Index;\n // Parse the decimal component.\n for (; position < length; position++) {\n charCode = source.charCodeAt(position);\n if (charCode < 48 || charCode > 57) {\n break;\n }\n }\n if (position == Index) {\n // Illegal trailing decimal.\n abort();\n }\n Index = position;\n }\n // Parse exponents. The `e` denoting the exponent is\n // case-insensitive.\n charCode = source.charCodeAt(Index);\n if (charCode == 101 || charCode == 69) {\n charCode = source.charCodeAt(++Index);\n // Skip past the sign following the exponent, if one is\n // specified.\n if (charCode == 43 || charCode == 45) {\n Index++;\n }\n // Parse the exponential component.\n for (position = Index; position < length; position++) {\n charCode = source.charCodeAt(position);\n if (charCode < 48 || charCode > 57) {\n break;\n }\n }\n if (position == Index) {\n // Illegal empty exponent.\n abort();\n }\n Index = position;\n }\n // Coerce the parsed value to a JavaScript number.\n return +source.slice(begin, Index);\n }\n // A negative sign may only precede numbers.\n if (isSigned) {\n abort();\n }\n // `true`, `false`, and `null` literals.\n var temp = source.slice(Index, Index + 4);\n if (temp == \"true\") {\n Index += 4;\n return true;\n } else if (temp == \"fals\" && source.charCodeAt(Index + 4 ) == 101) {\n Index += 5;\n return false;\n } else if (temp == \"null\") {\n Index += 4;\n return null;\n }\n // Unrecognized token.\n abort();\n }\n }\n // Return the sentinel `$` character if the parser has reached the end\n // of the source string.\n return \"$\";\n };\n\n // Internal: Parses a JSON `value` token.\n var get = function (value) {\n var results, hasMembers;\n if (value == \"$\") {\n // Unexpected end of input.\n abort();\n }\n if (typeof value == \"string\") {\n if ((charIndexBuggy ? value.charAt(0) : value[0]) == \"@\") {\n // Remove the sentinel `@` character.\n return value.slice(1);\n }\n // Parse object and array literals.\n if (value == \"[\") {\n // Parses a JSON array, returning a new JavaScript array.\n results = [];\n for (;;) {\n value = lex();\n // A closing square bracket marks the end of the array literal.\n if (value == \"]\") {\n break;\n }\n // If the array literal contains elements, the current token\n // should be a comma separating the previous element from the\n // next.\n if (hasMembers) {\n if (value == \",\") {\n value = lex();\n if (value == \"]\") {\n // Unexpected trailing `,` in array literal.\n abort();\n }\n } else {\n // A `,` must separate each array element.\n abort();\n }\n } else {\n hasMembers = true;\n }\n // Elisions and leading commas are not permitted.\n if (value == \",\") {\n abort();\n }\n results.push(get(value));\n }\n return results;\n } else if (value == \"{\") {\n // Parses a JSON object, returning a new JavaScript object.\n results = {};\n for (;;) {\n value = lex();\n // A closing curly brace marks the end of the object literal.\n if (value == \"}\") {\n break;\n }\n // If the object literal contains members, the current token\n // should be a comma separator.\n if (hasMembers) {\n if (value == \",\") {\n value = lex();\n if (value == \"}\") {\n // Unexpected trailing `,` in object literal.\n abort();\n }\n } else {\n // A `,` must separate each object member.\n abort();\n }\n } else {\n hasMembers = true;\n }\n // Leading commas are not permitted, object property names must be\n // double-quoted strings, and a `:` must separate each property\n // name and value.\n if (value == \",\" || typeof value != \"string\" || (charIndexBuggy ? value.charAt(0) : value[0]) != \"@\" || lex() != \":\") {\n abort();\n }\n results[value.slice(1)] = get(lex());\n }\n return results;\n }\n // Unexpected token encountered.\n abort();\n }\n return value;\n };\n\n // Internal: Updates a traversed object member.\n var update = function (source, property, callback) {\n var element = walk(source, property, callback);\n if (element === undefined) {\n delete source[property];\n } else {\n source[property] = element;\n }\n };\n\n // Internal: Recursively traverses a parsed JSON object, invoking the\n // `callback` function for each value. This is an implementation of the\n // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2.\n var walk = function (source, property, callback) {\n var value = source[property], length;\n if (typeof value == \"object\" && value) {\n // `forOwn` can't be used to traverse an array in Opera <= 8.54\n // because its `Object#hasOwnProperty` implementation returns `false`\n // for array indices (e.g., `![1, 2, 3].hasOwnProperty(\"0\")`).\n if (getClass.call(value) == arrayClass) {\n for (length = value.length; length--;) {\n update(getClass, forOwn, value, length, callback);\n }\n } else {\n forOwn(value, function (property) {\n update(value, property, callback);\n });\n }\n }\n return callback.call(source, property, value);\n };\n\n // Public: `JSON.parse`. See ES 5.1 section 15.12.2.\n exports.parse = function (source, callback) {\n var result, value;\n Index = 0;\n Source = \"\" + source;\n result = get(lex());\n // If a JSON string contains multiple tokens, it is invalid.\n if (lex() != \"$\") {\n abort();\n }\n // Reset the parser state.\n Index = Source = null;\n return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[\"\"] = result, value), \"\", callback) : result;\n };\n }\n }\n\n exports.runInContext = runInContext;\n return exports;\n }\n\n if (freeExports && !isLoader) {\n // Export for CommonJS environments.\n runInContext(root, freeExports);\n } else {\n // Export for web browsers and JavaScript engines.\n var nativeJSON = root.JSON,\n previousJSON = root.JSON3,\n isRestored = false;\n\n var JSON3 = runInContext(root, (root.JSON3 = {\n // Public: Restores the original value of the global `JSON` object and\n // returns a reference to the `JSON3` object.\n \"noConflict\": function () {\n if (!isRestored) {\n isRestored = true;\n root.JSON = nativeJSON;\n root.JSON3 = previousJSON;\n nativeJSON = previousJSON = null;\n }\n return JSON3;\n }\n }));\n\n root.JSON = {\n \"parse\": JSON3.parse,\n \"stringify\": JSON3.stringify\n };\n }\n\n // Export for asynchronous module loaders.\n if (isLoader) {\n define(function () {\n return JSON3;\n });\n }\n}).call(this);\n","\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = debug;\nexports.coerce = coerce;\nexports.disable = disable;\nexports.enable = enable;\nexports.enabled = enabled;\nexports.humanize = require('ms');\n\n/**\n * The currently active debug mode names, and names to skip.\n */\n\nexports.names = [];\nexports.skips = [];\n\n/**\n * Map of special \"%n\" handling functions, for the debug \"format\" argument.\n *\n * Valid key names are a single, lowercased letter, i.e. \"n\".\n */\n\nexports.formatters = {};\n\n/**\n * Previously assigned color.\n */\n\nvar prevColor = 0;\n\n/**\n * Previous log timestamp.\n */\n\nvar prevTime;\n\n/**\n * Select a color.\n *\n * @return {Number}\n * @api private\n */\n\nfunction selectColor() {\n return exports.colors[prevColor++ % exports.colors.length];\n}\n\n/**\n * Create a debugger with the given `namespace`.\n *\n * @param {String} namespace\n * @return {Function}\n * @api public\n */\n\nfunction debug(namespace) {\n\n // define the `disabled` version\n function disabled() {\n }\n disabled.enabled = false;\n\n // define the `enabled` version\n function enabled() {\n\n var self = enabled;\n\n // set `diff` timestamp\n var curr = +new Date();\n var ms = curr - (prevTime || curr);\n self.diff = ms;\n self.prev = prevTime;\n self.curr = curr;\n prevTime = curr;\n\n // add the `color` if not set\n if (null == self.useColors) self.useColors = exports.useColors();\n if (null == self.color && self.useColors) self.color = selectColor();\n\n var args = Array.prototype.slice.call(arguments);\n\n args[0] = exports.coerce(args[0]);\n\n if ('string' !== typeof args[0]) {\n // anything else let's inspect with %o\n args = ['%o'].concat(args);\n }\n\n // apply any `formatters` transformations\n var index = 0;\n args[0] = args[0].replace(/%([a-z%])/g, function(match, format) {\n // if we encounter an escaped % then don't increase the array index\n if (match === '%%') return match;\n index++;\n var formatter = exports.formatters[format];\n if ('function' === typeof formatter) {\n var val = args[index];\n match = formatter.call(self, val);\n\n // now we need to remove `args[index]` since it's inlined in the `format`\n args.splice(index, 1);\n index--;\n }\n return match;\n });\n\n if ('function' === typeof exports.formatArgs) {\n args = exports.formatArgs.apply(self, args);\n }\n var logFn = enabled.log || exports.log || console.log.bind(console);\n logFn.apply(self, args);\n }\n enabled.enabled = true;\n\n var fn = exports.enabled(namespace) ? enabled : disabled;\n\n fn.namespace = namespace;\n\n return fn;\n}\n\n/**\n * Enables a debug mode by namespaces. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} namespaces\n * @api public\n */\n\nfunction enable(namespaces) {\n exports.save(namespaces);\n\n var split = (namespaces || '').split(/[\\s,]+/);\n var len = split.length;\n\n for (var i = 0; i < len; i++) {\n if (!split[i]) continue; // ignore empty strings\n namespaces = split[i].replace(/\\*/g, '.*?');\n if (namespaces[0] === '-') {\n exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$'));\n } else {\n exports.names.push(new RegExp('^' + namespaces + '$'));\n }\n }\n}\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\nfunction disable() {\n exports.enable('');\n}\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\nfunction enabled(name) {\n var i, len;\n for (i = 0, len = exports.skips.length; i < len; i++) {\n if (exports.skips[i].test(name)) {\n return false;\n }\n }\n for (i = 0, len = exports.names.length; i < len; i++) {\n if (exports.names[i].test(name)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Coerce `val`.\n *\n * @param {Mixed} val\n * @return {Mixed}\n * @api private\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n","\n/**\n * This is the web browser implementation of `debug()`.\n *\n * Expose `debug()` as the module.\n */\n\nexports = module.exports = require('./debug');\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = 'undefined' != typeof chrome\n && 'undefined' != typeof chrome.storage\n ? chrome.storage.local\n : localstorage();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n 'lightseagreen',\n 'forestgreen',\n 'goldenrod',\n 'dodgerblue',\n 'darkorchid',\n 'crimson'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\nfunction useColors() {\n // is webkit? http://stackoverflow.com/a/16459606/376773\n return ('WebkitAppearance' in document.documentElement.style) ||\n // is firebug? http://stackoverflow.com/a/398120/376773\n (window.console && (console.firebug || (console.exception && console.table))) ||\n // is firefox >= v31?\n // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n (navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/) && parseInt(RegExp.$1, 10) >= 31);\n}\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nexports.formatters.j = function(v) {\n return JSON.stringify(v);\n};\n\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs() {\n var args = arguments;\n var useColors = this.useColors;\n\n args[0] = (useColors ? '%c' : '')\n + this.namespace\n + (useColors ? ' %c' : ' ')\n + args[0]\n + (useColors ? '%c ' : ' ')\n + '+' + exports.humanize(this.diff);\n\n if (!useColors) return args;\n\n var c = 'color: ' + this.color;\n args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1));\n\n // the final \"%c\" is somewhat tricky, because there could be other\n // arguments passed either before or after the %c, so we need to\n // figure out the correct index to insert the CSS into\n var index = 0;\n var lastC = 0;\n args[0].replace(/%[a-z%]/g, function(match) {\n if ('%%' === match) return;\n index++;\n if ('%c' === match) {\n // we only are interested in the *last* %c\n // (the user may have provided their own)\n lastC = index;\n }\n });\n\n args.splice(lastC, 0, c);\n return args;\n}\n\n/**\n * Invokes `console.log()` when available.\n * No-op when `console.log` is not a \"function\".\n *\n * @api public\n */\n\nfunction log() {\n // this hackery is required for IE8/9, where\n // the `console.log` function doesn't have 'apply'\n return 'object' === typeof console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\n\nfunction save(namespaces) {\n try {\n if (null == namespaces) {\n exports.storage.removeItem('debug');\n } else {\n exports.storage.debug = namespaces;\n }\n } catch(e) {}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n var r;\n try {\n r = exports.storage.debug;\n } catch(e) {}\n return r;\n}\n\n/**\n * Enable namespaces listed in `localStorage.debug` initially.\n */\n\nexports.enable(load());\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage(){\n try {\n return window.localStorage;\n } catch (e) {}\n}\n","\n/**\n * Module dependencies.\n */\n\nvar debug = require('debug')('cookie');\n\n/**\n * Set or get cookie `name` with `value` and `options` object.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @return {Mixed}\n * @api public\n */\n\nmodule.exports = function(name, value, options){\n switch (arguments.length) {\n case 3:\n case 2:\n return set(name, value, options);\n case 1:\n return get(name);\n default:\n return all();\n }\n};\n\n/**\n * Set cookie `name` to `value`.\n *\n * @param {String} name\n * @param {String} value\n * @param {Object} options\n * @api private\n */\n\nfunction set(name, value, options) {\n options = options || {};\n var str = encode(name) + '=' + encode(value);\n\n if (null == value) options.maxage = -1;\n\n if (options.maxage) {\n options.expires = new Date(+new Date + options.maxage);\n }\n\n if (options.path) str += '; path=' + options.path;\n if (options.domain) str += '; domain=' + options.domain;\n if (options.expires) str += '; expires=' + options.expires.toUTCString();\n if (options.secure) str += '; secure';\n\n document.cookie = str;\n}\n\n/**\n * Return all cookies.\n *\n * @return {Object}\n * @api private\n */\n\nfunction all() {\n var str;\n try {\n str = document.cookie;\n } catch (err) {\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(err.stack || err);\n }\n return {};\n }\n return parse(str);\n}\n\n/**\n * Get cookie `name`.\n *\n * @param {String} name\n * @return {String}\n * @api private\n */\n\nfunction get(name) {\n return all()[name];\n}\n\n/**\n * Parse cookie `str`.\n *\n * @param {String} str\n * @return {Object}\n * @api private\n */\n\nfunction parse(str) {\n var obj = {};\n var pairs = str.split(/ *; */);\n var pair;\n if ('' == pairs[0]) return obj;\n for (var i = 0; i < pairs.length; ++i) {\n pair = pairs[i].split('=');\n obj[decode(pair[0])] = decode(pair[1]);\n }\n return obj;\n}\n\n/**\n * Encode.\n */\n\nfunction encode(value){\n try {\n return encodeURIComponent(value);\n } catch (e) {\n debug('error `encode(%o)` - %o', value, e)\n }\n}\n\n/**\n * Decode.\n */\n\nfunction decode(value) {\n try {\n return decodeURIComponent(value);\n } catch (e) {\n debug('error `decode(%o)` - %o', value, e)\n }\n}\n","'use strict';\n\n/**\n * Module dependencies.\n */\n\nvar parse = require('component-url').parse;\nvar cookie = require('component-cookie');\n\n/**\n * Get the top domain.\n *\n * The function constructs the levels of domain and attempts to set a global\n * cookie on each one when it succeeds it returns the top level domain.\n *\n * The method returns an empty string when the hostname is an ip or `localhost`.\n *\n * Example levels:\n *\n * domain.levels('http://www.google.co.uk');\n * // => [\"co.uk\", \"google.co.uk\", \"www.google.co.uk\"]\n *\n * Example:\n *\n * domain('http://localhost:3000/baz');\n * // => ''\n * domain('http://dev:3000/baz');\n * // => ''\n * domain('http://127.0.0.1:3000/baz');\n * // => ''\n * domain('http://segment.io/baz');\n * // => 'segment.io'\n *\n * @param {string} url\n * @return {string}\n * @api public\n */\nfunction domain(url) {\n var cookie = exports.cookie;\n var levels = exports.levels(url);\n\n // Lookup the real top level one.\n for (var i = 0; i < levels.length; ++i) {\n var cname = '__tld__';\n var domain = levels[i];\n var opts = { domain: '.' + domain };\n\n cookie(cname, 1, opts);\n if (cookie(cname)) {\n cookie(cname, null, opts);\n return domain;\n }\n }\n\n return '';\n}\n\n/**\n * Levels returns all levels of the given url.\n *\n * @param {string} url\n * @return {Array}\n * @api public\n */\ndomain.levels = function(url) {\n var host = parse(url).hostname;\n var parts = host.split('.');\n var last = parts[parts.length - 1];\n var levels = [];\n\n // Ip address.\n if (parts.length === 4 && last === parseInt(last, 10)) {\n return levels;\n }\n\n // Localhost.\n if (parts.length <= 1) {\n return levels;\n }\n\n // Create levels.\n for (var i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join('.'));\n }\n\n return levels;\n};\n\n/**\n * Expose cookie on domain.\n */\ndomain.cookie = cookie;\n\n/*\n * Exports.\n */\n\nexports = module.exports = domain;\n","import clone from \"@ndhoule/clone\";\nimport cookie from \"rudder-component-cookie\";\nimport defaults from \"@ndhoule/defaults\";\nimport json from \"json3\";\nimport topDomain from \"@segment/top-domain\";\nimport logger from \"../logUtil\";\n\n/**\n * An object utility to persist values in cookies\n */\nclass CookieLocal {\n constructor(options) {\n this._options = {};\n this.options(options);\n }\n\n /**\n *\n * @param {*} options\n */\n options(options = {}) {\n if (arguments.length === 0) return this._options;\n\n let domain = `.${topDomain(window.location.href)}`;\n if (domain === \".\") domain = null;\n\n // the default maxage and path\n this._options = defaults(options, {\n maxage: 31536000000,\n path: \"/\",\n domain,\n samesite: \"Lax\",\n });\n\n // try setting a cookie first\n this.set(\"test_rudder\", true);\n if (!this.get(\"test_rudder\")) {\n this._options.domain = null;\n }\n this.remove(\"test_rudder\");\n }\n\n /**\n *\n * @param {*} key\n * @param {*} value\n */\n set(key, value) {\n try {\n cookie(key, value, clone(this._options));\n return true;\n } catch (e) {\n logger.error(e);\n return false;\n }\n }\n\n /**\n *\n * @param {*} key\n */\n get(key) {\n return cookie(key);\n }\n\n /**\n *\n * @param {*} key\n */\n remove(key) {\n try {\n cookie(key, null, clone(this._options));\n return true;\n } catch (e) {\n return false;\n }\n }\n}\n\n// Exporting only the instance\nconst Cookie = new CookieLocal({});\n\nexport { Cookie };\n","\"use strict\"\n\nvar JSON = require('json3');\n\nmodule.exports = (function() {\n\t// Store.js\n\tvar store = {},\n\t\twin = (typeof window != 'undefined' ? window : global),\n\t\tdoc = win.document,\n\t\tlocalStorageName = 'localStorage',\n\t\tscriptTag = 'script',\n\t\tstorage\n\n\tstore.disabled = false\n\tstore.version = '1.3.20'\n\tstore.set = function(key, value) {}\n\tstore.get = function(key, defaultVal) {}\n\tstore.has = function(key) { return store.get(key) !== undefined }\n\tstore.remove = function(key) {}\n\tstore.clear = function() {}\n\tstore.transact = function(key, defaultVal, transactionFn) {\n\t\tif (transactionFn == null) {\n\t\t\ttransactionFn = defaultVal\n\t\t\tdefaultVal = null\n\t\t}\n\t\tif (defaultVal == null) {\n\t\t\tdefaultVal = {}\n\t\t}\n\t\tvar val = store.get(key, defaultVal)\n\t\ttransactionFn(val)\n\t\tstore.set(key, val)\n\t}\n\tstore.getAll = function() {\n\t\tvar ret = {}\n\t\tstore.forEach(function(key, val) {\n\t\t\tret[key] = val\n\t\t})\n\t\treturn ret\n\t}\n\tstore.forEach = function() {}\n\tstore.serialize = function(value) {\n\t\treturn JSON.stringify(value)\n\t}\n\tstore.deserialize = function(value) {\n\t\tif (typeof value != 'string') { return undefined }\n\t\ttry { return JSON.parse(value) }\n\t\tcatch(e) { return value || undefined }\n\t}\n\n\t// Functions to encapsulate questionable FireFox 3.6.13 behavior\n\t// when about.config::dom.storage.enabled === false\n\t// See https://github.com/marcuswestin/store.js/issues#issue/13\n\tfunction isLocalStorageNameSupported() {\n\t\ttry { return (localStorageName in win && win[localStorageName]) }\n\t\tcatch(err) { return false }\n\t}\n\n\tif (isLocalStorageNameSupported()) {\n\t\tstorage = win[localStorageName]\n\t\tstore.set = function(key, val) {\n\t\t\tif (val === undefined) { return store.remove(key) }\n\t\t\tstorage.setItem(key, store.serialize(val))\n\t\t\treturn val\n\t\t}\n\t\tstore.get = function(key, defaultVal) {\n\t\t\tvar val = store.deserialize(storage.getItem(key))\n\t\t\treturn (val === undefined ? defaultVal : val)\n\t\t}\n\t\tstore.remove = function(key) { storage.removeItem(key) }\n\t\tstore.clear = function() { storage.clear() }\n\t\tstore.forEach = function(callback) {\n\t\t\tfor (var i=0; idocument.w=window')\n\t\t\tstorageContainer.close()\n\t\t\tstorageOwner = storageContainer.w.frames[0].document\n\t\t\tstorage = storageOwner.createElement('div')\n\t\t} catch(e) {\n\t\t\t// somehow ActiveXObject instantiation failed (perhaps some special\n\t\t\t// security settings or otherwse), fall back to per-path storage\n\t\t\tstorage = doc.createElement('div')\n\t\t\tstorageOwner = doc.body\n\t\t}\n\t\tvar withIEStorage = function(storeFunction) {\n\t\t\treturn function() {\n\t\t\t\tvar args = Array.prototype.slice.call(arguments, 0)\n\t\t\t\targs.unshift(storage)\n\t\t\t\t// See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx\n\t\t\t\t// and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx\n\t\t\t\tstorageOwner.appendChild(storage)\n\t\t\t\tstorage.addBehavior('#default#userData')\n\t\t\t\tstorage.load(localStorageName)\n\t\t\t\tvar result = storeFunction.apply(store, args)\n\t\t\t\tstorageOwner.removeChild(storage)\n\t\t\t\treturn result\n\t\t\t}\n\t\t}\n\n\t\t// In IE7, keys cannot start with a digit or contain certain chars.\n\t\t// See https://github.com/marcuswestin/store.js/issues/40\n\t\t// See https://github.com/marcuswestin/store.js/issues/83\n\t\tvar forbiddenCharsRegex = new RegExp(\"[!\\\"#$%&'()*+,/\\\\\\\\:;<=>?@[\\\\]^`{|}~]\", \"g\")\n\t\tvar ieKeyFix = function(key) {\n\t\t\treturn key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___')\n\t\t}\n\t\tstore.set = withIEStorage(function(storage, key, val) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tif (val === undefined) { return store.remove(key) }\n\t\t\tstorage.setAttribute(key, store.serialize(val))\n\t\t\tstorage.save(localStorageName)\n\t\t\treturn val\n\t\t})\n\t\tstore.get = withIEStorage(function(storage, key, defaultVal) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tvar val = store.deserialize(storage.getAttribute(key))\n\t\t\treturn (val === undefined ? defaultVal : val)\n\t\t})\n\t\tstore.remove = withIEStorage(function(storage, key) {\n\t\t\tkey = ieKeyFix(key)\n\t\t\tstorage.removeAttribute(key)\n\t\t\tstorage.save(localStorageName)\n\t\t})\n\t\tstore.clear = withIEStorage(function(storage) {\n\t\t\tvar attributes = storage.XMLDocument.documentElement.attributes\n\t\t\tstorage.load(localStorageName)\n\t\t\tfor (var i=attributes.length-1; i>=0; i--) {\n\t\t\t\tstorage.removeAttribute(attributes[i].name)\n\t\t\t}\n\t\t\tstorage.save(localStorageName)\n\t\t})\n\t\tstore.forEach = withIEStorage(function(storage, callback) {\n\t\t\tvar attributes = storage.XMLDocument.documentElement.attributes\n\t\t\tfor (var i=0, attr; attr=attributes[i]; ++i) {\n\t\t\t\tcallback(attr.name, store.deserialize(storage.getAttribute(attr.name)))\n\t\t\t}\n\t\t})\n\t}\n\n\ttry {\n\t\tvar testKey = '__storejs__'\n\t\tstore.set(testKey, testKey)\n\t\tif (store.get(testKey) != testKey) { store.disabled = true }\n\t\tstore.remove(testKey)\n\t} catch(e) {\n\t\tstore.disabled = true\n\t}\n\tstore.enabled = !store.disabled\n\t\n\treturn store\n}())\n","import defaults from \"@ndhoule/defaults\";\nimport store from \"@segment/store\";\n\n/**\n * An object utility to persist user and other values in localstorage\n */\nclass StoreLocal {\n constructor(options) {\n this._options = {};\n this.enabled = false;\n this.options(options);\n }\n\n /**\n *\n * @param {*} options\n */\n options(options = {}) {\n if (arguments.length === 0) return this._options;\n\n defaults(options, { enabled: true });\n\n this.enabled = options.enabled && store.enabled;\n this._options = options;\n }\n\n /**\n *\n * @param {*} key\n * @param {*} value\n */\n set(key, value) {\n if (!this.enabled) return false;\n return store.set(key, value);\n }\n\n /**\n *\n * @param {*} key\n */\n get(key) {\n if (!this.enabled) return null;\n return store.get(key);\n }\n\n /**\n *\n * @param {*} key\n */\n remove(key) {\n if (!this.enabled) return false;\n return store.remove(key);\n }\n}\n\n// Exporting only the instance\nconst Store = new StoreLocal({});\n\nexport { Store };\n","import AES from \"crypto-js/aes\";\nimport Utf8 from \"crypto-js/enc-utf8\";\nimport logger from \"../logUtil\";\nimport { Cookie } from \"./cookie\";\nimport { Store } from \"./store\";\n\nconst defaults = {\n user_storage_key: \"rl_user_id\",\n user_storage_trait: \"rl_trait\",\n user_storage_anonymousId: \"rl_anonymous_id\",\n group_storage_key: \"rl_group_id\",\n group_storage_trait: \"rl_group_trait\",\n prefix: \"RudderEncrypt:\",\n key: \"Rudder\",\n};\n\n/**\n * An object that handles persisting key-val from Analytics\n */\nclass Storage {\n constructor() {\n // First try setting the storage to cookie else to localstorage\n Cookie.set(\"rudder_cookies\", true);\n\n if (Cookie.get(\"rudder_cookies\")) {\n Cookie.remove(\"rudder_cookies\");\n this.storage = Cookie;\n return;\n }\n\n // localStorage is enabled.\n if (Store.enabled) {\n this.storage = Store;\n }\n }\n\n /**\n * Json stringify the given value\n * @param {*} value\n */\n stringify(value) {\n return JSON.stringify(value);\n }\n\n /**\n * JSON parse the value\n * @param {*} value\n */\n parse(value) {\n // if not parseable, return as is without json parse\n try {\n return value ? JSON.parse(value) : null;\n } catch (e) {\n logger.error(e);\n return value || null;\n }\n }\n\n /**\n * trim using regex for browser polyfill\n * @param {*} value\n */\n trim(value) {\n return value.replace(/^\\s+|\\s+$/gm, \"\");\n }\n\n /**\n * AES encrypt value with constant prefix\n * @param {*} value\n */\n encryptValue(value) {\n if (this.trim(value) == \"\") {\n return value;\n }\n const prefixedVal = `${defaults.prefix}${AES.encrypt(\n value,\n defaults.key\n ).toString()}`;\n\n return prefixedVal;\n }\n\n /**\n * decrypt value\n * @param {*} value\n */\n decryptValue(value) {\n if (!value || (typeof value === \"string\" && this.trim(value) == \"\")) {\n return value;\n }\n if (value.substring(0, defaults.prefix.length) == defaults.prefix) {\n return AES.decrypt(\n value.substring(defaults.prefix.length),\n defaults.key\n ).toString(Utf8);\n }\n return value;\n }\n\n /**\n *\n * @param {*} key\n * @param {*} value\n */\n setItem(key, value) {\n this.storage.set(key, this.encryptValue(this.stringify(value)));\n }\n\n /**\n *\n * @param {*} value\n */\n setUserId(value) {\n if (typeof value !== \"string\") {\n logger.error(\"[Storage] setUserId:: userId should be string\");\n return;\n }\n this.storage.set(\n defaults.user_storage_key,\n this.encryptValue(this.stringify(value))\n );\n }\n\n /**\n *\n * @param {*} value\n */\n setUserTraits(value) {\n this.storage.set(\n defaults.user_storage_trait,\n this.encryptValue(this.stringify(value))\n );\n }\n\n /**\n *\n * @param {*} value\n */\n setGroupId(value) {\n if (typeof value !== \"string\") {\n logger.error(\"[Storage] setGroupId:: groupId should be string\");\n return;\n }\n this.storage.set(\n defaults.group_storage_key,\n this.encryptValue(this.stringify(value))\n );\n }\n\n /**\n *\n * @param {*} value\n */\n setGroupTraits(value) {\n this.storage.set(\n defaults.group_storage_trait,\n this.encryptValue(this.stringify(value))\n );\n }\n\n /**\n *\n * @param {*} value\n */\n setAnonymousId(value) {\n if (typeof value !== \"string\") {\n logger.error(\"[Storage] setAnonymousId:: anonymousId should be string\");\n return;\n }\n this.storage.set(\n defaults.user_storage_anonymousId,\n this.encryptValue(this.stringify(value))\n );\n }\n\n /**\n *\n * @param {*} key\n */\n getItem(key) {\n return this.parse(this.decryptValue(this.storage.get(key)));\n }\n\n /**\n * get the stored userId\n */\n getUserId() {\n return this.parse(\n this.decryptValue(this.storage.get(defaults.user_storage_key))\n );\n }\n\n /**\n * get the stored user traits\n */\n getUserTraits() {\n return this.parse(\n this.decryptValue(this.storage.get(defaults.user_storage_trait))\n );\n }\n\n /**\n * get the stored userId\n */\n getGroupId() {\n return this.parse(\n this.decryptValue(this.storage.get(defaults.group_storage_key))\n );\n }\n\n /**\n * get the stored user traits\n */\n getGroupTraits() {\n return this.parse(\n this.decryptValue(this.storage.get(defaults.group_storage_trait))\n );\n }\n\n /**\n * get stored anonymous id\n */\n getAnonymousId() {\n return this.parse(\n this.decryptValue(this.storage.get(defaults.user_storage_anonymousId))\n );\n }\n\n /**\n *\n * @param {*} key\n */\n removeItem(key) {\n return this.storage.remove(key);\n }\n\n /**\n * remove stored keys\n */\n clear() {\n this.storage.remove(defaults.user_storage_key);\n this.storage.remove(defaults.user_storage_trait);\n this.storage.remove(defaults.group_storage_key);\n this.storage.remove(defaults.group_storage_trait);\n // this.storage.remove(defaults.user_storage_anonymousId);\n }\n}\n\nexport { Storage };\n","import { Storage } from \"./storage\";\n\nexport default new Storage();\n","import logger from \"../../utils/logUtil\";\nimport Storage from \"../../utils/storage\";\n\nconst defaults = {\n lotame_synch_time_key: \"lt_synch_timestamp\",\n};\n\nclass LotameStorage {\n constructor() {\n this.storage = Storage; // new Storage();\n }\n\n setLotameSynchTime(value) {\n this.storage.setItem(defaults.lotame_synch_time_key, value);\n }\n\n getLotameSynchTime() {\n return this.storage.getItem(defaults.lotame_synch_time_key);\n }\n}\nconst lotameStorage = new LotameStorage();\nexport { lotameStorage as LotameStorage };\n","import logger from \"../../utils/logUtil\";\nimport { LotameStorage } from \"./LotameStorage\";\n\nclass Lotame {\n constructor(config, analytics) {\n this.name = \"LOTAME\";\n this.analytics = analytics;\n this.storage = LotameStorage;\n this.bcpUrlSettingsPixel = config.bcpUrlSettingsPixel;\n this.bcpUrlSettingsIframe = config.bcpUrlSettingsIframe;\n this.dspUrlSettingsPixel = config.dspUrlSettingsPixel;\n this.dspUrlSettingsIframe = config.dspUrlSettingsIframe;\n this.mappings = {};\n config.mappings.forEach((mapping) => {\n const { key } = mapping;\n const { value } = mapping;\n this.mappings[key] = value;\n });\n }\n\n init() {\n logger.debug(\"===in init Lotame===\");\n window.LOTAME_SYNCH_CALLBACK = () => {};\n }\n\n addPixel(source, width, height) {\n logger.debug(`Adding pixel for :: ${source}`);\n\n const image = document.createElement(\"img\");\n image.src = source;\n image.setAttribute(\"width\", width);\n image.setAttribute(\"height\", height);\n\n logger.debug(`Image Pixel :: ${image}`);\n document.getElementsByTagName(\"body\")[0].appendChild(image);\n }\n\n addIFrame(source) {\n logger.debug(`Adding iframe for :: ${source}`);\n\n const iframe = document.createElement(\"iframe\");\n iframe.src = source;\n iframe.title = \"empty\";\n iframe.setAttribute(\"id\", \"LOTCCFrame\");\n iframe.setAttribute(\"tabindex\", \"-1\");\n iframe.setAttribute(\"role\", \"presentation\");\n iframe.setAttribute(\"aria-hidden\", \"true\");\n iframe.setAttribute(\n \"style\",\n \"border: 0px; width: 0px; height: 0px; display: block;\"\n );\n\n logger.debug(`IFrame :: ${iframe}`);\n document.getElementsByTagName(\"body\")[0].appendChild(iframe);\n }\n\n syncPixel(userId) {\n logger.debug(\"===== in syncPixel ======\");\n\n logger.debug(\"Firing DSP Pixel URLs\");\n if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) {\n const currentTime = Date.now();\n this.dspUrlSettingsPixel.forEach((urlSettings) => {\n const dspUrl = this.compileUrl(\n { ...this.mappings, userId, random: currentTime },\n urlSettings.dspUrlTemplate\n );\n this.addPixel(dspUrl, \"1\", \"1\");\n });\n }\n\n logger.debug(\"Firing DSP IFrame URLs\");\n if (this.dspUrlSettingsIframe && this.dspUrlSettingsIframe.length > 0) {\n const currentTime = Date.now();\n this.dspUrlSettingsIframe.forEach((urlSettings) => {\n const dspUrl = this.compileUrl(\n { ...this.mappings, userId, random: currentTime },\n urlSettings.dspUrlTemplate\n );\n this.addIFrame(dspUrl);\n });\n }\n\n this.storage.setLotameSynchTime(Date.now());\n // emit on syncPixel\n if (this.analytics.methodToCallbackMapping.syncPixel) {\n this.analytics.emit(\"syncPixel\", {\n destination: this.name,\n });\n }\n }\n\n compileUrl(map, url) {\n Object.keys(map).forEach((key) => {\n if (map.hasOwnProperty(key)) {\n const replaceKey = `{{${key}}}`;\n const regex = new RegExp(replaceKey, \"gi\");\n url = url.replace(regex, map[key]);\n }\n });\n return url;\n }\n\n identify(rudderElement) {\n logger.debug(\"in Lotame identify\");\n const { userId } = rudderElement.message;\n this.syncPixel(userId);\n }\n\n track(rudderElement) {\n logger.debug(\"track not supported for lotame\");\n }\n\n page(rudderElement) {\n logger.debug(\"in Lotame page\");\n\n logger.debug(\"Firing BCP Pixel URLs\");\n if (this.bcpUrlSettingsPixel && this.bcpUrlSettingsPixel.length > 0) {\n const currentTime = Date.now();\n this.bcpUrlSettingsPixel.forEach((urlSettings) => {\n const bcpUrl = this.compileUrl(\n { ...this.mappings, random: currentTime },\n urlSettings.bcpUrlTemplate\n );\n this.addPixel(bcpUrl, \"1\", \"1\");\n });\n }\n\n logger.debug(\"Firing BCP IFrame URLs\");\n if (this.bcpUrlSettingsIframe && this.bcpUrlSettingsIframe.length > 0) {\n const currentTime = Date.now();\n this.bcpUrlSettingsIframe.forEach((urlSettings) => {\n const bcpUrl = this.compileUrl(\n { ...this.mappings, random: currentTime },\n urlSettings.bcpUrlTemplate\n );\n this.addIFrame(bcpUrl);\n });\n }\n\n if (rudderElement.message.userId && this.isPixelToBeSynched()) {\n this.syncPixel(rudderElement.message.userId);\n }\n }\n\n isPixelToBeSynched() {\n const lastSynchedTime = this.storage.getLotameSynchTime();\n const currentTime = Date.now();\n if (!lastSynchedTime) {\n return true;\n }\n\n const difference = Math.floor(\n (currentTime - lastSynchedTime) / (1000 * 3600 * 24)\n );\n return difference >= 7;\n }\n\n isLoaded() {\n logger.debug(\"in Lotame isLoaded\");\n return true;\n }\n\n isReady() {\n return true;\n }\n}\n\nexport { Lotame };\n","/* eslint-disable no-param-reassign */\n/* eslint-disable class-methods-use-this */\nimport logger from \"../../utils/logUtil\";\n\nclass Optimizely {\n constructor(config, analytics) {\n this.analytics = analytics;\n this.sendExperimentTrack = config.sendExperimentTrack;\n this.sendExperimentIdentify = config.sendExperimentIdentify;\n this.sendExperimentTrackAsNonInteractive =\n config.sendExperimentTrackAsNonInteractive;\n this.revenueOnlyOnOrderCompleted = config.revenueOnlyOnOrderCompleted;\n this.trackCategorizedPages = config.trackCategorizedPages;\n this.trackNamedPages = config.trackNamedPages;\n this.customCampaignProperties = config.customCampaignProperties\n ? config.customCampaignProperties\n : [];\n this.customExperimentProperties = config.customExperimentProperties\n ? config.customExperimentProperties\n : [];\n this.name = \"OPTIMIZELY\";\n }\n\n init() {\n logger.debug(\"=== in optimizely init ===\");\n this.initOptimizelyIntegration(\n this.referrerOverride,\n this.sendDataToRudder\n );\n }\n\n referrerOverride = (referrer) => {\n if (referrer) {\n window.optimizelyEffectiveReferrer = referrer;\n return referrer;\n }\n return undefined;\n };\n\n sendDataToRudder = (campaignState) => {\n logger.debug(campaignState);\n const { experiment } = campaignState;\n const { variation } = campaignState;\n const context = { integrations: { All: true } };\n const { audiences } = campaignState;\n\n // Reformatting this data structure into hash map so concatenating variation ids and names is easier later\n const audiencesMap = {};\n audiences.forEach((audience) => {\n audiencesMap[audience.id] = audience.name;\n });\n\n const audienceIds = Object.keys(audiencesMap).sort().join();\n const audienceNames = Object.values(audiencesMap).sort().join(\", \");\n\n if (this.sendExperimentTrack) {\n const props = {\n campaignName: campaignState.campaignName,\n campaignId: campaignState.id,\n experimentId: experiment.id,\n experimentName: experiment.name,\n variationName: variation.name,\n variationId: variation.id,\n audienceId: audienceIds, // eg. '7527562222,7527111138'\n audienceName: audienceNames, // eg. 'Peaky Blinders, Trust Tree'\n isInCampaignHoldback: campaignState.isInCampaignHoldback,\n };\n\n // If this was a redirect experiment and the effective referrer is different from document.referrer,\n // this value is made available. So if a customer came in via google.com/ad -> tb12.com -> redirect experiment -> Belichickgoat.com\n // `experiment.referrer` would be google.com/ad here NOT `tb12.com`.\n if (experiment.referrer) {\n props.referrer = experiment.referrer;\n context.page = { referrer: experiment.referrer };\n }\n\n // For Google's nonInteraction flag\n if (this.sendExperimentTrackAsNonInteractive) props.nonInteraction = 1;\n\n // If customCampaignProperties is provided overide the props with it.\n // If valid customCampaignProperties present it will override existing props.\n // const data = window.optimizely && window.optimizely.get(\"data\");\n const data = campaignState;\n if (data && this.customCampaignProperties.length > 0) {\n for (\n let index = 0;\n index < this.customCampaignProperties.length;\n index += 1\n ) {\n const rudderProp = this.customCampaignProperties[index].from;\n const optimizelyProp = this.customCampaignProperties[index].to;\n if (typeof props[optimizelyProp] !== \"undefined\") {\n props[rudderProp] = props[optimizelyProp];\n delete props[optimizelyProp];\n }\n }\n }\n\n // Send to Rudder\n this.analytics.track(\"Experiment Viewed\", props, context);\n }\n if (this.sendExperimentIdentify) {\n const traits = {};\n traits[`Experiment: ${experiment.name}`] = variation.name;\n\n // Send to Rudder\n this.analytics.identify(traits);\n }\n };\n\n initOptimizelyIntegration(referrerOverride, sendCampaignData) {\n const newActiveCampaign = (id, referrer) => {\n const state = window.optimizely.get && window.optimizely.get(\"state\");\n if (state) {\n const activeCampaigns = state.getCampaignStates({\n isActive: true,\n });\n const campaignState = activeCampaigns[id];\n if (referrer) campaignState.experiment.referrer = referrer;\n sendCampaignData(campaignState);\n }\n };\n\n const checkReferrer = () => {\n const state = window.optimizely.get && window.optimizely.get(\"state\");\n if (state) {\n const referrer =\n state.getRedirectInfo() && state.getRedirectInfo().referrer;\n\n if (referrer) {\n referrerOverride(referrer);\n return referrer;\n }\n }\n return undefined;\n };\n\n const registerFutureActiveCampaigns = () => {\n window.optimizely = window.optimizely || [];\n window.optimizely.push({\n type: \"addListener\",\n filter: {\n type: \"lifecycle\",\n name: \"campaignDecided\",\n },\n handler(event) {\n const { id } = event.data.campaign;\n newActiveCampaign(id);\n },\n });\n };\n\n const registerCurrentlyActiveCampaigns = () => {\n window.optimizely = window.optimizely || [];\n const state = window.optimizely.get && window.optimizely.get(\"state\");\n if (state) {\n const referrer = checkReferrer();\n const activeCampaigns = state.getCampaignStates({\n isActive: true,\n });\n Object.keys(activeCampaigns).forEach((id) => {\n if (referrer) {\n newActiveCampaign(id, referrer);\n } else {\n newActiveCampaign(id);\n }\n });\n } else {\n window.optimizely.push({\n type: \"addListener\",\n filter: {\n type: \"lifecycle\",\n name: \"initialized\",\n },\n handler() {\n checkReferrer();\n },\n });\n }\n };\n registerCurrentlyActiveCampaigns();\n registerFutureActiveCampaigns();\n }\n\n track(rudderElement) {\n logger.debug(\"in Optimizely web track\");\n const eventProperties = rudderElement.message.properties;\n const { event } = rudderElement.message;\n if (eventProperties.revenue && this.revenueOnlyOnOrderCompleted) {\n if (event === \"Order Completed\") {\n eventProperties.revenue = Math.round(eventProperties.revenue * 100);\n } else if (event !== \"Order Completed\") {\n delete eventProperties.revenue;\n }\n }\n const eventName = event.replace(/:/g, \"_\"); // can't have colons so replacing with underscores\n const payload = {\n type: \"event\",\n eventName,\n tags: eventProperties,\n };\n\n window.optimizely.push(payload);\n }\n\n page(rudderElement) {\n logger.debug(\"in Optimizely web page\");\n const { category } = rudderElement.message.properties;\n const { name } = rudderElement.message;\n /* const contextOptimizely = {\n integrations: { All: false, Optimizely: true },\n }; */\n\n // categorized pages\n if (category && this.trackCategorizedPages) {\n // this.analytics.track(`Viewed ${category} page`, {}, contextOptimizely);\n rudderElement.message.event = `Viewed ${category} page`;\n rudderElement.message.type = \"track\";\n this.track(rudderElement);\n }\n\n // named pages\n if (name && this.trackNamedPages) {\n // this.analytics.track(`Viewed ${name} page`, {}, contextOptimizely);\n rudderElement.message.event = `Viewed ${name} page`;\n rudderElement.message.type = \"track\";\n this.track(rudderElement);\n }\n }\n\n isLoaded() {\n return !!(\n window.optimizely && window.optimizely.push !== Array.prototype.push\n );\n }\n\n isReady() {\n return !!(\n window.optimizely && window.optimizely.push !== Array.prototype.push\n );\n }\n}\n\nexport default Optimizely;\n","import logger from \"../../utils/logUtil\";\nimport ScriptLoader from \"../ScriptLoader\";\n\nclass Bugsnag {\n constructor(config) {\n this.releaseStage = config.releaseStage;\n this.apiKey = config.apiKey;\n this.name = \"BUGSNAG\";\n this.setIntervalHandler = undefined;\n }\n\n init() {\n logger.debug(\"===in init Bugsnag===\");\n ScriptLoader(\n \"bugsnag-id\",\n \"https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js\"\n );\n\n this.setIntervalHandler = setInterval(\n this.initBugsnagClient.bind(this),\n 1000\n );\n }\n\n initBugsnagClient() {\n if (window.bugsnag !== undefined) {\n window.bugsnagClient = window.bugsnag(this.apiKey);\n window.bugsnagClient.releaseStage = this.releaseStage;\n clearInterval(this.setIntervalHandler);\n }\n }\n\n isLoaded() {\n logger.debug(\"in bugsnag isLoaded\");\n return !!window.bugsnagClient;\n }\n\n isReady() {\n logger.debug(\"in bugsnag isReady\");\n return !!window.bugsnagClient;\n }\n\n identify(rudderElement) {\n const { traits } = rudderElement.message.context;\n const traitsFinal = {\n id: rudderElement.message.userId || rudderElement.message.anonymousId,\n name: traits.name,\n email: traits.email,\n };\n\n window.bugsnagClient.user = traitsFinal;\n window.bugsnagClient.notify(new Error(\"error in identify\"));\n }\n}\nexport { Bugsnag };\n","'use strict';\n\nconst preserveCamelCase = string => {\n\tlet isLastCharLower = false;\n\tlet isLastCharUpper = false;\n\tlet isLastLastCharUpper = false;\n\n\tfor (let i = 0; i < string.length; i++) {\n\t\tconst character = string[i];\n\n\t\tif (isLastCharLower && /[\\p{Lu}]/u.test(character)) {\n\t\t\tstring = string.slice(0, i) + '-' + string.slice(i);\n\t\t\tisLastCharLower = false;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = true;\n\t\t\ti++;\n\t\t} else if (isLastCharUpper && isLastLastCharUpper && /[\\p{Ll}]/u.test(character)) {\n\t\t\tstring = string.slice(0, i - 1) + '-' + string.slice(i - 1);\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = false;\n\t\t\tisLastCharLower = true;\n\t\t} else {\n\t\t\tisLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character;\n\t\t\tisLastLastCharUpper = isLastCharUpper;\n\t\t\tisLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character;\n\t\t}\n\t}\n\n\treturn string;\n};\n\nconst camelCase = (input, options) => {\n\tif (!(typeof input === 'string' || Array.isArray(input))) {\n\t\tthrow new TypeError('Expected the input to be `string | string[]`');\n\t}\n\n\toptions = {\n\t\t...{pascalCase: false},\n\t\t...options\n\t};\n\n\tconst postProcess = x => options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x;\n\n\tif (Array.isArray(input)) {\n\t\tinput = input.map(x => x.trim())\n\t\t\t.filter(x => x.length)\n\t\t\t.join('-');\n\t} else {\n\t\tinput = input.trim();\n\t}\n\n\tif (input.length === 0) {\n\t\treturn '';\n\t}\n\n\tif (input.length === 1) {\n\t\treturn options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase();\n\t}\n\n\tconst hasUpperCase = input !== input.toLocaleLowerCase();\n\n\tif (hasUpperCase) {\n\t\tinput = preserveCamelCase(input);\n\t}\n\n\tinput = input\n\t\t.replace(/^[_.\\- ]+/, '')\n\t\t.toLocaleLowerCase()\n\t\t.replace(/[_.\\- ]+([\\p{Alpha}\\p{N}_]|$)/gu, (_, p1) => p1.toLocaleUpperCase())\n\t\t.replace(/\\d+([\\p{Alpha}\\p{N}_]|$)/gu, m => m.toLocaleUpperCase());\n\n\treturn postProcess(input);\n};\n\nmodule.exports = camelCase;\n// TODO: Remove this for the next major release\nmodule.exports.default = camelCase;\n","/**\n * Convert array of 16 byte values to UUID string format of the form:\n * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX\n */\nvar byteToHex = [];\nfor (var i = 0; i < 256; ++i) {\n byteToHex[i] = (i + 0x100).toString(16).substr(1);\n}\n\nfunction bytesToUuid(buf, offset) {\n var i = offset || 0;\n var bth = byteToHex;\n // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4\n return ([\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]], '-',\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]],\n bth[buf[i++]], bth[buf[i++]]\n ]).join('');\n}\n\nmodule.exports = bytesToUuid;\n","import * as HubSpot from \"./HubSpot\";\nimport * as GA from \"./GA\";\nimport * as Hotjar from \"./Hotjar\";\nimport * as GoogleAds from \"./GoogleAds\";\nimport * as VWO from \"./VWO\";\nimport * as GoogleTagManager from \"./GoogleTagManager\";\nimport * as Braze from \"./Braze\";\nimport * as INTERCOM from \"./INTERCOM\";\nimport * as Keen from \"./Keen\";\nimport * as Kissmetrics from \"./Kissmetrics\";\nimport * as CustomerIO from \"./CustomerIO\";\nimport * as Chartbeat from \"./Chartbeat\";\nimport * as Comscore from \"./Comscore\";\nimport * as FBPixel from \"./FacebookPixel\";\nimport * as Lotame from \"./Lotame\";\nimport * as Optimizely from \"./Optimizely\";\nimport * as Bugsnag from \"./Bugsnag\";\nimport * as Fullstory from \"./Fullstory\";\nimport * as TVSquared from \"./TVSquared\";\n\n// the key names should match the destination.name value to keep partity everywhere\n// (config-plan name, native destination.name , exported integration name(this one below))\n\nconst integrations = {\n HS: HubSpot.default,\n GA: GA.default,\n HOTJAR: Hotjar.default,\n GOOGLEADS: GoogleAds.default,\n VWO: VWO.default,\n GTM: GoogleTagManager.default,\n BRAZE: Braze.default,\n INTERCOM: INTERCOM.default,\n KEEN: Keen.default,\n KISSMETRICS: Kissmetrics.default,\n CUSTOMERIO: CustomerIO.default,\n CHARTBEAT: Chartbeat.default,\n COMSCORE: Comscore.default,\n FACEBOOK_PIXEL: FBPixel.default,\n LOTAME: Lotame.default,\n OPTIMIZELY: Optimizely.default,\n BUGSNAG: Bugsnag.default,\n FULLSTORY: Fullstory.default,\n TVSQUARED: TVSquared.default,\n};\n\nexport { integrations };\n","import camelcase from \"camelcase\";\nimport logger from \"../../utils/logUtil\";\n\nclass Fullstory {\n constructor(config) {\n this.fs_org = config.fs_org;\n this.fs_debug_mode = config.fs_debug_mode;\n this.name = \"FULLSTORY\";\n }\n\n static getFSProperties(properties) {\n const FS_properties = {};\n Object.keys(properties).map(function (key, index) {\n FS_properties[\n key === \"displayName\" || key === \"email\"\n ? key\n : Fullstory.camelCaseField(key)\n ] = properties[key];\n });\n return FS_properties;\n }\n\n static camelCaseField(fieldName) {\n // Do not camel case across type suffixes.\n const parts = fieldName.split(\"_\");\n if (parts.length > 1) {\n const typeSuffix = parts.pop();\n switch (typeSuffix) {\n case \"str\":\n case \"int\":\n case \"date\":\n case \"real\":\n case \"bool\":\n case \"strs\":\n case \"ints\":\n case \"dates\":\n case \"reals\":\n case \"bools\":\n return `${camelcase(parts.join(\"_\"))}_${typeSuffix}`;\n default: // passthrough\n }\n }\n // No type suffix found. Camel case the whole field name.\n return camelcase(fieldName);\n }\n\n init() {\n logger.debug(\"===in init FULLSTORY===\");\n\n window._fs_debug = this.fs_debug_mode;\n window._fs_host = \"fullstory.com\";\n window._fs_script = \"edge.fullstory.com/s/fs.js\";\n window._fs_org = this.fs_org;\n window._fs_namespace = \"FS\";\n (function (m, n, e, t, l, o, g, y) {\n if (e in m) {\n if (m.console && m.console.log) {\n m.console.log(\n 'FullStory namespace conflict. Please set window[\"_fs_namespace\"].'\n );\n }\n return;\n }\n g = m[e] = function (a, b, s) {\n g.q ? g.q.push([a, b, s]) : g._api(a, b, s);\n };\n g.q = [];\n o = n.createElement(t);\n o.async = 1;\n o.crossOrigin = \"anonymous\";\n o.src = `https://${_fs_script}`;\n y = n.getElementsByTagName(t)[0];\n y.parentNode.insertBefore(o, y);\n g.identify = function (i, v, s) {\n g(l, { uid: i }, s);\n if (v) g(l, v, s);\n };\n g.setUserVars = function (v, s) {\n g(l, v, s);\n };\n g.event = function (i, v, s) {\n g(\"event\", { n: i, p: v }, s);\n };\n g.shutdown = function () {\n g(\"rec\", !1);\n };\n g.restart = function () {\n g(\"rec\", !0);\n };\n g.log = function (a, b) {\n g(\"log\", [a, b]);\n };\n g.consent = function (a) {\n g(\"consent\", !arguments.length || a);\n };\n g.identifyAccount = function (i, v) {\n o = \"account\";\n v = v || {};\n v.acctId = i;\n g(o, v);\n };\n g.clearUserCookie = function () {};\n g._w = {};\n y = \"XMLHttpRequest\";\n g._w[y] = m[y];\n y = \"fetch\";\n g._w[y] = m[y];\n if (m[y])\n m[y] = function () {\n return g._w[y].apply(this, arguments);\n };\n })(window, document, window._fs_namespace, \"script\", \"user\");\n }\n\n page(rudderElement) {\n logger.debug(\"in FULLSORY page\");\n const rudderMessage = rudderElement.message;\n const pageName = rudderMessage.name;\n const props = {\n name: pageName,\n ...rudderMessage.properties,\n };\n\n window.FS.event(\"Viewed a Page\", Fullstory.getFSProperties(props));\n }\n\n identify(rudderElement) {\n logger.debug(\"in FULLSORY identify\");\n let { userId } = rudderElement.message;\n const { traits } = rudderElement.message.context;\n if (!userId) userId = rudderElement.message.anonymousId;\n\n if (Object.keys(traits).length === 0 && traits.constructor === Object)\n window.FS.identify(userId);\n else window.FS.identify(userId, Fullstory.getFSProperties(traits));\n }\n\n track(rudderElement) {\n logger.debug(\"in FULLSTORY track\");\n window.FS.event(\n rudderElement.message.event,\n Fullstory.getFSProperties(rudderElement.message.properties)\n );\n }\n\n isLoaded() {\n logger.debug(\"in FULLSTORY isLoaded\");\n return !!window.FS;\n }\n}\n\nexport { Fullstory };\n","/* eslint-disable camelcase */\n/* eslint-disable no-underscore-dangle */\nimport ScriptLoader from \"../ScriptLoader\";\nimport logger from \"../../utils/logUtil\";\n\nclass TVSquared {\n constructor(config) {\n this.brandId = config.brandId;\n this.clientId = config.clientId;\n this.eventWhiteList = config.eventWhiteList || [];\n this.customMetrics = config.customMetrics || [];\n this.name = \"TVSquared\";\n }\n\n init() {\n logger.debug(\"===in init TVSquared===\");\n window._tvq = window._tvq || [];\n let url = document.location.protocol === \"https:\" ? \"https://\" : \"http://\";\n url += `collector-${this.clientId}.tvsquared.com/`;\n window._tvq.push([\"setSiteId\", this.brandId]);\n window._tvq.push([\"setTrackerUrl\", `${url}tv2track.php`]);\n ScriptLoader(\"TVSquared-integration\", `${url}tv2track.js`);\n }\n\n isLoaded = () => {\n logger.debug(\"in TVSqaured isLoaded\");\n return !!(window._tvq && window._tvq.push !== Array.prototype.push);\n };\n\n isReady = () => {\n logger.debug(\"in TVSqaured isReady\");\n return !!(window._tvq && window._tvq.push !== Array.prototype.push);\n };\n\n page = () => {\n window._tvq.push([\"trackPageView\"]);\n };\n\n track(rudderElement) {\n const { event, userId, anonymousId } = rudderElement.message;\n const {\n revenue,\n productType,\n category,\n order_id,\n promotion_id,\n } = rudderElement.message.properties;\n let i;\n let j;\n let whitelist = this.eventWhiteList.slice();\n whitelist = whitelist.filter((wl) => {\n return wl.event !== \"\";\n });\n for (i = 0; i < whitelist.length; i += 1) {\n if (event.toUpperCase() === whitelist[i].event.toUpperCase()) {\n break;\n }\n if (i === whitelist.length - 1) {\n return;\n }\n }\n\n const session = { user: userId || anonymousId || \"\" };\n const action = {\n rev: revenue ? this.formatRevenue(revenue) : \"\",\n prod: category || productType || \"\",\n id: order_id || \"\",\n promo: promotion_id || \"\",\n };\n let customMetrics = this.customMetrics.slice();\n customMetrics = customMetrics.filter((cm) => {\n return cm.propertyName !== \"\";\n });\n if (customMetrics.length) {\n for (j = 0; j < customMetrics.length; j += 1) {\n const key = customMetrics[j].propertyName;\n const value = rudderElement.message.properties[key];\n if (value) {\n action[key] = value;\n }\n }\n }\n window._tvq.push([\n function () {\n this.setCustomVariable(5, \"session\", JSON.stringify(session), \"visit\");\n },\n ]);\n if (event.toUpperCase() !== \"RESPONSE\") {\n window._tvq.push([\n function () {\n this.setCustomVariable(5, event, JSON.stringify(action), \"page\");\n },\n ]);\n window._tvq.push([\"trackPageView\"]);\n }\n };\n\n formatRevenue = (revenue) => {\n let rev = revenue;\n rev = parseFloat(rev.toString().replace(/^[^\\d.]*/, \"\"));\n return rev;\n };\n}\nexport default TVSquared;\n","// Application class\nclass RudderApp {\n constructor() {\n this.build = \"1.0.0\";\n this.name = \"RudderLabs JavaScript SDK\";\n this.namespace = \"com.rudderlabs.javascript\";\n this.version = \"process.package_version\";\n }\n}\nexport default RudderApp;\n","// Library information class\nclass RudderLibraryInfo {\n constructor() {\n this.name = \"RudderLabs JavaScript SDK\";\n this.version = \"process.package_version\";\n }\n}\n// Operating System information class\nclass RudderOSInfo {\n constructor() {\n this.name = \"\";\n this.version = \"\";\n }\n}\n// Screen information class\nclass RudderScreenInfo {\n constructor() {\n this.density = 0;\n this.width = 0;\n this.height = 0;\n }\n}\n// Device information class\nclass RudderDeviceInfo {\n constructor() {\n this.id = \"\";\n this.manufacturer = \"\";\n this.model = \"\";\n this.name = \"\";\n }\n}\n// Carrier information\nclass RudderNetwork {\n constructor() {\n this.carrier = \"\";\n }\n}\nexport {\n RudderLibraryInfo,\n RudderOSInfo,\n RudderScreenInfo,\n RudderDeviceInfo,\n RudderNetwork,\n};\n","// Context class\nimport RudderApp from \"./RudderApp\";\nimport {\n RudderLibraryInfo,\n RudderOSInfo,\n RudderScreenInfo,\n} from \"./RudderInfo\";\n\nclass RudderContext {\n constructor() {\n this.app = new RudderApp();\n this.traits = null;\n this.library = new RudderLibraryInfo();\n // this.os = null;\n const os = new RudderOSInfo();\n os.version = \"\"; // skipping version for simplicity now\n const screen = new RudderScreenInfo();\n\n // Depending on environment within which the code is executing, screen\n // dimensions can be set\n // User agent and locale can be retrieved only for browser\n // For server-side integration, same needs to be set by calling program\n if (!process.browser) {\n // server-side integration\n screen.width = 0;\n screen.height = 0;\n screen.density = 0;\n os.version = \"\";\n os.name = \"\";\n this.userAgent = null;\n this.locale = null;\n } else {\n // running within browser\n screen.width = window.width;\n screen.height = window.height;\n screen.density = window.devicePixelRatio;\n this.userAgent = navigator.userAgent;\n // property name differs based on browser version\n this.locale = navigator.language || navigator.browserLanguage;\n }\n this.os = os;\n this.screen = screen;\n this.device = null;\n this.network = null;\n }\n}\nexport default RudderContext;\n","// Core message class with default values\nimport { generateUUID } from \"./utils\";\nimport { MessageType, ECommerceEvents } from \"./constants\";\nimport RudderContext from \"./RudderContext\";\n\nclass RudderMessage {\n constructor() {\n this.channel = \"web\";\n this.context = new RudderContext();\n this.type = null;\n this.action = null;\n this.messageId = generateUUID().toString();\n this.originalTimestamp = new Date().toISOString();\n this.anonymousId = null;\n this.userId = null;\n this.event = null;\n this.properties = {};\n this.integrations = {};\n // By default, all integrations will be set as enabled from client\n // Decision to route to specific destinations will be taken at server end\n this.integrations.All = true;\n }\n\n // Get property\n getProperty(key) {\n return this.properties[key];\n }\n\n // Add property\n addProperty(key, value) {\n this.properties[key] = value;\n }\n\n // Validate whether this message is semantically valid for the type mentioned\n validateFor(messageType) {\n // First check that properties is populated\n if (!this.properties) {\n throw new Error(\"Key properties is required\");\n }\n // Event type specific checks\n switch (messageType) {\n case MessageType.TRACK:\n // check if event is present\n if (!this.event) {\n throw new Error(\"Key event is required for track event\");\n }\n // Next make specific checks for e-commerce events\n if (this.event in Object.values(ECommerceEvents)) {\n switch (this.event) {\n case ECommerceEvents.CHECKOUT_STEP_VIEWED:\n case ECommerceEvents.CHECKOUT_STEP_COMPLETED:\n case ECommerceEvents.PAYMENT_INFO_ENTERED:\n this.checkForKey(\"checkout_id\");\n this.checkForKey(\"step\");\n break;\n case ECommerceEvents.PROMOTION_VIEWED:\n case ECommerceEvents.PROMOTION_CLICKED:\n this.checkForKey(\"promotion_id\");\n break;\n case ECommerceEvents.ORDER_REFUNDED:\n this.checkForKey(\"order_id\");\n break;\n default:\n }\n } else if (!this.properties.category) {\n // if category is not there, set to event\n this.properties.category = this.event;\n }\n\n break;\n case MessageType.PAGE:\n break;\n case MessageType.SCREEN:\n if (!this.properties.name) {\n throw new Error(\"Key 'name' is required in properties\");\n }\n break;\n }\n }\n\n // Function for checking existence of a particular property\n checkForKey(propertyName) {\n if (!this.properties[propertyName]) {\n throw new Error(`Key '${propertyName}' is required in properties`);\n }\n }\n}\nexport default RudderMessage;\n","import RudderMessage from \"./RudderMessage\";\n// Individual element class containing Rudder Message\nclass RudderElement {\n constructor() {\n this.message = new RudderMessage();\n }\n\n // Setters that in turn set the field values for the contained object\n setType(type) {\n this.message.type = type;\n }\n\n setProperty(rudderProperty) {\n this.message.properties = rudderProperty;\n }\n\n setUserProperty(rudderUserProperty) {\n this.message.user_properties = rudderUserProperty;\n }\n\n setUserId(userId) {\n this.message.userId = userId;\n }\n\n setEventName(eventName) {\n this.message.event = eventName;\n }\n\n updateTraits(traits) {\n this.message.context.traits = traits;\n }\n\n getElementContent() {\n return this.message;\n }\n}\nexport default RudderElement;\n","// Class responsible for building up the individual elements in a batch\n// that is transmitted by the SDK\nimport RudderElement from \"./RudderElement.js\";\n\nclass RudderElementBuilder {\n constructor() {\n this.rudderProperty = null;\n this.rudderUserProperty = null;\n this.event = null;\n this.userId = null;\n this.channel = null;\n this.type = null;\n }\n\n // Set the property\n setProperty(inputRudderProperty) {\n this.rudderProperty = inputRudderProperty;\n return this;\n }\n\n // Build and set the property object\n setPropertyBuilder(rudderPropertyBuilder) {\n this.rudderProperty = rudderPropertyBuilder.build();\n return this;\n }\n\n setUserProperty(inputRudderUserProperty) {\n this.rudderUserProperty = inputRudderUserProperty;\n return this;\n }\n\n setUserPropertyBuilder(rudderUserPropertyBuilder) {\n this.rudderUserProperty = rudderUserPropertyBuilder.build();\n return this;\n }\n\n // Setter methods for all variables. Instance is returned for each call in\n // accordance with the Builder pattern\n\n setEvent(event) {\n this.event = event;\n return this;\n }\n\n setUserId(userId) {\n this.userId = userId;\n return this;\n }\n\n setChannel(channel) {\n this.channel = channel;\n return this;\n }\n\n setType(eventType) {\n this.type = eventType;\n return this;\n }\n\n build() {\n const element = new RudderElement();\n element.setUserId(this.userId);\n element.setType(this.type);\n element.setEventName(this.event);\n element.setProperty(this.rudderProperty);\n element.setUserProperty(this.rudderUserProperty);\n return element;\n }\n}\nexport default RudderElementBuilder;\n","// Unique ID creation requires a high quality random # generator. In the\n// browser this is a little complicated due to unknown quality of Math.random()\n// and inconsistent support for the `crypto` API. We do the best we can via\n// feature-detection\n\n// getRandomValues needs to be invoked in a context where \"this\" is a Crypto\n// implementation. Also, find the complete implementation of crypto on IE11.\nvar getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||\n (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));\n\nif (getRandomValues) {\n // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto\n var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef\n\n module.exports = function whatwgRNG() {\n getRandomValues(rnds8);\n return rnds8;\n };\n} else {\n // Math.random()-based (RNG)\n //\n // If all else fails, use Math.random(). It's fast, but is of unspecified\n // quality.\n var rnds = new Array(16);\n\n module.exports = function mathRNG() {\n for (var i = 0, r; i < 16; i++) {\n if ((i & 0x03) === 0) r = Math.random() * 0x100000000;\n rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;\n }\n\n return rnds;\n };\n}\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\n// **`v1()` - Generate time-based UUID**\n//\n// Inspired by https://github.com/LiosK/UUID.js\n// and http://docs.python.org/library/uuid.html\n\nvar _nodeId;\nvar _clockseq;\n\n// Previous uuid creation time\nvar _lastMSecs = 0;\nvar _lastNSecs = 0;\n\n// See https://github.com/uuidjs/uuid for API details\nfunction v1(options, buf, offset) {\n var i = buf && offset || 0;\n var b = buf || [];\n\n options = options || {};\n var node = options.node || _nodeId;\n var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;\n\n // node and clockseq need to be initialized to random values if they're not\n // specified. We do this lazily to minimize issues related to insufficient\n // system entropy. See #189\n if (node == null || clockseq == null) {\n var seedBytes = rng();\n if (node == null) {\n // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)\n node = _nodeId = [\n seedBytes[0] | 0x01,\n seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]\n ];\n }\n if (clockseq == null) {\n // Per 4.2.2, randomize (14 bit) clockseq\n clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;\n }\n }\n\n // UUID timestamps are 100 nano-second units since the Gregorian epoch,\n // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so\n // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'\n // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.\n var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();\n\n // Per 4.2.1.2, use count of uuid's generated during the current clock\n // cycle to simulate higher resolution clock\n var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;\n\n // Time since last uuid creation (in msecs)\n var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;\n\n // Per 4.2.1.2, Bump clockseq on clock regression\n if (dt < 0 && options.clockseq === undefined) {\n clockseq = clockseq + 1 & 0x3fff;\n }\n\n // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new\n // time interval\n if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {\n nsecs = 0;\n }\n\n // Per 4.2.1.2 Throw error if too many uuids are requested\n if (nsecs >= 10000) {\n throw new Error('uuid.v1(): Can\\'t create more than 10M uuids/sec');\n }\n\n _lastMSecs = msecs;\n _lastNSecs = nsecs;\n _clockseq = clockseq;\n\n // Per 4.1.4 - Convert from unix epoch to Gregorian epoch\n msecs += 12219292800000;\n\n // `time_low`\n var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;\n b[i++] = tl >>> 24 & 0xff;\n b[i++] = tl >>> 16 & 0xff;\n b[i++] = tl >>> 8 & 0xff;\n b[i++] = tl & 0xff;\n\n // `time_mid`\n var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;\n b[i++] = tmh >>> 8 & 0xff;\n b[i++] = tmh & 0xff;\n\n // `time_high_and_version`\n b[i++] = tmh >>> 24 & 0xf | 0x10; // include version\n b[i++] = tmh >>> 16 & 0xff;\n\n // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)\n b[i++] = clockseq >>> 8 | 0x80;\n\n // `clock_seq_low`\n b[i++] = clockseq & 0xff;\n\n // `node`\n for (var n = 0; n < 6; ++n) {\n b[i + n] = node[n];\n }\n\n return buf ? buf : bytesToUuid(b);\n}\n\nmodule.exports = v1;\n","var rng = require('./lib/rng');\nvar bytesToUuid = require('./lib/bytesToUuid');\n\nfunction v4(options, buf, offset) {\n var i = buf && offset || 0;\n\n if (typeof(options) == 'string') {\n buf = options === 'binary' ? new Array(16) : null;\n options = null;\n }\n options = options || {};\n\n var rnds = options.random || (options.rng || rng)();\n\n // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`\n rnds[6] = (rnds[6] & 0x0f) | 0x40;\n rnds[8] = (rnds[8] & 0x3f) | 0x80;\n\n // Copy bytes to buffer, if provided\n if (buf) {\n for (var ii = 0; ii < 16; ++ii) {\n buf[i + ii] = rnds[ii];\n }\n }\n\n return buf || bytesToUuid(rnds);\n}\n\nmodule.exports = v4;\n","var v1 = require('./v1');\nvar v4 = require('./v4');\n\nvar uuid = v4;\nuuid.v1 = v1;\nuuid.v4 = v4;\n\nmodule.exports = uuid;\n","'use strict';\n\nvar keys = require('@ndhoule/keys');\nvar uuid = require('uuid').v4;\n\nvar inMemoryStore = {\n _data: {},\n length: 0,\n setItem: function(key, value) {\n this._data[key] = value;\n this.length = keys(this._data).length;\n return value;\n },\n getItem: function(key) {\n if (key in this._data) {\n return this._data[key];\n }\n return null;\n },\n removeItem: function(key) {\n if (key in this._data) {\n delete this._data[key];\n }\n this.length = keys(this._data).length;\n return null;\n },\n clear: function() {\n this._data = {};\n this.length = 0;\n },\n key: function(index) {\n return keys(this._data)[index];\n }\n};\n\nfunction isSupportedNatively() {\n try {\n if (!window.localStorage) return false;\n var key = uuid();\n window.localStorage.setItem(key, 'test_value');\n var value = window.localStorage.getItem(key);\n window.localStorage.removeItem(key);\n\n // handle localStorage silently failing\n return value === 'test_value';\n } catch (e) {\n // Can throw if localStorage is disabled\n return false;\n }\n}\n\nfunction pickStorage() {\n if (isSupportedNatively()) {\n return window.localStorage;\n }\n // fall back to in-memory\n return inMemoryStore;\n}\n\n// Return a shared instance\nmodule.exports.defaultEngine = pickStorage();\n// Expose the in-memory store explicitly for testing\nmodule.exports.inMemoryEngine = inMemoryStore;\n","'use strict';\n\nvar defaultEngine = require('./engine').defaultEngine;\nvar inMemoryEngine = require('./engine').inMemoryEngine;\nvar each = require('@ndhoule/each');\nvar keys = require('@ndhoule/keys');\nvar json = require('json3');\n\n/**\n* Store Implementation with dedicated\n*/\n\nfunction Store(name, id, keys, optionalEngine) {\n this.id = id;\n this.name = name;\n this.keys = keys || {};\n this.engine = optionalEngine || defaultEngine;\n this.originalEngine = this.engine;\n}\n\n/**\n* Set value by key.\n*/\n\nStore.prototype.set = function(key, value) {\n var compoundKey = this._createValidKey(key);\n if (!compoundKey) return;\n try {\n this.engine.setItem(compoundKey, json.stringify(value));\n } catch (err) {\n if (isQuotaExceeded(err)) {\n // switch to inMemory engine\n this._swapEngine();\n // and save it there\n this.set(key, value);\n }\n }\n};\n\n/**\n* Get by Key.\n*/\n\nStore.prototype.get = function(key) {\n try {\n var str = this.engine.getItem(this._createValidKey(key));\n if (str === null) {\n return null;\n }\n return json.parse(str);\n } catch (err) {\n return null;\n }\n};\n\n/**\n * Get original engine\n */\n\nStore.prototype.getOriginalEngine = function() {\n return this.originalEngine;\n};\n\n/**\n* Remove by Key.\n*/\n\nStore.prototype.remove = function(key) {\n this.engine.removeItem(this._createValidKey(key));\n};\n\n/**\n* Ensure the key is valid\n*/\n\nStore.prototype._createValidKey = function(key) {\n var name = this.name;\n var id = this.id;\n\n if (!keys(this.keys).length) return [name, id, key].join('.');\n\n // validate and return undefined if invalid key\n var compoundKey;\n each(function(value) {\n if (value === key) {\n compoundKey = [name, id, key].join('.');\n }\n }, this.keys);\n return compoundKey;\n};\n\n/**\n* Switch to inMemoryEngine, bringing any existing data with.\n*/\n\nStore.prototype._swapEngine = function() {\n var self = this;\n\n // grab existing data, but only for this page's queue instance, not all\n // better to keep other queues in localstorage to be flushed later\n // than to pull them into memory and remove them from durable storage\n each(function(key) {\n var value = self.get(key);\n inMemoryEngine.setItem([self.name, self.id, key].join('.'), value);\n self.remove(key);\n }, this.keys);\n\n this.engine = inMemoryEngine;\n};\n\nmodule.exports = Store;\n\nfunction isQuotaExceeded(e) {\n var quotaExceeded = false;\n if (e.code) {\n switch (e.code) {\n case 22:\n quotaExceeded = true;\n break;\n case 1014:\n // Firefox\n if (e.name === 'NS_ERROR_DOM_QUOTA_REACHED') {\n quotaExceeded = true;\n }\n break;\n default:\n break;\n }\n } else if (e.number === -2147024882) {\n // Internet Explorer 8\n quotaExceeded = true;\n }\n return quotaExceeded;\n}\n","'use strict';\n\nvar each = require('@ndhoule/each');\n\nvar defaultClock = {\n setTimeout: function(fn, ms) {\n return window.setTimeout(fn, ms);\n },\n clearTimeout: function(id) {\n return window.clearTimeout(id);\n },\n Date: window.Date\n};\n\nvar clock = defaultClock;\n\nfunction Schedule() {\n this.tasks = {};\n this.nextId = 1;\n}\n\nSchedule.prototype.now = function() {\n return +new clock.Date();\n};\n\nSchedule.prototype.run = function(task, timeout) {\n var id = this.nextId++;\n this.tasks[id] = clock.setTimeout(this._handle(id, task), timeout);\n return id;\n};\n\nSchedule.prototype.cancel = function(id) {\n if (this.tasks[id]) {\n clock.clearTimeout(this.tasks[id]);\n delete this.tasks[id];\n }\n};\n\nSchedule.prototype.cancelAll = function() {\n each(clock.clearTimeout, this.tasks);\n this.tasks = {};\n};\n\nSchedule.prototype._handle = function(id, callback) {\n var self = this;\n return function() {\n delete self.tasks[id];\n return callback();\n };\n};\n\nSchedule.setClock = function(newClock) {\n clock = newClock;\n};\n\nSchedule.resetClock = function() {\n clock = defaultClock;\n};\n\nmodule.exports = Schedule;\n","\n/**\n * Expose `debug()` as the module.\n */\n\nmodule.exports = debug;\n\n/**\n * Create a debugger with the given `name`.\n *\n * @param {String} name\n * @return {Type}\n * @api public\n */\n\nfunction debug(name) {\n if (!debug.enabled(name)) return function(){};\n\n return function(fmt){\n fmt = coerce(fmt);\n\n var curr = new Date;\n var ms = curr - (debug[name] || curr);\n debug[name] = curr;\n\n fmt = name\n + ' '\n + fmt\n + ' +' + debug.humanize(ms);\n\n // This hackery is required for IE8\n // where `console.log` doesn't have 'apply'\n window.console\n && console.log\n && Function.prototype.apply.call(console.log, console, arguments);\n }\n}\n\n/**\n * The currently active debug mode names.\n */\n\ndebug.names = [];\ndebug.skips = [];\n\n/**\n * Enables a debug mode by name. This can include modes\n * separated by a colon and wildcards.\n *\n * @param {String} name\n * @api public\n */\n\ndebug.enable = function(name) {\n try {\n localStorage.debug = name;\n } catch(e){}\n\n var split = (name || '').split(/[\\s,]+/)\n , len = split.length;\n\n for (var i = 0; i < len; i++) {\n name = split[i].replace('*', '.*?');\n if (name[0] === '-') {\n debug.skips.push(new RegExp('^' + name.substr(1) + '$'));\n }\n else {\n debug.names.push(new RegExp('^' + name + '$'));\n }\n }\n};\n\n/**\n * Disable debug output.\n *\n * @api public\n */\n\ndebug.disable = function(){\n debug.enable('');\n};\n\n/**\n * Humanize the given `ms`.\n *\n * @param {Number} m\n * @return {String}\n * @api private\n */\n\ndebug.humanize = function(ms) {\n var sec = 1000\n , min = 60 * 1000\n , hour = 60 * min;\n\n if (ms >= hour) return (ms / hour).toFixed(1) + 'h';\n if (ms >= min) return (ms / min).toFixed(1) + 'm';\n if (ms >= sec) return (ms / sec | 0) + 's';\n return ms + 'ms';\n};\n\n/**\n * Returns true if the given mode name is enabled, false otherwise.\n *\n * @param {String} name\n * @return {Boolean}\n * @api public\n */\n\ndebug.enabled = function(name) {\n for (var i = 0, len = debug.skips.length; i < len; i++) {\n if (debug.skips[i].test(name)) {\n return false;\n }\n }\n for (var i = 0, len = debug.names.length; i < len; i++) {\n if (debug.names[i].test(name)) {\n return true;\n }\n }\n return false;\n};\n\n/**\n * Coerce `val`.\n */\n\nfunction coerce(val) {\n if (val instanceof Error) return val.stack || val.message;\n return val;\n}\n\n// persist\n\ntry {\n if (window.localStorage) debug.enable(localStorage.debug);\n} catch(e){}\n","'use strict';\n\nvar uuid = require('uuid').v4;\nvar Store = require('./store');\nvar each = require('@ndhoule/each');\nvar Schedule = require('./schedule');\nvar debug = require('debug')('localstorage-retry');\nvar Emitter = require('component-emitter');\n\n// Some browsers don't support Function.prototype.bind, so just including a simplified version here\nfunction bind(func, obj) {\n return function() {\n return func.apply(obj, arguments);\n };\n}\n\n/**\n * @callback processFunc\n * @param {Mixed} item The item added to the queue to process\n * @param {Function} done A function to call when processing is completed.\n * @param {Error} Optional error parameter if the processing failed\n * @param {Response} Optional response parameter to emit for async handling\n */\n\n/**\n * Constructs a Queue backed by localStorage\n *\n * @constructor\n * @param {String} name The name of the queue. Will be used to find abandoned queues and retry their items\n * @param {processFunc} fn The function to call in order to process an item added to the queue\n */\nfunction Queue(name, opts, fn) {\n if (typeof opts === 'function') fn = opts;\n this.name = name;\n this.id = uuid();\n this.fn = fn;\n this.maxItems = opts.maxItems || Infinity;\n this.maxAttempts = opts.maxAttempts || Infinity;\n\n this.backoff = {\n MIN_RETRY_DELAY: opts.minRetryDelay || 1000,\n MAX_RETRY_DELAY: opts.maxRetryDelay || 30000,\n FACTOR: opts.backoffFactor || 2,\n JITTER: opts.backoffJitter || 0\n };\n\n // painstakingly tuned. that's why they're not \"easily\" configurable\n this.timeouts = {\n ACK_TIMER: 1000,\n RECLAIM_TIMER: 3000,\n RECLAIM_TIMEOUT: 10000,\n RECLAIM_WAIT: 500\n };\n\n this.keys = {\n IN_PROGRESS: 'inProgress',\n QUEUE: 'queue',\n RECLAIM_START: 'reclaimStart',\n RECLAIM_END: 'reclaimEnd',\n ACK: 'ack'\n };\n\n this._schedule = new Schedule();\n this._processId = 0;\n\n // Set up our empty queues\n this._store = new Store(this.name, this.id, this.keys);\n this._store.set(this.keys.IN_PROGRESS, {});\n this._store.set(this.keys.QUEUE, []);\n\n // bind recurring tasks for ease of use\n this._ack = bind(this._ack, this);\n this._checkReclaim = bind(this._checkReclaim, this);\n this._processHead = bind(this._processHead, this);\n\n this._running = false;\n}\n\n/**\n * Mix in event emitter\n */\n\nEmitter(Queue.prototype);\n\n/**\n * Starts processing the queue\n */\nQueue.prototype.start = function() {\n if (this._running) {\n this.stop();\n }\n this._running = true;\n this._ack();\n this._checkReclaim();\n this._processHead();\n};\n\n/**\n * Stops processing the queue\n */\nQueue.prototype.stop = function() {\n this._schedule.cancelAll();\n this._running = false;\n};\n\n/**\n * Decides whether to retry. Overridable.\n *\n * @param {Object} item The item being processed\n * @param {Number} attemptNumber The attemptNumber (1 for first retry)\n * @param {Error} error The error from previous attempt, if there was one\n * @return {Boolean} Whether to requeue the message\n */\nQueue.prototype.shouldRetry = function(_, attemptNumber) {\n if (attemptNumber > this.maxAttempts) return false;\n return true;\n};\n\n/**\n * Calculates the delay (in ms) for a retry attempt\n *\n * @param {Number} attemptNumber The attemptNumber (1 for first retry)\n * @return {Number} The delay in milliseconds to wait before attempting a retry\n */\nQueue.prototype.getDelay = function(attemptNumber) {\n var ms = this.backoff.MIN_RETRY_DELAY * Math.pow(this.backoff.FACTOR, attemptNumber);\n if (this.backoff.JITTER) {\n var rand = Math.random();\n var deviation = Math.floor(rand * this.backoff.JITTER * ms);\n if (Math.floor(rand * 10) < 5) {\n ms -= deviation;\n } else {\n ms += deviation;\n }\n }\n return Number(Math.min(ms, this.backoff.MAX_RETRY_DELAY).toPrecision(1));\n};\n\n/**\n * Adds an item to the queue\n *\n * @param {Mixed} item The item to process\n */\nQueue.prototype.addItem = function(item) {\n this._enqueue({\n item: item,\n attemptNumber: 0,\n time: this._schedule.now()\n });\n};\n\n/**\n * Adds an item to the retry queue\n *\n * @param {Mixed} item The item to retry\n * @param {Number} attemptNumber The attempt number (1 for first retry)\n * @param {Error} [error] The error from previous attempt, if there was one\n */\nQueue.prototype.requeue = function(item, attemptNumber, error) {\n if (this.shouldRetry(item, attemptNumber, error)) {\n this._enqueue({\n item: item,\n attemptNumber: attemptNumber,\n time: this._schedule.now() + this.getDelay(attemptNumber)\n });\n } else {\n this.emit('discard', item, attemptNumber);\n }\n};\n\nQueue.prototype._enqueue = function(entry) {\n var queue = this._store.get(this.keys.QUEUE) || [];\n queue = queue.slice(-(this.maxItems - 1));\n queue.push(entry);\n queue = queue.sort(function(a,b) {\n return a.time - b.time;\n });\n\n this._store.set(this.keys.QUEUE, queue);\n\n if (this._running) {\n this._processHead();\n }\n};\n\nQueue.prototype._processHead = function() {\n var self = this;\n var store = this._store;\n\n // cancel the scheduled task if it exists\n this._schedule.cancel(this._processId);\n\n // Pop the head off the queue\n var queue = store.get(this.keys.QUEUE) || [];\n var inProgress = store.get(this.keys.IN_PROGRESS) || {};\n var now = this._schedule.now();\n var toRun = [];\n\n function enqueue(el, id) {\n toRun.push({\n item: el.item,\n done: function handle(err, res) {\n var inProgress = store.get(self.keys.IN_PROGRESS) || {};\n delete inProgress[id];\n store.set(self.keys.IN_PROGRESS, inProgress);\n self.emit('processed', err, res, el.item);\n if (err) {\n self.requeue(el.item, el.attemptNumber + 1, err);\n }\n }\n });\n }\n\n var inProgressSize = Object.keys(inProgress).length;\n\n while (queue.length && queue[0].time <= now && inProgressSize++ < self.maxItems) {\n var el = queue.shift();\n var id = uuid();\n\n // Save this to the in progress map\n inProgress[id] = {\n item: el.item,\n attemptNumber: el.attemptNumber,\n time: self._schedule.now()\n };\n\n enqueue(el, id);\n }\n\n store.set(this.keys.QUEUE, queue);\n store.set(this.keys.IN_PROGRESS, inProgress);\n\n each(function(el) {\n // TODO: handle fn timeout\n try {\n self.fn(el.item, el.done);\n } catch (err) {\n debug('Process function threw error: ' + err);\n }\n }, toRun);\n\n // re-read the queue in case the process function finished immediately or added another item\n queue = store.get(this.keys.QUEUE) || [];\n this._schedule.cancel(this._processId);\n if (queue.length > 0) {\n this._processId = this._schedule.run(this._processHead, queue[0].time - now);\n }\n};\n\n// Ack continuously to prevent other tabs from claiming our queue\nQueue.prototype._ack = function() {\n this._store.set(this.keys.ACK, this._schedule.now());\n this._store.set(this.keys.RECLAIM_START, null);\n this._store.set(this.keys.RECLAIM_END, null);\n this._schedule.run(this._ack, this.timeouts.ACK_TIMER);\n};\n\nQueue.prototype._checkReclaim = function() {\n var self = this;\n\n function tryReclaim(store) {\n store.set(self.keys.RECLAIM_START, self.id);\n store.set(self.keys.ACK, self._schedule.now());\n\n self._schedule.run(function() {\n if (store.get(self.keys.RECLAIM_START) !== self.id) return;\n store.set(self.keys.RECLAIM_END, self.id);\n\n self._schedule.run(function() {\n if (store.get(self.keys.RECLAIM_END) !== self.id) return;\n if (store.get(self.keys.RECLAIM_START) !== self.id) return;\n self._reclaim(store.id);\n }, self.timeouts.RECLAIM_WAIT);\n }, self.timeouts.RECLAIM_WAIT);\n }\n\n function findOtherQueues(name) {\n var res = [];\n var storage = self._store.getOriginalEngine();\n for (var i = 0; i < storage.length; i++) {\n var k = storage.key(i);\n var parts = k.split('.');\n if (parts.length !== 3) continue;\n if (parts[0] !== name) continue;\n if (parts[2] !== 'ack') continue;\n res.push(new Store(name, parts[1], self.keys));\n }\n return res;\n }\n\n each(function(store) {\n if (store.id === self.id) return;\n if (self._schedule.now() - store.get(self.keys.ACK) < self.timeouts.RECLAIM_TIMEOUT) return;\n tryReclaim(store);\n }, findOtherQueues(this.name));\n\n this._schedule.run(this._checkReclaim, this.timeouts.RECLAIM_TIMER);\n};\n\nQueue.prototype._reclaim = function(id) {\n var self = this;\n var other = new Store(this.name, id, this.keys);\n\n var our = {\n queue: this._store.get(this.keys.QUEUE) || []\n };\n\n var their = {\n inProgress: other.get(this.keys.IN_PROGRESS) || {},\n queue: other.get(this.keys.QUEUE) || []\n };\n\n // add their queue to ours, resetting run-time to immediate and copying the attempt#\n each(function(el) {\n our.queue.push({\n item: el.item,\n attemptNumber: el.attemptNumber,\n time: self._schedule.now()\n });\n }, their.queue);\n\n // if the queue is abandoned, all the in-progress are failed. retry them immediately and increment the attempt#\n each(function(el) {\n our.queue.push({\n item: el.item,\n attemptNumber: el.attemptNumber + 1,\n time: self._schedule.now()\n });\n }, their.inProgress);\n\n our.queue = our.queue.sort(function(a,b) {\n return a.time - b.time;\n });\n\n this._store.set(this.keys.QUEUE, our.queue);\n\n // remove all keys\n other.remove(this.keys.IN_PROGRESS);\n other.remove(this.keys.QUEUE);\n other.remove(this.keys.RECLAIM_START);\n other.remove(this.keys.RECLAIM_END);\n other.remove(this.keys.ACK);\n\n // process the new items we claimed\n this._processHead();\n};\n\nmodule.exports = Queue;\n","// Payload class, contains batch of Elements\nclass RudderPayload {\n constructor() {\n this.batch = null;\n this.writeKey = null;\n }\n}\nexport { RudderPayload };\n","import Queue from \"@segment/localstorage-retry\";\nimport {\n BASE_URL,\n FLUSH_QUEUE_SIZE,\n FLUSH_INTERVAL_DEFAULT,\n} from \"./constants\";\nimport { getCurrentTimeFormatted, handleError, replacer } from \"./utils\";\n\nimport { RudderPayload } from \"./RudderPayload\";\nimport logger from \"./logUtil\";\n// import * as XMLHttpRequestNode from \"Xmlhttprequest\";\n\nlet XMLHttpRequestNode;\nif (!process.browser) {\n XMLHttpRequestNode = require(\"Xmlhttprequest\");\n}\n\nlet btoaNode;\nif (!process.browser) {\n btoaNode = require(\"btoa\");\n}\n\nconst queueOptions = {\n maxRetryDelay: 360000,\n minRetryDelay: 1000,\n backoffFactor: 2,\n maxAttempts: 10,\n maxItems: 100,\n};\n\nconst MESSAGE_LENGTH = 32 * 1000; // ~32 Kb\n\n/**\n *\n * @class EventRepository responsible for adding events into\n * flush queue and sending data to rudder backend\n * in batch and maintains order of the event.\n */\nclass EventRepository {\n /**\n *Creates an instance of EventRepository.\n * @memberof EventRepository\n */\n constructor() {\n this.eventsBuffer = [];\n this.writeKey = \"\";\n this.url = \"\";\n this.state = \"READY\";\n this.batchSize = 0;\n\n // previous implementation\n // setInterval(this.preaparePayloadAndFlush, FLUSH_INTERVAL_DEFAULT, this);\n\n this.payloadQueue = new Queue(\"rudder\", queueOptions, function (\n item,\n done\n ) {\n // apply sentAt at flush time and reset on each retry\n item.message.sentAt = getCurrentTimeFormatted();\n // send this item for processing, with a callback to enable queue to get the done status\n eventRepository.processQueueElement(\n item.url,\n item.headers,\n item.message,\n 10 * 1000,\n function (err, res) {\n if (err) {\n return done(err);\n }\n done(null, res);\n }\n );\n });\n\n // start queue\n this.payloadQueue.start();\n }\n\n /**\n *\n *\n * @param {EventRepository} repo\n * @returns\n * @memberof EventRepository\n */\n preaparePayloadAndFlush(repo) {\n // construct payload\n logger.debug(`==== in preaparePayloadAndFlush with state: ${repo.state}`);\n logger.debug(repo.eventsBuffer);\n if (repo.eventsBuffer.length == 0 || repo.state === \"PROCESSING\") {\n return;\n }\n const eventsPayload = repo.eventsBuffer;\n const payload = new RudderPayload();\n payload.batch = eventsPayload;\n payload.writeKey = repo.writeKey;\n payload.sentAt = getCurrentTimeFormatted();\n\n // add sentAt to individual events as well\n payload.batch.forEach((event) => {\n event.sentAt = payload.sentAt;\n });\n\n repo.batchSize = repo.eventsBuffer.length;\n // server-side integration, XHR is node module\n\n if (process.browser) {\n var xhr = new XMLHttpRequest();\n } else {\n var xhr = new XMLHttpRequestNode.XMLHttpRequest();\n }\n\n logger.debug(\"==== in flush sending to Rudder BE ====\");\n logger.debug(JSON.stringify(payload, replacer));\n\n xhr.open(\"POST\", repo.url, true);\n xhr.setRequestHeader(\"Content-Type\", \"application/json\");\n\n if (process.browser) {\n xhr.setRequestHeader(\n \"Authorization\",\n `Basic ${btoa(`${payload.writeKey}:`)}`\n );\n } else {\n xhr.setRequestHeader(\n \"Authorization\",\n `Basic ${btoaNode(`${payload.writeKey}:`)}`\n );\n }\n\n // register call back to reset event buffer on successfull POST\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4 && xhr.status === 200) {\n logger.debug(`====== request processed successfully: ${xhr.status}`);\n repo.eventsBuffer = repo.eventsBuffer.slice(repo.batchSize);\n logger.debug(repo.eventsBuffer.length);\n } else if (xhr.readyState === 4 && xhr.status !== 200) {\n handleError(\n new Error(\n `request failed with status: ${xhr.status} for url: ${repo.url}`\n )\n );\n }\n repo.state = \"READY\";\n };\n xhr.send(JSON.stringify(payload, replacer));\n repo.state = \"PROCESSING\";\n }\n\n /**\n * the queue item proceesor\n * @param {*} url to send requests to\n * @param {*} headers\n * @param {*} message\n * @param {*} timeout\n * @param {*} queueFn the function to call after request completion\n */\n processQueueElement(url, headers, message, timeout, queueFn) {\n try {\n const xhr = new XMLHttpRequest();\n xhr.open(\"POST\", url, true);\n for (const k in headers) {\n xhr.setRequestHeader(k, headers[k]);\n }\n xhr.timeout = timeout;\n xhr.ontimeout = queueFn;\n xhr.onerror = queueFn;\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n if (xhr.status === 429 || (xhr.status >= 500 && xhr.status < 600)) {\n handleError(\n new Error(\n `request failed with status: ${xhr.status}${xhr.statusText} for url: ${url}`\n )\n );\n queueFn(\n new Error(\n `request failed with status: ${xhr.status}${xhr.statusText} for url: ${url}`\n )\n );\n } else {\n logger.debug(\n `====== request processed successfully: ${xhr.status}`\n );\n queueFn(null, xhr.status);\n }\n }\n };\n\n xhr.send(JSON.stringify(message, replacer));\n } catch (error) {\n queueFn(error);\n }\n }\n\n /**\n *\n *\n * @param {RudderElement} rudderElement\n * @memberof EventRepository\n */\n enqueue(rudderElement, type) {\n const message = rudderElement.getElementContent();\n\n const headers = {\n \"Content-Type\": \"application/json\",\n Authorization: `Basic ${btoa(`${this.writeKey}:`)}`,\n AnonymousId: btoa(message.anonymousId),\n };\n\n message.originalTimestamp = getCurrentTimeFormatted();\n message.sentAt = getCurrentTimeFormatted(); // add this, will get modified when actually being sent\n\n // check message size, if greater log an error\n if (JSON.stringify(message).length > MESSAGE_LENGTH) {\n logger.error(\n \"[EventRepository] enqueue:: message length greater 32 Kb \",\n message\n );\n }\n\n // modify the url for event specific endpoints\n const url = this.url.slice(-1) == \"/\" ? this.url.slice(0, -1) : this.url;\n // add items to the queue\n this.payloadQueue.addItem({\n url: `${url}/v1/${type}`,\n headers,\n message,\n });\n }\n}\nlet eventRepository = new EventRepository();\nexport { eventRepository as EventRepository };\n","import { getDefaultPageProperties } from \"./utils\";\nimport logger from \"./logUtil\";\n\nfunction addDomEventHandlers(rudderanalytics) {\n const handler = (e) => {\n e = e || window.event;\n let target = e.target || e.srcElement;\n\n if (isTextNode(target)) {\n target = target.parentNode;\n }\n if (shouldTrackDomEvent(target, e)) {\n logger.debug(\"to be tracked \", e.type);\n } else {\n logger.debug(\"not to be tracked \", e.type);\n }\n trackWindowEvent(e, rudderanalytics);\n };\n register_event(document, \"submit\", handler, true);\n register_event(document, \"change\", handler, true);\n register_event(document, \"click\", handler, true);\n rudderanalytics.page();\n}\n\nfunction register_event(element, type, handler, useCapture) {\n if (!element) {\n logger.error(\n \"[Autotrack] register_event:: No valid element provided to register_event\"\n );\n return;\n }\n element.addEventListener(type, handler, !!useCapture);\n}\n\nfunction shouldTrackDomEvent(el, event) {\n if (!el || isTag(el, \"html\") || !isElementNode(el)) {\n return false;\n }\n const tag = el.tagName.toLowerCase();\n switch (tag) {\n case \"html\":\n return false;\n case \"form\":\n return event.type === \"submit\";\n case \"input\":\n if ([\"button\", \"submit\"].indexOf(el.getAttribute(\"type\")) === -1) {\n return event.type === \"change\";\n }\n return event.type === \"click\";\n\n case \"select\":\n case \"textarea\":\n return event.type === \"change\";\n default:\n return event.type === \"click\";\n }\n}\n\nfunction isTag(el, tag) {\n return el && el.tagName && el.tagName.toLowerCase() === tag.toLowerCase();\n}\n\nfunction isElementNode(el) {\n return el && el.nodeType === 1; // Node.ELEMENT_NODE - use integer constant for browser portability\n}\n\nfunction isTextNode(el) {\n return el && el.nodeType === 3; // Node.TEXT_NODE - use integer constant for browser portability\n}\n\n// excerpt from https://github.com/mixpanel/mixpanel-js/blob/master/src/autotrack-utils.js\nfunction shouldTrackElement(el) {\n\n if (!el.parentNode || isTag(el, \"body\")) return false;\n\n let curEl = el;\n while (curEl.parentNode && !isTag(curEl, \"body\")) {\n let classes = getClassName(el).split(\" \");\n\n // if explicitly specified \"rudder-no-track\", even at parent level, dont track the child nodes too.\n if (classes.indexOf(\"rudder-no-track\") >= 0) {\n return false;\n }\n curEl = curEl.parentNode;\n }\n\n // if explicitly set \"rudder-include\", at element level, then track the element even if the element is hidden or sensitive.\n let classes = getClassName(el).split(\" \");\n if (classes.indexOf(\"rudder-include\") >= 0) {\n return true;\n }\n\n // for general elements, do not track input/select/textarea(s)\n if (\n isTag(el, 'input') ||\n isTag(el, 'select') ||\n isTag(el, 'textarea') ||\n el.getAttribute('contenteditable') === 'true'\n ) {\n return false;\n } else if (el.getAttribute('contenteditable') === 'inherit'){\n for(curEl = el.parentNode; curEl.parentNode && !isTag(curEl, \"body\"); curEl = curEl.parentNode){\n if(curEl.getAttribute('contenteditable') === 'true'){\n return false;\n }\n }\n }\n\n // do not track hidden/password elements\n let type = el.type || '';\n if (typeof type === 'string') { // it's possible for el.type to be a DOM element if el is a form with a child input[name=\"type\"]\n switch(type.toLowerCase()) {\n case 'hidden':\n return false;\n case 'password':\n return false;\n }\n }\n\n // filter out data from fields that look like sensitive field - \n // safeguard - match with regex with possible strings as id or name of an element for creditcard, password, ssn, pan, adhar\n let name = el.name || el.id || '';\n if (typeof name === 'string') { // it's possible for el.name or el.id to be a DOM element if el is a form with a child input[name=\"name\"]\n let sensitiveNameRegex = /^adhar|cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pan|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;\n if (sensitiveNameRegex.test(name.replace(/[^a-zA-Z0-9]/g, ''))) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction getClassName(el) {\n switch (typeof el.className) {\n case \"string\":\n return el.className;\n case \"object\": // handle cases where className might be SVGAnimatedString or some other type\n return el.className.baseVal || el.getAttribute(\"class\") || \"\";\n default:\n // future proof\n return \"\";\n }\n}\n\nfunction trackWindowEvent(e, rudderanalytics) {\n let target = e.target || e.srcElement;\n let formValues;\n if (isTextNode(target)) {\n target = target.parentNode;\n }\n\n if (shouldTrackDomEvent(target, e)) {\n if (target.tagName.toLowerCase() == \"form\") {\n formValues = {};\n for (let i = 0; i < target.elements.length; i++) {\n const formElement = target.elements[i];\n if (\n shouldTrackElement(formElement) &&\n isValueToBeTrackedFromTrackingList(formElement, rudderanalytics.trackValues)\n ) {\n const name = formElement.id ? formElement.id : formElement.name;\n if (name && typeof name === \"string\") {\n const key = formElement.id ? formElement.id : formElement.name;\n // formElement.value gives the same thing\n let value = formElement.id\n ? document.getElementById(formElement.id).value\n : document.getElementsByName(formElement.name)[0].value;\n if (\n formElement.type === \"checkbox\" ||\n formElement.type === \"radio\"\n ) {\n value = formElement.checked;\n }\n if (key.trim() !== \"\") {\n formValues[encodeURIComponent(key)] = encodeURIComponent(value);\n }\n }\n }\n }\n }\n const targetElementList = [];\n let curEl = target;\n if(isExplicitNoTrack(curEl)){\n return false;\n }\n while (curEl.parentNode && !isTag(curEl, \"body\")) {\n if(shouldTrackElement(curEl)){\n targetElementList.push(curEl);\n }\n curEl = curEl.parentNode;\n }\n\n const elementsJson = [];\n let href;\n\n targetElementList.forEach((el) => {\n\n // if the element or a parent element is an anchor tag\n // include the href as a property\n if (el.tagName.toLowerCase() === \"a\") {\n href = el.getAttribute(\"href\");\n href = isValueToBeTracked(href) && href;\n }\n elementsJson.push(getPropertiesFromElement(el, rudderanalytics));\n });\n\n if (targetElementList && targetElementList.length == 0) {\n return false;\n }\n\n let elementText = \"\";\n const text = getText(target); \n if (text && text.length) {\n elementText = text;\n }\n const props = {\n event_type: e.type,\n page: getDefaultPageProperties(),\n elements: elementsJson,\n el_attr_href: href,\n el_text: elementText,\n };\n\n if (formValues) {\n props.form_values = formValues;\n }\n\n logger.debug(\"web_event\", props);\n rudderanalytics.track(\"autotrack\", props);\n return true;\n }\n}\n\nfunction isExplicitNoTrack(el){\n const classes = getClassName(el).split(\" \");\n if (classes.indexOf(\"rudder-no-track\") >= 0) {\n return true;\n }\n return false;\n}\n\n// excerpt from https://github.com/mixpanel/mixpanel-js/blob/master/src/autotrack-utils.js\nfunction isValueToBeTracked(value){\n if(value === null || value === undefined){\n return false;\n }\n if (typeof value === 'string') {\n value = value.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n // check to see if input value looks like a credit card number\n // see: https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9781449327453/ch04s20.html\n var ccRegex = /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;\n if (ccRegex.test((value || '').replace(/[- ]/g, ''))) {\n return false;\n }\n\n // check to see if input value looks like a social security number\n var ssnRegex = /(^\\d{3}-?\\d{2}-?\\d{4}$)/;\n if (ssnRegex.test(value)) {\n return false;\n }\n\n // check to see if input value looks like a adhar number\n var adharRegex = /(^\\d{4}-?\\d{4}-?\\d{4}$)/;\n if (adharRegex.test(value)) {\n return false;\n }\n\n // check to see if input value looks like a PAN number\n var panRegex = /(^\\w{5}-?\\d{4}-?\\w{1}$)/;\n if (panRegex.test(value)) {\n return false;\n }\n}\n\nreturn true;\n}\n\n// if the element name is provided in the valTrackingList while loading rudderanalytics, track the value.\n/**\n * \n * @param {*} el \n * @param {*} includeList - valTrackingList provided in rudderanalytics.load()\n */\nfunction isValueToBeTrackedFromTrackingList(el, includeList) {\n const elAttributesLength = el.attributes.length;\n for (let i = 0; i < elAttributesLength; i++) {\n const { value } = el.attributes[i];\n if (includeList.indexOf(value) > -1) {\n return true;\n }\n }\n return false;\n}\n\nfunction getText(el) {\n let text = \"\";\n el.childNodes.forEach(function (value) {\n if (value.nodeType === Node.TEXT_NODE) {\n let textContent = value.nodeValue.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n // take each word from the text content and check whether the value should be tracked. Also, replace the whitespaces.\n let textValue = textContent.split(/(\\s+)/).filter(isValueToBeTracked).join('').replace(/[\\r\\n]/g, ' ');\n text += textValue;\n }\n });\n return text.trim();\n}\n\nfunction getPropertiesFromElement(elem, rudderanalytics) {\n const props = {\n classes: getClassName(elem).split(\" \"),\n tag_name: elem.tagName.toLowerCase(),\n };\n\n const attrLength = elem.attributes.length;\n for (let i = 0; i < attrLength; i++) {\n const { name } = elem.attributes[i];\n const { value } = elem.attributes[i];\n if (value && isValueToBeTracked(value)) {\n props[`attr__${name}`] = value;\n }\n if (\n (name == \"name\" || name == \"id\") &&\n isValueToBeTrackedFromTrackingList(elem, rudderanalytics.trackValues)\n ) {\n props.field_value =\n name == \"id\"\n ? document.getElementById(value).value\n : document.getElementsByName(value)[0].value;\n\n if (elem.type === \"checkbox\" || elem.type === \"radio\") {\n props.field_value = elem.checked;\n }\n }\n }\n\n let nthChild = 1;\n let nthOfType = 1;\n let currentElem = elem;\n while ((currentElem = previousElementSibling(currentElem))) {\n nthChild++;\n if (currentElem.tagName === elem.tagName) {\n nthOfType++;\n }\n }\n props.nth_child = nthChild;\n props.nth_of_type = nthOfType;\n\n return props;\n}\n\nfunction previousElementSibling(el) {\n if (el.previousElementSibling) {\n return el.previousElementSibling;\n }\n do {\n el = el.previousSibling;\n } while (el && !isElementNode(el));\n return el;\n}\nexport { addDomEventHandlers };\n","/* eslint-disable new-cap */\n/* eslint-disable func-names */\n/* eslint-disable eqeqeq */\n/* eslint-disable no-prototype-builtins */\n/* eslint-disable class-methods-use-this */\n/* eslint-disable no-restricted-syntax */\n/* eslint-disable guard-for-in */\n/* eslint-disable no-sequences */\n/* eslint-disable no-multi-assign */\n/* eslint-disable no-unused-expressions */\n/* eslint-disable import/extensions */\n/* eslint-disable no-param-reassign */\nimport Emitter from \"component-emitter\";\nimport after from \"after\";\nimport querystring from \"component-querystring\";\nimport {\n getJSONTrimmed,\n generateUUID,\n handleError,\n getDefaultPageProperties,\n getUserProvidedConfigUrl,\n findAllEnabledDestinations,\n tranformToRudderNames,\n transformToServerNames,\n} from \"./utils/utils\";\nimport {\n CONFIG_URL,\n MAX_WAIT_FOR_INTEGRATION_LOAD,\n INTEGRATION_LOAD_CHECK_INTERVAL,\n} from \"./utils/constants\";\nimport { integrations } from \"./integrations\";\nimport RudderElementBuilder from \"./utils/RudderElementBuilder\";\nimport Storage from \"./utils/storage\";\nimport { EventRepository } from \"./utils/EventRepository\";\nimport logger from \"./utils/logUtil\";\nimport { addDomEventHandlers } from \"./utils/autotrack.js\";\nimport ScriptLoader from \"./integrations/ScriptLoader\";\n\nconst queryDefaults = {\n trait: \"ajs_trait_\",\n prop: \"ajs_prop_\",\n};\n\n// https://unpkg.com/test-rudder-sdk@1.0.5/dist/browser.js\n\n/**\n * Add the rudderelement object to flush queue\n *\n * @param {RudderElement} rudderElement\n */\nfunction enqueue(rudderElement, type) {\n if (!this.eventRepository) {\n this.eventRepository = EventRepository;\n }\n this.eventRepository.enqueue(rudderElement, type);\n}\n\n/**\n * class responsible for handling core\n * event tracking functionalities\n */\nclass Analytics {\n /**\n * Creates an instance of Analytics.\n * @memberof Analytics\n */\n constructor() {\n this.autoTrackHandlersRegistered = false;\n this.autoTrackFeatureEnabled = false;\n this.initialized = false;\n this.trackValues = [];\n this.eventsBuffer = [];\n this.clientIntegrations = [];\n this.loadOnlyIntegrations = {};\n this.clientIntegrationObjects = undefined;\n this.successfullyLoadedIntegration = [];\n this.failedToBeLoadedIntegration = [];\n this.toBeProcessedArray = [];\n this.toBeProcessedByIntegrationArray = [];\n this.storage = Storage;\n this.eventRepository = EventRepository;\n this.sendAdblockPage = false;\n this.sendAdblockPageOptions = {};\n this.clientSuppliedCallbacks = {};\n this.readyCallback = () => {};\n this.executeReadyCallback = undefined;\n this.methodToCallbackMapping = {\n syncPixel: \"syncPixelCallback\",\n };\n this.loaded = false;\n }\n\n /**\n * initialize the user after load config\n */\n initializeUser() {\n this.userId =\n this.storage.getUserId() != undefined ? this.storage.getUserId() : \"\";\n\n this.userTraits =\n this.storage.getUserTraits() != undefined\n ? this.storage.getUserTraits()\n : {};\n\n this.groupId =\n this.storage.getGroupId() != undefined ? this.storage.getGroupId() : \"\";\n\n this.groupTraits =\n this.storage.getGroupTraits() != undefined\n ? this.storage.getGroupTraits()\n : {};\n\n this.anonymousId = this.getAnonymousId();\n\n // save once for storing older values to encrypted\n this.storage.setUserId(this.userId);\n this.storage.setAnonymousId(this.anonymousId);\n this.storage.setGroupId(this.groupId);\n this.storage.setUserTraits(this.userTraits);\n this.storage.setGroupTraits(this.groupTraits);\n }\n\n /**\n * Process the response from control plane and\n * call initialize for integrations\n *\n * @param {*} status\n * @param {*} response\n * @memberof Analytics\n */\n processResponse(status, response) {\n try {\n logger.debug(`===in process response=== ${status}`);\n response = JSON.parse(response);\n if (\n response.source.useAutoTracking &&\n !this.autoTrackHandlersRegistered\n ) {\n this.autoTrackFeatureEnabled = true;\n addDomEventHandlers(this);\n this.autoTrackHandlersRegistered = true;\n }\n response.source.destinations.forEach(function (destination, index) {\n logger.debug(\n `Destination ${index} Enabled? ${destination.enabled} Type: ${destination.destinationDefinition.name} Use Native SDK? ${destination.config.useNativeSDK}`\n );\n if (destination.enabled) {\n this.clientIntegrations.push({\n name: destination.destinationDefinition.name,\n config: destination.config,\n });\n }\n }, this);\n\n logger.debug(\"this.clientIntegrations: \", this.clientIntegrations);\n // intersection of config-plane native sdk destinations with sdk load time destination list\n this.clientIntegrations = findAllEnabledDestinations(\n this.loadOnlyIntegrations,\n this.clientIntegrations\n );\n\n // remove from the list which don't have support yet in SDK\n this.clientIntegrations = this.clientIntegrations.filter((intg) => {\n return integrations[intg.name] != undefined;\n });\n\n this.init(this.clientIntegrations);\n } catch (error) {\n handleError(error);\n logger.debug(\"===handling config BE response processing error===\");\n logger.debug(\n \"autoTrackHandlersRegistered\",\n this.autoTrackHandlersRegistered\n );\n if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {\n addDomEventHandlers(this);\n this.autoTrackHandlersRegistered = true;\n }\n }\n }\n\n /**\n * Initialize integrations by addinfg respective scripts\n * keep the instances reference in core\n *\n * @param {*} intgArray\n * @returns\n * @memberof Analytics\n */\n init(intgArray) {\n const self = this;\n logger.debug(\"supported intgs \", integrations);\n // this.clientIntegrationObjects = [];\n\n if (!intgArray || intgArray.length == 0) {\n if (this.readyCallback) {\n this.readyCallback();\n }\n this.toBeProcessedByIntegrationArray = [];\n return;\n }\n\n intgArray.forEach((intg) => {\n try {\n logger.debug(\n \"[Analytics] init :: trying to initialize integration name:: \",\n intg.name\n );\n const intgClass = integrations[intg.name];\n const destConfig = intg.config;\n const intgInstance = new intgClass(destConfig, self);\n intgInstance.init();\n\n logger.debug(\"initializing destination: \", intg);\n\n this.isInitialized(intgInstance).then(this.replayEvents);\n } catch (e) {\n logger.error(\n \"[Analytics] initialize integration (integration.init()) failed :: \",\n intg.name\n );\n }\n });\n }\n\n // eslint-disable-next-line class-methods-use-this\n replayEvents(object) {\n if (\n object.successfullyLoadedIntegration.length +\n object.failedToBeLoadedIntegration.length ===\n object.clientIntegrations.length\n ) {\n logger.debug(\n \"===replay events called====\",\n object.successfullyLoadedIntegration.length,\n object.failedToBeLoadedIntegration.length\n );\n // eslint-disable-next-line no-param-reassign\n object.clientIntegrationObjects = [];\n // eslint-disable-next-line no-param-reassign\n object.clientIntegrationObjects = object.successfullyLoadedIntegration;\n\n logger.debug(\n \"==registering after callback===\",\n object.clientIntegrationObjects.length\n );\n object.executeReadyCallback = after(\n object.clientIntegrationObjects.length,\n object.readyCallback\n );\n\n logger.debug(\"==registering ready callback===\");\n object.on(\"ready\", object.executeReadyCallback);\n\n object.clientIntegrationObjects.forEach((intg) => {\n logger.debug(\"===looping over each successful integration====\");\n if (!intg.isReady || intg.isReady()) {\n logger.debug(\"===letting know I am ready=====\", intg.name);\n object.emit(\"ready\");\n }\n });\n\n if (object.toBeProcessedByIntegrationArray.length > 0) {\n // send the queued events to the fetched integration\n object.toBeProcessedByIntegrationArray.forEach((event) => {\n const methodName = event[0];\n event.shift();\n\n // convert common names to sdk identified name\n if (Object.keys(event[0].message.integrations).length > 0) {\n tranformToRudderNames(event[0].message.integrations);\n }\n\n // if not specified at event level, All: true is default\n const clientSuppliedIntegrations = event[0].message.integrations;\n\n // get intersection between config plane native enabled destinations\n // (which were able to successfully load on the page) vs user supplied integrations\n const succesfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(\n clientSuppliedIntegrations,\n object.clientIntegrationObjects\n );\n\n // send to all integrations now from the 'toBeProcessedByIntegrationArray' replay queue\n for (\n let i = 0;\n i < succesfulLoadedIntersectClientSuppliedIntegrations.length;\n i += 1\n ) {\n try {\n if (\n !succesfulLoadedIntersectClientSuppliedIntegrations[i]\n .isFailed ||\n !succesfulLoadedIntersectClientSuppliedIntegrations[\n i\n ].isFailed()\n ) {\n if (\n succesfulLoadedIntersectClientSuppliedIntegrations[i][\n methodName\n ]\n ) {\n succesfulLoadedIntersectClientSuppliedIntegrations[i][\n methodName\n ](...event);\n }\n }\n } catch (error) {\n handleError(error);\n }\n }\n });\n object.toBeProcessedByIntegrationArray = [];\n }\n }\n }\n\n pause(time) {\n return new Promise((resolve) => {\n setTimeout(resolve, time);\n });\n }\n\n isInitialized(instance, time = 0) {\n return new Promise((resolve) => {\n if (instance.isLoaded()) {\n logger.debug(\"===integration loaded successfully====\", instance.name);\n this.successfullyLoadedIntegration.push(instance);\n return resolve(this);\n }\n if (time >= MAX_WAIT_FOR_INTEGRATION_LOAD) {\n logger.debug(\"====max wait over====\");\n this.failedToBeLoadedIntegration.push(instance);\n return resolve(this);\n }\n\n this.pause(INTEGRATION_LOAD_CHECK_INTERVAL).then(() => {\n logger.debug(\"====after pause, again checking====\");\n return this.isInitialized(\n instance,\n time + INTEGRATION_LOAD_CHECK_INTERVAL\n ).then(resolve);\n });\n });\n }\n\n /**\n * Process page params and forward to page call\n *\n * @param {*} category\n * @param {*} name\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n page(category, name, properties, options, callback) {\n if (!this.loaded) return;\n if (typeof options === \"function\") (callback = options), (options = null);\n if (typeof properties === \"function\")\n (callback = properties), (options = properties = null);\n if (typeof name === \"function\")\n (callback = name), (options = properties = name = null);\n if (\n typeof category === \"object\" &&\n category != null &&\n category != undefined\n )\n (options = name), (properties = category), (name = category = null);\n if (typeof name === \"object\" && name != null && name != undefined)\n (options = properties), (properties = name), (name = null);\n if (typeof category === \"string\" && typeof name !== \"string\")\n (name = category), (category = null);\n if (this.sendAdblockPage && category != \"RudderJS-Initiated\") {\n this.sendSampleRequest();\n }\n this.processPage(category, name, properties, options, callback);\n }\n\n /**\n * Process track params and forward to track call\n *\n * @param {*} event\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n track(event, properties, options, callback) {\n if (!this.loaded) return;\n if (typeof options === \"function\") (callback = options), (options = null);\n if (typeof properties === \"function\")\n (callback = properties), (options = null), (properties = null);\n\n this.processTrack(event, properties, options, callback);\n }\n\n /**\n * Process identify params and forward to indentify call\n *\n * @param {*} userId\n * @param {*} traits\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n identify(userId, traits, options, callback) {\n if (!this.loaded) return;\n if (typeof options === \"function\") (callback = options), (options = null);\n if (typeof traits === \"function\")\n (callback = traits), (options = null), (traits = null);\n if (typeof userId === \"object\")\n (options = traits), (traits = userId), (userId = this.userId);\n\n this.processIdentify(userId, traits, options, callback);\n }\n\n /**\n *\n * @param {*} to\n * @param {*} from\n * @param {*} options\n * @param {*} callback\n */\n alias(to, from, options, callback) {\n if (!this.loaded) return;\n if (typeof options === \"function\") (callback = options), (options = null);\n if (typeof from === \"function\")\n (callback = from), (options = null), (from = null);\n if (typeof from === \"object\") (options = from), (from = null);\n\n const rudderElement = new RudderElementBuilder().setType(\"alias\").build();\n rudderElement.message.previousId =\n from || (this.userId ? this.userId : this.getAnonymousId());\n rudderElement.message.userId = to;\n\n this.processAndSendDataToDestinations(\n \"alias\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n *\n * @param {*} to\n * @param {*} from\n * @param {*} options\n * @param {*} callback\n */\n group(groupId, traits, options, callback) {\n if (!this.loaded) return;\n if (!arguments.length) return;\n\n if (typeof options === \"function\") (callback = options), (options = null);\n if (typeof traits === \"function\")\n (callback = traits), (options = null), (traits = null);\n if (typeof groupId === \"object\")\n (options = traits), (traits = groupId), (groupId = this.groupId);\n\n this.groupId = groupId;\n this.storage.setGroupId(this.groupId);\n\n const rudderElement = new RudderElementBuilder().setType(\"group\").build();\n if (traits) {\n for (const key in traits) {\n this.groupTraits[key] = traits[key];\n }\n } else {\n this.groupTraits = {};\n }\n this.storage.setGroupTraits(this.groupTraits);\n\n this.processAndSendDataToDestinations(\n \"group\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Send page call to Rudder BE and to initialized integrations\n *\n * @param {*} category\n * @param {*} name\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n processPage(category, name, properties, options, callback) {\n const rudderElement = new RudderElementBuilder().setType(\"page\").build();\n if (!properties) {\n properties = {};\n }\n if (name) {\n rudderElement.message.name = name;\n properties.name = name;\n }\n if (category) {\n rudderElement.message.category = category;\n properties.category = category;\n }\n rudderElement.message.properties = this.getPageProperties(properties); // properties;\n\n this.trackPage(rudderElement, options, callback);\n }\n\n /**\n * Send track call to Rudder BE and to initialized integrations\n *\n * @param {*} event\n * @param {*} properties\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n processTrack(event, properties, options, callback) {\n const rudderElement = new RudderElementBuilder().setType(\"track\").build();\n if (event) {\n rudderElement.setEventName(event);\n }\n if (properties) {\n rudderElement.setProperty(properties);\n } else {\n rudderElement.setProperty({});\n }\n\n this.trackEvent(rudderElement, options, callback);\n }\n\n /**\n * Send identify call to Rudder BE and to initialized integrations\n *\n * @param {*} userId\n * @param {*} traits\n * @param {*} options\n * @param {*} callback\n * @memberof Analytics\n */\n processIdentify(userId, traits, options, callback) {\n if (userId && this.userId && userId !== this.userId) {\n this.reset();\n }\n this.userId = userId;\n this.storage.setUserId(this.userId);\n\n const rudderElement = new RudderElementBuilder()\n .setType(\"identify\")\n .build();\n if (traits) {\n for (const key in traits) {\n this.userTraits[key] = traits[key];\n }\n this.storage.setUserTraits(this.userTraits);\n }\n\n this.identifyUser(rudderElement, options, callback);\n }\n\n /**\n * Identify call supporting rudderelement from builder\n *\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n identifyUser(rudderElement, options, callback) {\n if (rudderElement.message.userId) {\n this.userId = rudderElement.message.userId;\n this.storage.setUserId(this.userId);\n }\n\n if (\n rudderElement &&\n rudderElement.message &&\n rudderElement.message.context &&\n rudderElement.message.context.traits\n ) {\n this.userTraits = {\n ...rudderElement.message.context.traits,\n };\n this.storage.setUserTraits(this.userTraits);\n }\n\n this.processAndSendDataToDestinations(\n \"identify\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Page call supporting rudderelement from builder\n *\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n trackPage(rudderElement, options, callback) {\n this.processAndSendDataToDestinations(\n \"page\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Track call supporting rudderelement from builder\n *\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n trackEvent(rudderElement, options, callback) {\n this.processAndSendDataToDestinations(\n \"track\",\n rudderElement,\n options,\n callback\n );\n }\n\n /**\n * Process and send data to destinations along with rudder BE\n *\n * @param {*} type\n * @param {*} rudderElement\n * @param {*} callback\n * @memberof Analytics\n */\n processAndSendDataToDestinations(type, rudderElement, options, callback) {\n try {\n if (!this.anonymousId) {\n this.setAnonymousId();\n }\n\n // assign page properties to context\n // rudderElement.message.context.page = getDefaultPageProperties();\n\n rudderElement.message.context.traits = {\n ...this.userTraits,\n };\n\n logger.debug(\"anonymousId: \", this.anonymousId);\n rudderElement.message.anonymousId = this.anonymousId;\n rudderElement.message.userId = rudderElement.message.userId\n ? rudderElement.message.userId\n : this.userId;\n\n if (type == \"group\") {\n if (this.groupId) {\n rudderElement.message.groupId = this.groupId;\n }\n if (this.groupTraits) {\n rudderElement.message.traits = {\n ...this.groupTraits,\n };\n }\n }\n\n this.processOptionsParam(rudderElement, options);\n logger.debug(JSON.stringify(rudderElement));\n\n // structure user supplied integrations object to rudder format\n if (Object.keys(rudderElement.message.integrations).length > 0) {\n tranformToRudderNames(rudderElement.message.integrations);\n }\n\n // if not specified at event level, All: true is default\n const clientSuppliedIntegrations = rudderElement.message.integrations;\n\n // get intersection between config plane native enabled destinations\n // (which were able to successfully load on the page) vs user supplied integrations\n const succesfulLoadedIntersectClientSuppliedIntegrations = findAllEnabledDestinations(\n clientSuppliedIntegrations,\n this.clientIntegrationObjects\n );\n\n // try to first send to all integrations, if list populated from BE\n try {\n succesfulLoadedIntersectClientSuppliedIntegrations.forEach((obj) => {\n if (!obj.isFailed || !obj.isFailed()) {\n if (obj[type]) {\n obj[type](rudderElement);\n }\n }\n });\n } catch (err) {\n handleError({ message: `[sendToNative]:${err}` });\n }\n\n // config plane native enabled destinations, still not completely loaded\n // in the page, add the events to a queue and process later\n if (!this.clientIntegrationObjects) {\n logger.debug(\"pushing in replay queue\");\n // new event processing after analytics initialized but integrations not fetched from BE\n this.toBeProcessedByIntegrationArray.push([type, rudderElement]);\n }\n\n // convert integrations object to server identified names, kind of hack now!\n transformToServerNames(rudderElement.message.integrations);\n\n // self analytics process, send to rudder\n enqueue.call(this, rudderElement, type);\n\n logger.debug(`${type} is called `);\n if (callback) {\n callback();\n }\n } catch (error) {\n handleError(error);\n }\n }\n\n /**\n * process options parameter\n *\n * @param {*} rudderElement\n * @param {*} options\n * @memberof Analytics\n */\n processOptionsParam(rudderElement, options) {\n const { type, properties } = rudderElement.message;\n const toplevelElements = [\n \"integrations\",\n \"anonymousId\",\n \"originalTimestamp\",\n ];\n for (const key in options) {\n if (toplevelElements.includes(key)) {\n rudderElement.message[key] = options[key];\n // special handle for ananymousId as transformation expects anonymousId in traits.\n /* if (key === \"anonymousId\") {\n rudderElement.message.context.traits[\"anonymousId\"] = options[key];\n } */\n } else if (key !== \"context\")\n rudderElement.message.context[key] = options[key];\n else {\n for (const k in options[key]) {\n rudderElement.message.context[k] = options[key][k];\n }\n }\n }\n // assign page properties to context.page\n rudderElement.message.context.page =\n type == \"page\"\n ? this.getContextPageProperties(options, properties)\n : this.getContextPageProperties(options);\n }\n\n getPageProperties(properties, options) {\n const defaultPageProperties = getDefaultPageProperties();\n const optionPageProperties = options && options.page ? options.page : {};\n for (const key in defaultPageProperties) {\n if (properties[key] === undefined) {\n properties[key] =\n optionPageProperties[key] || defaultPageProperties[key];\n }\n }\n return properties;\n }\n\n // Assign page properties to context.page if the same property is not provided under context.page\n getContextPageProperties(options, properties) {\n const defaultPageProperties = getDefaultPageProperties();\n const contextPageProperties = options && options.page ? options.page : {};\n for (const key in defaultPageProperties) {\n if (contextPageProperties[key] === undefined) {\n contextPageProperties[key] =\n properties && properties[key]\n ? properties[key]\n : defaultPageProperties[key];\n }\n }\n return contextPageProperties;\n }\n\n /**\n * Clear user information\n *\n * @memberof Analytics\n */\n reset() {\n if (!this.loaded) return;\n this.userId = \"\";\n this.userTraits = {};\n this.groupId = \"\";\n this.groupTraits = {};\n this.storage.clear();\n }\n\n getAnonymousId() {\n // if (!this.loaded) return;\n this.anonymousId = this.storage.getAnonymousId();\n if (!this.anonymousId) {\n this.setAnonymousId();\n }\n return this.anonymousId;\n }\n\n setAnonymousId(anonymousId) {\n // if (!this.loaded) return;\n this.anonymousId = anonymousId || generateUUID();\n this.storage.setAnonymousId(this.anonymousId);\n }\n\n isValidWriteKey(writeKey) {\n if (\n !writeKey ||\n typeof writeKey !== \"string\" ||\n writeKey.trim().length == 0\n ) {\n return false;\n }\n return true;\n }\n\n isValidServerUrl(serverUrl) {\n if (\n !serverUrl ||\n typeof serverUrl !== \"string\" ||\n serverUrl.trim().length == 0\n ) {\n return false;\n }\n return true;\n }\n\n /**\n * Call control pane to get client configs\n *\n * @param {*} writeKey\n * @memberof Analytics\n */\n load(writeKey, serverUrl, options) {\n logger.debug(\"inside load \");\n if (this.loaded) return;\n let configUrl = CONFIG_URL;\n if (!this.isValidWriteKey(writeKey) || !this.isValidServerUrl(serverUrl)) {\n handleError({\n message:\n \"[Analytics] load:: Unable to load due to wrong writeKey or serverUrl\",\n });\n throw Error(\"failed to initialize\");\n }\n if (options && options.logLevel) {\n logger.setLogLevel(options.logLevel);\n }\n if (options && options.integrations) {\n Object.assign(this.loadOnlyIntegrations, options.integrations);\n tranformToRudderNames(this.loadOnlyIntegrations);\n }\n if (options && options.configUrl) {\n configUrl = getUserProvidedConfigUrl(options.configUrl);\n }\n if (options && options.sendAdblockPage) {\n this.sendAdblockPage = true;\n }\n if (options && options.sendAdblockPageOptions) {\n if (typeof options.sendAdblockPageOptions === \"object\") {\n this.sendAdblockPageOptions = options.sendAdblockPageOptions;\n }\n }\n if (options && options.clientSuppliedCallbacks) {\n // convert to rudder recognised method names\n const tranformedCallbackMapping = {};\n Object.keys(this.methodToCallbackMapping).forEach((methodName) => {\n if (this.methodToCallbackMapping.hasOwnProperty(methodName)) {\n if (\n options.clientSuppliedCallbacks[\n this.methodToCallbackMapping[methodName]\n ]\n ) {\n tranformedCallbackMapping[methodName] =\n options.clientSuppliedCallbacks[\n this.methodToCallbackMapping[methodName]\n ];\n }\n }\n });\n Object.assign(this.clientSuppliedCallbacks, tranformedCallbackMapping);\n this.registerCallbacks(true);\n }\n\n this.eventRepository.writeKey = writeKey;\n if (serverUrl) {\n this.eventRepository.url = serverUrl;\n }\n this.initializeUser();\n this.loaded = true;\n if (\n options &&\n options.valTrackingList &&\n options.valTrackingList.push == Array.prototype.push\n ) {\n this.trackValues = options.valTrackingList;\n }\n if (options && options.useAutoTracking) {\n this.autoTrackFeatureEnabled = true;\n if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {\n addDomEventHandlers(this);\n this.autoTrackHandlersRegistered = true;\n logger.debug(\n \"autoTrackHandlersRegistered\",\n this.autoTrackHandlersRegistered\n );\n }\n }\n try {\n getJSONTrimmed(this, configUrl, writeKey, this.processResponse);\n } catch (error) {\n handleError(error);\n if (this.autoTrackFeatureEnabled && !this.autoTrackHandlersRegistered) {\n addDomEventHandlers(this);\n }\n }\n }\n\n ready(callback) {\n if (!this.loaded) return;\n if (typeof callback === \"function\") {\n this.readyCallback = callback;\n return;\n }\n logger.error(\"ready callback is not a function\");\n }\n\n initializeCallbacks() {\n Object.keys(this.methodToCallbackMapping).forEach((methodName) => {\n if (this.methodToCallbackMapping.hasOwnProperty(methodName)) {\n this.on(methodName, () => {});\n }\n });\n }\n\n registerCallbacks(calledFromLoad) {\n if (!calledFromLoad) {\n Object.keys(this.methodToCallbackMapping).forEach((methodName) => {\n if (this.methodToCallbackMapping.hasOwnProperty(methodName)) {\n if (window.rudderanalytics) {\n if (\n typeof window.rudderanalytics[\n this.methodToCallbackMapping[methodName]\n ] === \"function\"\n ) {\n this.clientSuppliedCallbacks[methodName] =\n window.rudderanalytics[\n this.methodToCallbackMapping[methodName]\n ];\n }\n }\n // let callback =\n // ? typeof window.rudderanalytics[\n // this.methodToCallbackMapping[methodName]\n // ] == \"function\"\n // ? window.rudderanalytics[this.methodToCallbackMapping[methodName]]\n // : () => {}\n // : () => {};\n\n // logger.debug(\"registerCallbacks\", methodName, callback);\n\n // this.on(methodName, callback);\n }\n });\n }\n\n Object.keys(this.clientSuppliedCallbacks).forEach((methodName) => {\n if (this.clientSuppliedCallbacks.hasOwnProperty(methodName)) {\n logger.debug(\n \"registerCallbacks\",\n methodName,\n this.clientSuppliedCallbacks[methodName]\n );\n this.on(methodName, this.clientSuppliedCallbacks[methodName]);\n }\n });\n }\n\n sendSampleRequest() {\n ScriptLoader(\n \"ad-block\",\n \"//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js\"\n );\n }\n\n /**\n * parse the given query string into usable Rudder object\n * @param {*} query\n */\n parseQueryString(query) {\n function getTraitsFromQueryObject(qObj) {\n const traits = {};\n Object.keys(qObj).forEach((key) => {\n if (key.substr(0, queryDefaults.trait.length) == queryDefaults.trait) {\n traits[key.substr(queryDefaults.trait.length)] = qObj[key];\n }\n });\n\n return traits;\n }\n\n function getEventPropertiesFromQueryObject(qObj) {\n const props = {};\n Object.keys(qObj).forEach((key) => {\n if (key.substr(0, queryDefaults.prop.length) == queryDefaults.prop) {\n props[key.substr(queryDefaults.prop.length)] = qObj[key];\n }\n });\n\n return props;\n }\n\n const returnObj = {};\n const queryObject = querystring.parse(query);\n const userTraits = getTraitsFromQueryObject(queryObject);\n const eventProps = getEventPropertiesFromQueryObject(queryObject);\n if (queryObject.ajs_uid) {\n returnObj.userId = queryObject.ajs_uid;\n returnObj.traits = userTraits;\n }\n if (queryObject.ajs_aid) {\n returnObj.anonymousId = queryObject.ajs_aid;\n }\n if (queryObject.ajs_event) {\n returnObj.event = queryObject.ajs_event;\n returnObj.properties = eventProps;\n }\n\n return returnObj;\n }\n}\n\nfunction pushDataToAnalyticsArray(argumentsArray, obj) {\n if (obj.anonymousId) {\n if (obj.userId) {\n argumentsArray.unshift(\n [\"setAnonymousId\", obj.anonymousId],\n [\"identify\", obj.userId, obj.traits]\n );\n } else {\n argumentsArray.unshift([\"setAnonymousId\", obj.anonymousId]);\n }\n } else if (obj.userId) {\n argumentsArray.unshift([\"identify\", obj.userId, obj.traits]);\n }\n\n if (obj.event) {\n argumentsArray.push([\"track\", obj.event, obj.properties]);\n }\n}\n\nconst instance = new Analytics();\n\nEmitter(instance);\n\nwindow.addEventListener(\n \"error\",\n (e) => {\n handleError(e, instance);\n },\n true\n);\n\n// if (process.browser) {\n// test for adblocker\n// instance.sendSampleRequest()\n\n// initialize supported callbacks\ninstance.initializeCallbacks();\n\n// register supported callbacks\ninstance.registerCallbacks(false);\nconst eventsPushedAlready =\n !!window.rudderanalytics &&\n window.rudderanalytics.push == Array.prototype.push;\n\nconst argumentsArray = window.rudderanalytics;\n\nwhile (argumentsArray && argumentsArray[0] && argumentsArray[0][0] !== \"load\") {\n argumentsArray.shift();\n}\nif (\n argumentsArray &&\n argumentsArray.length > 0 &&\n argumentsArray[0][0] === \"load\"\n) {\n const method = argumentsArray[0][0];\n argumentsArray[0].shift();\n logger.debug(\"=====from init, calling method:: \", method);\n instance[method](...argumentsArray[0]);\n argumentsArray.shift();\n}\n\n// once loaded, parse querystring of the page url to send events\nconst parsedQueryObject = instance.parseQueryString(window.location.search);\n\npushDataToAnalyticsArray(argumentsArray, parsedQueryObject);\n\nif (eventsPushedAlready && argumentsArray && argumentsArray.length > 0) {\n for (let i = 0; i < argumentsArray.length; i++) {\n instance.toBeProcessedArray.push(argumentsArray[i]);\n }\n\n for (let i = 0; i < instance.toBeProcessedArray.length; i++) {\n const event = [...instance.toBeProcessedArray[i]];\n const method = event[0];\n event.shift();\n logger.debug(\"=====from init, calling method:: \", method);\n instance[method](...event);\n }\n instance.toBeProcessedArray = [];\n}\n// }\n\nconst ready = instance.ready.bind(instance);\nconst identify = instance.identify.bind(instance);\nconst page = instance.page.bind(instance);\nconst track = instance.track.bind(instance);\nconst alias = instance.alias.bind(instance);\nconst group = instance.group.bind(instance);\nconst reset = instance.reset.bind(instance);\nconst load = instance.load.bind(instance);\nconst initialized = (instance.initialized = true);\nconst getAnonymousId = instance.getAnonymousId.bind(instance);\nconst setAnonymousId = instance.setAnonymousId.bind(instance);\n\nexport {\n initialized,\n ready,\n page,\n track,\n load,\n identify,\n reset,\n alias,\n group,\n getAnonymousId,\n setAnonymousId,\n};\n"],"names":["Emitter","obj","key","prototype","mixin","module","on","addEventListener","event","fn","_callbacks","this","push","once","off","apply","arguments","removeListener","removeAllListeners","removeEventListener","length","cb","callbacks","i","splice","emit","args","Array","len","slice","listeners","hasListeners","count","callback","err_cb","bail","noop","proxy","err","result","Error","exports","str","replace","pattern","Object","toString","decode","decodeURIComponent","e","trim","charAt","pairs","split","m","parts","exec","port","protocol","location","url","a","document","createElement","href","host","hash","hostname","pathname","search","query","indexOf","isAbsolute","parse","window","LOG_LEVEL","logger","logLevel","toUpperCase","console","log","commonNames","All","GoogleAnalytics","GA","GoogleAds","GOOGLEADS","Braze","BRAZE","Chartbeat","CHARTBEAT","Comscore","COMSCORE","Customerio","FB_PIXEL","GTM","Hotjar","hotjar","HOTJAR","Hubspot","HUBSPOT","Intercom","INTERCOM","Keen","KEEN","Kissmetrics","KISSMETRICS","Lotame","LOTAME","VWO","OPTIMIZELY","Optimizely","FULLSTORY","Fullstory","BUGSNAG","TVSQUARED","clientToServerNames","CUSTOMERIO","FACEBOOK_PIXEL","HS","TVSQUUARED","MessageType","TRACK","PAGE","IDENTIFY","ECommerceEvents","PRODUCTS_SEARCHED","PRODUCT_LIST_VIEWED","PRODUCT_LIST_FILTERED","PROMOTION_VIEWED","PROMOTION_CLICKED","PRODUCT_CLICKED","PRODUCT_VIEWED","PRODUCT_ADDED","PRODUCT_REMOVED","CART_VIEWED","CHECKOUT_STARTED","CHECKOUT_STEP_VIEWED","CHECKOUT_STEP_COMPLETED","PAYMENT_INFO_ENTERED","ORDER_UPDATED","ORDER_COMPLETED","ORDER_REFUNDED","ORDER_CANCELLED","COUPON_ENTERED","COUPON_APPLIED","COUPON_DENIED","COUPON_REMOVED","PRODUCT_ADDED_TO_WISHLIST","PRODUCT_REMOVED_FROM_WISHLIST","WISH_LIST_PRODUCT_ADDED_TO_CART","PRODUCT_SHARED","CART_SHARED","PRODUCT_REVIEWED","CONFIG_URL","replacer","value","generateUUID","d","Date","getTime","performance","now","c","r","Math","random","floor","getCurrentTimeFormatted","toISOString","handleError","error","analyticsInstance","sampleAdBlockTest","errorMessage","message","undefined","Event","target","localName","src","id","includes","page","path","title","sendAdblockPageOptions","getDefaultPageProperties","canonicalUrl","getCanonicalUrl","referrer","hashIndex","getUrl","tag","tags","getElementsByTagName","getAttribute","getRevenue","properties","eventName","revenue","match","total","val","parseFloat","isNaN","getCurrency","tranformToRudderNames","integrationObject","keys","forEach","hasOwnProperty","findAllEnabledDestinations","sdkSuppliedIntegrations","configPlaneEnabledIntegrations","enabledList","allValue","intg","intgValue","_typeof","name","rejectArr","compact","call","type","rejectarray","rejectobject","arr","ret","k","symbolValueOf","bigIntValueOf","ScriptLoader","js","async","parentNode","insertBefore","config","hubId","hubID","hubspotJs","rudderElement","traits","context","traitsValue","getOwnPropertyDescriptor","hubspotkey","userProperties","user_properties","_hsq","eventValue","objProto","owns","toStr","Symbol","valueOf","BigInt","isActualNaN","NON_HOST_TYPES","number","string","base64Regex","hexRegex","is","defined","empty","equal","other","hosted","instance","constructor","nil","undef","isStandardArguments","isOldArguments","array","arraylike","object","callee","isArray","bool","isFinite","Boolean","Number","date","valid","element","HTMLElement","nodeType","alert","infinite","Infinity","decimal","divisibleBy","n","isDividendInfinite","isDivisorInfinite","isNonZeroNumber","integer","maximum","others","TypeError","minimum","nan","even","odd","ge","gt","le","lt","within","start","finish","primitive","setInterval","regexp","base64","test","hex","symbol","bigint","expr","globals","p","unique","props","_","prefixed","map","require$$0","require$$1","toFunction","defaultToFunction","objectToFunction","Function","prop","stripNested","get","re","RegExp","$0","$1","has","ctx","trackingID","sendUserId","dimensions","metrics","contentGroupings","nonInteraction","anonymizeIp","useGoogleAmpClientId","domain","doubleClick","enhancedEcommerce","enhancedLinkAttribution","includeSearch","setAllMappedProps","siteSpeedSampleRate","sampleRate","trackCategorizedPages","trackNamedPages","optimizeContainerId","optimize","resetCustomDimensionsOnPage","enhancedEcommerceLoaded","eventWithCategoryFieldProductScoped","elementTo","pageCalled","dimensionsArray","to","startsWith","_this","from","metricsArray","contentGroupingsArray","GoogleAnalyticsObject","ga","q","l","loadScript","cookieDomain","defaults","allowLinker","useAmpClientId","ecommerce","userId","custom","metricsFunction","payload","params","filters","sorts","self","options","extractCheckoutOptions","products","data","eventCategory","category","orderId","order_id","eventAction","eventLabel","label","campaign","loadEnhancedEcommerce","each","product","productTrack","createProductTrack","enhancedEcommerceTrackProduct","step","option","pushEnhancedEcommerce","affiliation","tax","shipping","coupon","track","product_id","sku","quantity","enhancedEcommerceTrackProductAction","list","promotion_id","creative","position","item","impressionObj","list_id","brand","band","variant","price","getProductPosition","sorters","join","formatValue","campaignName","source","campaignSource","medium","campaignMedium","content","campaignContent","term","campaignKeyword","setCustomDimenionsAndMetrics","currency","eventProperties","pageTitle","pageview","pagePath","pageReferrer","resetCustomDimensions","property","gaplugins","group","round","action","toLowerCase","x","paymentMethod","shippingMethod","siteId","siteID","_ready","hotjarSiteId","h","o","t","j","hj","_hjSettings","hjid","hjsv","appendChild","anonymousId","conversionId","conversionID","pageLoadConversions","clickEventConversions","defaultPageConversion","dataLayer","gtag","conversionData","getConversionData","conversionLabel","sendToValue","transaction_id","send_to","eventTypeConversions","eventTypeConversion","analytics","accountId","settingsTolerance","isSPA","libraryTolerance","useExistingJquery","sendExperimentTrack","sendExperimentIdentify","account_id","settings_tolerance","library_tolerance","use_existing_jquery","_vwo_code","f","getElementById","removeChild","finished","load","b","innerText","onerror","init","settings_timer","setTimeout","setAttribute","styleSheet","cssText","createTextNode","encodeURIComponent","URL","_vwo_settings_timer","experimentViewedIdentify","experimentViewed","expId","variationId","_vwo_exp","comb_n","experimentId","variationName","identify","GoogleTagManager","containerID","w","s","rudderMessage","sendToGTMDatalayer","pageName","pageCategory","appKey","endPoint","dataCenter","dataCenterArr","gender","appboy","ab","User","Genders","FEMALE","MALE","OTHER","P","y","appboyQueue","getUser","getCachedFeed","Feed","getCachedContentCards","ContentCards","initialize","enableLogging","baseUrl","display","automaticallyShowNewInAppMessages","changeUser","openSession","address","avatar","birthday","email","firstname","lastname","phone","JSON","stringify","setAvatarImageUrl","setEmail","setFirstName","setGender","formatGender","setLastName","setPhoneNumber","setCountry","country","setHomeCity","city","setDateOfBirth","getUTCFullYear","getUTCMonth","getUTCDate","setCustomUserAttribute","currencyCode","del","productId","logPurchase","handlePurchase","handleReservedProperties","logCustomEvent","base64map","crypt","rotl","rotr","endian","randomBytes","bytes","bytesToWords","words","wordsToBytes","bytesToHex","hexToBytes","parseInt","substr","bytesToBase64","triplet","base64ToBytes","imod4","pow","charenc","utf8","stringToBytes","bin","unescape","bytesToString","escape","charCodeAt","String","fromCharCode","isBuffer","readFloatLE","isSlowBuffer","_isBuffer","require$$2","md5","encoding","Uint8Array","FF","_ff","GG","_gg","HH","_hh","II","_ii","aa","bb","cc","dd","_blocksize","_digestsize","digestbytes","asBytes","asString","NAME","API_KEY","apiKey","APP_ID","appId","MOBILE_APP_ID","mobileAppId","intercomSettings","app_id","ic","readyState","intercom_code","attachEvent","rawPayload","userHash","user_hash","hideDefaultLauncher","hide_default_launcher","field","companies","company","company_id","companyFields","created_at","user_id","event_name","originalTimestamp","projectID","writeKey","ipAddon","uaAddon","urlAddon","referrerAddon","client","check","KeenTracking","projectId","initKeen","clearInterval","bind","assign","user","getAddOn","extendEvents","recordEvent","addOns","ip_address","input","ip","output","user_agent","ua_string","page_url","referrer_url","keen","addons","dest","sources","multiple","normalize","isFunction","normalizer","defaultNormalize","loop","normalizedKey","temp","child","prefixProperties","_kmq","_kmk","_kms","u","isEnvMobile","navigator","userAgent","toUnixTimestamp","nestedObj","flattenedObj","flatten","safe","extend","opts","delimiter","maxDepth","currentDepth","prev","isarray","isobject","newKey","clean","timestamp","prefix","iterator","_t","_d","KM","set","previousId","groupId","groupTraits","CustomerIO","_cio","concat","body","interval","_sf_async_config","useCanonical","uid","isVideo","video","sendNameAndCategoryAsTitle","subscriberEngagementKeys","replayEvents","failed","isFirstPageCallMade","loadConfig","isLoaded","pSUPERFLY","virtualPage","initAfterPage","author","sections","authors","_cbq","script","_isReady","then","time","Promise","resolve","_this2","pause","c2ID","comScoreBeaconParam","comScoreParams","beacon","mapComscoreParams","_comscore","el","comScoreBeaconParamsMap","c1","c2","hop","strCharAt","index","indexKeys","pred","results","isArrayLike","objectKeys","objToString","isNumber","arrayEach","baseEach","ks","collection","FacebookPixel","blacklistPiiProperties","categoryToContent","pixelId","eventsToEvents","eventCustomProperties","valueFieldIdentifier","advancedMapping","traitKeyToExternalId","legacyConversionPixelId","userIdAsPixelId","whitelistPiiProperties","_fbq","fbq","callMethod","queue","loaded","disablePushState","allowDuplicatePageViews","version","formatRevenue","buildPayLoad","standardTo","legacyTo","standard","legacy","reduce","filtered","eventID","messageId","contents","customProperties","contentIds","contentType","merge","content_ids","content_type","getContentType","useValue","content_name","product_name","content_category","item_price","pId","num_items","search_string","contentCategory","defaultValue","mappedTo","mapped","obj1","obj2","res","propObj1","propObj2","toFixed","isStandardEvent","dateFields","defaultPiiProperties","customPiiProperties","configuration","blacklistPiiHash","toISOTring","sha256","isPropertyPii","isProperyWhiteListed","CryptoJS","create","F","subtype","C","C_lib","lib","Base","overrides","mixIn","$super","propertyName","clone","WordArray","sigBytes","encoder","Hex","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","clamp","thatByte","ceil","nBytes","rcache","m_w","m_z","mask","_r","C_enc","enc","hexChars","bite","hexStr","hexStrLength","Latin1","latin1Chars","latin1Str","latin1StrLength","Utf8","utf8Str","BufferedBlockAlgorithm","reset","_data","_nDataBytes","_append","_process","doFlush","dataWords","dataSigBytes","blockSize","nBlocksReady","nWordsReady","max","_minBufferSize","nBytesReady","min","offset","_doProcessBlock","processedWords","C_algo","Hasher","cfg","_doReset","update","messageUpdate","finalize","_doFinalize","_createHelper","hasher","_createHmacHelper","HMAC","algo","Base64","_map","base64Chars","paddingChar","base64Str","base64StrLength","reverseMap","_reverseMap","paddingIndex","bits1","bits2","parseLoop","T","abs","sin","MD5","_hash","M","offset_i","M_offset_i","H","M_offset_0","M_offset_1","M_offset_2","M_offset_3","M_offset_4","M_offset_5","M_offset_6","M_offset_7","M_offset_8","M_offset_9","M_offset_10","M_offset_11","M_offset_12","M_offset_13","M_offset_14","M_offset_15","nBitsTotal","nBitsLeft","nBitsTotalH","nBitsTotalL","H_i","HmacMD5","W","SHA1","HmacSHA1","_hasher","hasherBlockSize","hasherBlockSizeBytes","oKey","_oKey","iKey","_iKey","oKeyWords","iKeyWords","innerHash","EvpKDF","keySize","iterations","compute","password","salt","derivedKey","derivedKeyWords","block","Cipher","C_mode","BlockCipherMode","CBC","Pkcs7","CipherParams","OpenSSLFormatter","SerializableCipher","OpenSSLKdf","PasswordBasedCipher","createEncryptor","_ENC_XFORM_MODE","createDecryptor","_DEC_XFORM_MODE","xformMode","_xformMode","_key","process","dataUpdate","ivSize","selectCipherStrategy","cipher","encrypt","decrypt","ciphertext","StreamCipher","mode","iv","Encryptor","Decryptor","_cipher","_iv","xorBlock","_prevBlock","processBlock","encryptBlock","thisBlock","decryptBlock","pad","blockSizeBytes","nPaddingBytes","paddingWord","paddingWords","padding","unpad","BlockCipher","modeCreator","_mode","__creator","finalProcessedBlocks","cipherParams","formatter","format","OpenSSL","openSSLStr","ciphertextWords","encryptor","cipherCfg","algorithm","_parse","kdf","execute","derivedParams","SBOX","INV_SBOX","SUB_MIX_0","SUB_MIX_1","SUB_MIX_2","SUB_MIX_3","INV_SUB_MIX_0","INV_SUB_MIX_1","INV_SUB_MIX_2","INV_SUB_MIX_3","xi","sx","x2","x4","x8","RCON","AES","_nRounds","_keyPriorReset","keyWords","ksRows","keySchedule","_keySchedule","ksRow","invKeySchedule","_invKeySchedule","invKsRow","_doCryptBlock","nRounds","s0","s1","s2","s3","t0","t1","t2","t3","copy","flags","multiline","global","ignoreCase","ms","plural","long","short","namespace","disabled","enabled","curr","prevTime","diff","useColors","color","selectColor","coerce","formatters","formatArgs","logFn","stack","enable","namespaces","save","skips","names","prevColor","colors","storage","debug","humanize","lastC","removeItem","documentElement","style","firebug","exception","table","chrome","local","localStorage","localstorage","v","all","encode","maxage","expires","toUTCString","samesite","secure","cookie","pair","toDrop","resultsLength","isObject","isPlainObject","shallowCombiner","deepCombiner","defaultsDeep","defaultsWith","combiner","drop","rest","objectTypes","freeExports","root","freeGlobal","runInContext","SyntaxError","nativeJSON","objectProto","getClass","isProperty","attempt","func","errorFunc","isExtended","isSupported","serialized","stringifySupported","toJSON","parseSupported","getUTCHours","getUTCMinutes","getUTCSeconds","getUTCMilliseconds","charIndexBuggy","forOwn","Properties","dontEnums","size","isConstructor","hasProperty","Escapes","toPaddedString","width","serializeDate","getData","year","month","hours","minutes","seconds","milliseconds","Months","getDay","dateToJSON","nativeStringify","filter","nativeToJSON","escapeChar","character","charCode","escaped","reEscape","quote","lastIndex","whitespace","className","serialize","indentation","pop","Index","Source","Unescapes","abort","lex","begin","isSigned","walk","hasMembers","previousJSON","JSON3","isRestored","levels","last","Cookie","_options","topDomain","remove","store","win","doc","defaultVal","clear","transact","transactionFn","getAll","deserialize","isLocalStorageNameSupported","setItem","getItem","addBehavior","storageOwner","storageContainer","ActiveXObject","open","write","close","frames","withIEStorage","storeFunction","unshift","forbiddenCharsRegex","ieKeyFix","removeAttribute","attributes","XMLDocument","attr","testKey","Store","substring","encryptValue","decryptValue","lotameStorage","Storage","LotameStorage","bcpUrlSettingsPixel","bcpUrlSettingsIframe","dspUrlSettingsPixel","dspUrlSettingsIframe","mappings","mapping","LOTAME_SYNCH_CALLBACK","height","image","iframe","currentTime","urlSettings","dspUrl","compileUrl","dspUrlTemplate","addPixel","addIFrame","setLotameSynchTime","methodToCallbackMapping","syncPixel","destination","replaceKey","regex","bcpUrl","_this3","bcpUrlTemplate","isPixelToBeSynched","lastSynchedTime","getLotameSynchTime","referrerOverride","optimizelyEffectiveReferrer","sendDataToRudder","campaignState","experiment","variation","integrations","audiences","audiencesMap","audience","audienceIds","sort","audienceNames","values","campaignId","experimentName","audienceId","audienceName","isInCampaignHoldback","sendExperimentTrackAsNonInteractive","customCampaignProperties","rudderProp","optimizelyProp","revenueOnlyOnOrderCompleted","customExperimentProperties","initOptimizelyIntegration","sendCampaignData","newActiveCampaign","state","optimizely","getCampaignStates","isActive","checkReferrer","getRedirectInfo","activeCampaigns","handler","registerCurrentlyActiveCampaigns","Bugsnag","releaseStage","setIntervalHandler","initBugsnagClient","bugsnag","bugsnagClient","traitsFinal","notify","camelCase","pascalCase","toLocaleUpperCase","toLocaleLowerCase","isLastCharLower","isLastCharUpper","isLastLastCharUpper","preserveCamelCase","p1","HubSpot","FBPixel","fs_org","fs_debug_mode","_fs_debug","_fs_host","_fs_script","_fs_org","_fs_namespace","g","_api","crossOrigin","setUserVars","shutdown","restart","consent","identifyAccount","acctId","clearUserCookie","_w","FS","getFSProperties","FS_properties","camelCaseField","fieldName","typeSuffix","camelcase","_tvq","isReady","rev","brandId","clientId","eventWhiteList","customMetrics","productType","whitelist","wl","session","prod","promo","cm","setCustomVariable","RudderApp","build","RudderLibraryInfo","RudderOSInfo","RudderScreenInfo","density","RudderContext","app","library","os","screen","devicePixelRatio","locale","language","browserLanguage","device","network","RudderMessage","channel","messageType","checkForKey","SCREEN","RudderElement","rudderProperty","rudderUserProperty","RudderElementBuilder","inputRudderProperty","rudderPropertyBuilder","inputRudderUserProperty","rudderUserPropertyBuilder","eventType","setUserId","setType","setEventName","setProperty","setUserProperty","getRandomValues","crypto","msCrypto","rnds8","rnds","byteToHex","_nodeId","_clockseq","buf","bth","_lastMSecs","_lastNSecs","node","clockseq","seedBytes","rng","msecs","nsecs","dt","tl","tmh","bytesToUuid","ii","uuid","v4","v1","inMemoryStore","isSupportedNatively","defaultEngine","inMemoryEngine","optionalEngine","engine","originalEngine","compoundKey","_createValidKey","json","quotaExceeded","code","isQuotaExceeded","_swapEngine","getOriginalEngine","defaultClock","clearTimeout","clock","Schedule","tasks","nextId","run","task","timeout","_handle","cancel","cancelAll","setClock","newClock","resetClock","fmt","disable","Queue","maxItems","maxAttempts","backoff","MIN_RETRY_DELAY","minRetryDelay","MAX_RETRY_DELAY","maxRetryDelay","FACTOR","backoffFactor","JITTER","backoffJitter","timeouts","ACK_TIMER","RECLAIM_TIMER","RECLAIM_TIMEOUT","RECLAIM_WAIT","IN_PROGRESS","QUEUE","RECLAIM_START","RECLAIM_END","ACK","_schedule","_processId","_store","_ack","_checkReclaim","_processHead","_running","stop","shouldRetry","attemptNumber","getDelay","rand","deviation","toPrecision","addItem","_enqueue","requeue","entry","inProgress","toRun","enqueue","done","inProgressSize","shift","_reclaim","tryReclaim","findOtherQueues","our","their","RudderPayload","batch","queueOptions","eventRepository","eventsBuffer","batchSize","payloadQueue","sentAt","processQueueElement","headers","repo","eventsPayload","xhr","XMLHttpRequest","setRequestHeader","btoa","onreadystatechange","status","send","queueFn","ontimeout","statusText","getElementContent","Authorization","AnonymousId","addDomEventHandlers","rudderanalytics","srcElement","isTextNode","shouldTrackDomEvent","formValues","tagName","elements","formElement","shouldTrackElement","isValueToBeTrackedFromTrackingList","trackValues","getElementsByName","checked","targetElementList","curEl","getClassName","isExplicitNoTrack","isTag","elementsJson","isValueToBeTracked","elem","classes","tag_name","attrLength","field_value","nthChild","nthOfType","currentElem","previousElementSibling","nth_child","nth_of_type","getPropertiesFromElement","elementText","text","childNodes","Node","TEXT_NODE","textValue","nodeValue","getText","event_type","el_attr_href","el_text","form_values","trackWindowEvent","register_event","useCapture","isElementNode","baseVal","includeList","elAttributesLength","previousSibling","queryDefaults","EventRepository","autoTrackHandlersRegistered","autoTrackFeatureEnabled","initialized","clientIntegrations","loadOnlyIntegrations","clientIntegrationObjects","successfullyLoadedIntegration","failedToBeLoadedIntegration","toBeProcessedArray","toBeProcessedByIntegrationArray","sendAdblockPage","clientSuppliedCallbacks","readyCallback","executeReadyCallback","getUserId","userTraits","getUserTraits","getGroupId","getGroupTraits","getAnonymousId","setAnonymousId","setGroupId","setUserTraits","setGroupTraits","response","useAutoTracking","destinations","destinationDefinition","useNativeSDK","intgArray","intgInstance","intgClass","isInitialized","after","methodName","succesfulLoadedIntersectClientSuppliedIntegrations","isFailed","sendSampleRequest","processPage","processTrack","processIdentify","processAndSendDataToDestinations","getPageProperties","trackPage","trackEvent","identifyUser","processOptionsParam","toplevelElements","getContextPageProperties","defaultPageProperties","optionPageProperties","contextPageProperties","serverUrl","configUrl","isValidWriteKey","isValidServerUrl","getUserProvidedConfigUrl","tranformedCallbackMapping","registerCallbacks","initializeUser","valTrackingList","cb_","onload","responseText","getJSONTrimmed","processResponse","_this4","calledFromLoad","_this5","qObj","returnObj","queryObject","querystring","eventProps","getEventPropertiesFromQueryObject","ajs_uid","ajs_aid","ajs_event","initializeCallbacks","eventsPushedAlready","argumentsArray","method","pushDataToAnalyticsArray","parseQueryString","ready","alias"],"mappings":"guEAeSA,EAAQC,MACXA,EAAK,gBAWIA,OACR,IAAIC,KAAOF,EAAQG,UACtBF,EAAIC,GAAOF,EAAQG,UAAUD,UAExBD,EAfSG,CAAMH,GAVtBI,UAAiBL,EAqCnBA,EAAQG,UAAUG,GAClBN,EAAQG,UAAUI,iBAAmB,SAASC,EAAOC,eAC9CC,WAAaC,KAAKD,YAAc,IACpCC,KAAKD,WAAW,IAAMF,GAASG,KAAKD,WAAW,IAAMF,IAAU,IAC7DI,KAAKH,GACDE,MAaTX,EAAQG,UAAUU,KAAO,SAASL,EAAOC,YAC9BH,SACFQ,IAAIN,EAAOF,GAChBG,EAAGM,MAAMJ,KAAMK,kBAGjBV,EAAGG,GAAKA,OACHH,GAAGE,EAAOF,GACRK,MAaTX,EAAQG,UAAUW,IAClBd,EAAQG,UAAUc,eAClBjB,EAAQG,UAAUe,mBAClBlB,EAAQG,UAAUgB,oBAAsB,SAASX,EAAOC,WACjDC,W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AGlDjP,EAAIO,OACNsrD,EAAelrD,KAAK,CAAC,QAASX,EAAIO,MAAOP,EAAIqM,aAiDjD0/C,CAAyBF,GAFCj7C,GAASo7C,iBAAiBvnD,OAAOf,SAASU,SAIhEwnD,IAAuBC,IAAkBA,GAAe1qD,OAAS,EAAG,KACjE,IAAIG,GAAI,EAAGA,GAAIuqD,GAAe1qD,OAAQG,KACzCsP,GAASy2C,mBAAmB1mD,KAAKkrD,GAAevqD,SAG7C,IAAIA,GAAI,EAAGA,GAAIsP,GAASy2C,mBAAmBlmD,OAAQG,KAAK,KACrDf,KAAYqQ,GAASy2C,mBAAmB/lD,KACxCwqD,GAASvrD,GAAM,GACrBA,GAAMghD,QACN58C,EAAa,oCAAqCmnD,IAClDl7C,GAASk7C,UAATl7C,KAAoBrQ,KAEtBqQ,GAASy2C,mBAAqB,OAI1B4E,GAAQr7C,GAASq7C,MAAM5gC,KAAKza,IAC5BwQ,GAAWxQ,GAASwQ,SAASiK,KAAKza,IAClCtF,GAAOsF,GAAStF,KAAK+f,KAAKza,IAC1BsJ,GAAQtJ,GAASsJ,MAAMmR,KAAKza,IAC5Bs7C,GAAQt7C,GAASs7C,MAAM7gC,KAAKza,IAC5B6L,GAAQ7L,GAAS6L,MAAM4O,KAAKza,IAC5B4oB,GAAQ5oB,GAAS4oB,MAAMnO,KAAKza,IAC5BkP,GAAOlP,GAASkP,KAAKuL,KAAKza,IAC1Bm2C,GAAen2C,GAASm2C,aAAc,EACtCiB,GAAiBp3C,GAASo3C,eAAe38B,KAAKza,IAC9Cq3C,GAAiBr3C,GAASq3C,eAAe58B,KAAKza"} \ No newline at end of file diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index b33770530a..b369987c3f 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -926,7 +926,8 @@ Optimizely: "OPTIMIZELY", FULLSTORY: "FULLSTORY", Fullstory: "FULLSTORY", - BUGSNAG: "BUGSNAG" + BUGSNAG: "BUGSNAG", + TVSQUARED: "TVSQUARED" }; // from client native integration name to server identified display name @@ -949,7 +950,8 @@ LOTAME: "Lotame", VWO: "VWO", OPTIMIZELY: "Optimizely", - FULLSTORY: "Fullstory" + FULLSTORY: "Fullstory", + TVSQUUARED: "TVSquared" }; // Message Type enumeration @@ -2363,11 +2365,15 @@ /** * toString ref. */ +<<<<<<< HEAD <<<<<<< HEAD var toString$1 = Object.prototype.toString; ======= var toString = Object.prototype.toString; >>>>>>> branch for npm and latest release +======= + var toString$1 = Object.prototype.toString; +>>>>>>> NPM release version 1.0.11 /** * Return the type of `val`. * @@ -2376,6 +2382,7 @@ * @api public */ +<<<<<<< HEAD <<<<<<< HEAD var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { @@ -2383,6 +2390,10 @@ var componentType = function componentType(val) { switch (toString.call(val)) { >>>>>>> branch for npm and latest release +======= + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { +>>>>>>> NPM release version 1.0.11 case '[object Function]': return 'function'; @@ -15159,9 +15170,13 @@ /** * Module dependencies. */ +<<<<<<< HEAD var debug$1 = browser$1('cookie'); >>>>>>> branch for npm and latest release +======= + var toString$2 = Object.prototype.toString; +>>>>>>> NPM release version 1.0.11 /** * Set or get cookie `name` with `value` and `options` object. * @@ -15172,12 +15187,22 @@ * @api public */ +<<<<<<< HEAD <<<<<<< HEAD var rudderComponentCookie = function rudderComponentCookie(name, value, options) { switch (arguments.length) { case 3: case 2: return set(name, value, options); +======= + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { + case '[object Date]': + return 'date'; + + case '[object RegExp]': + return 'regexp'; +>>>>>>> NPM release version 1.0.11 case 1: return get$1(name); @@ -15234,12 +15259,20 @@ */ +<<<<<<< HEAD <<<<<<< HEAD function all() { ======= function all$1() { >>>>>>> branch for npm and latest release var str; +======= + var clone = function clone(obj) { + var t = componentType$2(obj); + + if (t === 'object') { + var copy = {}; +>>>>>>> NPM release version 1.0.11 try { str = document.cookie; @@ -15335,6 +15368,7 @@ * drop(4, [1, 2, 3]); // => [] */ +<<<<<<< HEAD var drop = function drop(count, collection) { var length = collection ? collection.length : 0; @@ -15354,6 +15388,12 @@ } return results; +======= + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse$1(val); + return options["long"] ? _long(val) : _short(val); +>>>>>>> NPM release version 1.0.11 }; /* * Exports. @@ -15383,6 +15423,16 @@ // `arguments` objects on v8. For a summary, see: // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments +<<<<<<< HEAD +======= + function parse$1(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(); +>>>>>>> NPM release version 1.0.11 var results = new Array(max$1(collection.length - 2, 0)); @@ -15823,6 +15873,7 @@ } // Manually invoke the callback for each non-enumerable property. +<<<<<<< HEAD for (length = dontEnums.length; property = dontEnums[--length];) { if (hasProperty.call(object, property)) { callback(property); @@ -15835,6 +15886,12 @@ var isFunction = getClass.call(object) == functionClass, property, isConstructor; +======= + function set(name, value, options) { + options = options || {}; + var str = encode$1(name) + '=' + encode$1(value); + if (null == value) options.maxage = -1; +>>>>>>> NPM release version 1.0.11 for (property in object) { if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { @@ -15872,7 +15929,19 @@ }; // Internal: Converts `value` into a zero-padded string such that its // length is at least equal to `width`. The `width` must be <= 6. +<<<<<<< HEAD var leadingZeroes = "000000"; +======= + return parse$2(str); + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ +>>>>>>> NPM release version 1.0.11 var toPaddedString = function toPaddedString(width, value) { // The `|| 0` expression is necessary to work around a bug in @@ -15884,12 +15953,25 @@ var _serializeDate = function serializeDate(value) { var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. +<<<<<<< HEAD if (!isExtended) { var floor = Math.floor; // A mapping between the months of the year and the number of days between // January 1st and the first of the respective month. var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the // first day of the given month. +======= + function parse$2(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]); + } +>>>>>>> NPM release version 1.0.11 var getDay = function getDay(year, month) { return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); @@ -15904,16 +15986,39 @@ for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { } +<<<<<<< HEAD for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { } +======= + function encode$1(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ +>>>>>>> NPM release version 1.0.11 date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used // to compute `A modulo B`, as the `%` operator does not // correspond to the `modulo` operation for negative numbers. +<<<<<<< HEAD time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by // decomposing the time within the day. See section 15.9.1.10. +======= + function decode$1(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); + } + } +>>>>>>> NPM release version 1.0.11 hours = floor(time / 36e5) % 24; minutes = floor(time / 6e4) % 60; @@ -17740,6 +17845,7 @@ * @param {*} key */ +<<<<<<< HEAD }, { key: "getItem", value: function getItem(key) { @@ -17748,6 +17854,12 @@ /** * get the stored userId */ +======= + function set$1(name, value, options) { + options = options || {}; + var str = encode$2(name) + '=' + encode$2(value); + if (null == value) options.maxage = -1; +>>>>>>> NPM release version 1.0.11 }, { key: "getUserId", @@ -17804,6 +17916,7 @@ * remove stored keys */ +<<<<<<< HEAD }, { key: "clear", value: function clear() { @@ -17813,6 +17926,17 @@ this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); } }]); +======= + return parse$3(str); + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ +>>>>>>> NPM release version 1.0.11 return Storage; }(); @@ -17823,11 +17947,23 @@ lotame_synch_time_key: "lt_synch_timestamp" }; +<<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { function LotameStorage() { _classCallCheck(this, LotameStorage); this.storage = Storage$1; // new Storage(); +======= + 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$2(pair[0])] = decode$2(pair[1]); +>>>>>>> NPM release version 1.0.11 } _createClass(LotameStorage, [{ @@ -17847,12 +17983,26 @@ var lotameStorage = new LotameStorage(); +<<<<<<< HEAD var Lotame = /*#__PURE__*/function () { function Lotame(config, analytics) { var _this = this; +======= + function encode$2(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug$1('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ +>>>>>>> NPM release version 1.0.11 _classCallCheck(this, Lotame); +<<<<<<< HEAD this.name = "LOTAME"; this.analytics = analytics; this.storage = lotameStorage; @@ -17866,6 +18016,13 @@ var value = mapping.value; _this.mappings[key] = value; }); +======= + function decode$2(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug$1('error `decode(%o)` - %o', value, e); +>>>>>>> NPM release version 1.0.11 } ======= @@ -19795,6 +19952,123 @@ return Fullstory; }(); + var TVSquared = /*#__PURE__*/function () { + function TVSquared(config) { + _classCallCheck(this, TVSquared); + + this.isLoaded = function () { + logger.debug("in TVSqaured isLoaded"); + return !!(window._tvq && window._tvq.push !== Array.prototype.push); + }; + + this.isReady = function () { + logger.debug("in TVSqaured isReady"); + return !!(window._tvq && window._tvq.push !== Array.prototype.push); + }; + + this.page = function () { + window._tvq.push(["trackPageView"]); + }; + + this.formatRevenue = function (revenue) { + var rev = revenue; + rev = parseFloat(rev.toString().replace(/^[^\d.]*/, "")); + return rev; + }; + + this.brandId = config.brandId; + this.clientId = config.clientId; + this.eventWhiteList = config.eventWhiteList || []; + this.customMetrics = config.customMetrics || []; + this.name = "TVSquared"; + } + + _createClass(TVSquared, [{ + key: "init", + value: function init() { + logger.debug("===in init TVSquared==="); + window._tvq = window._tvq || []; + var url = document.location.protocol === "https:" ? "https://" : "http://"; + url += "collector-".concat(this.clientId, ".tvsquared.com/"); + + window._tvq.push(["setSiteId", this.brandId]); + + window._tvq.push(["setTrackerUrl", "".concat(url, "tv2track.php")]); + + ScriptLoader("TVSquared-integration", "".concat(url, "tv2track.js")); + } + }, { + key: "track", + value: function track(rudderElement) { + var _rudderElement$messag = rudderElement.message, + event = _rudderElement$messag.event, + userId = _rudderElement$messag.userId, + anonymousId = _rudderElement$messag.anonymousId; + var _rudderElement$messag2 = rudderElement.message.properties, + revenue = _rudderElement$messag2.revenue, + productType = _rudderElement$messag2.productType, + category = _rudderElement$messag2.category, + order_id = _rudderElement$messag2.order_id, + promotion_id = _rudderElement$messag2.promotion_id; + var i; + var j; + var whitelist = this.eventWhiteList.slice(); + whitelist = whitelist.filter(function (wl) { + return wl.event !== ""; + }); + + for (i = 0; i < whitelist.length; i += 1) { + if (event.toUpperCase() === whitelist[i].event.toUpperCase()) { + break; + } + + if (i === whitelist.length - 1) { + return; + } + } + + var session = { + user: userId || anonymousId || "" + }; + var action = { + rev: revenue ? this.formatRevenue(revenue) : "", + prod: category || productType || "", + id: order_id || "", + promo: promotion_id || "" + }; + var customMetrics = this.customMetrics.slice(); + customMetrics = customMetrics.filter(function (cm) { + return cm.propertyName !== ""; + }); + + if (customMetrics.length) { + for (j = 0; j < customMetrics.length; j += 1) { + var key = customMetrics[j].propertyName; + var value = rudderElement.message.properties[key]; + + if (value) { + action[key] = value; + } + } + } + + window._tvq.push([function () { + this.setCustomVariable(5, "session", JSON.stringify(session), "visit"); + }]); + + if (event.toUpperCase() !== "RESPONSE") { + window._tvq.push([function () { + this.setCustomVariable(5, event, JSON.stringify(action), "page"); + }]); + + window._tvq.push(["trackPageView"]); + } + } + }]); + + return TVSquared; + }(); + // (config-plan name, native destination.name , exported integration name(this one below)) var integrations = { @@ -19815,7 +20089,8 @@ LOTAME: Lotame, OPTIMIZELY: Optimizely, BUGSNAG: Bugsnag, - FULLSTORY: Fullstory + FULLSTORY: Fullstory, + TVSQUARED: TVSquared }; // Application class @@ -22806,7 +23081,11 @@ logger.debug("=====from init, calling method:: ", method); instance[method].apply(instance, _toConsumableArray(argumentsArray[0])); argumentsArray.shift(); - } + } // once loaded, parse querystring of the page url to send events + + + var parsedQueryObject = instance.parseQueryString(window.location.search); + pushDataToAnalyticsArray(argumentsArray, parsedQueryObject); >>>>>>> update npm module if (eventsPushedAlready && argumentsArray && argumentsArray.length > 0) { diff --git a/dist/rudder-sdk-js/package.json b/dist/rudder-sdk-js/package.json index 9087a99fdf..b38cc49483 100644 --- a/dist/rudder-sdk-js/package.json +++ b/dist/rudder-sdk-js/package.json @@ -1,6 +1,6 @@ { "name": "rudder-sdk-js", - "version": "1.0.10", + "version": "1.0.11", "description": "Rudder Javascript SDK", "main": "index.js", "types": "index.d.ts", From 0608d2432a85a3eca2ca2575974dfc733f7efbda Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Tue, 8 Sep 2020 21:32:07 +0530 Subject: [PATCH 10/20] add querystring parse to npm module --- dist/rudder-sdk-js/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index b369987c3f..ffbb9fd036 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -993,6 +993,7 @@ PRODUCT_REVIEWED: "Product Reviewed" }; // Enumeration for integrations supported +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; @@ -1002,6 +1003,9 @@ ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; >>>>>>> branch for npm and latest release +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +>>>>>>> add querystring parse to npm module var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -20101,6 +20105,7 @@ this.name = "RudderLabs JavaScript SDK"; this.namespace = "com.rudderlabs.javascript"; <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -20109,6 +20114,9 @@ ======= this.version = "1.0.9"; >>>>>>> branch for npm and latest release +======= + this.version = "1.0.10"; +>>>>>>> add querystring parse to npm module }; // Library information class @@ -20117,6 +20125,7 @@ this.name = "RudderLabs JavaScript SDK"; <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -20125,6 +20134,9 @@ ======= this.version = "1.0.9"; >>>>>>> branch for npm and latest release +======= + this.version = "1.0.10"; +>>>>>>> add querystring parse to npm module }; // Operating System information class From 4a833c75593be1dafdd46cb0702f5cf326acee1b Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Wed, 16 Sep 2020 11:19:03 +0530 Subject: [PATCH 11/20] rebase with production branch --- dist/rudder-sdk-js/index.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index ffbb9fd036..aedb454c40 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -995,6 +995,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ======= @@ -1006,6 +1007,9 @@ ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; >>>>>>> add querystring parse to npm module +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; +>>>>>>> rebase with production branch var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -20106,6 +20110,7 @@ this.namespace = "com.rudderlabs.javascript"; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -20117,6 +20122,9 @@ ======= this.version = "1.0.10"; >>>>>>> add querystring parse to npm module +======= + this.version = "1.0.11"; +>>>>>>> rebase with production branch }; // Library information class @@ -20126,6 +20134,7 @@ this.name = "RudderLabs JavaScript SDK"; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -20137,6 +20146,9 @@ ======= this.version = "1.0.10"; >>>>>>> add querystring parse to npm module +======= + this.version = "1.0.11"; +>>>>>>> rebase with production branch }; // Operating System information class From 056b6713d9a88368e46bea3cc44c5666fecc3e57 Mon Sep 17 00:00:00 2001 From: Arnab Date: Wed, 12 Aug 2020 18:40:01 +0530 Subject: [PATCH 12/20] Updated npm distribution files --- dist/rudder-sdk-js/index.js | 908 +++++++++++++++++++++++++++++++++--- 1 file changed, 837 insertions(+), 71 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index aedb454c40..a866fc0c04 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -1,8 +1,18 @@ (function (global, factory) { +<<<<<<< HEAD typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.rudderanalytics = {})); }(this, (function (exports) { 'use strict'; +======= + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : + typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : + (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); +}(this, (function (exports, AES, Utf8) { 'use strict'; + + AES = AES && Object.prototype.hasOwnProperty.call(AES, 'default') ? AES['default'] : AES; + Utf8 = Utf8 && Object.prototype.hasOwnProperty.call(Utf8, 'default') ? Utf8['default'] : Utf8; +>>>>>>> Updated npm distribution files function _typeof(obj) { "@babel/helpers - typeof"; @@ -996,6 +1006,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ======= @@ -1010,6 +1021,16 @@ ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; >>>>>>> rebase with production branch +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; +======= +<<<<<<< HEAD + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -16366,9 +16387,18 @@ // four-digit code point. begin = ++Index; +<<<<<<< HEAD for (position = Index + 4; Index < position; Index++) { charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- // insensitive) that form a single hexadecimal value. +======= + var json3 = createCommonjsModule(function (module, exports) { +<<<<<<< HEAD + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. +>>>>>>> Updated npm distribution files if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { // Invalid Unicode escape sequence. @@ -16410,7 +16440,82 @@ } // Unterminated string. +<<<<<<< HEAD abort(); +======= + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } +======= + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; + + // A set of types used to distinguish objects from primitives. + var objectTypes = { + "function": true, + "object": true + }; + + // Detect the `exports` object exposed by CommonJS implementations. + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; + + // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + var root = objectTypes[typeof window] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; + + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } + + // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); + + // Native constructor aliases. + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; + + // Delegate to the native `stringify` and `parse` implementations. + if (typeof nativeJSON == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } + + // Convenience aliases. + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; + + // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); +>>>>>>> Updated npm distribution files + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. +>>>>>>> Updated npm distribution files default: // Parse numbers and literals. @@ -17062,6 +17167,7 @@ * Module dependencies. */ +<<<<<<< HEAD var debug$1 = browser$1('cookie'); /** * Set or get cookie `name` with `value` and `options` object. @@ -17072,6 +17178,13 @@ * @return {Mixed} * @api public */ +======= +<<<<<<< HEAD + if (charCode < 48 || charCode > 57) { + break; + } + } +>>>>>>> Updated npm distribution files var componentCookie = function componentCookie(name, value, options) { switch (arguments.length) { @@ -17271,9 +17384,31 @@ } // Localhost. +<<<<<<< HEAD if (parts.length <= 1) { return levels; } // Create levels. +======= + if (hasMembers) { + if (value == ",") { + value = lex(); +======= + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files for (var i = parts.length - 2; i >= 0; --i) { @@ -17896,6 +18031,7 @@ * get the stored user traits */ +<<<<<<< HEAD }, { key: "getGroupTraits", value: function getGroupTraits() { @@ -17923,6 +18059,11 @@ /** * remove stored keys */ +======= + return {}; + } +<<<<<<< HEAD +>>>>>>> Updated npm distribution files <<<<<<< HEAD }, { @@ -17936,6 +18077,9 @@ }]); ======= return parse$3(str); +======= + return parse$2(str); +>>>>>>> Updated npm distribution files } /** * Get cookie `name`. @@ -17955,14 +18099,20 @@ lotame_synch_time_key: "lt_synch_timestamp" }; +<<<<<<< HEAD <<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { function LotameStorage() { _classCallCheck(this, LotameStorage); +======= +>>>>>>> Updated npm distribution files this.storage = Storage$1; // new Storage(); ======= function parse$3(str) { +======= + function parse$2(str) { +>>>>>>> Updated npm distribution files var obj = {}; var pairs = str.split(/ *; */); var pair; @@ -18726,7 +18876,11 @@ return value; } +<<<<<<< HEAD var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); +>>>>>>> Updated npm distribution files return prefixedVal; } /** @@ -18742,7 +18896,11 @@ } if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { +<<<<<<< HEAD return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); +======= + return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); +>>>>>>> Updated npm distribution files } return value; @@ -19407,7 +19565,14 @@ return Fullstory; }(); +<<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { +======= +<<<<<<< HEAD + var Optimizely = + /*#__PURE__*/ + function () { +>>>>>>> Updated npm distribution files function Optimizely(config, analytics) { var _this = this; @@ -20126,11 +20291,21 @@ this.version = "1.0.11"; >>>>>>> rebase with production branch }; +======= + var Optimizely = /*#__PURE__*/function () { + function Optimizely(config, analytics) { + var _this = this; - // Library information class - var RudderLibraryInfo = function RudderLibraryInfo() { - _classCallCheck(this, RudderLibraryInfo); + _classCallCheck(this, Optimizely); +>>>>>>> Updated npm distribution files + + this.referrerOverride = function (referrer) { + if (referrer) { + window.optimizelyEffectiveReferrer = referrer; + return referrer; + } +<<<<<<< HEAD this.name = "RudderLabs JavaScript SDK"; <<<<<<< HEAD <<<<<<< HEAD @@ -20150,94 +20325,661 @@ this.version = "1.0.11"; >>>>>>> rebase with production branch }; // Operating System information class +======= + return undefined; + }; +>>>>>>> Updated npm distribution files + this.sendDataToRudder = function (campaignState) { + logger.debug(campaignState); + var experiment = campaignState.experiment; + var variation = campaignState.variation; + var context = { + integrations: { + All: true + } + }; + var audiences = campaignState.audiences; // Reformatting this data structure into hash map so concatenating variation ids and names is easier later - var RudderOSInfo = function RudderOSInfo() { - _classCallCheck(this, RudderOSInfo); + var audiencesMap = {}; + audiences.forEach(function (audience) { + audiencesMap[audience.id] = audience.name; + }); + var audienceIds = Object.keys(audiencesMap).sort().join(); + var audienceNames = Object.values(audiencesMap).sort().join(", "); - this.name = ""; - this.version = ""; - }; // Screen information class + if (_this.sendExperimentTrack) { + var props = { + campaignName: campaignState.campaignName, + campaignId: campaignState.id, + experimentId: experiment.id, + experimentName: experiment.name, + variationName: variation.name, + variationId: variation.id, + audienceId: audienceIds, + // eg. '7527562222,7527111138' + audienceName: audienceNames, + // eg. 'Peaky Blinders, Trust Tree' + isInCampaignHoldback: campaignState.isInCampaignHoldback + }; // If this was a redirect experiment and the effective referrer is different from document.referrer, + // this value is made available. So if a customer came in via google.com/ad -> tb12.com -> redirect experiment -> Belichickgoat.com + // `experiment.referrer` would be google.com/ad here NOT `tb12.com`. + if (experiment.referrer) { + props.referrer = experiment.referrer; + context.page = { + referrer: experiment.referrer + }; + } // For Google's nonInteraction flag - var RudderScreenInfo = function RudderScreenInfo() { - _classCallCheck(this, RudderScreenInfo); - this.density = 0; - this.width = 0; - this.height = 0; - }; // Device information class + if (_this.sendExperimentTrackAsNonInteractive) props.nonInteraction = 1; // If customCampaignProperties is provided overide the props with it. + // If valid customCampaignProperties present it will override existing props. + // const data = window.optimizely && window.optimizely.get("data"); - var RudderContext = function RudderContext() { - _classCallCheck(this, RudderContext); + var data = campaignState; - this.app = new RudderApp(); - this.traits = null; - this.library = new RudderLibraryInfo(); // this.os = null; + if (data && _this.customCampaignProperties.length > 0) { + for (var index = 0; index < _this.customCampaignProperties.length; index += 1) { + var rudderProp = _this.customCampaignProperties[index].from; + var optimizelyProp = _this.customCampaignProperties[index].to; - var os = new RudderOSInfo(); - os.version = ""; // skipping version for simplicity now + if (typeof props[optimizelyProp] !== "undefined") { + props[rudderProp] = props[optimizelyProp]; + delete props[optimizelyProp]; + } + } + } // Send to Rudder - var screen = new RudderScreenInfo(); // Depending on environment within which the code is executing, screen - // dimensions can be set - // User agent and locale can be retrieved only for browser - // For server-side integration, same needs to be set by calling program - { - // running within browser - screen.width = window.width; - screen.height = window.height; - screen.density = window.devicePixelRatio; - this.userAgent = navigator.userAgent; // property name differs based on browser version + _this.analytics.track("Experiment Viewed", props, context); + } - this.locale = navigator.language || navigator.browserLanguage; - } + if (_this.sendExperimentIdentify) { + var traits = {}; + traits["Experiment: ".concat(experiment.name)] = variation.name; // Send to Rudder - this.os = os; - this.screen = screen; - this.device = null; - this.network = null; - }; + _this.analytics.identify(traits); + } + }; - var RudderMessage = /*#__PURE__*/function () { - function RudderMessage() { - _classCallCheck(this, RudderMessage); + this.analytics = analytics; + this.sendExperimentTrack = config.sendExperimentTrack; + this.sendExperimentIdentify = config.sendExperimentIdentify; + this.sendExperimentTrackAsNonInteractive = config.sendExperimentTrackAsNonInteractive; + this.revenueOnlyOnOrderCompleted = config.revenueOnlyOnOrderCompleted; + this.trackCategorizedPages = config.trackCategorizedPages; + this.trackNamedPages = config.trackNamedPages; + this.customCampaignProperties = config.customCampaignProperties ? config.customCampaignProperties : []; + this.customExperimentProperties = config.customExperimentProperties ? config.customExperimentProperties : []; + this.name = "OPTIMIZELY"; + } - this.channel = "web"; - this.context = new RudderContext(); - this.type = null; - this.action = null; - this.messageId = generateUUID().toString(); - this.originalTimestamp = new Date().toISOString(); - this.anonymousId = null; - this.userId = null; - this.event = null; - this.properties = {}; - this.integrations = {}; // By default, all integrations will be set as enabled from client - // Decision to route to specific destinations will be taken at server end + _createClass(Optimizely, [{ + key: "init", + value: function init() { + logger.debug("=== in optimizely init ==="); + this.initOptimizelyIntegration(this.referrerOverride, this.sendDataToRudder); + } + }, { + key: "initOptimizelyIntegration", + value: function initOptimizelyIntegration(referrerOverride, sendCampaignData) { + var newActiveCampaign = function newActiveCampaign(id, referrer) { + var state = window.optimizely.get && window.optimizely.get("state"); - this.integrations.All = true; - } // Get property + if (state) { + var activeCampaigns = state.getCampaignStates({ + isActive: true + }); + var campaignState = activeCampaigns[id]; + if (referrer) campaignState.experiment.referrer = referrer; + sendCampaignData(campaignState); + } + }; + var checkReferrer = function checkReferrer() { + var state = window.optimizely.get && window.optimizely.get("state"); - _createClass(RudderMessage, [{ - key: "getProperty", - value: function getProperty(key) { - return this.properties[key]; - } // Add property + if (state) { + var referrer = state.getRedirectInfo() && state.getRedirectInfo().referrer; - }, { - key: "addProperty", - value: function addProperty(key, value) { - this.properties[key] = value; - } // Validate whether this message is semantically valid for the type mentioned + if (referrer) { + referrerOverride(referrer); + return referrer; + } + } - }, { - key: "validateFor", - value: function validateFor(messageType) { - // First check that properties is populated - if (!this.properties) { - throw new Error("Key properties is required"); + return undefined; + }; + + var registerFutureActiveCampaigns = function registerFutureActiveCampaigns() { + window.optimizely = window.optimizely || []; + window.optimizely.push({ + type: "addListener", + filter: { + type: "lifecycle", + name: "campaignDecided" + }, + handler: function handler(event) { + var id = event.data.campaign.id; + newActiveCampaign(id); + } + }); + }; + + var registerCurrentlyActiveCampaigns = function registerCurrentlyActiveCampaigns() { + window.optimizely = window.optimizely || []; + var state = window.optimizely.get && window.optimizely.get("state"); + + if (state) { + var referrer = checkReferrer(); + var activeCampaigns = state.getCampaignStates({ + isActive: true + }); + Object.keys(activeCampaigns).forEach(function (id) { + if (referrer) { + newActiveCampaign(id, referrer); + } else { + newActiveCampaign(id); + } + }); + } else { + window.optimizely.push({ + type: "addListener", + filter: { + type: "lifecycle", + name: "initialized" + }, + handler: function handler() { + checkReferrer(); + } + }); + } + }; + + registerCurrentlyActiveCampaigns(); + registerFutureActiveCampaigns(); + } + }, { + key: "track", + value: function track(rudderElement) { + logger.debug("in Optimizely web track"); + var eventProperties = rudderElement.message.properties; + var event = rudderElement.message.event; + + if (eventProperties.revenue && this.revenueOnlyOnOrderCompleted) { + if (event === "Order Completed") { + eventProperties.revenue = Math.round(eventProperties.revenue * 100); + } else if (event !== "Order Completed") { + delete eventProperties.revenue; + } + } + + var eventName = event.replace(/:/g, "_"); // can't have colons so replacing with underscores + + var payload = { + type: "event", + eventName: eventName, + tags: eventProperties + }; + window.optimizely.push(payload); + } + }, { + key: "page", + value: function page(rudderElement) { + logger.debug("in Optimizely web page"); + var category = rudderElement.message.properties.category; + var name = rudderElement.message.name; + /* const contextOptimizely = { + integrations: { All: false, Optimizely: true }, + }; */ + // categorized pages + + if (category && this.trackCategorizedPages) { + // this.analytics.track(`Viewed ${category} page`, {}, contextOptimizely); + rudderElement.message.event = "Viewed ".concat(category, " page"); + rudderElement.message.type = "track"; + this.track(rudderElement); + } // named pages + + + if (name && this.trackNamedPages) { + // this.analytics.track(`Viewed ${name} page`, {}, contextOptimizely); + rudderElement.message.event = "Viewed ".concat(name, " page"); + rudderElement.message.type = "track"; + this.track(rudderElement); + } + } + }, { + key: "isLoaded", + value: function isLoaded() { + return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); + } + }, { + key: "isReady", + value: function isReady() { + return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); + } + }]); + + return Optimizely; + }(); + + var Bugsnag = /*#__PURE__*/function () { + function Bugsnag(config) { + _classCallCheck(this, Bugsnag); + + this.releaseStage = config.releaseStage; + this.apiKey = config.apiKey; + this.name = "BUGSNAG"; + this.setIntervalHandler = undefined; + } + + _createClass(Bugsnag, [{ + key: "init", + value: function init() { + logger.debug("===in init Bugsnag==="); + ScriptLoader("bugsnag-id", "https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js"); + this.setIntervalHandler = setInterval(this.initBugsnagClient.bind(this), 1000); + } + }, { + key: "initBugsnagClient", + value: function initBugsnagClient() { + if (window.bugsnag !== undefined) { + window.bugsnagClient = window.bugsnag(this.apiKey); + window.bugsnagClient.releaseStage = this.releaseStage; + clearInterval(this.setIntervalHandler); + } + } + }, { + key: "isLoaded", + value: function isLoaded() { + logger.debug("in bugsnag isLoaded"); + return !!window.bugsnagClient; + } + }, { + key: "isReady", + value: function isReady() { + logger.debug("in bugsnag isReady"); + return !!window.bugsnagClient; + } + }, { + key: "identify", + value: function identify(rudderElement) { + var traits = rudderElement.message.context.traits; + var traitsFinal = { + id: rudderElement.message.userId || rudderElement.message.anonymousId, + name: traits.name, + email: traits.email + }; + window.bugsnagClient.user = traitsFinal; + window.bugsnagClient.notify(new Error("error in identify")); + } + }]); + + return Bugsnag; + }(); + + function preserveCamelCase(str) { + let isLastCharLower = false; + let isLastCharUpper = false; + let isLastLastCharUpper = false; + + for (let i = 0; i < str.length; i++) { + const c = str[i]; + + if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { + str = str.substr(0, i) + '-' + str.substr(i); + isLastCharLower = false; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = true; + i++; + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { + str = str.substr(0, i - 1) + '-' + str.substr(i - 1); + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = false; + isLastCharLower = true; + } else { + isLastCharLower = c.toLowerCase() === c; + isLastLastCharUpper = isLastCharUpper; + isLastCharUpper = c.toUpperCase() === c; + } + } + + return str; + } + + var camelcase = function (str) { + if (arguments.length > 1) { + str = Array.from(arguments) + .map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + str = str.trim(); + } + + if (str.length === 0) { + return ''; + } + + if (str.length === 1) { + return str.toLowerCase(); + } + + if (/^[a-z0-9]+$/.test(str)) { + return str; + } + + const hasUpperCase = str !== str.toLowerCase(); + + if (hasUpperCase) { + str = preserveCamelCase(str); + } + + return str + .replace(/^[_.\- ]+/, '') + .toLowerCase() + .replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); + }; + + var Fullstory = /*#__PURE__*/function () { + function Fullstory(config) { + _classCallCheck(this, Fullstory); + + this.fs_org = config.fs_org; + this.fs_debug_mode = config.fs_debug_mode; + this.name = "FULLSTORY"; + } + + _createClass(Fullstory, [{ + key: "init", + value: function init() { + logger.debug("===in init FULLSTORY==="); + window._fs_debug = this.fs_debug_mode; + window._fs_host = "fullstory.com"; + window._fs_script = "edge.fullstory.com/s/fs.js"; + window._fs_org = this.fs_org; + window._fs_namespace = "FS"; + + (function (m, n, e, t, l, o, g, y) { + if (e in m) { + if (m.console && m.console.log) { + m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'); + } + + return; + } + + g = m[e] = function (a, b, s) { + g.q ? g.q.push([a, b, s]) : g._api(a, b, s); + }; + + g.q = []; + o = n.createElement(t); + o.async = 1; + o.crossOrigin = "anonymous"; + o.src = "https://".concat(_fs_script); + y = n.getElementsByTagName(t)[0]; + y.parentNode.insertBefore(o, y); + + g.identify = function (i, v, s) { + g(l, { + uid: i + }, s); + if (v) g(l, v, s); + }; + + g.setUserVars = function (v, s) { + g(l, v, s); + }; + + g.event = function (i, v, s) { + g("event", { + n: i, + p: v + }, s); + }; + + g.shutdown = function () { + g("rec", !1); + }; + + g.restart = function () { + g("rec", !0); + }; + + g.log = function (a, b) { + g("log", [a, b]); + }; + + g.consent = function (a) { + g("consent", !arguments.length || a); + }; + + g.identifyAccount = function (i, v) { + o = "account"; + v = v || {}; + v.acctId = i; + g(o, v); + }; + + g.clearUserCookie = function () {}; + + g._w = {}; + y = "XMLHttpRequest"; + g._w[y] = m[y]; + y = "fetch"; + g._w[y] = m[y]; + if (m[y]) m[y] = function () { + return g._w[y].apply(this, arguments); + }; + })(window, document, window._fs_namespace, "script", "user"); + } + }, { + key: "page", + value: function page(rudderElement) { + logger.debug("in FULLSORY page"); + var rudderMessage = rudderElement.message; + var pageName = rudderMessage.name; + + var props = _objectSpread2({ + name: pageName + }, rudderMessage.properties); + + window.FS.event("Viewed a Page", Fullstory.getFSProperties(props)); + } + }, { + key: "identify", + value: function identify(rudderElement) { + logger.debug("in FULLSORY identify"); + var userId = rudderElement.message.userId; + var traits = rudderElement.message.context.traits; + if (!userId) userId = rudderElement.message.anonymousId; + if (Object.keys(traits).length === 0 && traits.constructor === Object) window.FS.identify(userId);else window.FS.identify(userId, Fullstory.getFSProperties(traits)); + } + }, { + key: "track", + value: function track(rudderElement) { + logger.debug("in FULLSTORY track"); + window.FS.event(rudderElement.message.event, Fullstory.getFSProperties(rudderElement.message.properties)); + } + }, { + key: "isLoaded", + value: function isLoaded() { + logger.debug("in FULLSTORY isLoaded"); + return !!window.FS; + } + }], [{ + key: "getFSProperties", + value: function getFSProperties(properties) { + var FS_properties = {}; + Object.keys(properties).map(function (key, index) { + FS_properties[key === "displayName" || key === "email" ? key : Fullstory.camelCaseField(key)] = properties[key]; + }); + return FS_properties; + } + }, { + key: "camelCaseField", + value: function camelCaseField(fieldName) { + // Do not camel case across type suffixes. + var parts = fieldName.split("_"); + + if (parts.length > 1) { + var typeSuffix = parts.pop(); + + switch (typeSuffix) { + case "str": + case "int": + case "date": + case "real": + case "bool": + case "strs": + case "ints": + case "dates": + case "reals": + case "bools": + return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); + + } + } // No type suffix found. Camel case the whole field name. + + + return camelcase(fieldName); + } + }]); + + return Fullstory; + }(); + + // (config-plan name, native destination.name , exported integration name(this one below)) + + var integrations = { + HS: index, + GA: index$1, + HOTJAR: index$2, + GOOGLEADS: index$3, + VWO: VWO, + GTM: GoogleTagManager, + BRAZE: Braze, + INTERCOM: INTERCOM, + KEEN: Keen, + KISSMETRICS: Kissmetrics, + CUSTOMERIO: CustomerIO, + CHARTBEAT: Chartbeat, + COMSCORE: Comscore, + FACEBOOK_PIXEL: FacebookPixel, + LOTAME: Lotame, + OPTIMIZELY: Optimizely, + BUGSNAG: Bugsnag, + FULLSTORY: Fullstory + }; + + // Application class + var RudderApp = function RudderApp() { + _classCallCheck(this, RudderApp); + + this.build = "1.0.0"; + this.name = "RudderLabs JavaScript SDK"; + this.namespace = "com.rudderlabs.javascript"; + this.version = "1.0.7"; + }; + + // Library information class + var RudderLibraryInfo = function RudderLibraryInfo() { + _classCallCheck(this, RudderLibraryInfo); + + this.name = "RudderLabs JavaScript SDK"; + this.version = "1.0.7"; + }; // Operating System information class + + + var RudderOSInfo = function RudderOSInfo() { + _classCallCheck(this, RudderOSInfo); + + this.name = ""; + this.version = ""; + }; // Screen information class + + + var RudderScreenInfo = function RudderScreenInfo() { + _classCallCheck(this, RudderScreenInfo); + + this.density = 0; + this.width = 0; + this.height = 0; + }; // Device information class + + var RudderContext = function RudderContext() { + _classCallCheck(this, RudderContext); + + this.app = new RudderApp(); + this.traits = null; + this.library = new RudderLibraryInfo(); // this.os = null; + + var os = new RudderOSInfo(); + os.version = ""; // skipping version for simplicity now + + var screen = new RudderScreenInfo(); // Depending on environment within which the code is executing, screen + // dimensions can be set + // User agent and locale can be retrieved only for browser + // For server-side integration, same needs to be set by calling program + + { + // running within browser + screen.width = window.width; + screen.height = window.height; + screen.density = window.devicePixelRatio; + this.userAgent = navigator.userAgent; // property name differs based on browser version + + this.locale = navigator.language || navigator.browserLanguage; + } + + this.os = os; + this.screen = screen; + this.device = null; + this.network = null; + }; + + var RudderMessage = /*#__PURE__*/function () { + function RudderMessage() { + _classCallCheck(this, RudderMessage); + + this.channel = "web"; + this.context = new RudderContext(); + this.type = null; + this.action = null; + this.messageId = generateUUID().toString(); + this.originalTimestamp = new Date().toISOString(); + this.anonymousId = null; + this.userId = null; + this.event = null; + this.properties = {}; + this.integrations = {}; // By default, all integrations will be set as enabled from client + // Decision to route to specific destinations will be taken at server end + + this.integrations.All = true; + } // Get property + + + _createClass(RudderMessage, [{ + key: "getProperty", + value: function getProperty(key) { + return this.properties[key]; + } // Add property + + }, { + key: "addProperty", + value: function addProperty(key, value) { + this.properties[key] = value; + } // Validate whether this message is semantically valid for the type mentioned + + }, { + key: "validateFor", + value: function validateFor(messageType) { + // First check that properties is populated + if (!this.properties) { + throw new Error("Key properties is required"); } // Event type specific checks @@ -20473,9 +21215,24 @@ function bytesToUuid(buf, offset) { var i = offset || 0; +<<<<<<< HEAD var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); +======= + var bth = byteToHex; + // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + return ([ + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]] + ]).join(''); +>>>>>>> Updated npm distribution files } var bytesToUuid_1 = bytesToUuid; @@ -20492,6 +21249,10 @@ var _lastMSecs = 0; var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details +<<<<<<< HEAD +======= + // See https://github.com/uuidjs/uuid for API details +>>>>>>> Updated npm distribution files function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; @@ -20795,6 +21556,7 @@ switch (e.code) { case 22: quotaExceeded = true; +<<<<<<< HEAD break; case 1014: @@ -20804,6 +21566,10 @@ } break; +======= + } + break; +>>>>>>> Updated npm distribution files } } else if (e.number === -2147024882) { // Internet Explorer 8 From 83a96a4ef728929af7e4fbdcece8e52c2e4dcc5f Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Thu, 13 Aug 2020 00:55:56 +0530 Subject: [PATCH 13/20] update npm module --- dist/rudder-sdk-js/index.js | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index a866fc0c04..c30ad3a7e9 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -1007,6 +1007,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ======= @@ -1024,13 +1025,31 @@ ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; ======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; +>>>>>>> update npm module +>>>>>>> update npm module +>>>>>>> update npm module +>>>>>>> update npm module var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -18876,11 +18895,18 @@ return value; } +<<<<<<< HEAD <<<<<<< HEAD var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); ======= var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); >>>>>>> Updated npm distribution files +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); +>>>>>>> update npm module +>>>>>>> update npm module return prefixedVal; } /** @@ -18896,11 +18922,18 @@ } if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { +<<<<<<< HEAD <<<<<<< HEAD return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ======= return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); >>>>>>> Updated npm distribution files +======= + return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); +======= + return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); +>>>>>>> update npm module +>>>>>>> update npm module } return value; @@ -19565,10 +19598,25 @@ return Fullstory; }(); +<<<<<<< HEAD <<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { ======= <<<<<<< HEAD +======= +<<<<<<< HEAD + var Optimizely = + /*#__PURE__*/ + function () { +======= + var Optimizely = /*#__PURE__*/function () { +>>>>>>> update npm module + function Optimizely(config, analytics) { + var _this = this; + + _classCallCheck(this, Optimizely); +======= +>>>>>>> update npm module var Optimizely = /*#__PURE__*/ function () { @@ -20291,6 +20339,7 @@ this.version = "1.0.11"; >>>>>>> rebase with production branch }; +<<<<<<< HEAD ======= var Optimizely = /*#__PURE__*/function () { function Optimizely(config, analytics) { @@ -20299,12 +20348,17 @@ _classCallCheck(this, Optimizely); >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module + +>>>>>>> update npm module this.referrerOverride = function (referrer) { if (referrer) { window.optimizelyEffectiveReferrer = referrer; return referrer; } +<<<<<<< HEAD <<<<<<< HEAD this.name = "RudderLabs JavaScript SDK"; <<<<<<< HEAD @@ -20329,6 +20383,15 @@ return undefined; }; >>>>>>> Updated npm distribution files +======= + return undefined; + }; +======= + this.name = "RudderLabs JavaScript SDK"; + this.version = "1.0.8"; + }; // Operating System information class +>>>>>>> update npm module +>>>>>>> update npm module this.sendDataToRudder = function (campaignState) { logger.debug(campaignState); From fedffc91ae0361b440c143d28a091994c9c7f3de Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Thu, 3 Sep 2020 13:33:26 +0530 Subject: [PATCH 14/20] branch for npm and latest release --- dist/rudder-sdk-js/index.js | 15566 +++++++++++++++++++++------------- 1 file changed, 9826 insertions(+), 5740 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index c30ad3a7e9..0a338ac45c 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -1,10 +1,13 @@ (function (global, factory) { +<<<<<<< HEAD <<<<<<< HEAD typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.rudderanalytics = {})); }(this, (function (exports) { 'use strict'; ======= +======= +>>>>>>> branch for npm and latest release typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); @@ -12,7 +15,16 @@ AES = AES && Object.prototype.hasOwnProperty.call(AES, 'default') ? AES['default'] : AES; Utf8 = Utf8 && Object.prototype.hasOwnProperty.call(Utf8, 'default') ? Utf8['default'] : Utf8; +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.rudderanalytics = {})); +}(this, (function (exports) { 'use strict'; +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release function _typeof(obj) { "@babel/helpers - typeof"; @@ -671,6 +683,123 @@ return !!this.listeners(event).length; }; }); +>>>>>>> branch for npm and latest release +<<<<<<< HEAD + + exports.isAbsolute = function (url) { + return 0 == url.indexOf('//') || !!~url.indexOf('://'); + }; + /** + * Check if `url` is relative. + * + * @param {String} url + * @return {Boolean} + * @api public + */ + +<<<<<<< HEAD + + exports.isRelative = function (url) { + return !exports.isAbsolute(url); + }; + /** + * Check if `url` is cross domain. + * + * @param {String} url + * @return {Boolean} + * @api public + */ + + + exports.isCrossDomain = function (url) { + url = exports.parse(url); + var location = exports.parse(window.location.href); + return url.hostname !== location.hostname || url.port !== location.port || url.protocol !== location.protocol; + }; + /** + * Return default port for `protocol`. + * + * @param {String} protocol + * @return {String} + * @api private + */ +======= + function after(count, callback, err_cb) { + var bail = false; + err_cb = err_cb || noop; + proxy.count = count; + return count === 0 ? callback() : proxy; + + function proxy(err, result) { + if (proxy.count <= 0) { + throw new Error('after called too many times'); + } + + --proxy.count; // after first error, rest are passed to err_cb + + if (err) { + bail = true; + callback(err); // future error callbacks will go to error handler + + callback = err_cb; + } else if (proxy.count === 0 && !bail) { + callback(null, result); + } + } + } +>>>>>>> branch for npm and latest release + + + function port(protocol) { + switch (protocol) { + case 'http:': + return 80; + + case 'https:': + return 443; + + default: + return location.port; + } + } + }); + var componentUrl_1 = componentUrl.parse; + var componentUrl_2 = componentUrl.isAbsolute; + var componentUrl_3 = componentUrl.isRelative; + var componentUrl_4 = componentUrl.isCrossDomain; + + var componentUrl = createCommonjsModule(function (module, exports) { + /** + * Parse the given `url`. + * + * @param {String} str + * @return {Object} + * @api public + */ + exports.parse = function (url) { + var a = document.createElement('a'); + a.href = url; + return { + href: a.href, + host: a.host || location.host, + port: '0' === a.port || '' === a.port ? port(a.protocol) : a.port, + hash: a.hash, + hostname: a.hostname || location.hostname, + pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname, + protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol, + search: a.search, + query: a.search.slice(1) + }; + }; + /** + * Check if `url` is absolute. + * + * @param {String} url + * @return {Boolean} + * @api public + */ + +======= >>>>>>> branch for npm and latest release exports.isAbsolute = function (url) { @@ -1008,6 +1137,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ======= @@ -1027,10 +1157,16 @@ ======= ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; +======= +>>>>>>> branch for npm and latest release ======= ======= >>>>>>> update npm module >>>>>>> update npm module +======= +>>>>>>> branch for npm and latest release <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ======= @@ -1043,13 +1179,27 @@ ======= ======= ======= +======= +>>>>>>> branch for npm and latest release var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; >>>>>>> update npm module +<<<<<<< HEAD >>>>>>> update npm module +<<<<<<< HEAD >>>>>>> update npm module +<<<<<<< HEAD >>>>>>> update npm module +======= +======= +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -2415,13 +2565,19 @@ */ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> branch for npm and latest release var toString$1 = Object.prototype.toString; ======= var toString = Object.prototype.toString; >>>>>>> branch for npm and latest release +<<<<<<< HEAD ======= var toString$1 = Object.prototype.toString; >>>>>>> NPM release version 1.0.11 +======= +>>>>>>> branch for npm and latest release /** * Return the type of `val`. * @@ -2430,6 +2586,7 @@ * @api public */ +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD var componentType$1 = function componentType(val) { @@ -2442,6 +2599,14 @@ var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { >>>>>>> NPM release version 1.0.11 +======= + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { +======= + var componentType = function componentType(val) { + switch (toString.call(val)) { +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release case '[object Function]': return 'function'; @@ -4217,6 +4382,49 @@ bytes.push(Math.floor(Math.random() * 256)); } +<<<<<<< HEAD +======= + return bytes; + }, + // Convert a byte array to big-endian 32-bit words + bytesToWords: function bytesToWords(bytes) { + for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) { + words[b >>> 5] |= bytes[i] << 24 - b % 32; + } + + return words; + }, + // Convert big-endian 32-bit words to a byte array + wordsToBytes: function wordsToBytes(words) { + for (var bytes = [], b = 0; b < words.length * 32; b += 8) { + bytes.push(words[b >>> 5] >>> 24 - b % 32 & 0xFF); + } + + return bytes; + }, + // Convert a byte array to a hex string + bytesToHex: function bytesToHex(bytes) { + for (var hex = [], i = 0; i < bytes.length; i++) { + hex.push((bytes[i] >>> 4).toString(16)); + hex.push((bytes[i] & 0xF).toString(16)); + } + + return hex.join(''); + }, + // Convert a hex string to a byte array + hexToBytes: function hexToBytes(hex) { + for (var bytes = [], c = 0; c < hex.length; c += 2) { + bytes.push(parseInt(hex.substr(c, 2), 16)); + } + + return bytes; + }, + // Convert a byte array to a base-64 string + bytesToBase64: function bytesToBase64(bytes) { + for (var base64 = [], i = 0; i < bytes.length; i += 3) { + var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; + +>>>>>>> branch for npm and latest release ======= return n; @@ -4268,6 +4476,7 @@ for (var base64 = [], i = 0; i < bytes.length; i += 3) { var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; +>>>>>>> branch for npm and latest release for (var j = 0; j < 4; j++) { if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt(triplet >>> 6 * (3 - j) & 0x3F));else base64.push('='); } @@ -4929,6 +5138,42 @@ } } } +<<<<<<< HEAD + + key = undefined; // if we found no matching properties + // on the current object, there's no match. + + finished = true; + } + + if (!key) return; + if (null == obj) return obj; // the `obj` and `key` is one above the leaf object and key, so + // start object: { a: { 'b.c': 10 } } + // end object: { 'b.c': 10 } + // end key: 'b.c' + // this way, you can do `obj[key]` and get `10`. + + return fn(obj, key, val); + }; + } + /** + * Find an object by its key + * + * find({ first_name : 'Calvin' }, 'firstName') + */ + + + function find(obj, key) { + if (obj.hasOwnProperty(key)) return obj[key]; + } + /** + * Delete a value for a given key + * + * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } + */ + + +======= key = undefined; // if we found no matching properties // on the current object, there's no match. @@ -4997,6 +5242,7 @@ ======= >>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release function del(obj, key) { if (obj.hasOwnProperty(key)) delete obj[key]; return obj; @@ -6566,6 +6812,7 @@ var core = createCommonjsModule(function (module, exports) { <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= (function (root, factory) { { @@ -7320,6 +7567,8 @@ })); }); ======= +>>>>>>> branch for npm and latest release +======= >>>>>>> branch for npm and latest release (function (root, factory) { @@ -7762,126 +8011,434 @@ words.push(_r() * 0x100000000 | 0); } - return new WordArray.init(words, nBytes); - } - }); - /** - * Encoder namespace. - */ +======= - var C_enc = C.enc = {}; + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(); + } + })(commonjsGlobal, function () { + /** + * CryptoJS core components. + */ + var CryptoJS = CryptoJS || function (Math, undefined$1) { + /* + * Local polyfil of Object.create + */ + var create = Object.create || function () { + function F() {} + return function (obj) { + var subtype; + F.prototype = obj; + subtype = new F(); + F.prototype = null; + return subtype; + }; + }(); /** - * Hex encoding strategy. + * CryptoJS namespace. */ - var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. - * - * @static - * - * @example - * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert - var hexChars = []; + var C = {}; + /** + * Library namespace. + */ - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); + var C_lib = C.lib = {}; + /** + * Base object for prototypal inheritance. + */ + + var Base = C_lib.Base = function () { + return { + /** + * Creates a new object that inherits from this object. + * + * @param {Object} overrides Properties to copy into the new object. + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * field: 'value', + * + * method: function () { + * } + * }); + */ + extend: function extend(overrides) { + // Spawn + var subtype = create(this); // Augment + + if (overrides) { + subtype.mixIn(overrides); + } // Create default initializer + + + if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { + subtype.init = function () { + subtype.$super.init.apply(this, arguments); + }; + } // Initializer's prototype is the subtype object + + + subtype.init.prototype = subtype; // Reference supertype + + subtype.$super = this; + return subtype; + }, + + /** + * Extends this object and runs the init method. + * Arguments to create() will be passed to init(). + * + * @return {Object} The new object. + * + * @static + * + * @example + * + * var instance = MyType.create(); + */ + create: function create() { + var instance = this.extend(); + instance.init.apply(instance, arguments); + return instance; + }, + + /** + * Initializes a newly created object. + * Override this method to add some logic when your objects are created. + * + * @example + * + * var MyType = CryptoJS.lib.Base.extend({ + * init: function () { + * // ... + * } + * }); + */ + init: function init() {}, + + /** + * Copies properties into this object. + * + * @param {Object} properties The properties to mix in. + * + * @example + * + * MyType.mixIn({ + * field: 'value' + * }); + */ + mixIn: function mixIn(properties) { + for (var propertyName in properties) { + if (properties.hasOwnProperty(propertyName)) { + this[propertyName] = properties[propertyName]; + } + } // IE won't copy toString using the loop above + + + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function clone() { + return this.init.prototype.extend(this); } + }; + }(); + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ - return hexChars.join(''); - }, + var WordArray = C_lib.WordArray = Base.extend({ /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. - * - * @return {WordArray} The word array. + * Initializes a newly created word array. * - * @static + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. * * @example * - * var wordArray = CryptoJS.enc.Hex.parse(hexString); + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); */ - parse: function parse(hexStr) { - // Shortcut - var hexStrLength = hexStr.length; // Convert - - var words = []; + init: function init(words, sigBytes) { + words = this.words = words || []; - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; + if (sigBytes != undefined$1) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; } + }, - return new WordArray.init(words, hexStrLength / 2); - } - }; - /** - * Latin1 encoding strategy. - */ - - var Latin1 = C_enc.Latin1 = { /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. + * Converts this word array to a string. * - * @return {string} The Latin1 string. + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex * - * @static + * @return {string} The stringified word array. * * @example * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert - - var latin1Chars = []; - - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } - - return latin1Chars.join(''); + toString: function toString(encoder) { + return (encoder || Hex).stringify(this); }, /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. + * Concatenates a word array to this word array. * - * @return {WordArray} The word array. + * @param {WordArray} wordArray The word array to append. * - * @static + * @return {WordArray} This word array. * * @example * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + * wordArray1.concat(wordArray2); */ - parse: function parse(latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; // Convert - - var words = []; - + concat: function concat(wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; // Clamp excess bits + + this.clamp(); // Concat + + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; + } + } else { + // Copy one word at a time + for (var i = 0; i < thatSigBytes; i += 4) { + thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; + } + } + + this.sigBytes += thatSigBytes; // Chainable + + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function clamp() { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; // Clamp + + words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function random(nBytes) { + var words = []; + + var r = function r(m_w) { + var m_w = m_w; + var m_z = 0x3ade68b1; + var mask = 0xffffffff; + return function () { + m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; + m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; + var result = (m_z << 0x10) + m_w & mask; + result /= 0x100000000; + result += 0.5; + return result * (Math.random() > .5 ? 1 : -1); + }; + }; + + for (var i = 0, rcache; i < nBytes; i += 4) { + var _r = r((rcache || Math.random()) * 0x100000000); + + rcache = _r() * 0x3ade67b7; + words.push(_r() * 0x100000000 | 0); + } + +>>>>>>> branch for npm and latest release + return new WordArray.init(words, nBytes); + } + }); + /** + * Encoder namespace. + */ + + var C_enc = C.enc = {}; + /** + * Hex encoding strategy. + */ + + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert + + var hexChars = []; + + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } +<<<<<<< HEAD + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function parse(hexStr) { + // Shortcut + var hexStrLength = hexStr.length; // Convert + + var words = []; + + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + /** + * Latin1 encoding strategy. + */ + + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert + + var latin1Chars = []; + + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function parse(latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; // Convert + + var words = []; + for (var i = 0; i < latin1StrLength; i++) { words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; } @@ -8178,161 +8735,16 @@ /** * Algorithm namespace. */ ->>>>>>> branch for npm and latest release var C_algo = C.algo = {}; return C; }(Math); -<<<<<<< HEAD - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function clone() { - return this.init.prototype.extend(this); - } - }; - }(); - /** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ + return CryptoJS; + }); + }); - - var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function init(words, sigBytes) { - words = this.words = words || []; - - if (sigBytes != undefined$1) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, - - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function toString(encoder) { - return (encoder || Hex).stringify(this); - }, - - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function concat(wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; // Clamp excess bits - - this.clamp(); // Concat - - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; - } - } - - this.sigBytes += thatSigBytes; // Chainable - - return this; - }, - - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function clamp() { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; // Clamp - - words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; - words.length = Math.ceil(sigBytes / 4); - }, - - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - return clone; - }, - - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. -======= - return CryptoJS; - }); - }); - - var encBase64 = createCommonjsModule(function (module, exports) { + var encBase64 = createCommonjsModule(function (module, exports) { (function (root, factory) { { @@ -8357,86 +8769,11 @@ * @param {WordArray} wordArray The word array. * * @return {string} The Base64 string. ->>>>>>> branch for npm and latest release - * - * @static - * - * @example - * -<<<<<<< HEAD - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function random(nBytes) { - var words = []; - - var r = function r(m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - return function () { - m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; - m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; - var result = (m_z << 0x10) + m_w & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - }; - }; - - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); - - rcache = _r() * 0x3ade67b7; - words.push(_r() * 0x100000000 | 0); - } - - return new WordArray.init(words, nBytes); - } - }); - /** - * Encoder namespace. - */ - - var C_enc = C.enc = {}; - /** - * Hex encoding strategy. - */ - - var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. * * @static * * @example * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert - - var hexChars = []; - - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); - } - - return hexChars.join(''); - }, - - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. -======= * var base64String = CryptoJS.enc.Base64.stringify(wordArray); */ stringify: function stringify(wordArray) { @@ -8476,7 +8813,6 @@ * Converts a Base64 string to a word array. * * @param {string} base64Str The Base64 string. ->>>>>>> branch for npm and latest release * * @return {WordArray} The word array. * @@ -8484,1878 +8820,5189 @@ * * @example * -<<<<<<< HEAD - * var wordArray = CryptoJS.enc.Hex.parse(hexString); + * var wordArray = CryptoJS.enc.Base64.parse(base64String); */ - parse: function parse(hexStr) { - // Shortcut - var hexStrLength = hexStr.length; // Convert + parse: function parse(base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; - var words = []; + if (!reverseMap) { + reverseMap = this._reverseMap = []; - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; - } + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } // Ignore padding - return new WordArray.init(words, hexStrLength / 2); - } - }; - /** - * Latin1 encoding strategy. - */ - var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert + var paddingChar = map.charAt(64); - var latin1Chars = []; + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } // Convert - return latin1Chars.join(''); + + return parseLoop(base64Str, base64StrLength, reverseMap); }, + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function parse(latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; // Convert - - var words = []; + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; + words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; + nBytes++; } - - return new WordArray.init(words, latin1StrLength); } - }; - /** - * UTF-8 encoding strategy. - */ - var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, + return WordArray.create(words, nBytes); + } + })(); - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function parse(utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + return CryptoJS.enc.Base64; + }); + }); + + var md5$1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Constants table + + var T = []; // Compute constants + + (function () { + for (var i = 0; i < 64; i++) { + T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; } - }; + })(); /** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + * MD5 hash algorithm. */ - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function reset() { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; + + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; + } // Shortcuts - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function _append(data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } // Append + var H = this._hash.words; + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; // Working varialbes - this._data.concat(data); + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; // Computation - this._nDataBytes += data.sigBytes; - }, + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function _process(doFlush) { + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + }, + _doFinalize: function _doFinalize() { // Shortcuts var data = this._data; var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; // Count blocks ready + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding - var nBlocksReady = dataSigBytes / blockSizeBytes; - - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } // Count words ready - - - var nWordsReady = nBlocksReady * blockSize; // Count bytes ready + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; + data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks + this._process(); // Shortcuts - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } // Remove processed words + var hash = this._hash; + var H = hash.words; // Swap endian - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } // Return processed words + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; + } // Return final computed hash - return new WordArray.init(processedWords, nBytesReady); + return hash; }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ clone: function clone() { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); return clone; - }, - _minBufferSize: 0 + } }); + + function FF(a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return (n << s | n >>> 32 - s) + b; + } /** - * Abstract hasher template. + * Shortcut function to the hasher's object interface. * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); */ - var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function init(cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Set initial values + C.MD5 = Hasher._createHelper(MD5); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ - this.reset(); - }, + C.HmacMD5 = Hasher._createHmacHelper(MD5); + })(Math); - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic + return CryptoJS.MD5; + }); + }); - this._doReset(); + var sha1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Reusable object + + var W = []; + /** + * SHA-1 hash algorithm. + */ + + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Shortcut + var H = this._hash.words; // Working variables - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function update(messageUpdate) { - // Append - this._append(messageUpdate); // Update the hash + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; // Computation + + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = n << 1 | n >>> 31; + } + var t = (a << 5 | a >>> 27) + e + W[i]; - this._process(); // Chainable + if (i < 20) { + t += (b & c | ~b & d) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += (b & c | b & d | c & d) - 0x70e44324; + } else + /* if (i < 80) */ + { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = b << 30 | b >>> 2; + b = a; + a = t; + } // Intermediate hash value - return this; + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + H[4] = H[4] + e | 0; }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } // Perform concrete-hasher logic + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; // Hash final blocks + this._process(); // Return final computed hash - var hash = this._doFinalize(); - return hash; + return this._hash; }, - blockSize: 512 / 32, - - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function _createHelper(hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, - - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function _createHmacHelper(hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; } }); /** - * Algorithm namespace. + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); */ - var C_algo = C.algo = {}; - return C; - }(Math); + C.SHA1 = Hasher._createHelper(SHA1); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ - return CryptoJS; + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + })(); + + return CryptoJS.SHA1; }); }); - var encBase64 = createCommonjsModule(function (module, exports) { + var hmac = createCommonjsModule(function (module, exports) { -======= - * var wordArray = CryptoJS.enc.Base64.parse(base64String); + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + /** + * HMAC algorithm. + */ + + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); */ - parse: function parse(base64Str) { - // Shortcuts - var base64StrLength = base64Str.length; - var map = this._map; - var reverseMap = this._reverseMap; + init: function init(hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already - if (!reverseMap) { - reverseMap = this._reverseMap = []; + if (typeof key == 'string') { + key = Utf8.parse(key); + } // Shortcuts - for (var j = 0; j < map.length; j++) { - reverseMap[map.charCodeAt(j)] = j; - } - } // Ignore padding + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys - var paddingChar = map.charAt(64); + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } // Clamp excess bits - if (paddingChar) { - var paddingIndex = base64Str.indexOf(paddingChar); - if (paddingIndex !== -1) { - base64StrLength = paddingIndex; - } - } // Convert + key.clamp(); // Clone key for inner and outer pads + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); // Shortcuts - return parseLoop(base64Str, base64StrLength, reverseMap); + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; // XOR keys with pad constants + + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + + this.reset(); }, - _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' - }; - function parseLoop(base64Str, base64StrLength, reverseMap) { - var words = []; - var nBytes = 0; + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function reset() { + // Shortcut + var hasher = this._hasher; // Reset - for (var i = 0; i < base64StrLength; i++) { - if (i % 4) { - var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; - var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; - words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; - nBytes++; - } - } + hasher.reset(); + hasher.update(this._iKey); + }, - return WordArray.create(words, nBytes); - } - })(); + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function update(messageUpdate) { + this._hasher.update(messageUpdate); // Chainable - return CryptoJS.enc.Base64; + + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Shortcut + var hasher = this._hasher; // Compute HMAC + + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + return hmac; + } + }); + })(); }); }); - var md5$1 = createCommonjsModule(function (module, exports) { + var evpkdf = createCommonjsModule(function (module, exports) { - (function (root, factory) { + (function (root, factory, undef) { { // CommonJS - module.exports = exports = factory(core); + module.exports = exports = factory(core, sha1, hmac); } })(commonjsGlobal, function (CryptoJS) { - (function (Math) { + (function () { // Shortcuts var C = CryptoJS; var C_lib = C.lib; + var Base = C_lib.Base; var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Constants table - - var T = []; // Compute constants - - (function () { - for (var i = 0; i < 64; i++) { - T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; - } - })(); + var C_algo = C.algo; + var MD5 = C_algo.MD5; /** - * MD5 hash algorithm. + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128 / 32, + hasher: MD5, + iterations: 1 + }), - var MD5 = C_algo.MD5 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Swap endian - for (var i = 0; i < 16; i++) { - // Shortcuts - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; - } // Shortcuts - - - var H = this._hash.words; - var M_offset_0 = M[offset + 0]; - var M_offset_1 = M[offset + 1]; - var M_offset_2 = M[offset + 2]; - var M_offset_3 = M[offset + 3]; - var M_offset_4 = M[offset + 4]; - var M_offset_5 = M[offset + 5]; - var M_offset_6 = M[offset + 6]; - var M_offset_7 = M[offset + 7]; - var M_offset_8 = M[offset + 8]; - var M_offset_9 = M[offset + 9]; - var M_offset_10 = M[offset + 10]; - var M_offset_11 = M[offset + 11]; - var M_offset_12 = M[offset + 12]; - var M_offset_13 = M[offset + 13]; - var M_offset_14 = M[offset + 14]; - var M_offset_15 = M[offset + 15]; // Working varialbes - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; // Computation + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function init(cfg) { + this.cfg = this.cfg.extend(cfg); + }, - a = FF(a, b, c, d, M_offset_0, 7, T[0]); - d = FF(d, a, b, c, M_offset_1, 12, T[1]); - c = FF(c, d, a, b, M_offset_2, 17, T[2]); - b = FF(b, c, d, a, M_offset_3, 22, T[3]); - a = FF(a, b, c, d, M_offset_4, 7, T[4]); - d = FF(d, a, b, c, M_offset_5, 12, T[5]); - c = FF(c, d, a, b, M_offset_6, 17, T[6]); - b = FF(b, c, d, a, M_offset_7, 22, T[7]); - a = FF(a, b, c, d, M_offset_8, 7, T[8]); - d = FF(d, a, b, c, M_offset_9, 12, T[9]); - c = FF(c, d, a, b, M_offset_10, 17, T[10]); - b = FF(b, c, d, a, M_offset_11, 22, T[11]); - a = FF(a, b, c, d, M_offset_12, 7, T[12]); - d = FF(d, a, b, c, M_offset_13, 12, T[13]); - c = FF(c, d, a, b, M_offset_14, 17, T[14]); - b = FF(b, c, d, a, M_offset_15, 22, T[15]); - a = GG(a, b, c, d, M_offset_1, 5, T[16]); - d = GG(d, a, b, c, M_offset_6, 9, T[17]); - c = GG(c, d, a, b, M_offset_11, 14, T[18]); - b = GG(b, c, d, a, M_offset_0, 20, T[19]); - a = GG(a, b, c, d, M_offset_5, 5, T[20]); - d = GG(d, a, b, c, M_offset_10, 9, T[21]); - c = GG(c, d, a, b, M_offset_15, 14, T[22]); - b = GG(b, c, d, a, M_offset_4, 20, T[23]); - a = GG(a, b, c, d, M_offset_9, 5, T[24]); - d = GG(d, a, b, c, M_offset_14, 9, T[25]); - c = GG(c, d, a, b, M_offset_3, 14, T[26]); - b = GG(b, c, d, a, M_offset_8, 20, T[27]); - a = GG(a, b, c, d, M_offset_13, 5, T[28]); - d = GG(d, a, b, c, M_offset_2, 9, T[29]); - c = GG(c, d, a, b, M_offset_7, 14, T[30]); - b = GG(b, c, d, a, M_offset_12, 20, T[31]); - a = HH(a, b, c, d, M_offset_5, 4, T[32]); - d = HH(d, a, b, c, M_offset_8, 11, T[33]); - c = HH(c, d, a, b, M_offset_11, 16, T[34]); - b = HH(b, c, d, a, M_offset_14, 23, T[35]); - a = HH(a, b, c, d, M_offset_1, 4, T[36]); - d = HH(d, a, b, c, M_offset_4, 11, T[37]); - c = HH(c, d, a, b, M_offset_7, 16, T[38]); - b = HH(b, c, d, a, M_offset_10, 23, T[39]); - a = HH(a, b, c, d, M_offset_13, 4, T[40]); - d = HH(d, a, b, c, M_offset_0, 11, T[41]); - c = HH(c, d, a, b, M_offset_3, 16, T[42]); - b = HH(b, c, d, a, M_offset_6, 23, T[43]); - a = HH(a, b, c, d, M_offset_9, 4, T[44]); - d = HH(d, a, b, c, M_offset_12, 11, T[45]); - c = HH(c, d, a, b, M_offset_15, 16, T[46]); - b = HH(b, c, d, a, M_offset_2, 23, T[47]); - a = II(a, b, c, d, M_offset_0, 6, T[48]); - d = II(d, a, b, c, M_offset_7, 10, T[49]); - c = II(c, d, a, b, M_offset_14, 15, T[50]); - b = II(b, c, d, a, M_offset_5, 21, T[51]); - a = II(a, b, c, d, M_offset_12, 6, T[52]); - d = II(d, a, b, c, M_offset_3, 10, T[53]); - c = II(c, d, a, b, M_offset_10, 15, T[54]); - b = II(b, c, d, a, M_offset_1, 21, T[55]); - a = II(a, b, c, d, M_offset_8, 6, T[56]); - d = II(d, a, b, c, M_offset_15, 10, T[57]); - c = II(c, d, a, b, M_offset_6, 15, T[58]); - b = II(b, c, d, a, M_offset_13, 21, T[59]); - a = II(a, b, c, d, M_offset_4, 6, T[60]); - d = II(d, a, b, c, M_offset_11, 10, T[61]); - c = II(c, d, a, b, M_offset_2, 15, T[62]); - b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function compute(password, salt) { + // Shortcut + var cfg = this.cfg; // Init hasher - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding + var hasher = cfg.hasher.create(); // Initial values - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); - var nBitsTotalL = nBitsTotal; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; - data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + var derivedKey = WordArray.create(); // Shortcuts - this._process(); // Shortcuts + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; // Generate key + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } - var hash = this._hash; - var H = hash.words; // Swap endian + var block = hasher.update(password).finalize(salt); + hasher.reset(); // Iterations - for (var i = 0; i < 4; i++) { - // Shortcut - var H_i = H[i]; - H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; - } // Return final computed hash + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + derivedKey.concat(block); + } - return hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; + derivedKey.sigBytes = keySize * 4; + return derivedKey; } }); - - function FF(a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function GG(a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function HH(a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function II(a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + x + t; - return (n << s | n >>> 32 - s) + b; - } - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.MD5('message'); - * var hash = CryptoJS.MD5(wordArray); - */ - - - C.MD5 = Hasher._createHelper(MD5); /** - * Shortcut function to the HMAC's object interface. + * Derives a key from a password. * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. * - * @return {WordArray} The HMAC. + * @return {WordArray} The derived key. * * @static * * @example * - * var hmac = CryptoJS.HmacMD5(message, key); + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); */ - C.HmacMD5 = Hasher._createHmacHelper(MD5); - })(Math); + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + })(); - return CryptoJS.MD5; + return CryptoJS.EvpKDF; }); }); - var sha1 = createCommonjsModule(function (module, exports) { + var cipherCore = createCommonjsModule(function (module, exports) { - (function (root, factory) { + (function (root, factory, undef) { { // CommonJS - module.exports = exports = factory(core); + module.exports = exports = factory(core, evpkdf); } })(commonjsGlobal, function (CryptoJS) { - (function () { + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || function (undefined$1) { // Shortcuts var C = CryptoJS; var C_lib = C.lib; + var Base = C_lib.Base; var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Reusable object - - var W = []; - /** - * SHA-1 hash algorithm. - */ - - var SHA1 = C_algo.SHA1 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Shortcut - var H = this._hash.words; // Working variables - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; // Computation - - for (var i = 0; i < 80; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = n << 1 | n >>> 31; - } - - var t = (a << 5 | a >>> 27) + e + W[i]; - - if (i < 20) { - t += (b & c | ~b & d) + 0x5a827999; - } else if (i < 40) { - t += (b ^ c ^ d) + 0x6ed9eba1; - } else if (i < 60) { - t += (b & c | b & d | c & d) - 0x70e44324; - } else - /* if (i < 80) */ - { - t += (b ^ c ^ d) - 0x359d3e2a; - } - - e = d; - d = c; - c = b << 30 | b >>> 2; - b = a; - a = t; - } // Intermediate hash value - - - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - H[4] = H[4] + e | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding - - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; // Hash final blocks - - this._process(); // Return final computed hash - - - return this._hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA1('message'); - * var hash = CryptoJS.SHA1(wordArray); - */ - - C.SHA1 = Hasher._createHelper(SHA1); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA1(message, key); - */ - - C.HmacSHA1 = Hasher._createHmacHelper(SHA1); - })(); - - return CryptoJS.SHA1; - }); - }); - - var hmac = createCommonjsModule(function (module, exports) { - ->>>>>>> branch for npm and latest release - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; -<<<<<<< HEAD - var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; /** - * Base64 encoding strategy. + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. */ - var Base64 = C_enc.Base64 = { + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ /** - * Converts a word array to a Base64 string. - * - * @param {WordArray} wordArray The word array. + * Configuration options. * - * @return {string} The Base64 string. -======= - var Base = C_lib.Base; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var C_algo = C.algo; - /** - * HMAC algorithm. - */ + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), - var HMAC = C_algo.HMAC = Base.extend({ /** - * Initializes a newly created HMAC. + * Creates this cipher in encryption mode. * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static * * @example * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); */ - init: function init(hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already - - if (typeof key == 'string') { - key = Utf8.parse(key); - } // Shortcuts - - - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys - - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } // Clamp excess bits - - - key.clamp(); // Clone key for inner and outer pads - - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); // Shortcuts - - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; // XOR keys with pad constants - - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } - - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values - - this.reset(); + createEncryptor: function createEncryptor(key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); }, /** - * Resets this HMAC to its initial state. + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static * * @example * - * hmacHasher.reset(); + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); */ - reset: function reset() { - // Shortcut - var hasher = this._hasher; // Reset - - hasher.reset(); - hasher.update(this._iKey); + createDecryptor: function createDecryptor(key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); }, /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. + * Initializes a newly created cipher. * - * @return {HMAC} This HMAC instance. + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. * * @example * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); */ - update: function update(messageUpdate) { - this._hasher.update(messageUpdate); // Chainable + init: function init(xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Store transform mode and key + this._xformMode = xformMode; + this._key = key; // Set initial values - return this; + this.reset(); }, /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. + * Resets this cipher to its initial state. * * @example * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); + * cipher.reset(); */ - finalize: function finalize(messageUpdate) { - // Shortcut - var hasher = this._hasher; // Compute HMAC - - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - return hmac; - } - }); - })(); - }); - }); - - var evpkdf = createCommonjsModule(function (module, exports) { + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, sha1, hmac); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var C_algo = C.algo; - var MD5 = C_algo.MD5; - /** - * This key derivation function is meant to conform with EVP_BytesToKey. - * www.openssl.org/docs/crypto/EVP_BytesToKey.html - */ + this._doReset(); + }, - var EvpKDF = C_algo.EvpKDF = Base.extend({ /** - * Configuration options. + * Adds data to be encrypted or decrypted. * - * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) - * @property {Hasher} hasher The hash algorithm to use. Default: MD5 - * @property {number} iterations The number of iterations to perform. Default: 1 - */ - cfg: Base.extend({ - keySize: 128 / 32, - hasher: MD5, - iterations: 1 - }), - - /** - * Initializes a newly created key derivation function. + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. * - * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * @return {WordArray} The data after processing. * * @example * - * var kdf = CryptoJS.algo.EvpKDF.create(); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); */ - init: function init(cfg) { - this.cfg = this.cfg.extend(cfg); + process: function process(dataUpdate) { + // Append + this._append(dataUpdate); // Process available blocks + + + return this._process(); }, /** - * Derives a key from a password. + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. * - * @return {WordArray} The derived key. + * @return {WordArray} The data after final processing. * * @example * - * var key = kdf.compute(password, salt); + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); */ - compute: function compute(password, salt) { - // Shortcut - var cfg = this.cfg; // Init hasher - - var hasher = cfg.hasher.create(); // Initial values - - var derivedKey = WordArray.create(); // Shortcuts + finalize: function finalize(dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } // Perform concrete-cipher logic - var derivedKeyWords = derivedKey.words; - var keySize = cfg.keySize; - var iterations = cfg.iterations; // Generate key - while (derivedKeyWords.length < keySize) { - if (block) { - hasher.update(block); - } + var finalProcessedData = this._doFinalize(); - var block = hasher.update(password).finalize(salt); - hasher.reset(); // Iterations + return finalProcessedData; + }, + keySize: 128 / 32, + ivSize: 128 / 32, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, - for (var i = 1; i < iterations; i++) { - block = hasher.finalize(block); - hasher.reset(); + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; } - - derivedKey.concat(block); } - derivedKey.sigBytes = keySize * 4; - return derivedKey; - } + return function (cipher) { + return { + encrypt: function encrypt(message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + decrypt: function decrypt(ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }() }); /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * @param {Object} cfg (Optional) The configuration options to use for this computation. - * - * @return {WordArray} The derived key. - * - * @static - * - * @example + * Abstract base stream cipher template. * - * var key = CryptoJS.EvpKDF(password, salt); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) */ - C.EvpKDF = function (password, salt, cfg) { - return EvpKDF.create(cfg).compute(password, salt); - }; - })(); - - return CryptoJS.EvpKDF; - }); - }); + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function _doFinalize() { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); - var cipherCore = createCommonjsModule(function (module, exports) { + return finalProcessedBlocks; + }, + blockSize: 1 + }); + /** + * Mode namespace. + */ - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, evpkdf); - } - })(commonjsGlobal, function (CryptoJS) { - /** - * Cipher core components. - */ - CryptoJS.lib.Cipher || function (undefined$1) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var Base64 = C_enc.Base64; - var C_algo = C.algo; - var EvpKDF = C_algo.EvpKDF; + var C_mode = C.mode = {}; /** - * Abstract base cipher template. - * - * @property {number} keySize This cipher's key size. Default: 4 (128 bits) - * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) - * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. - * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + * Abstract base block cipher mode template. */ - var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ /** - * Configuration options. + * Creates this mode for encryption. * - * @property {WordArray} iv The IV to use for this operation. + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); */ - cfg: Base.extend(), + createEncryptor: function createEncryptor(cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, /** - * Creates this cipher in encryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. + * Creates this mode for decryption. * - * @return {Cipher} A cipher instance. ->>>>>>> branch for npm and latest release + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. * * @static * * @example * -<<<<<<< HEAD - * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - var map = this._map; // Clamp excess bits - - wordArray.clamp(); // Convert - - var base64Chars = []; + createDecryptor: function createDecryptor(cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, - for (var i = 0; i < sigBytes; i += 3) { - var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; - var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; - var triplet = byte1 << 16 | byte2 << 8 | byte3; + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function init(cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); + /** + * Cipher Block Chaining mode. + */ - for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { - base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); - } - } // Add padding + var CBC = C_mode.CBC = function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + /** + * CBC encryptor. + */ + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // XOR and encrypt - var paddingChar = map.charAt(64); + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); // Remember this block to use with next block - if (paddingChar) { - while (base64Chars.length % 4) { - base64Chars.push(paddingChar); - } + this._prevBlock = words.slice(offset, offset + blockSize); } + }); + /** + * CBC decryptor. + */ - return base64Chars.join(''); - }, + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // Remember this block to use with next block + + var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR + + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block + + this._prevBlock = thisBlock; + } + }); + + function xorBlock(words, offset, blockSize) { + // Shortcut + var iv = this._iv; // Choose mixing block + + if (iv) { + var block = iv; // Remove IV for subsequent blocks + + this._iv = undefined$1; + } else { + var block = this._prevBlock; + } // XOR blocks + + + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }(); + /** + * Padding namespace. + */ + + var C_pad = C.pad = {}; + /** + * PKCS #5/7 padding strategy. + */ + + var Pkcs7 = C_pad.Pkcs7 = { /** - * Converts a Base64 string to a word array. - * - * @param {string} base64Str The Base64 string. + * Pads data using the algorithm defined in PKCS #5/7. * - * @return {WordArray} The word array. + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. * * @static * * @example * - * var wordArray = CryptoJS.enc.Base64.parse(base64String); + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); */ - parse: function parse(base64Str) { - // Shortcuts - var base64StrLength = base64Str.length; - var map = this._map; - var reverseMap = this._reverseMap; - - if (!reverseMap) { - reverseMap = this._reverseMap = []; - - for (var j = 0; j < map.length; j++) { - reverseMap[map.charCodeAt(j)] = j; - } - } // Ignore padding + pad: function pad(data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; // Count padding bytes + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word - var paddingChar = map.charAt(64); + var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding - if (paddingChar) { - var paddingIndex = base64Str.indexOf(paddingChar); + var paddingWords = []; - if (paddingIndex !== -1) { - base64StrLength = paddingIndex; - } - } // Convert + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding - return parseLoop(base64Str, base64StrLength, reverseMap); + data.concat(padding); }, - _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' - }; - function parseLoop(base64Str, base64StrLength, reverseMap) { - var words = []; - var nBytes = 0; + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function unpad(data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding - for (var i = 0; i < base64StrLength; i++) { - if (i % 4) { - var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; - var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; - words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; - nBytes++; - } + data.sigBytes -= nPaddingBytes; } + }; + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ - return WordArray.create(words, nBytes); - } - })(); + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + reset: function reset() { + // Reset cipher + Cipher.reset.call(this); // Shortcuts - return CryptoJS.enc.Base64; - }); - }); + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; // Reset block mode - var md5$1 = createCommonjsModule(function (module, exports) { + if (this._xformMode == this._ENC_XFORM_MODE) { + var modeCreator = mode.createEncryptor; + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function (Math) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Constants table + this._minBufferSize = 1; + } - var T = []; // Compute constants + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; + } + }, + _doProcessBlock: function _doProcessBlock(words, offset) { + this._mode.processBlock(words, offset); + }, + _doFinalize: function _doFinalize() { + // Shortcut + var padding = this.cfg.padding; // Finalize - (function () { - for (var i = 0; i < 64; i++) { - T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; - } + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); // Process final blocks + + var finalProcessedBlocks = this._process(!!'flush'); + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + // Process final blocks + var finalProcessedBlocks = this._process(!!'flush'); // Unpad data + + + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; + }, + blockSize: 128 / 32 + }); + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + + var CipherParams = C_lib.CipherParams = Base.extend({ + /** + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. + * + * @example + * + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); + */ + init: function init(cipherParams) { + this.mixIn(cipherParams); + }, + + /** + * Converts this cipher params object to a string. + * + * @param {Format} formatter (Optional) The formatting strategy to use. + * + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. + * + * @example + * + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); + */ + toString: function toString(formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + /** + * Format namespace. + */ + + var C_format = C.format = {}; + /** + * OpenSSL formatting strategy. + */ + + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function stringify(cipherParams) { + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; // Format + + if (salt) { + var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + var wordArray = ciphertext; + } + + return wordArray.toString(Base64); + }, + + /** + * Converts an OpenSSL-compatible string to a cipher params object. + * + * @param {string} openSSLStr The OpenSSL-compatible string. + * + * @return {CipherParams} The cipher params object. + * + * @static + * + * @example + * + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); + */ + parse: function parse(openSSLStr) { + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); // Shortcut + + var ciphertextWords = ciphertext.words; // Test for salt + + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext + + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ + ciphertext: ciphertext, + salt: salt + }); + } + }; + /** + * A cipher wrapper that returns ciphertext as a serializable cipher params object. + */ + + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ + /** + * Configuration options. + * + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL + */ + cfg: Base.extend({ + format: OpenSSLFormatter + }), + + /** + * Encrypts a message. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Encrypt + + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); // Shortcut + + var cipherCfg = encryptor.cfg; // Create and return serializable cipher params + + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); + }, + + /** + * Decrypts serialized ciphertext. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Decrypt + + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + return plaintext; + }, + + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function _parse(ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; + } + } + }); + /** + * Key derivation function namespace. + */ + + var C_kdf = C.kdf = {}; + /** + * OpenSSL key derivation function. + */ + + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function execute(password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64 / 8); + } // Derive key and IV + + + var key = EvpKDF.create({ + keySize: keySize + ivSize + }).compute(password, salt); // Separate key and IV + + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; // Return params + + return CipherParams.create({ + key: key, + iv: iv, + salt: salt + }); + } + }; + /** + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. + */ + + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ + /** + * Configuration options. + * + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL + */ + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), + + /** + * Encrypts a message using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config + + cfg.iv = derivedParams.iv; // Encrypt + + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params + + ciphertext.mixIn(derivedParams); + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config + + cfg.iv = derivedParams.iv; // Decrypt + + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + return plaintext; + } + }); + }(); + }); + }); + + var aes = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; // Lookup tables + + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; // Compute lookup tables + + (function () { + // Compute double table + var d = []; + + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = i << 1 ^ 0x11b; + } + } // Walk GF(2^8) + + + var x = 0; + var xi = 0; + + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; + sx = sx >>> 8 ^ sx & 0xff ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; // Compute multiplication + + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; // Compute sub bytes, mix columns tables + + var t = d[sx] * 0x101 ^ sx * 0x1010100; + SUB_MIX_0[x] = t << 24 | t >>> 8; + SUB_MIX_1[x] = t << 16 | t >>> 16; + SUB_MIX_2[x] = t << 8 | t >>> 24; + SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables + + var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; + INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; + INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; + INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; + INV_SUB_MIX_3[sx] = t; // Compute next counter + + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + })(); // Precomputed Rcon lookup + + + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + /** + * AES block cipher algorithm. + */ + + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function _doReset() { + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } // Shortcuts + + + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; // Compute number of rounds + + var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows + + var ksRows = (nRounds + 1) * 4; // Compute key schedule + + var keySchedule = this._keySchedule = []; + + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + var t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = t << 8 | t >>> 24; // Sub word + + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon + + t ^= RCON[ksRow / keySize | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; + } + + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } // Compute inv key schedule + + + var invKeySchedule = this._invKeySchedule = []; + + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; + + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } + + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; + } else { + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; + } + } + }, + encryptBlock: function encryptBlock(M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + decryptBlock: function decryptBlock(M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows + + + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; + }, + _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; // Get input, add round key + + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter + + var ksRow = 4; // Rounds + + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state + + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } // Shift rows, sub bytes, add round key + + + var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output + + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + keySize: 256 / 32 + }); + /** + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); + */ + + C.AES = BlockCipher._createHelper(AES); + })(); + + return CryptoJS.AES; + }); + }); + + var encUtf8 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + return CryptoJS.enc.Utf8; + }); + }); + + /** + * toString ref. + */ + var toString$2 = Object.prototype.toString; + /** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ + + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { + 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'; + } + + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + if (isBuffer$1(val)) return 'buffer'; + val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); + return _typeof(val); + }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js + + + function isBuffer$1(obj) { + return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + } +======= + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function parse(hexStr) { + // Shortcut + var hexStrLength = hexStr.length; // Convert + + var words = []; + + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + /** + * Latin1 encoding strategy. + */ + + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert + + var latin1Chars = []; + + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } +>>>>>>> branch for npm and latest release + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function parse(latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; // Convert + + var words = []; + + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; + } + +<<<<<<< HEAD + /** + * Deeply clone an object. + * + * @param {*} obj Any object. + */ + + + var clone = function clone(obj) { + var t = componentType$2(obj); + + if (t === 'object') { + var copy = {}; + + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + copy[key] = clone(obj[key]); + } + } + + return copy; + } + + if (t === 'array') { + var copy = new Array(obj.length); + + for (var i = 0, l = obj.length; i < l; i++) { + copy[i] = clone(obj[i]); + } + + return copy; + } +======= + return new WordArray.init(words, latin1StrLength); + } + }; + /** + * UTF-8 encoding strategy. + */ + + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function parse(utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function reset() { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function _append(data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } // Append + + + this._data.concat(data); + + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function _process(doFlush) { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; // Count blocks ready + + var nBlocksReady = dataSigBytes / blockSizeBytes; + + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } // Count words ready + + + var nWordsReady = nBlocksReady * blockSize; // Count bytes ready + + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks + + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } // Remove processed words + + + var processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } // Return processed words + + + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + return clone; + }, + _minBufferSize: 0 + }); + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function init(cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Set initial values + + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic + + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function update(messageUpdate) { + // Append + this._append(messageUpdate); // Update the hash + + + this._process(); // Chainable + + + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } // Perform concrete-hasher logic + + + var hash = this._doFinalize(); + + return hash; + }, + blockSize: 512 / 32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function _createHelper(hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function _createHmacHelper(hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + /** + * Algorithm namespace. + */ +>>>>>>> branch for npm and latest release + + var C_algo = C.algo = {}; + return C; + }(Math); + +<<<<<<< HEAD + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = instance.clone(); + */ + clone: function clone() { + return this.init.prototype.extend(this); + } + }; + }(); + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ + + + var WordArray = C_lib.WordArray = Base.extend({ + /** + * Initializes a newly created word array. + * + * @param {Array} words (Optional) An array of 32-bit words. + * @param {number} sigBytes (Optional) The number of significant bytes in the words. + * + * @example + * + * var wordArray = CryptoJS.lib.WordArray.create(); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); + * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); + */ + init: function init(words, sigBytes) { + words = this.words = words || []; + + if (sigBytes != undefined$1) { + this.sigBytes = sigBytes; + } else { + this.sigBytes = words.length * 4; + } + }, + + /** + * Converts this word array to a string. + * + * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex + * + * @return {string} The stringified word array. + * + * @example + * + * var string = wordArray + ''; + * var string = wordArray.toString(); + * var string = wordArray.toString(CryptoJS.enc.Utf8); + */ + toString: function toString(encoder) { + return (encoder || Hex).stringify(this); + }, + + /** + * Concatenates a word array to this word array. + * + * @param {WordArray} wordArray The word array to append. + * + * @return {WordArray} This word array. + * + * @example + * + * wordArray1.concat(wordArray2); + */ + concat: function concat(wordArray) { + // Shortcuts + var thisWords = this.words; + var thatWords = wordArray.words; + var thisSigBytes = this.sigBytes; + var thatSigBytes = wordArray.sigBytes; // Clamp excess bits + + this.clamp(); // Concat + + if (thisSigBytes % 4) { + // Copy one byte at a time + for (var i = 0; i < thatSigBytes; i++) { + var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; + } + } else { + // Copy one word at a time + for (var i = 0; i < thatSigBytes; i += 4) { + thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; + } + } + + this.sigBytes += thatSigBytes; // Chainable + + return this; + }, + + /** + * Removes insignificant bits. + * + * @example + * + * wordArray.clamp(); + */ + clamp: function clamp() { + // Shortcuts + var words = this.words; + var sigBytes = this.sigBytes; // Clamp + + words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; + words.length = Math.ceil(sigBytes / 4); + }, + + /** + * Creates a copy of this word array. + * + * @return {WordArray} The clone. + * + * @example + * + * var clone = wordArray.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone.words = this.words.slice(0); + return clone; + }, + + /** + * Creates a word array filled with random bytes. + * + * @param {number} nBytes The number of random bytes to generate. + * + * @return {WordArray} The random word array. +======= + return CryptoJS; + }); + }); + + var encBase64 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + /** + * Base64 encoding strategy. + */ + + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. +>>>>>>> branch for npm and latest release + * + * @static + * + * @example + * +<<<<<<< HEAD + * var wordArray = CryptoJS.lib.WordArray.random(16); + */ + random: function random(nBytes) { + var words = []; + + var r = function r(m_w) { + var m_w = m_w; + var m_z = 0x3ade68b1; + var mask = 0xffffffff; + return function () { + m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; + m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; + var result = (m_z << 0x10) + m_w & mask; + result /= 0x100000000; + result += 0.5; + return result * (Math.random() > .5 ? 1 : -1); + }; + }; + + for (var i = 0, rcache; i < nBytes; i += 4) { + var _r = r((rcache || Math.random()) * 0x100000000); + + rcache = _r() * 0x3ade67b7; + words.push(_r() * 0x100000000 | 0); + } + + return new WordArray.init(words, nBytes); + } + }); + /** + * Encoder namespace. + */ + + var C_enc = C.enc = {}; + /** + * Hex encoding strategy. + */ + + var Hex = C_enc.Hex = { + /** + * Converts a word array to a hex string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The hex string. + * + * @static + * + * @example + * + * var hexString = CryptoJS.enc.Hex.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert + + var hexChars = []; + + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + hexChars.push((bite >>> 4).toString(16)); + hexChars.push((bite & 0x0f).toString(16)); + } + + return hexChars.join(''); + }, + + /** + * Converts a hex string to a word array. + * + * @param {string} hexStr The hex string. +======= + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; // Clamp excess bits + + wordArray.clamp(); // Convert + + var base64Chars = []; + + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; + var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; + var triplet = byte1 << 16 | byte2 << 8 | byte3; + + for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { + base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); + } + } // Add padding + +>>>>>>> branch for npm and latest release + + var paddingChar = map.charAt(64); + +<<<<<<< HEAD + if (t === 'date') { + return new Date(obj.getTime()); + } // string, number, boolean, etc. + + + return obj; + }; + /* + * Exports. + */ + + + var clone_1 = clone; + + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse$1(val); +======= + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. +>>>>>>> branch for npm and latest release + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * +<<<<<<< HEAD + * var wordArray = CryptoJS.enc.Hex.parse(hexString); + */ + parse: function parse(hexStr) { + // Shortcut + var hexStrLength = hexStr.length; // Convert + + var words = []; + + for (var i = 0; i < hexStrLength; i += 2) { + words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; + } + + return new WordArray.init(words, hexStrLength / 2); + } + }; + /** + * Latin1 encoding strategy. + */ + + var Latin1 = C_enc.Latin1 = { + /** + * Converts a word array to a Latin1 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Latin1 string. + * + * @static + * + * @example + * + * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; // Convert + + var latin1Chars = []; + + for (var i = 0; i < sigBytes; i++) { + var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + latin1Chars.push(String.fromCharCode(bite)); + } + + return latin1Chars.join(''); + }, + + /** + * Converts a Latin1 string to a word array. + * + * @param {string} latin1Str The Latin1 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); + */ + parse: function parse(latin1Str) { + // Shortcut + var latin1StrLength = latin1Str.length; // Convert + + var words = []; + + for (var i = 0; i < latin1StrLength; i++) { + words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; + } + + return new WordArray.init(words, latin1StrLength); + } + }; + /** + * UTF-8 encoding strategy. + */ + + var Utf8 = C_enc.Utf8 = { + /** + * Converts a word array to a UTF-8 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The UTF-8 string. + * + * @static + * + * @example + * + * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + try { + return decodeURIComponent(escape(Latin1.stringify(wordArray))); + } catch (e) { + throw new Error('Malformed UTF-8 data'); + } + }, + + /** + * Converts a UTF-8 string to a word array. + * + * @param {string} utf8Str The UTF-8 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); + */ + parse: function parse(utf8Str) { + return Latin1.parse(unescape(encodeURIComponent(utf8Str))); + } + }; + /** + * Abstract buffered block algorithm template. + * + * The property blockSize must be implemented in a concrete subtype. + * + * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 + */ + + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ + /** + * Resets this block algorithm's data buffer to its initial state. + * + * @example + * + * bufferedBlockAlgorithm.reset(); + */ + reset: function reset() { + // Initial values + this._data = new WordArray.init(); + this._nDataBytes = 0; + }, + + /** + * Adds new data to this block algorithm's buffer. + * + * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. + * + * @example + * + * bufferedBlockAlgorithm._append('data'); + * bufferedBlockAlgorithm._append(wordArray); + */ + _append: function _append(data) { + // Convert string to WordArray, else assume WordArray already + if (typeof data == 'string') { + data = Utf8.parse(data); + } // Append + + + this._data.concat(data); + + this._nDataBytes += data.sigBytes; + }, + + /** + * Processes available data blocks. + * + * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. + * + * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. + * + * @return {WordArray} The processed data. + * + * @example + * + * var processedData = bufferedBlockAlgorithm._process(); + * var processedData = bufferedBlockAlgorithm._process(!!'flush'); + */ + _process: function _process(doFlush) { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var dataSigBytes = data.sigBytes; + var blockSize = this.blockSize; + var blockSizeBytes = blockSize * 4; // Count blocks ready + + var nBlocksReady = dataSigBytes / blockSizeBytes; + + if (doFlush) { + // Round up to include partial blocks + nBlocksReady = Math.ceil(nBlocksReady); + } else { + // Round down to include only full blocks, + // less the number of blocks that must remain in the buffer + nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); + } // Count words ready + + + var nWordsReady = nBlocksReady * blockSize; // Count bytes ready + + var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks + + if (nWordsReady) { + for (var offset = 0; offset < nWordsReady; offset += blockSize) { + // Perform concrete-algorithm logic + this._doProcessBlock(dataWords, offset); + } // Remove processed words + + + var processedWords = dataWords.splice(0, nWordsReady); + data.sigBytes -= nBytesReady; + } // Return processed words + + + return new WordArray.init(processedWords, nBytesReady); + }, + + /** + * Creates a copy of this object. + * + * @return {Object} The clone. + * + * @example + * + * var clone = bufferedBlockAlgorithm.clone(); + */ + clone: function clone() { + var clone = Base.clone.call(this); + clone._data = this._data.clone(); + return clone; + }, + _minBufferSize: 0 + }); + /** + * Abstract hasher template. + * + * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) + */ + + var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + */ + cfg: Base.extend(), + + /** + * Initializes a newly created hasher. + * + * @param {Object} cfg (Optional) The configuration options to use for this hash computation. + * + * @example + * + * var hasher = CryptoJS.algo.SHA256.create(); + */ + init: function init(cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Set initial values + + this.reset(); + }, + + /** + * Resets this hasher to its initial state. + * + * @example + * + * hasher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic + + this._doReset(); + }, + + /** + * Updates this hasher with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {Hasher} This hasher. + * + * @example + * + * hasher.update('message'); + * hasher.update(wordArray); + */ + update: function update(messageUpdate) { + // Append + this._append(messageUpdate); // Update the hash + + + this._process(); // Chainable + + + return this; + }, + + /** + * Finalizes the hash computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The hash. + * + * @example + * + * var hash = hasher.finalize(); + * var hash = hasher.finalize('message'); + * var hash = hasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Final message update + if (messageUpdate) { + this._append(messageUpdate); + } // Perform concrete-hasher logic + + + var hash = this._doFinalize(); + + return hash; + }, + blockSize: 512 / 32, + + /** + * Creates a shortcut function to a hasher's object interface. + * + * @param {Hasher} hasher The hasher to create a helper for. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); + */ + _createHelper: function _createHelper(hasher) { + return function (message, cfg) { + return new hasher.init(cfg).finalize(message); + }; + }, + + /** + * Creates a shortcut function to the HMAC's object interface. + * + * @param {Hasher} hasher The hasher to use in this HMAC helper. + * + * @return {Function} The shortcut function. + * + * @static + * + * @example + * + * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); + */ + _createHmacHelper: function _createHmacHelper(hasher) { + return function (message, key) { + return new C_algo.HMAC.init(hasher, key).finalize(message); + }; + } + }); + /** + * Algorithm namespace. + */ + + var C_algo = C.algo = {}; + return C; + }(Math); + + return CryptoJS; + }); + }); + + var encBase64 = createCommonjsModule(function (module, exports) { + +======= + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function parse(base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } // Ignore padding + + + var paddingChar = map.charAt(64); + + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } // Convert + + + return parseLoop(base64Str, base64StrLength, reverseMap); + }, + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; + words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; + nBytes++; + } + } + + return WordArray.create(words, nBytes); + } + })(); + + return CryptoJS.enc.Base64; + }); + }); + + var md5$1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Constants table + + var T = []; // Compute constants + + (function () { + for (var i = 0; i < 64; i++) { + T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; + } + })(); + /** + * MD5 hash algorithm. + */ + + + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; + } // Shortcuts + + + var H = this._hash.words; + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; // Working varialbes + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; // Computation + + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; + data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + + this._process(); // Shortcuts + + + var hash = this._hash; + var H = hash.words; // Swap endian + + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; + } // Return final computed hash + + + return hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return (n << s | n >>> 32 - s) + b; + } + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + + + C.MD5 = Hasher._createHelper(MD5); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + + C.HmacMD5 = Hasher._createHmacHelper(MD5); + })(Math); + + return CryptoJS.MD5; + }); + }); + + var sha1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Reusable object + + var W = []; + /** + * SHA-1 hash algorithm. + */ + + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Shortcut + var H = this._hash.words; // Working variables + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; // Computation + + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = n << 1 | n >>> 31; + } + + var t = (a << 5 | a >>> 27) + e + W[i]; + + if (i < 20) { + t += (b & c | ~b & d) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += (b & c | b & d | c & d) - 0x70e44324; + } else + /* if (i < 80) */ + { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = b << 30 | b >>> 2; + b = a; + a = t; + } // Intermediate hash value + + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + H[4] = H[4] + e | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; // Hash final blocks + + this._process(); // Return final computed hash + + + return this._hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + + C.SHA1 = Hasher._createHelper(SHA1); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + })(); + + return CryptoJS.SHA1; + }); + }); + + var hmac = createCommonjsModule(function (module, exports) { + +>>>>>>> branch for npm and latest release + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; +<<<<<<< HEAD + var WordArray = C_lib.WordArray; + var C_enc = C.enc; + /** + * Base64 encoding strategy. + */ + + var Base64 = C_enc.Base64 = { + /** + * Converts a word array to a Base64 string. + * + * @param {WordArray} wordArray The word array. + * + * @return {string} The Base64 string. +======= + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + /** + * HMAC algorithm. + */ + + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function init(hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already + + if (typeof key == 'string') { + key = Utf8.parse(key); + } // Shortcuts + + + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys + + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } // Clamp excess bits + + + key.clamp(); // Clone key for inner and outer pads + + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); // Shortcuts + + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; // XOR keys with pad constants + + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function reset() { + // Shortcut + var hasher = this._hasher; // Reset + + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function update(messageUpdate) { + this._hasher.update(messageUpdate); // Chainable + + + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Shortcut + var hasher = this._hasher; // Compute HMAC + + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + return hmac; + } + }); + })(); + }); + }); + + var evpkdf = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, sha1, hmac); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html + */ + + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128 / 32, + hasher: MD5, + iterations: 1 + }), + + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function init(cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function compute(password, salt) { + // Shortcut + var cfg = this.cfg; // Init hasher + + var hasher = cfg.hasher.create(); // Initial values + + var derivedKey = WordArray.create(); // Shortcuts + + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; // Generate key + + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + + var block = hasher.update(password).finalize(salt); + hasher.reset(); // Iterations + + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + + derivedKey.sigBytes = keySize * 4; + return derivedKey; + } + }); + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + })(); + + return CryptoJS.EvpKDF; + }); + }); + + var cipherCore = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, evpkdf); + } + })(commonjsGlobal, function (CryptoJS) { + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || function (undefined$1) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. +>>>>>>> branch for npm and latest release + * + * @static + * + * @example + * +<<<<<<< HEAD + * var base64String = CryptoJS.enc.Base64.stringify(wordArray); + */ + stringify: function stringify(wordArray) { + // Shortcuts + var words = wordArray.words; + var sigBytes = wordArray.sigBytes; + var map = this._map; // Clamp excess bits + + wordArray.clamp(); // Convert + + var base64Chars = []; + + for (var i = 0; i < sigBytes; i += 3) { + var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; + var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; + var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; + var triplet = byte1 << 16 | byte2 << 8 | byte3; + + for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { + base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); + } + } // Add padding + + + var paddingChar = map.charAt(64); + + if (paddingChar) { + while (base64Chars.length % 4) { + base64Chars.push(paddingChar); + } + } + + return base64Chars.join(''); + }, + + /** + * Converts a Base64 string to a word array. + * + * @param {string} base64Str The Base64 string. + * + * @return {WordArray} The word array. + * + * @static + * + * @example + * + * var wordArray = CryptoJS.enc.Base64.parse(base64String); + */ + parse: function parse(base64Str) { + // Shortcuts + var base64StrLength = base64Str.length; + var map = this._map; + var reverseMap = this._reverseMap; + + if (!reverseMap) { + reverseMap = this._reverseMap = []; + + for (var j = 0; j < map.length; j++) { + reverseMap[map.charCodeAt(j)] = j; + } + } // Ignore padding + + + var paddingChar = map.charAt(64); + + if (paddingChar) { + var paddingIndex = base64Str.indexOf(paddingChar); + + if (paddingIndex !== -1) { + base64StrLength = paddingIndex; + } + } // Convert + + + return parseLoop(base64Str, base64StrLength, reverseMap); + }, + _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' + }; + + function parseLoop(base64Str, base64StrLength, reverseMap) { + var words = []; + var nBytes = 0; + + for (var i = 0; i < base64StrLength; i++) { + if (i % 4) { + var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; + var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; + words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; + nBytes++; + } + } + + return WordArray.create(words, nBytes); + } + })(); + + return CryptoJS.enc.Base64; + }); + }); + + var md5$1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function (Math) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Constants table + + var T = []; // Compute constants + + (function () { + for (var i = 0; i < 64; i++) { + T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; + } })(); /** - * MD5 hash algorithm. + * MD5 hash algorithm. + */ + + + var MD5 = C_algo.MD5 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Swap endian + for (var i = 0; i < 16; i++) { + // Shortcuts + var offset_i = offset + i; + var M_offset_i = M[offset_i]; + M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; + } // Shortcuts + + + var H = this._hash.words; + var M_offset_0 = M[offset + 0]; + var M_offset_1 = M[offset + 1]; + var M_offset_2 = M[offset + 2]; + var M_offset_3 = M[offset + 3]; + var M_offset_4 = M[offset + 4]; + var M_offset_5 = M[offset + 5]; + var M_offset_6 = M[offset + 6]; + var M_offset_7 = M[offset + 7]; + var M_offset_8 = M[offset + 8]; + var M_offset_9 = M[offset + 9]; + var M_offset_10 = M[offset + 10]; + var M_offset_11 = M[offset + 11]; + var M_offset_12 = M[offset + 12]; + var M_offset_13 = M[offset + 13]; + var M_offset_14 = M[offset + 14]; + var M_offset_15 = M[offset + 15]; // Working varialbes + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; // Computation + + a = FF(a, b, c, d, M_offset_0, 7, T[0]); + d = FF(d, a, b, c, M_offset_1, 12, T[1]); + c = FF(c, d, a, b, M_offset_2, 17, T[2]); + b = FF(b, c, d, a, M_offset_3, 22, T[3]); + a = FF(a, b, c, d, M_offset_4, 7, T[4]); + d = FF(d, a, b, c, M_offset_5, 12, T[5]); + c = FF(c, d, a, b, M_offset_6, 17, T[6]); + b = FF(b, c, d, a, M_offset_7, 22, T[7]); + a = FF(a, b, c, d, M_offset_8, 7, T[8]); + d = FF(d, a, b, c, M_offset_9, 12, T[9]); + c = FF(c, d, a, b, M_offset_10, 17, T[10]); + b = FF(b, c, d, a, M_offset_11, 22, T[11]); + a = FF(a, b, c, d, M_offset_12, 7, T[12]); + d = FF(d, a, b, c, M_offset_13, 12, T[13]); + c = FF(c, d, a, b, M_offset_14, 17, T[14]); + b = FF(b, c, d, a, M_offset_15, 22, T[15]); + a = GG(a, b, c, d, M_offset_1, 5, T[16]); + d = GG(d, a, b, c, M_offset_6, 9, T[17]); + c = GG(c, d, a, b, M_offset_11, 14, T[18]); + b = GG(b, c, d, a, M_offset_0, 20, T[19]); + a = GG(a, b, c, d, M_offset_5, 5, T[20]); + d = GG(d, a, b, c, M_offset_10, 9, T[21]); + c = GG(c, d, a, b, M_offset_15, 14, T[22]); + b = GG(b, c, d, a, M_offset_4, 20, T[23]); + a = GG(a, b, c, d, M_offset_9, 5, T[24]); + d = GG(d, a, b, c, M_offset_14, 9, T[25]); + c = GG(c, d, a, b, M_offset_3, 14, T[26]); + b = GG(b, c, d, a, M_offset_8, 20, T[27]); + a = GG(a, b, c, d, M_offset_13, 5, T[28]); + d = GG(d, a, b, c, M_offset_2, 9, T[29]); + c = GG(c, d, a, b, M_offset_7, 14, T[30]); + b = GG(b, c, d, a, M_offset_12, 20, T[31]); + a = HH(a, b, c, d, M_offset_5, 4, T[32]); + d = HH(d, a, b, c, M_offset_8, 11, T[33]); + c = HH(c, d, a, b, M_offset_11, 16, T[34]); + b = HH(b, c, d, a, M_offset_14, 23, T[35]); + a = HH(a, b, c, d, M_offset_1, 4, T[36]); + d = HH(d, a, b, c, M_offset_4, 11, T[37]); + c = HH(c, d, a, b, M_offset_7, 16, T[38]); + b = HH(b, c, d, a, M_offset_10, 23, T[39]); + a = HH(a, b, c, d, M_offset_13, 4, T[40]); + d = HH(d, a, b, c, M_offset_0, 11, T[41]); + c = HH(c, d, a, b, M_offset_3, 16, T[42]); + b = HH(b, c, d, a, M_offset_6, 23, T[43]); + a = HH(a, b, c, d, M_offset_9, 4, T[44]); + d = HH(d, a, b, c, M_offset_12, 11, T[45]); + c = HH(c, d, a, b, M_offset_15, 16, T[46]); + b = HH(b, c, d, a, M_offset_2, 23, T[47]); + a = II(a, b, c, d, M_offset_0, 6, T[48]); + d = II(d, a, b, c, M_offset_7, 10, T[49]); + c = II(c, d, a, b, M_offset_14, 15, T[50]); + b = II(b, c, d, a, M_offset_5, 21, T[51]); + a = II(a, b, c, d, M_offset_12, 6, T[52]); + d = II(d, a, b, c, M_offset_3, 10, T[53]); + c = II(c, d, a, b, M_offset_10, 15, T[54]); + b = II(b, c, d, a, M_offset_1, 21, T[55]); + a = II(a, b, c, d, M_offset_8, 6, T[56]); + d = II(d, a, b, c, M_offset_15, 10, T[57]); + c = II(c, d, a, b, M_offset_6, 15, T[58]); + b = II(b, c, d, a, M_offset_13, 21, T[59]); + a = II(a, b, c, d, M_offset_4, 6, T[60]); + d = II(d, a, b, c, M_offset_11, 10, T[61]); + c = II(c, d, a, b, M_offset_2, 15, T[62]); + b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); + var nBitsTotalL = nBitsTotal; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; + data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + + this._process(); // Shortcuts + + + var hash = this._hash; + var H = hash.words; // Swap endian + + for (var i = 0; i < 4; i++) { + // Shortcut + var H_i = H[i]; + H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; + } // Return final computed hash + + + return hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + + function FF(a, b, c, d, x, s, t) { + var n = a + (b & c | ~b & d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function GG(a, b, c, d, x, s, t) { + var n = a + (b & d | c & ~d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function HH(a, b, c, d, x, s, t) { + var n = a + (b ^ c ^ d) + x + t; + return (n << s | n >>> 32 - s) + b; + } + + function II(a, b, c, d, x, s, t) { + var n = a + (c ^ (b | ~d)) + x + t; + return (n << s | n >>> 32 - s) + b; + } + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.MD5('message'); + * var hash = CryptoJS.MD5(wordArray); + */ + + + C.MD5 = Hasher._createHelper(MD5); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacMD5(message, key); + */ + + C.HmacMD5 = Hasher._createHmacHelper(MD5); + })(Math); + + return CryptoJS.MD5; + }); + }); + + var sha1 = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var WordArray = C_lib.WordArray; + var Hasher = C_lib.Hasher; + var C_algo = C.algo; // Reusable object + + var W = []; + /** + * SHA-1 hash algorithm. + */ + + var SHA1 = C_algo.SHA1 = Hasher.extend({ + _doReset: function _doReset() { + this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); + }, + _doProcessBlock: function _doProcessBlock(M, offset) { + // Shortcut + var H = this._hash.words; // Working variables + + var a = H[0]; + var b = H[1]; + var c = H[2]; + var d = H[3]; + var e = H[4]; // Computation + + for (var i = 0; i < 80; i++) { + if (i < 16) { + W[i] = M[offset + i] | 0; + } else { + var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; + W[i] = n << 1 | n >>> 31; + } + + var t = (a << 5 | a >>> 27) + e + W[i]; + + if (i < 20) { + t += (b & c | ~b & d) + 0x5a827999; + } else if (i < 40) { + t += (b ^ c ^ d) + 0x6ed9eba1; + } else if (i < 60) { + t += (b & c | b & d | c & d) - 0x70e44324; + } else + /* if (i < 80) */ + { + t += (b ^ c ^ d) - 0x359d3e2a; + } + + e = d; + d = c; + c = b << 30 | b >>> 2; + b = a; + a = t; + } // Intermediate hash value + + + H[0] = H[0] + a | 0; + H[1] = H[1] + b | 0; + H[2] = H[2] + c | 0; + H[3] = H[3] + d | 0; + H[4] = H[4] + e | 0; + }, + _doFinalize: function _doFinalize() { + // Shortcuts + var data = this._data; + var dataWords = data.words; + var nBitsTotal = this._nDataBytes * 8; + var nBitsLeft = data.sigBytes * 8; // Add padding + + dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); + dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; + data.sigBytes = dataWords.length * 4; // Hash final blocks + + this._process(); // Return final computed hash + + + return this._hash; + }, + clone: function clone() { + var clone = Hasher.clone.call(this); + clone._hash = this._hash.clone(); + return clone; + } + }); + /** + * Shortcut function to the hasher's object interface. + * + * @param {WordArray|string} message The message to hash. + * + * @return {WordArray} The hash. + * + * @static + * + * @example + * + * var hash = CryptoJS.SHA1('message'); + * var hash = CryptoJS.SHA1(wordArray); + */ + + C.SHA1 = Hasher._createHelper(SHA1); + /** + * Shortcut function to the HMAC's object interface. + * + * @param {WordArray|string} message The message to hash. + * @param {WordArray|string} key The secret key. + * + * @return {WordArray} The HMAC. + * + * @static + * + * @example + * + * var hmac = CryptoJS.HmacSHA1(message, key); + */ + + C.HmacSHA1 = Hasher._createHmacHelper(SHA1); + })(); + + return CryptoJS.SHA1; + }); + }); + + var hmac = createCommonjsModule(function (module, exports) { + + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var C_algo = C.algo; + /** + * HMAC algorithm. + */ + + var HMAC = C_algo.HMAC = Base.extend({ + /** + * Initializes a newly created HMAC. + * + * @param {Hasher} hasher The hash algorithm to use. + * @param {WordArray|string} key The secret key. + * + * @example + * + * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + */ + init: function init(hasher, key) { + // Init hasher + hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already + + if (typeof key == 'string') { + key = Utf8.parse(key); + } // Shortcuts + + + var hasherBlockSize = hasher.blockSize; + var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys + + if (key.sigBytes > hasherBlockSizeBytes) { + key = hasher.finalize(key); + } // Clamp excess bits + + + key.clamp(); // Clone key for inner and outer pads + + var oKey = this._oKey = key.clone(); + var iKey = this._iKey = key.clone(); // Shortcuts + + var oKeyWords = oKey.words; + var iKeyWords = iKey.words; // XOR keys with pad constants + + for (var i = 0; i < hasherBlockSize; i++) { + oKeyWords[i] ^= 0x5c5c5c5c; + iKeyWords[i] ^= 0x36363636; + } + + oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + + this.reset(); + }, + + /** + * Resets this HMAC to its initial state. + * + * @example + * + * hmacHasher.reset(); + */ + reset: function reset() { + // Shortcut + var hasher = this._hasher; // Reset + + hasher.reset(); + hasher.update(this._iKey); + }, + + /** + * Updates this HMAC with a message. + * + * @param {WordArray|string} messageUpdate The message to append. + * + * @return {HMAC} This HMAC instance. + * + * @example + * + * hmacHasher.update('message'); + * hmacHasher.update(wordArray); + */ + update: function update(messageUpdate) { + this._hasher.update(messageUpdate); // Chainable + + + return this; + }, + + /** + * Finalizes the HMAC computation. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} messageUpdate (Optional) A final message update. + * + * @return {WordArray} The HMAC. + * + * @example + * + * var hmac = hmacHasher.finalize(); + * var hmac = hmacHasher.finalize('message'); + * var hmac = hmacHasher.finalize(wordArray); + */ + finalize: function finalize(messageUpdate) { + // Shortcut + var hasher = this._hasher; // Compute HMAC + + var innerHash = hasher.finalize(messageUpdate); + hasher.reset(); + var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); + return hmac; + } + }); + })(); + }); + }); + + var evpkdf = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, sha1, hmac); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var C_algo = C.algo; + var MD5 = C_algo.MD5; + /** + * This key derivation function is meant to conform with EVP_BytesToKey. + * www.openssl.org/docs/crypto/EVP_BytesToKey.html */ + var EvpKDF = C_algo.EvpKDF = Base.extend({ + /** + * Configuration options. + * + * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) + * @property {Hasher} hasher The hash algorithm to use. Default: MD5 + * @property {number} iterations The number of iterations to perform. Default: 1 + */ + cfg: Base.extend({ + keySize: 128 / 32, + hasher: MD5, + iterations: 1 + }), - var MD5 = C_algo.MD5 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); + /** + * Initializes a newly created key derivation function. + * + * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * + * @example + * + * var kdf = CryptoJS.algo.EvpKDF.create(); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); + * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + */ + init: function init(cfg) { + this.cfg = this.cfg.extend(cfg); + }, + + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * + * @return {WordArray} The derived key. + * + * @example + * + * var key = kdf.compute(password, salt); + */ + compute: function compute(password, salt) { + // Shortcut + var cfg = this.cfg; // Init hasher + + var hasher = cfg.hasher.create(); // Initial values + + var derivedKey = WordArray.create(); // Shortcuts + + var derivedKeyWords = derivedKey.words; + var keySize = cfg.keySize; + var iterations = cfg.iterations; // Generate key + + while (derivedKeyWords.length < keySize) { + if (block) { + hasher.update(block); + } + + var block = hasher.update(password).finalize(salt); + hasher.reset(); // Iterations + + for (var i = 1; i < iterations; i++) { + block = hasher.finalize(block); + hasher.reset(); + } + + derivedKey.concat(block); + } + + derivedKey.sigBytes = keySize * 4; + return derivedKey; + } + }); + /** + * Derives a key from a password. + * + * @param {WordArray|string} password The password. + * @param {WordArray|string} salt A salt. + * @param {Object} cfg (Optional) The configuration options to use for this computation. + * + * @return {WordArray} The derived key. + * + * @static + * + * @example + * + * var key = CryptoJS.EvpKDF(password, salt); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); + * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + */ + + C.EvpKDF = function (password, salt, cfg) { + return EvpKDF.create(cfg).compute(password, salt); + }; + })(); + + return CryptoJS.EvpKDF; + }); + }); + + var cipherCore = createCommonjsModule(function (module, exports) { + + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, evpkdf); + } + })(commonjsGlobal, function (CryptoJS) { + /** + * Cipher core components. + */ + CryptoJS.lib.Cipher || function (undefined$1) { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var Base = C_lib.Base; + var WordArray = C_lib.WordArray; + var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; + var C_enc = C.enc; + var Utf8 = C_enc.Utf8; + var Base64 = C_enc.Base64; + var C_algo = C.algo; + var EvpKDF = C_algo.EvpKDF; + /** + * Abstract base cipher template. + * + * @property {number} keySize This cipher's key size. Default: 4 (128 bits) + * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) + * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. + * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + */ + + var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + /** + * Configuration options. + * + * @property {WordArray} iv The IV to use for this operation. + */ + cfg: Base.extend(), + + /** + * Creates this cipher in encryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); + */ + createEncryptor: function createEncryptor(key, cfg) { + return this.create(this._ENC_XFORM_MODE, key, cfg); + }, + + /** + * Creates this cipher in decryption mode. + * + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {Cipher} A cipher instance. + * + * @static + * + * @example + * + * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); + */ + createDecryptor: function createDecryptor(key, cfg) { + return this.create(this._DEC_XFORM_MODE, key, cfg); }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Swap endian - for (var i = 0; i < 16; i++) { - // Shortcuts - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; - } // Shortcuts + /** + * Initializes a newly created cipher. + * + * @param {number} xformMode Either the encryption or decryption transormation mode constant. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @example + * + * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); + */ + init: function init(xformMode, key, cfg) { + // Apply config defaults + this.cfg = this.cfg.extend(cfg); // Store transform mode and key - var H = this._hash.words; - var M_offset_0 = M[offset + 0]; - var M_offset_1 = M[offset + 1]; - var M_offset_2 = M[offset + 2]; - var M_offset_3 = M[offset + 3]; - var M_offset_4 = M[offset + 4]; - var M_offset_5 = M[offset + 5]; - var M_offset_6 = M[offset + 6]; - var M_offset_7 = M[offset + 7]; - var M_offset_8 = M[offset + 8]; - var M_offset_9 = M[offset + 9]; - var M_offset_10 = M[offset + 10]; - var M_offset_11 = M[offset + 11]; - var M_offset_12 = M[offset + 12]; - var M_offset_13 = M[offset + 13]; - var M_offset_14 = M[offset + 14]; - var M_offset_15 = M[offset + 15]; // Working varialbes + this._xformMode = xformMode; + this._key = key; // Set initial values - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; // Computation + this.reset(); + }, - a = FF(a, b, c, d, M_offset_0, 7, T[0]); - d = FF(d, a, b, c, M_offset_1, 12, T[1]); - c = FF(c, d, a, b, M_offset_2, 17, T[2]); - b = FF(b, c, d, a, M_offset_3, 22, T[3]); - a = FF(a, b, c, d, M_offset_4, 7, T[4]); - d = FF(d, a, b, c, M_offset_5, 12, T[5]); - c = FF(c, d, a, b, M_offset_6, 17, T[6]); - b = FF(b, c, d, a, M_offset_7, 22, T[7]); - a = FF(a, b, c, d, M_offset_8, 7, T[8]); - d = FF(d, a, b, c, M_offset_9, 12, T[9]); - c = FF(c, d, a, b, M_offset_10, 17, T[10]); - b = FF(b, c, d, a, M_offset_11, 22, T[11]); - a = FF(a, b, c, d, M_offset_12, 7, T[12]); - d = FF(d, a, b, c, M_offset_13, 12, T[13]); - c = FF(c, d, a, b, M_offset_14, 17, T[14]); - b = FF(b, c, d, a, M_offset_15, 22, T[15]); - a = GG(a, b, c, d, M_offset_1, 5, T[16]); - d = GG(d, a, b, c, M_offset_6, 9, T[17]); - c = GG(c, d, a, b, M_offset_11, 14, T[18]); - b = GG(b, c, d, a, M_offset_0, 20, T[19]); - a = GG(a, b, c, d, M_offset_5, 5, T[20]); - d = GG(d, a, b, c, M_offset_10, 9, T[21]); - c = GG(c, d, a, b, M_offset_15, 14, T[22]); - b = GG(b, c, d, a, M_offset_4, 20, T[23]); - a = GG(a, b, c, d, M_offset_9, 5, T[24]); - d = GG(d, a, b, c, M_offset_14, 9, T[25]); - c = GG(c, d, a, b, M_offset_3, 14, T[26]); - b = GG(b, c, d, a, M_offset_8, 20, T[27]); - a = GG(a, b, c, d, M_offset_13, 5, T[28]); - d = GG(d, a, b, c, M_offset_2, 9, T[29]); - c = GG(c, d, a, b, M_offset_7, 14, T[30]); - b = GG(b, c, d, a, M_offset_12, 20, T[31]); - a = HH(a, b, c, d, M_offset_5, 4, T[32]); - d = HH(d, a, b, c, M_offset_8, 11, T[33]); - c = HH(c, d, a, b, M_offset_11, 16, T[34]); - b = HH(b, c, d, a, M_offset_14, 23, T[35]); - a = HH(a, b, c, d, M_offset_1, 4, T[36]); - d = HH(d, a, b, c, M_offset_4, 11, T[37]); - c = HH(c, d, a, b, M_offset_7, 16, T[38]); - b = HH(b, c, d, a, M_offset_10, 23, T[39]); - a = HH(a, b, c, d, M_offset_13, 4, T[40]); - d = HH(d, a, b, c, M_offset_0, 11, T[41]); - c = HH(c, d, a, b, M_offset_3, 16, T[42]); - b = HH(b, c, d, a, M_offset_6, 23, T[43]); - a = HH(a, b, c, d, M_offset_9, 4, T[44]); - d = HH(d, a, b, c, M_offset_12, 11, T[45]); - c = HH(c, d, a, b, M_offset_15, 16, T[46]); - b = HH(b, c, d, a, M_offset_2, 23, T[47]); - a = II(a, b, c, d, M_offset_0, 6, T[48]); - d = II(d, a, b, c, M_offset_7, 10, T[49]); - c = II(c, d, a, b, M_offset_14, 15, T[50]); - b = II(b, c, d, a, M_offset_5, 21, T[51]); - a = II(a, b, c, d, M_offset_12, 6, T[52]); - d = II(d, a, b, c, M_offset_3, 10, T[53]); - c = II(c, d, a, b, M_offset_10, 15, T[54]); - b = II(b, c, d, a, M_offset_1, 21, T[55]); - a = II(a, b, c, d, M_offset_8, 6, T[56]); - d = II(d, a, b, c, M_offset_15, 10, T[57]); - c = II(c, d, a, b, M_offset_6, 15, T[58]); - b = II(b, c, d, a, M_offset_13, 21, T[59]); - a = II(a, b, c, d, M_offset_4, 6, T[60]); - d = II(d, a, b, c, M_offset_11, 10, T[61]); - c = II(c, d, a, b, M_offset_2, 15, T[62]); - b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value + /** + * Resets this cipher to its initial state. + * + * @example + * + * cipher.reset(); + */ + reset: function reset() { + // Reset data buffer + BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; + this._doReset(); }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); - var nBitsTotalL = nBitsTotal; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; - data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks + /** + * Adds data to be encrypted or decrypted. + * + * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. + * + * @return {WordArray} The data after processing. + * + * @example + * + * var encrypted = cipher.process('data'); + * var encrypted = cipher.process(wordArray); + */ + process: function process(dataUpdate) { + // Append + this._append(dataUpdate); // Process available blocks - this._process(); // Shortcuts + return this._process(); + }, - var hash = this._hash; - var H = hash.words; // Swap endian + /** + * Finalizes the encryption or decryption process. + * Note that the finalize operation is effectively a destructive, read-once operation. + * + * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. + * + * @return {WordArray} The data after final processing. + * + * @example + * + * var encrypted = cipher.finalize(); + * var encrypted = cipher.finalize('data'); + * var encrypted = cipher.finalize(wordArray); + */ + finalize: function finalize(dataUpdate) { + // Final data update + if (dataUpdate) { + this._append(dataUpdate); + } // Perform concrete-cipher logic - for (var i = 0; i < 4; i++) { - // Shortcut - var H_i = H[i]; - H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; - } // Return final computed hash + var finalProcessedData = this._doFinalize(); - return hash; + return finalProcessedData; }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - - function FF(a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function GG(a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + x + t; - return (n << s | n >>> 32 - s) + b; - } + keySize: 128 / 32, + ivSize: 128 / 32, + _ENC_XFORM_MODE: 1, + _DEC_XFORM_MODE: 2, - function HH(a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + x + t; - return (n << s | n >>> 32 - s) + b; - } + /** + * Creates shortcut functions to a cipher's object interface. + * + * @param {Cipher} cipher The cipher to create a helper for. + * + * @return {Object} An object with encrypt and decrypt shortcut functions. + * + * @static + * + * @example + * + * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); + */ + _createHelper: function () { + function selectCipherStrategy(key) { + if (typeof key == 'string') { + return PasswordBasedCipher; + } else { + return SerializableCipher; + } + } - function II(a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + x + t; - return (n << s | n >>> 32 - s) + b; - } + return function (cipher) { + return { + encrypt: function encrypt(message, key, cfg) { + return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); + }, + decrypt: function decrypt(ciphertext, key, cfg) { + return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); + } + }; + }; + }() + }); /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example + * Abstract base stream cipher template. * - * var hash = CryptoJS.MD5('message'); - * var hash = CryptoJS.MD5(wordArray); + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) */ + var StreamCipher = C_lib.StreamCipher = Cipher.extend({ + _doFinalize: function _doFinalize() { + // Process partial blocks + var finalProcessedBlocks = this._process(!!'flush'); - C.MD5 = Hasher._createHelper(MD5); + return finalProcessedBlocks; + }, + blockSize: 1 + }); /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacMD5(message, key); + * Mode namespace. */ - C.HmacMD5 = Hasher._createHmacHelper(MD5); - })(Math); - - return CryptoJS.MD5; - }); - }); + var C_mode = C.mode = {}; + /** + * Abstract base block cipher mode template. + */ - var sha1 = createCommonjsModule(function (module, exports) { + var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ + /** + * Creates this mode for encryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); + */ + createEncryptor: function createEncryptor(cipher, iv) { + return this.Encryptor.create(cipher, iv); + }, - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Reusable object + /** + * Creates this mode for decryption. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @static + * + * @example + * + * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); + */ + createDecryptor: function createDecryptor(cipher, iv) { + return this.Decryptor.create(cipher, iv); + }, - var W = []; + /** + * Initializes a newly created mode. + * + * @param {Cipher} cipher A block cipher instance. + * @param {Array} iv The IV words. + * + * @example + * + * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); + */ + init: function init(cipher, iv) { + this._cipher = cipher; + this._iv = iv; + } + }); /** - * SHA-1 hash algorithm. + * Cipher Block Chaining mode. */ - var SHA1 = C_algo.SHA1 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Shortcut - var H = this._hash.words; // Working variables + var CBC = C_mode.CBC = function () { + /** + * Abstract base CBC mode. + */ + var CBC = BlockCipherMode.extend(); + /** + * CBC encryptor. + */ - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; // Computation + CBC.Encryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // XOR and encrypt - for (var i = 0; i < 80; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = n << 1 | n >>> 31; - } + xorBlock.call(this, words, offset, blockSize); + cipher.encryptBlock(words, offset); // Remember this block to use with next block - var t = (a << 5 | a >>> 27) + e + W[i]; + this._prevBlock = words.slice(offset, offset + blockSize); + } + }); + /** + * CBC decryptor. + */ - if (i < 20) { - t += (b & c | ~b & d) + 0x5a827999; - } else if (i < 40) { - t += (b ^ c ^ d) + 0x6ed9eba1; - } else if (i < 60) { - t += (b & c | b & d | c & d) - 0x70e44324; - } else - /* if (i < 80) */ - { - t += (b ^ c ^ d) - 0x359d3e2a; - } + CBC.Decryptor = CBC.extend({ + /** + * Processes the data block at offset. + * + * @param {Array} words The data words to operate on. + * @param {number} offset The offset where the block starts. + * + * @example + * + * mode.processBlock(data.words, offset); + */ + processBlock: function processBlock(words, offset) { + // Shortcuts + var cipher = this._cipher; + var blockSize = cipher.blockSize; // Remember this block to use with next block - e = d; - d = c; - c = b << 30 | b >>> 2; - b = a; - a = t; - } // Intermediate hash value + var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR + cipher.decryptBlock(words, offset); + xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - H[4] = H[4] + e | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding + this._prevBlock = thisBlock; + } + }); - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; // Hash final blocks + function xorBlock(words, offset, blockSize) { + // Shortcut + var iv = this._iv; // Choose mixing block - this._process(); // Return final computed hash + if (iv) { + var block = iv; // Remove IV for subsequent blocks + this._iv = undefined$1; + } else { + var block = this._prevBlock; + } // XOR blocks - return this._hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA1('message'); - * var hash = CryptoJS.SHA1(wordArray); - */ - C.SHA1 = Hasher._createHelper(SHA1); + for (var i = 0; i < blockSize; i++) { + words[offset + i] ^= block[i]; + } + } + + return CBC; + }(); /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA1(message, key); + * Padding namespace. */ - C.HmacSHA1 = Hasher._createHmacHelper(SHA1); - })(); - - return CryptoJS.SHA1; - }); - }); - - var hmac = createCommonjsModule(function (module, exports) { - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var C_algo = C.algo; + var C_pad = C.pad = {}; /** - * HMAC algorithm. + * PKCS #5/7 padding strategy. */ - var HMAC = C_algo.HMAC = Base.extend({ + var Pkcs7 = C_pad.Pkcs7 = { /** - * Initializes a newly created HMAC. + * Pads data using the algorithm defined in PKCS #5/7. * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. + * @param {WordArray} data The data to pad. + * @param {number} blockSize The multiple that the data should be padded to. + * + * @static * * @example * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); + * CryptoJS.pad.Pkcs7.pad(wordArray, 4); */ - init: function init(hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already + pad: function pad(data, blockSize) { + // Shortcut + var blockSizeBytes = blockSize * 4; // Count padding bytes - if (typeof key == 'string') { - key = Utf8.parse(key); - } // Shortcuts + var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word + var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys + var paddingWords = []; - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } // Clamp excess bits + for (var i = 0; i < nPaddingBytes; i += 4) { + paddingWords.push(paddingWord); + } + var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding - key.clamp(); // Clone key for inner and outer pads + data.concat(padding); + }, - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); // Shortcuts + /** + * Unpads data that had been padded using the algorithm defined in PKCS #5/7. + * + * @param {WordArray} data The data to unpad. + * + * @static + * + * @example + * + * CryptoJS.pad.Pkcs7.unpad(wordArray); + */ + unpad: function unpad(data) { + // Get number of padding bytes from last byte + var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; // XOR keys with pad constants + data.sigBytes -= nPaddingBytes; + } + }; + /** + * Abstract base block cipher template. + * + * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) + */ - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; + var BlockCipher = C_lib.BlockCipher = Cipher.extend({ + /** + * Configuration options. + * + * @property {Mode} mode The block mode to use. Default: CBC + * @property {Padding} padding The padding strategy to use. Default: Pkcs7 + */ + cfg: Cipher.cfg.extend({ + mode: CBC, + padding: Pkcs7 + }), + reset: function reset() { + // Reset cipher + Cipher.reset.call(this); // Shortcuts + + var cfg = this.cfg; + var iv = cfg.iv; + var mode = cfg.mode; // Reset block mode + + if (this._xformMode == this._ENC_XFORM_MODE) { + var modeCreator = mode.createEncryptor; + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding + + this._minBufferSize = 1; + } + + if (this._mode && this._mode.__creator == modeCreator) { + this._mode.init(this, iv && iv.words); + } else { + this._mode = modeCreator.call(mode, this, iv && iv.words); + this._mode.__creator = modeCreator; } + }, + _doProcessBlock: function _doProcessBlock(words, offset) { + this._mode.processBlock(words, offset); + }, + _doFinalize: function _doFinalize() { + // Shortcut + var padding = this.cfg.padding; // Finalize - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values + if (this._xformMode == this._ENC_XFORM_MODE) { + // Pad data + padding.pad(this._data, this.blockSize); // Process final blocks - this.reset(); + var finalProcessedBlocks = this._process(!!'flush'); + } else + /* if (this._xformMode == this._DEC_XFORM_MODE) */ + { + // Process final blocks + var finalProcessedBlocks = this._process(!!'flush'); // Unpad data + + + padding.unpad(finalProcessedBlocks); + } + + return finalProcessedBlocks; }, + blockSize: 128 / 32 + }); + /** + * A collection of cipher parameters. + * + * @property {WordArray} ciphertext The raw ciphertext. + * @property {WordArray} key The key to this ciphertext. + * @property {WordArray} iv The IV used in the ciphering operation. + * @property {WordArray} salt The salt used with a key derivation function. + * @property {Cipher} algorithm The cipher algorithm. + * @property {Mode} mode The block mode used in the ciphering operation. + * @property {Padding} padding The padding scheme used in the ciphering operation. + * @property {number} blockSize The block size of the cipher. + * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. + */ + var CipherParams = C_lib.CipherParams = Base.extend({ /** - * Resets this HMAC to its initial state. + * Initializes a newly created cipher params object. + * + * @param {Object} cipherParams An object with any of the possible cipher parameters. * * @example * - * hmacHasher.reset(); + * var cipherParams = CryptoJS.lib.CipherParams.create({ + * ciphertext: ciphertextWordArray, + * key: keyWordArray, + * iv: ivWordArray, + * salt: saltWordArray, + * algorithm: CryptoJS.algo.AES, + * mode: CryptoJS.mode.CBC, + * padding: CryptoJS.pad.PKCS7, + * blockSize: 4, + * formatter: CryptoJS.format.OpenSSL + * }); */ - reset: function reset() { - // Shortcut - var hasher = this._hasher; // Reset - - hasher.reset(); - hasher.update(this._iKey); + init: function init(cipherParams) { + this.mixIn(cipherParams); }, /** - * Updates this HMAC with a message. + * Converts this cipher params object to a string. * - * @param {WordArray|string} messageUpdate The message to append. + * @param {Format} formatter (Optional) The formatting strategy to use. * - * @return {HMAC} This HMAC instance. + * @return {string} The stringified cipher params. + * + * @throws Error If neither the formatter nor the default formatter is set. * * @example * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); + * var string = cipherParams + ''; + * var string = cipherParams.toString(); + * var string = cipherParams.toString(CryptoJS.format.OpenSSL); */ - update: function update(messageUpdate) { - this._hasher.update(messageUpdate); // Chainable + toString: function toString(formatter) { + return (formatter || this.formatter).stringify(this); + } + }); + /** + * Format namespace. + */ + + var C_format = C.format = {}; + /** + * OpenSSL formatting strategy. + */ + + var OpenSSLFormatter = C_format.OpenSSL = { + /** + * Converts a cipher params object to an OpenSSL-compatible string. + * + * @param {CipherParams} cipherParams The cipher params object. + * + * @return {string} The OpenSSL-compatible string. + * + * @static + * + * @example + * + * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); + */ + stringify: function stringify(cipherParams) { + // Shortcuts + var ciphertext = cipherParams.ciphertext; + var salt = cipherParams.salt; // Format + if (salt) { + var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); + } else { + var wordArray = ciphertext; + } - return this; + return wordArray.toString(Base64); }, /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. + * Converts an OpenSSL-compatible string to a cipher params object. * - * @param {WordArray|string} messageUpdate (Optional) A final message update. + * @param {string} openSSLStr The OpenSSL-compatible string. * - * @return {WordArray} The HMAC. + * @return {CipherParams} The cipher params object. + * + * @static * * @example * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); + * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); */ - finalize: function finalize(messageUpdate) { - // Shortcut - var hasher = this._hasher; // Compute HMAC + parse: function parse(openSSLStr) { + // Parse base64 + var ciphertext = Base64.parse(openSSLStr); // Shortcut - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - return hmac; - } - }); - })(); - }); - }); + var ciphertextWords = ciphertext.words; // Test for salt - var evpkdf = createCommonjsModule(function (module, exports) { + if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { + // Extract salt + var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, sha1, hmac); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var C_algo = C.algo; - var MD5 = C_algo.MD5; + ciphertextWords.splice(0, 4); + ciphertext.sigBytes -= 16; + } + + return CipherParams.create({ + ciphertext: ciphertext, + salt: salt + }); + } + }; /** - * This key derivation function is meant to conform with EVP_BytesToKey. - * www.openssl.org/docs/crypto/EVP_BytesToKey.html + * A cipher wrapper that returns ciphertext as a serializable cipher params object. */ - var EvpKDF = C_algo.EvpKDF = Base.extend({ + var SerializableCipher = C_lib.SerializableCipher = Base.extend({ /** * Configuration options. * - * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) - * @property {Hasher} hasher The hash algorithm to use. Default: MD5 - * @property {number} iterations The number of iterations to perform. Default: 1 + * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL */ cfg: Base.extend({ - keySize: 128 / 32, - hasher: MD5, - iterations: 1 + format: OpenSSLFormatter }), /** - * Initializes a newly created key derivation function. + * Encrypts a message. * - * @param {Object} cfg (Optional) The configuration options to use for the derivation. + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {CipherParams} A cipher params object. + * + * @static * * @example * - * var kdf = CryptoJS.algo.EvpKDF.create(); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); + * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ - init: function init(cfg) { - this.cfg = this.cfg.extend(cfg); + encrypt: function encrypt(cipher, message, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Encrypt + + var encryptor = cipher.createEncryptor(key, cfg); + var ciphertext = encryptor.finalize(message); // Shortcut + + var cipherCfg = encryptor.cfg; // Create and return serializable cipher params + + return CipherParams.create({ + ciphertext: ciphertext, + key: key, + iv: cipherCfg.iv, + algorithm: cipher, + mode: cipherCfg.mode, + padding: cipherCfg.padding, + blockSize: cipher.blockSize, + formatter: cfg.format + }); }, /** - * Derives a key from a password. + * Decrypts serialized ciphertext. * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {WordArray} key The key. + * @param {Object} cfg (Optional) The configuration options to use for this operation. * - * @return {WordArray} The derived key. + * @return {WordArray} The plaintext. + * + * @static * * @example * - * var key = kdf.compute(password, salt); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); */ - compute: function compute(password, salt) { - // Shortcut - var cfg = this.cfg; // Init hasher - - var hasher = cfg.hasher.create(); // Initial values - - var derivedKey = WordArray.create(); // Shortcuts - - var derivedKeyWords = derivedKey.words; - var keySize = cfg.keySize; - var iterations = cfg.iterations; // Generate key - - while (derivedKeyWords.length < keySize) { - if (block) { - hasher.update(block); - } + decrypt: function decrypt(cipher, ciphertext, key, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams - var block = hasher.update(password).finalize(salt); - hasher.reset(); // Iterations + ciphertext = this._parse(ciphertext, cfg.format); // Decrypt - for (var i = 1; i < iterations; i++) { - block = hasher.finalize(block); - hasher.reset(); - } + var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); + return plaintext; + }, - derivedKey.concat(block); + /** + * Converts serialized ciphertext to CipherParams, + * else assumed CipherParams already and returns ciphertext unchanged. + * + * @param {CipherParams|string} ciphertext The ciphertext. + * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. + * + * @return {CipherParams} The unserialized ciphertext. + * + * @static + * + * @example + * + * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); + */ + _parse: function _parse(ciphertext, format) { + if (typeof ciphertext == 'string') { + return format.parse(ciphertext, this); + } else { + return ciphertext; } - - derivedKey.sigBytes = keySize * 4; - return derivedKey; } }); /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * @param {Object} cfg (Optional) The configuration options to use for this computation. - * - * @return {WordArray} The derived key. - * - * @static - * - * @example - * - * var key = CryptoJS.EvpKDF(password, salt); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); + * Key derivation function namespace. */ - C.EvpKDF = function (password, salt, cfg) { - return EvpKDF.create(cfg).compute(password, salt); - }; - })(); + var C_kdf = C.kdf = {}; + /** + * OpenSSL key derivation function. + */ - return CryptoJS.EvpKDF; - }); - }); + var OpenSSLKdf = C_kdf.OpenSSL = { + /** + * Derives a key and IV from a password. + * + * @param {string} password The password to derive from. + * @param {number} keySize The size in words of the key to generate. + * @param {number} ivSize The size in words of the IV to generate. + * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. + * + * @return {CipherParams} A cipher params object with the key, IV, and salt. + * + * @static + * + * @example + * + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); + * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); + */ + execute: function execute(password, keySize, ivSize, salt) { + // Generate random salt + if (!salt) { + salt = WordArray.random(64 / 8); + } // Derive key and IV - var cipherCore = createCommonjsModule(function (module, exports) { - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, evpkdf); - } - })(commonjsGlobal, function (CryptoJS) { - /** - * Cipher core components. - */ - CryptoJS.lib.Cipher || function (undefined$1) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var Base64 = C_enc.Base64; - var C_algo = C.algo; - var EvpKDF = C_algo.EvpKDF; + var key = EvpKDF.create({ + keySize: keySize + ivSize + }).compute(password, salt); // Separate key and IV + + var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); + key.sigBytes = keySize * 4; // Return params + + return CipherParams.create({ + key: key, + iv: iv, + salt: salt + }); + } + }; /** - * Abstract base cipher template. - * - * @property {number} keySize This cipher's key size. Default: 4 (128 bits) - * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) - * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. - * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. + * A serializable cipher wrapper that derives the key from a password, + * and returns ciphertext as a serializable cipher params object. */ - var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ + var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ /** * Configuration options. * - * @property {WordArray} iv The IV to use for this operation. + * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL */ - cfg: Base.extend(), + cfg: SerializableCipher.cfg.extend({ + kdf: OpenSSLKdf + }), /** - * Creates this cipher in encryption mode. + * Encrypts a message using a password. * - * @param {WordArray} key The key. + * @param {Cipher} cipher The cipher algorithm to use. + * @param {WordArray|string} message The message to encrypt. + * @param {string} password The password. * @param {Object} cfg (Optional) The configuration options to use for this operation. * - * @return {Cipher} A cipher instance. + * @return {CipherParams} A cipher params object. * * @static * * @example * + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); + * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); + */ + encrypt: function encrypt(cipher, message, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config + + cfg.iv = derivedParams.iv; // Encrypt + + var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params + + ciphertext.mixIn(derivedParams); + return ciphertext; + }, + + /** + * Decrypts serialized ciphertext using a password. + * + * @param {Cipher} cipher The cipher algorithm to use. + * @param {CipherParams|string} ciphertext The ciphertext to decrypt. + * @param {string} password The password. + * @param {Object} cfg (Optional) The configuration options to use for this operation. + * + * @return {WordArray} The plaintext. + * + * @static + * + * @example + * + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); + * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); + */ + decrypt: function decrypt(cipher, ciphertext, password, cfg) { + // Apply config defaults + cfg = this.cfg.extend(cfg); // Convert string to CipherParams + + ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params + + var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config + + cfg.iv = derivedParams.iv; // Decrypt + + var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); + return plaintext; + } + }); + }(); + }); +======= * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); */ createEncryptor: function createEncryptor(key, cfg) { @@ -11140,793 +14787,648 @@ }); }(); }); -======= - * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); - */ - createEncryptor: function createEncryptor(key, cfg) { - return this.create(this._ENC_XFORM_MODE, key, cfg); - }, + }); - /** - * Creates this cipher in decryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); - */ - createDecryptor: function createDecryptor(key, cfg) { - return this.create(this._DEC_XFORM_MODE, key, cfg); - }, + var aes = createCommonjsModule(function (module, exports) { - /** - * Initializes a newly created cipher. - * - * @param {number} xformMode Either the encryption or decryption transormation mode constant. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @example - * - * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); - */ - init: function init(xformMode, key, cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Store transform mode and key + (function (root, factory, undef) { + { + // CommonJS + module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); + } + })(commonjsGlobal, function (CryptoJS) { + (function () { + // Shortcuts + var C = CryptoJS; + var C_lib = C.lib; + var BlockCipher = C_lib.BlockCipher; + var C_algo = C.algo; // Lookup tables - this._xformMode = xformMode; - this._key = key; // Set initial values + var SBOX = []; + var INV_SBOX = []; + var SUB_MIX_0 = []; + var SUB_MIX_1 = []; + var SUB_MIX_2 = []; + var SUB_MIX_3 = []; + var INV_SUB_MIX_0 = []; + var INV_SUB_MIX_1 = []; + var INV_SUB_MIX_2 = []; + var INV_SUB_MIX_3 = []; // Compute lookup tables - this.reset(); - }, + (function () { + // Compute double table + var d = []; - /** - * Resets this cipher to its initial state. - * - * @example - * - * cipher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic + for (var i = 0; i < 256; i++) { + if (i < 128) { + d[i] = i << 1; + } else { + d[i] = i << 1 ^ 0x11b; + } + } // Walk GF(2^8) - this._doReset(); - }, - /** - * Adds data to be encrypted or decrypted. - * - * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. - * - * @return {WordArray} The data after processing. - * - * @example - * - * var encrypted = cipher.process('data'); - * var encrypted = cipher.process(wordArray); - */ - process: function process(dataUpdate) { - // Append - this._append(dataUpdate); // Process available blocks + var x = 0; + var xi = 0; + + for (var i = 0; i < 256; i++) { + // Compute sbox + var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; + sx = sx >>> 8 ^ sx & 0xff ^ 0x63; + SBOX[x] = sx; + INV_SBOX[sx] = x; // Compute multiplication + + var x2 = d[x]; + var x4 = d[x2]; + var x8 = d[x4]; // Compute sub bytes, mix columns tables + + var t = d[sx] * 0x101 ^ sx * 0x1010100; + SUB_MIX_0[x] = t << 24 | t >>> 8; + SUB_MIX_1[x] = t << 16 | t >>> 16; + SUB_MIX_2[x] = t << 8 | t >>> 24; + SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables + + var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; + INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; + INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; + INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; + INV_SUB_MIX_3[sx] = t; // Compute next counter + + if (!x) { + x = xi = 1; + } else { + x = x2 ^ d[d[d[x8 ^ x2]]]; + xi ^= d[d[xi]]; + } + } + })(); // Precomputed Rcon lookup + + + var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; + /** + * AES block cipher algorithm. + */ + + var AES = C_algo.AES = BlockCipher.extend({ + _doReset: function _doReset() { + // Skip reset of nRounds has been set before and key did not change + if (this._nRounds && this._keyPriorReset === this._key) { + return; + } // Shortcuts + + + var key = this._keyPriorReset = this._key; + var keyWords = key.words; + var keySize = key.sigBytes / 4; // Compute number of rounds + + var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows + + var ksRows = (nRounds + 1) * 4; // Compute key schedule + + var keySchedule = this._keySchedule = []; + + for (var ksRow = 0; ksRow < ksRows; ksRow++) { + if (ksRow < keySize) { + keySchedule[ksRow] = keyWords[ksRow]; + } else { + var t = keySchedule[ksRow - 1]; + + if (!(ksRow % keySize)) { + // Rot word + t = t << 8 | t >>> 24; // Sub word + + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon + t ^= RCON[ksRow / keySize | 0] << 24; + } else if (keySize > 6 && ksRow % keySize == 4) { + // Sub word + t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; + } - return this._process(); - }, + keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; + } + } // Compute inv key schedule - /** - * Finalizes the encryption or decryption process. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. - * - * @return {WordArray} The data after final processing. - * - * @example - * - * var encrypted = cipher.finalize(); - * var encrypted = cipher.finalize('data'); - * var encrypted = cipher.finalize(wordArray); - */ - finalize: function finalize(dataUpdate) { - // Final data update - if (dataUpdate) { - this._append(dataUpdate); - } // Perform concrete-cipher logic + var invKeySchedule = this._invKeySchedule = []; - var finalProcessedData = this._doFinalize(); + for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { + var ksRow = ksRows - invKsRow; - return finalProcessedData; - }, - keySize: 128 / 32, - ivSize: 128 / 32, - _ENC_XFORM_MODE: 1, - _DEC_XFORM_MODE: 2, + if (invKsRow % 4) { + var t = keySchedule[ksRow]; + } else { + var t = keySchedule[ksRow - 4]; + } - /** - * Creates shortcut functions to a cipher's object interface. - * - * @param {Cipher} cipher The cipher to create a helper for. - * - * @return {Object} An object with encrypt and decrypt shortcut functions. - * - * @static - * - * @example - * - * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); - */ - _createHelper: function () { - function selectCipherStrategy(key) { - if (typeof key == 'string') { - return PasswordBasedCipher; + if (invKsRow < 4 || ksRow <= 4) { + invKeySchedule[invKsRow] = t; } else { - return SerializableCipher; + invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; } } + }, + encryptBlock: function encryptBlock(M, offset) { + this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); + }, + decryptBlock: function decryptBlock(M, offset) { + // Swap 2nd and 4th rows + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; - return function (cipher) { - return { - encrypt: function encrypt(message, key, cfg) { - return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); - }, - decrypt: function decrypt(ciphertext, key, cfg) { - return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); - } - }; - }; - }() - }); - /** - * Abstract base stream cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) - */ + this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows - var StreamCipher = C_lib.StreamCipher = Cipher.extend({ - _doFinalize: function _doFinalize() { - // Process partial blocks - var finalProcessedBlocks = this._process(!!'flush'); - return finalProcessedBlocks; + var t = M[offset + 1]; + M[offset + 1] = M[offset + 3]; + M[offset + 3] = t; }, - blockSize: 1 - }); - /** - * Mode namespace. - */ + _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { + // Shortcut + var nRounds = this._nRounds; // Get input, add round key - var C_mode = C.mode = {}; - /** - * Abstract base block cipher mode template. - */ + var s0 = M[offset] ^ keySchedule[0]; + var s1 = M[offset + 1] ^ keySchedule[1]; + var s2 = M[offset + 2] ^ keySchedule[2]; + var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter - var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ - /** - * Creates this mode for encryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); - */ - createEncryptor: function createEncryptor(cipher, iv) { - return this.Encryptor.create(cipher, iv); - }, + var ksRow = 4; // Rounds - /** - * Creates this mode for decryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); - */ - createDecryptor: function createDecryptor(cipher, iv) { - return this.Decryptor.create(cipher, iv); - }, + for (var round = 1; round < nRounds; round++) { + // Shift rows, sub bytes, mix columns, add round key + var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; + var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; + var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; + var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state - /** - * Initializes a newly created mode. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @example - * - * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); - */ - init: function init(cipher, iv) { - this._cipher = cipher; - this._iv = iv; - } + s0 = t0; + s1 = t1; + s2 = t2; + s3 = t3; + } // Shift rows, sub bytes, add round key + + + var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; + var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; + var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; + var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output + + M[offset] = t0; + M[offset + 1] = t1; + M[offset + 2] = t2; + M[offset + 3] = t3; + }, + keySize: 256 / 32 }); /** - * Cipher Block Chaining mode. + * Shortcut functions to the cipher's object interface. + * + * @example + * + * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); + * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); */ - var CBC = C_mode.CBC = function () { - /** - * Abstract base CBC mode. - */ - var CBC = BlockCipherMode.extend(); - /** - * CBC encryptor. - */ + C.AES = BlockCipher._createHelper(AES); + })(); - CBC.Encryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // XOR and encrypt + return CryptoJS.AES; + }); + }); - xorBlock.call(this, words, offset, blockSize); - cipher.encryptBlock(words, offset); // Remember this block to use with next block + var encUtf8 = createCommonjsModule(function (module, exports) { - this._prevBlock = words.slice(offset, offset + blockSize); - } - }); - /** - * CBC decryptor. - */ + (function (root, factory) { + { + // CommonJS + module.exports = exports = factory(core); + } + })(commonjsGlobal, function (CryptoJS) { + return CryptoJS.enc.Utf8; + }); + }); + + /** + * toString ref. + */ + var toString$1 = Object.prototype.toString; + /** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ + + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { + case '[object Date]': + return 'date'; + + case '[object RegExp]': + return 'regexp'; - CBC.Decryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // Remember this block to use with next block + case '[object Arguments]': + return 'arguments'; - var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR + case '[object Array]': + return 'array'; - cipher.decryptBlock(words, offset); - xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block + case '[object Error]': + return 'error'; + } - this._prevBlock = thisBlock; - } - }); + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + if (isBuffer$1(val)) return 'buffer'; + val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); + return _typeof(val); + }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - function xorBlock(words, offset, blockSize) { - // Shortcut - var iv = this._iv; // Choose mixing block - if (iv) { - var block = iv; // Remove IV for subsequent blocks + function isBuffer$1(obj) { + return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + } - this._iv = undefined$1; - } else { - var block = this._prevBlock; - } // XOR blocks + /* + * Module dependencies. + */ + /** + * Deeply clone an object. + * + * @param {*} obj Any object. + */ - for (var i = 0; i < blockSize; i++) { - words[offset + i] ^= block[i]; - } - } - return CBC; - }(); - /** - * Padding namespace. - */ + var clone = function clone(obj) { + var t = componentType$1(obj); + if (t === 'object') { + var copy = {}; - var C_pad = C.pad = {}; - /** - * PKCS #5/7 padding strategy. - */ + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + copy[key] = clone(obj[key]); + } + } - var Pkcs7 = C_pad.Pkcs7 = { - /** - * Pads data using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to pad. - * @param {number} blockSize The multiple that the data should be padded to. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.pad(wordArray, 4); - */ - pad: function pad(data, blockSize) { - // Shortcut - var blockSizeBytes = blockSize * 4; // Count padding bytes + return copy; + } - var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word + if (t === 'array') { + var copy = new Array(obj.length); - var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding + for (var i = 0, l = obj.length; i < l; i++) { + copy[i] = clone(obj[i]); + } - var paddingWords = []; + return copy; + } - for (var i = 0; i < nPaddingBytes; i += 4) { - paddingWords.push(paddingWord); - } + if (t === 'regexp') { + // from millermedeiros/amd-utils - MIT + var flags = ''; + flags += obj.multiline ? 'm' : ''; + flags += obj.global ? 'g' : ''; + flags += obj.ignoreCase ? 'i' : ''; + return new RegExp(obj.source, flags); + } - var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding + if (t === 'date') { + return new Date(obj.getTime()); + } // string, number, boolean, etc. - data.concat(padding); - }, - /** - * Unpads data that had been padded using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to unpad. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.unpad(wordArray); - */ - unpad: function unpad(data) { - // Get number of padding bytes from last byte - var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding + return obj; + }; + /* + * Exports. + */ - data.sigBytes -= nPaddingBytes; - } - }; - /** - * Abstract base block cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) - */ - var BlockCipher = C_lib.BlockCipher = Cipher.extend({ - /** - * Configuration options. - * - * @property {Mode} mode The block mode to use. Default: CBC - * @property {Padding} padding The padding strategy to use. Default: Pkcs7 - */ - cfg: Cipher.cfg.extend({ - mode: CBC, - padding: Pkcs7 - }), - reset: function reset() { - // Reset cipher - Cipher.reset.call(this); // Shortcuts + var clone_1 = clone; - var cfg = this.cfg; - var iv = cfg.iv; - var mode = cfg.mode; // Reset block mode + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ - if (this._xformMode == this._ENC_XFORM_MODE) { - var modeCreator = mode.createEncryptor; - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse(val); + return options["long"] ? _long(val) : _short(val); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ - this._minBufferSize = 1; - } - if (this._mode && this._mode.__creator == modeCreator) { - this._mode.init(this, iv && iv.words); - } else { - this._mode = modeCreator.call(mode, this, iv && iv.words); - this._mode.__creator = modeCreator; - } - }, - _doProcessBlock: function _doProcessBlock(words, offset) { - this._mode.processBlock(words, offset); - }, - _doFinalize: function _doFinalize() { - // Shortcut - var padding = this.cfg.padding; // Finalize + function parse(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(); - if (this._xformMode == this._ENC_XFORM_MODE) { - // Pad data - padding.pad(this._data, this.blockSize); // Process final blocks + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; - var finalProcessedBlocks = this._process(!!'flush'); - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - // Process final blocks - var finalProcessedBlocks = this._process(!!'flush'); // Unpad data + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; - padding.unpad(finalProcessedBlocks); - } + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; - return finalProcessedBlocks; - }, - blockSize: 128 / 32 - }); - /** - * A collection of cipher parameters. - * - * @property {WordArray} ciphertext The raw ciphertext. - * @property {WordArray} key The key to this ciphertext. - * @property {WordArray} iv The IV used in the ciphering operation. - * @property {WordArray} salt The salt used with a key derivation function. - * @property {Cipher} algorithm The cipher algorithm. - * @property {Mode} mode The block mode used in the ciphering operation. - * @property {Padding} padding The padding scheme used in the ciphering operation. - * @property {number} blockSize The block size of the cipher. - * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. - */ + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; - var CipherParams = C_lib.CipherParams = Base.extend({ - /** - * Initializes a newly created cipher params object. - * - * @param {Object} cipherParams An object with any of the possible cipher parameters. - * - * @example - * - * var cipherParams = CryptoJS.lib.CipherParams.create({ - * ciphertext: ciphertextWordArray, - * key: keyWordArray, - * iv: ivWordArray, - * salt: saltWordArray, - * algorithm: CryptoJS.algo.AES, - * mode: CryptoJS.mode.CBC, - * padding: CryptoJS.pad.PKCS7, - * blockSize: 4, - * formatter: CryptoJS.format.OpenSSL - * }); - */ - init: function init(cipherParams) { - this.mixIn(cipherParams); - }, + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - /** - * Converts this cipher params object to a string. - * - * @param {Format} formatter (Optional) The formatting strategy to use. - * - * @return {string} The stringified cipher params. - * - * @throws Error If neither the formatter nor the default formatter is set. - * - * @example - * - * var string = cipherParams + ''; - * var string = cipherParams.toString(); - * var string = cipherParams.toString(CryptoJS.format.OpenSSL); - */ - toString: function toString(formatter) { - return (formatter || this.formatter).stringify(this); - } - }); - /** - * Format namespace. - */ - var C_format = C.format = {}; - /** - * OpenSSL formatting strategy. - */ + function _short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - var OpenSSLFormatter = C_format.OpenSSL = { - /** - * Converts a cipher params object to an OpenSSL-compatible string. - * - * @param {CipherParams} cipherParams The cipher params object. - * - * @return {string} The OpenSSL-compatible string. - * - * @static - * - * @example - * - * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); - */ - stringify: function stringify(cipherParams) { - // Shortcuts - var ciphertext = cipherParams.ciphertext; - var salt = cipherParams.salt; // Format - if (salt) { - var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); - } else { - var wordArray = ciphertext; - } + function _long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } + /** + * Pluralization helper. + */ - return wordArray.toString(Base64); - }, - /** - * Converts an OpenSSL-compatible string to a cipher params object. - * - * @param {string} openSSLStr The OpenSSL-compatible string. - * - * @return {CipherParams} The cipher params object. - * - * @static - * - * @example - * - * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); - */ - parse: function parse(openSSLStr) { - // Parse base64 - var ciphertext = Base64.parse(openSSLStr); // Shortcut + function plural(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 ciphertextWords = ciphertext.words; // Test for salt + var debug_1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ - if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { - // Extract salt - var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ - ciphertextWords.splice(0, 4); - ciphertext.sigBytes -= 16; - } + exports.formatters = {}; + /** + * Previously assigned color. + */ - return CipherParams.create({ - ciphertext: ciphertext, - salt: salt - }); - } - }; - /** - * A cipher wrapper that returns ciphertext as a serializable cipher params object. - */ + var prevColor = 0; + /** + * Previous log timestamp. + */ - var SerializableCipher = C_lib.SerializableCipher = Base.extend({ - /** - * Configuration options. - * - * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL - */ - cfg: Base.extend({ - format: OpenSSLFormatter - }), + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ - /** - * Encrypts a message. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Encrypt + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ - var encryptor = cipher.createEncryptor(key, cfg); - var ciphertext = encryptor.finalize(message); // Shortcut - var cipherCfg = encryptor.cfg; // Create and return serializable cipher params + function debug(namespace) { + // define the `disabled` version + function disabled() {} - return CipherParams.create({ - ciphertext: ciphertext, - key: key, - iv: cipherCfg.iv, - algorithm: cipher, - mode: cipherCfg.mode, - padding: cipherCfg.padding, - blockSize: cipher.blockSize, - formatter: cfg.format - }); - }, + disabled.enabled = false; // define the `enabled` version - /** - * Decrypts serialized ciphertext. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams + function enabled() { + var self = enabled; // set `diff` timestamp - ciphertext = this._parse(ciphertext, cfg.format); // Decrypt + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set - var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); - return plaintext; - }, + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); - /** - * Converts serialized ciphertext to CipherParams, - * else assumed CipherParams already and returns ciphertext unchanged. - * - * @param {CipherParams|string} ciphertext The ciphertext. - * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. - * - * @return {CipherParams} The unserialized ciphertext. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); - */ - _parse: function _parse(ciphertext, format) { - if (typeof ciphertext == 'string') { - return format.parse(ciphertext, this); - } else { - return ciphertext; - } + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // 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; }); - /** - * Key derivation function namespace. - */ - var C_kdf = C.kdf = {}; - /** - * OpenSSL key derivation function. - */ + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } - var OpenSSLKdf = C_kdf.OpenSSL = { - /** - * Derives a key and IV from a password. - * - * @param {string} password The password to derive from. - * @param {number} keySize The size in words of the key to generate. - * @param {number} ivSize The size in words of the IV to generate. - * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. - * - * @return {CipherParams} A cipher params object with the key, IV, and salt. - * - * @static - * - * @example - * - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); - */ - execute: function execute(password, keySize, ivSize, salt) { - // Generate random salt - if (!salt) { - salt = WordArray.random(64 / 8); - } // Derive key and IV + 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 + */ - var key = EvpKDF.create({ - keySize: keySize + ivSize - }).compute(password, salt); // Separate key and IV - var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); - key.sigBytes = keySize * 4; // Return params + function enable(namespaces) { + exports.save(namespaces); + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; - return CipherParams.create({ - key: key, - iv: iv, - salt: salt - }); - } - }; - /** - * A serializable cipher wrapper that derives the key from a password, - * and returns ciphertext as a serializable cipher params object. - */ + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings - var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ - /** - * Configuration options. - * - * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL - */ - cfg: SerializableCipher.cfg.extend({ - kdf: OpenSSLKdf - }), + namespaces = split[i].replace(/\*/g, '.*?'); - /** - * Encrypts a message using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Derive key and other params + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + /** + * Disable debug output. + * + * @api public + */ - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config - cfg.iv = derivedParams.iv; // Encrypt + function disable() { + exports.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ - var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params - ciphertext.mixIn(derivedParams); - return ciphertext; - }, + function enabled(name) { + var i, len; - /** - * Decrypts serialized ciphertext using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } - ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ - cfg.iv = derivedParams.iv; // Decrypt - var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); - return plaintext; - } - }); - }(); - }); + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } +>>>>>>> branch for npm and latest release }); +<<<<<<< HEAD var aes = createCommonjsModule(function (module, exports) { (function (root, factory, undef) { @@ -12133,10 +15635,155 @@ return CryptoJS.AES; }); +======= + var browser = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug_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 === "undefined" ? "undefined" : _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) {} + } +>>>>>>> branch for npm and latest release }); var encUtf8 = createCommonjsModule(function (module, exports) { +<<<<<<< HEAD (function (root, factory) { { // CommonJS @@ -12147,10 +15794,13 @@ }); }); +======= + var debug = browser('cookie'); +>>>>>>> branch for npm and latest release /** * toString ref. */ - var toString$1 = Object.prototype.toString; + var toString$2 = Object.prototype.toString; /** * Return the type of `val`. * @@ -12159,43 +15809,108 @@ * @api public */ - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { +<<<<<<< HEAD + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { case '[object Date]': return 'date'; - case '[object RegExp]': - return 'regexp'; + case '[object RegExp]': + return 'regexp'; + + case '[object Arguments]': + return 'arguments'; + + case '[object Array]': + return 'array'; + + case '[object Error]': + return 'error'; + } + + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + if (isBuffer$1(val)) return 'buffer'; + val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); + return _typeof(val); + }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js + + + function isBuffer$1(obj) { + return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + } + + /* + * Module dependencies. + */ + +======= + var rudderComponentCookie = function rudderComponentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set(name, value, options); + + case 1: + return get$1(name); + + default: + return all(); + } + }; + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ + + + function set(name, value, options) { + options = options || {}; + var str = encode(name) + '=' + encode(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.samesite) str += '; samesite=' + options.samesite; + if (options.secure) str += '; secure'; + document.cookie = str; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ + - case '[object Arguments]': - return 'arguments'; + function all() { + var str; - case '[object Array]': - return 'array'; + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } - case '[object Error]': - return 'error'; + return {}; } - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - if (isBuffer$1(val)) return 'buffer'; - val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); - return _typeof(val); - }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - - - function isBuffer$1(obj) { - return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + return parse$1(str); } - - /* - * Module dependencies. - */ - +>>>>>>> branch for npm and latest release /** * Deeply clone an object. * @@ -12203,8 +15918,9 @@ */ +<<<<<<< HEAD var clone = function clone(obj) { - var t = componentType$1(obj); + var t = componentType$2(obj); if (t === 'object') { var copy = {}; @@ -12240,6 +15956,88 @@ if (t === 'date') { return new Date(obj.getTime()); } // string, number, boolean, etc. +======= + function get$1(name) { + return all()[name]; + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ + + + function parse$1(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(pair[0])] = decode(pair[1]); + } + + return obj; + } + /** + * Encode. + */ + + + function encode(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ + + + function decode(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); + } + } + + var max = Math.max; + /** + * Produce a new array composed of all but the first `n` elements of an input `collection`. + * + * @name drop + * @api public + * @param {number} count The number of elements to drop. + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * drop(0, [1, 2, 3]); // => [1, 2, 3] + * drop(1, [1, 2, 3]); // => [2, 3] + * drop(2, [1, 2, 3]); // => [3] + * drop(3, [1, 2, 3]); // => [] + * drop(4, [1, 2, 3]); // => [] + */ + + var drop = function drop(count, collection) { + var length = collection ? collection.length : 0; + + if (!length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments + + + var toDrop = max(Number(count) || 0, 0); + var resultsLength = max(length - toDrop, 0); + var results = new Array(resultsLength); +>>>>>>> branch for npm and latest release return obj; @@ -12248,9 +16046,16 @@ * Exports. */ +<<<<<<< HEAD var clone_1 = clone; +======= + + var drop_1 = drop; + + var max$1 = Math.max; +>>>>>>> branch for npm and latest release /** * Helpers. */ @@ -12271,12 +16076,30 @@ * @return {String|Number} * @api public */ +<<<<<<< HEAD +======= + + var rest = function rest(collection) { + if (collection == null || !collection.length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments + + + var results = new Array(max$1(collection.length - 2, 0)); + + for (var i = 1; i < collection.length; i += 1) { + results[i - 1] = collection[i]; + } +>>>>>>> branch for npm and latest release var ms = function ms(val, options) { options = options || {}; - if ('string' == typeof val) return parse(val); + if ('string' == typeof val) return parse$1(val); return options["long"] ? _long(val) : _short(val); }; +<<<<<<< HEAD /** * Parse the given `str` and return milliseconds. * @@ -12285,8 +16108,16 @@ * @api private */ +======= + /* + * Exports. + */ + - function parse(str) { + var rest_1 = rest; +>>>>>>> branch for npm and latest release + + function parse$1(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); @@ -12307,6 +16138,7 @@ case 'd': return n * d; +<<<<<<< HEAD case 'hours': case 'hour': case 'hrs': @@ -12336,6 +16168,10 @@ return n; } } +======= + var has$3 = Object.prototype.hasOwnProperty; + var objToString$1 = Object.prototype.toString; +>>>>>>> branch for npm and latest release /** * Short format for `ms`. * @@ -12343,6 +16179,7 @@ * @return {String} * @api private */ +<<<<<<< HEAD function _short(ms) { @@ -12352,45 +16189,115 @@ if (ms >= s) return Math.round(ms / s) + 's'; return ms + 'ms'; } +======= + // TODO: Move to a library + + var isObject = function isObject(value) { + return Boolean(value) && _typeof(value) === 'object'; + }; +>>>>>>> branch for npm and latest release + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ +<<<<<<< HEAD + + + function _long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } +======= + // TODO: Move to a library + + + var isPlainObject = function isPlainObject(value) { + return Boolean(value) && objToString$1.call(value) === '[object Object]'; + }; +>>>>>>> branch for npm and latest release + /** + * Pluralization helper. + */ + +<<<<<<< HEAD + + function plural(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 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ +======= + + var shallowCombiner = function shallowCombiner(target, source, value, key) { + if (has$3.call(source, key) && target[key] === undefined) { + target[key] = value; + } + + return source; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined; also merges objects recursively. + * + * @name deepCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + * @return {Object} + */ + + + var deepCombiner = function deepCombiner(target, source, value, key) { + if (has$3.call(source, key)) { + if (isPlainObject(target[key]) && isPlainObject(value)) { + target[key] = defaultsDeep(target[key], value); + } else if (target[key] === undefined) { + target[key] = value; + } + } + + return source; + }; /** - * Long format for `ms`. + * TODO: Document * - * @param {Number} ms - * @return {String} + * @name defaultsWith * @api private + * @param {Function} combiner + * @param {Object} target + * @param {...Object} sources + * @return {Object} Return the input `target`. */ - function _long(ms) { - return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; - } - /** - * Pluralization helper. - */ - - - function plural(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 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ + var defaultsWith = function defaultsWith(combiner, target + /*, ...sources */ + ) { + if (!isObject(target)) { + return target; + } +>>>>>>> branch for npm and latest release exports.names = []; exports.skips = []; @@ -12429,6 +16336,7 @@ * @api public */ +<<<<<<< HEAD function debug(namespace) { // define the `disabled` version @@ -12562,218 +16470,17 @@ function coerce(val) { if (val instanceof Error) return val.stack || val.message; return val; - } ->>>>>>> branch for npm and latest release - }); - -<<<<<<< HEAD - var aes = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var BlockCipher = C_lib.BlockCipher; - var C_algo = C.algo; // Lookup tables - - var SBOX = []; - var INV_SBOX = []; - var SUB_MIX_0 = []; - var SUB_MIX_1 = []; - var SUB_MIX_2 = []; - var SUB_MIX_3 = []; - var INV_SUB_MIX_0 = []; - var INV_SUB_MIX_1 = []; - var INV_SUB_MIX_2 = []; - var INV_SUB_MIX_3 = []; // Compute lookup tables - - (function () { - // Compute double table - var d = []; - - for (var i = 0; i < 256; i++) { - if (i < 128) { - d[i] = i << 1; - } else { - d[i] = i << 1 ^ 0x11b; - } - } // Walk GF(2^8) - - - var x = 0; - var xi = 0; - - for (var i = 0; i < 256; i++) { - // Compute sbox - var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; - sx = sx >>> 8 ^ sx & 0xff ^ 0x63; - SBOX[x] = sx; - INV_SBOX[sx] = x; // Compute multiplication - - var x2 = d[x]; - var x4 = d[x2]; - var x8 = d[x4]; // Compute sub bytes, mix columns tables - - var t = d[sx] * 0x101 ^ sx * 0x1010100; - SUB_MIX_0[x] = t << 24 | t >>> 8; - SUB_MIX_1[x] = t << 16 | t >>> 16; - SUB_MIX_2[x] = t << 8 | t >>> 24; - SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables - - var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; - INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; - INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; - INV_SUB_MIX_3[sx] = t; // Compute next counter - - if (!x) { - x = xi = 1; - } else { - x = x2 ^ d[d[d[x8 ^ x2]]]; - xi ^= d[d[xi]]; - } - } - })(); // Precomputed Rcon lookup - - - var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; - /** - * AES block cipher algorithm. - */ - - var AES = C_algo.AES = BlockCipher.extend({ - _doReset: function _doReset() { - // Skip reset of nRounds has been set before and key did not change - if (this._nRounds && this._keyPriorReset === this._key) { - return; - } // Shortcuts - - - var key = this._keyPriorReset = this._key; - var keyWords = key.words; - var keySize = key.sigBytes / 4; // Compute number of rounds - - var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows - - var ksRows = (nRounds + 1) * 4; // Compute key schedule - - var keySchedule = this._keySchedule = []; - - for (var ksRow = 0; ksRow < ksRows; ksRow++) { - if (ksRow < keySize) { - keySchedule[ksRow] = keyWords[ksRow]; - } else { - var t = keySchedule[ksRow - 1]; - - if (!(ksRow % keySize)) { - // Rot word - t = t << 8 | t >>> 24; // Sub word - - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon - - t ^= RCON[ksRow / keySize | 0] << 24; - } else if (keySize > 6 && ksRow % keySize == 4) { - // Sub word - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; - } - - keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; - } - } // Compute inv key schedule - - - var invKeySchedule = this._invKeySchedule = []; - - for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { - var ksRow = ksRows - invKsRow; - - if (invKsRow % 4) { - var t = keySchedule[ksRow]; - } else { - var t = keySchedule[ksRow - 4]; - } - - if (invKsRow < 4 || ksRow <= 4) { - invKeySchedule[invKsRow] = t; - } else { - invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; - } - } - }, - encryptBlock: function encryptBlock(M, offset) { - this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); - }, - decryptBlock: function decryptBlock(M, offset) { - // Swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - - this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows - - - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - }, - _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { - // Shortcut - var nRounds = this._nRounds; // Get input, add round key - - var s0 = M[offset] ^ keySchedule[0]; - var s1 = M[offset + 1] ^ keySchedule[1]; - var s2 = M[offset + 2] ^ keySchedule[2]; - var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter - - var ksRow = 4; // Rounds - - for (var round = 1; round < nRounds; round++) { - // Shift rows, sub bytes, mix columns, add round key - var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; - var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; - var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; - var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state - - s0 = t0; - s1 = t1; - s2 = t2; - s3 = t3; - } // Shift rows, sub bytes, add round key - - - var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; - var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; - var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; - var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output - - M[offset] = t0; - M[offset + 1] = t1; - M[offset + 2] = t2; - M[offset + 3] = t3; - }, - keySize: 256 / 32 - }); - /** - * Shortcut functions to the cipher's object interface. - * - * @example - * - * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); - * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); - */ - - C.AES = BlockCipher._createHelper(AES); - })(); + } + }); + var debug_2 = debug_1.coerce; + var debug_3 = debug_1.disable; + var debug_4 = debug_1.enable; + var debug_5 = debug_1.enabled; + var debug_6 = debug_1.humanize; + var debug_7 = debug_1.names; + var debug_8 = debug_1.skips; + var debug_9 = debug_1.formatters; - return CryptoJS.AES; - }); -======= var browser = createCommonjsModule(function (module, exports) { /** * This is the web browser implementation of `debug()`. @@ -12916,2063 +16623,1953 @@ return window.localStorage; } catch (e) {} } ->>>>>>> branch for npm and latest release - }); - - var encUtf8 = createCommonjsModule(function (module, exports) { - -<<<<<<< HEAD - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - return CryptoJS.enc.Utf8; - }); }); + var browser_1 = browser.log; + var browser_2 = browser.formatArgs; + var browser_3 = browser.save; + var browser_4 = browser.load; + var browser_5 = browser.useColors; + var browser_6 = browser.storage; + var browser_7 = browser.colors; -======= - var debug = browser('cookie'); ->>>>>>> branch for npm and latest release - /** - * toString ref. - */ - var toString$2 = Object.prototype.toString; /** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ - -<<<<<<< HEAD - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { - 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'; - } - - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - if (isBuffer$1(val)) return 'buffer'; - val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); - return _typeof(val); - }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - - - function isBuffer$1(obj) { - return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); - } - - /* * Module dependencies. */ + var debug = browser('cookie'); ======= - var rudderComponentCookie = function rudderComponentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set(name, value, options); - - case 1: - return get$1(name); - - default: - return all(); - } + return target; }; /** - * Set cookie `name` to `value`. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @api private - */ - - - function set(name, value, options) { - options = options || {}; - var str = encode(name) + '=' + encode(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.samesite) str += '; samesite=' + options.samesite; - if (options.secure) str += '; secure'; - document.cookie = str; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ - - - function all() { - var str; - - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); - } - - return {}; - } - - return parse$1(str); - } ->>>>>>> branch for npm and latest release - /** - * Deeply clone an object. - * - * @param {*} obj Any object. - */ - - -<<<<<<< HEAD - var clone = function clone(obj) { - var t = componentType$2(obj); - - if (t === 'object') { - var copy = {}; - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - copy[key] = clone(obj[key]); - } - } - - return copy; - } - - if (t === 'array') { - var copy = new Array(obj.length); - - for (var i = 0, l = obj.length; i < l; i++) { - copy[i] = clone(obj[i]); - } - - return copy; - } - - if (t === 'regexp') { - // from millermedeiros/amd-utils - MIT - var flags = ''; - flags += obj.multiline ? 'm' : ''; - flags += obj.global ? 'g' : ''; - flags += obj.ignoreCase ? 'i' : ''; - return new RegExp(obj.source, flags); - } - - if (t === 'date') { - return new Date(obj.getTime()); - } // string, number, boolean, etc. -======= - function get$1(name) { - return all()[name]; - } - /** - * Parse cookie `str`. + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * Recurses on objects. * - * @param {String} str - * @return {Object} - * @api private - */ - - - function parse$1(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(pair[0])] = decode(pair[1]); - } - - return obj; - } - /** - * Encode. - */ - - - function encode(value) { - try { - return encodeURIComponent(value); - } catch (e) { - debug('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. + * @name defaultsDeep + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} The input `target`. */ - function decode(value) { - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } - - var max = Math.max; + var defaultsDeep = function defaultsDeep(target + /*, sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); + }; /** - * Produce a new array composed of all but the first `n` elements of an input `collection`. + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. * - * @name drop + * @name defaults * @api public - * @param {number} count The number of elements to drop. - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. + * @param {Object} target + * @param {...Object} sources + * @return {Object} * @example - * drop(0, [1, 2, 3]); // => [1, 2, 3] - * drop(1, [1, 2, 3]); // => [2, 3] - * drop(2, [1, 2, 3]); // => [3] - * drop(3, [1, 2, 3]); // => [] - * drop(4, [1, 2, 3]); // => [] + * var a = { a: 1 }; + * var b = { a: 2, b: 2 }; + * + * defaults(a, b); + * console.log(a); //=> { a: 1, b: 2 } */ - var drop = function drop(count, collection) { - var length = collection ? collection.length : 0; - - if (!length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var toDrop = max(Number(count) || 0, 0); - var resultsLength = max(length - toDrop, 0); - var results = new Array(resultsLength); ->>>>>>> branch for npm and latest release - - return obj; + var defaults = function defaults(target + /*, ...sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); }; /* * Exports. */ -<<<<<<< HEAD - - var clone_1 = clone; - -======= - var drop_1 = drop; + var defaults_1 = defaults; + var deep = defaultsDeep; + defaults_1.deep = deep; - var max$1 = Math.max; ->>>>>>> branch for npm and latest release - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ -<<<<<<< HEAD -======= + var json3 = createCommonjsModule(function (module, exports) { + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - var rest = function rest(collection) { - if (collection == null || !collection.length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. - var results = new Array(max$1(collection.length - 2, 0)); + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - for (var i = 1; i < collection.length; i += 1) { - results[i - 1] = collection[i]; - } ->>>>>>> branch for npm and latest release + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse$1(val); - return options["long"] ? _long(val) : _short(val); - }; -<<<<<<< HEAD - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ -======= - /* - * Exports. - */ + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - var rest_1 = rest; ->>>>>>> branch for npm and latest release + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. - function parse$1(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; + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. - case 'days': - case 'day': - case 'd': - return n * d; + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. -<<<<<<< HEAD - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; + var isExtended = new Date(-3509827334573292); + attempt(function () { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + }); // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; + function has(name) { + if (has[name] != null) { + // Return cached feature test result. + return has[name]; + } - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } - } -======= - var has$3 = Object.prototype.hasOwnProperty; - var objToString$1 = Object.prototype.toString; ->>>>>>> branch for npm and latest release - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ -<<<<<<< HEAD + var isSupported; + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); + } else if (name == "date-serialization") { + // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. + isSupported = has("json-stringify") && isExtended; - function _short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; - } -======= - // TODO: Move to a library + if (isSupported) { + var stringify = exports.stringify; + attempt(function () { + isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + }); + } + } else { + var value, + serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - var isObject = function isObject(value) { - return Boolean(value) && _typeof(value) === 'object'; - }; ->>>>>>> branch for npm and latest release - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ -<<<<<<< HEAD + if (name == "json-stringify") { + var stringify = exports.stringify, + stringifySupported = typeof stringify == "function"; + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function value() { + return 1; + }).toJSON = value; + attempt(function () { + stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ + "a": [value, true, false, null, "\x00\b\n\f\r\t"] + }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; + }, function () { + stringifySupported = false; + }); + } - function _long(ms) { - return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; - } -======= - // TODO: Move to a library + isSupported = stringifySupported; + } // Test `JSON.parse`. - var isPlainObject = function isPlainObject(value) { - return Boolean(value) && objToString$1.call(value) === '[object Object]'; - }; ->>>>>>> branch for npm and latest release - /** - * Pluralization helper. - */ + if (name == "json-parse") { + var parse = exports.parse, + parseSupported; -<<<<<<< HEAD + if (typeof parse == "function") { + attempt(function () { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + parseSupported = value["a"].length == 5 && value["a"][0] === 1; - function plural(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'; - } + if (parseSupported) { + attempt(function () { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + }); - var debug_1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ -======= + if (parseSupported) { + attempt(function () { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + }); + } - var shallowCombiner = function shallowCombiner(target, source, value, key) { - if (has$3.call(source, key) && target[key] === undefined) { - target[key] = value; - } + if (parseSupported) { + attempt(function () { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + }); + } + } + } + }, function () { + parseSupported = false; + }); + } - return source; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined; also merges objects recursively. - * - * @name deepCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - * @return {Object} - */ + isSupported = parseSupported; + } + } + return has[name] = !!isSupported; + } - var deepCombiner = function deepCombiner(target, source, value, key) { - if (has$3.call(source, key)) { - if (isPlainObject(target[key]) && isPlainObject(value)) { - target[key] = defaultsDeep(target[key], value); - } else if (target[key] === undefined) { - target[key] = value; - } - } + has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - return source; - }; - /** - * TODO: Document - * - * @name defaultsWith - * @api private - * @param {Function} combiner - * @param {Object} target - * @param {...Object} sources - * @return {Object} Return the input `target`. - */ + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. + var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. - var defaultsWith = function defaultsWith(combiner, target - /*, ...sources */ - ) { - if (!isObject(target)) { - return target; - } ->>>>>>> branch for npm and latest release + var _forOwn = function forOwn(object, callback) { + var size = 0, + Properties, + dontEnums, + property; // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - exports.formatters = {}; - /** - * Previously assigned color. - */ + dontEnums = new Properties(); - var prevColor = 0; - /** - * Previous log timestamp. - */ + for (property in dontEnums) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(dontEnums, property)) { + size++; + } + } - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ + Properties = dontEnums = null; // Normalize the iteration algorithm. - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; - } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. + + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } // Manually invoke the callback for each non-enumerable property. -<<<<<<< HEAD - function debug(namespace) { - // define the `disabled` version - function disabled() {} + for (length = dontEnums.length; property = dontEnums[--length];) { + if (hasProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + isConstructor; - disabled.enabled = false; // define the `enabled` version + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. - function enabled() { - var self = enabled; // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set + if (isConstructor || isProperty.call(object, property = "constructor")) { + callback(property); + } + }; + } - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); + return _forOwn(object, callback); + }; // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // apply any `formatters` transformations + if (!has("json-stringify") && !has("date-serialization")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. - 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]; + var leadingZeroes = "000000"; - 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` + var toPaddedString = function toPaddedString(width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; // Internal: Serializes a date object. - args.splice(index, 1); - index--; - } - return match; - }); + var _serializeDate = function serializeDate(value) { + var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } + if (!isExtended) { + var floor = Math.floor; // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. - 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 - */ + var getDay = function getDay(year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; + getData = function getData(value) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); - function enable(namespaces) { - exports.save(namespaces); - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { + } - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { + } - namespaces = split[i].replace(/\*/g, '.*?'); + date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } - } - /** - * Disable debug output. - * - * @api public - */ + time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + }; + } else { + getData = function getData(value) { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + }; + } - function disable() { - exports.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ + _serializeDate = function serializeDate(value) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + getData(value); // Serialize extended years correctly. + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + year = month = date = hours = minutes = seconds = milliseconds = null; + } else { + value = null; + } - function enabled(name) { - var i, len; + return value; + }; - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } - } + return _serializeDate(value); + }; // For environments with `JSON.stringify` but buggy date serialization, + // we override the native `Date#toJSON` implementation with a + // spec-compliant one. - 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 - */ + if (has("json-stringify") && !has("date-serialization")) { + // Internal: the `Date#toJSON` implementation used to override the native one. + var dateToJSON = function dateToJSON(key) { + return _serializeDate(this); + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; - } - }); - var debug_2 = debug_1.coerce; - var debug_3 = debug_1.disable; - var debug_4 = debug_1.enable; - var debug_5 = debug_1.enabled; - var debug_6 = debug_1.humanize; - var debug_7 = debug_1.names; - var debug_8 = debug_1.skips; - var debug_9 = debug_1.formatters; + var nativeStringify = exports.stringify; - var browser = createCommonjsModule(function (module, exports) { - /** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug_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.stringify = function (source, filter, width) { + var nativeToJSON = Date.prototype.toJSON; + Date.prototype.toJSON = dateToJSON; + var result = nativeStringify(source, filter, width); + Date.prototype.toJSON = nativeToJSON; + return result; + }; + } else { + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; - 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 - */ + var escapeChar = function escapeChar(character) { + var charCode = character.charCodeAt(0), + escaped = Escapes[charCode]; - 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. - */ + if (escaped) { + return escaped; + } + return unicodePrefix + toPaddedString(2, charCode.toString(16)); + }; - exports.formatters.j = function (v) { - return JSON.stringify(v); - }; - /** - * Colorize log arguments if enabled. - * - * @api public - */ + var reEscape = /[\x00-\x1f\x22\x5c]/g; + var quote = function quote(value) { + reEscape.lastIndex = 0; + return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; + }; // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - 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++; + var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { + var value, type, className, results, element, index, length, prefix, result; + attempt(function () { + // Necessary for host object support. + value = object[property]; + }); - 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 - */ + if (_typeof(value) == "object" && value) { + if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { + value = _serializeDate(value); + } else if (typeof value.toJSON == "function") { + value = value.toJSON(property); + } + } + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } // Exit early if value is `undefined` or `null`. - function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); - } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ + if (value == undefined$1) { + return value === undefined$1 ? value : "null"; + } - 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 - */ + type = _typeof(value); // Only call `getClass` if the value is an object. + + if (type == "object") { + className = getClass.call(value); + } + switch (className || type) { + case "boolean": + case booleanClass: + // Booleans are represented literally. + return "" + value; - function load() { - var r; + case "number": + case numberClass: + // JSON numbers must be finite. `Infinity` and `NaN` are serialized as + // `"null"`. + return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - try { - r = exports.storage.debug; - } catch (e) {} + case "string": + case stringClass: + // Strings are double-quoted and escaped. + return quote("" + value); + } // Recursively serialize objects and arrays. - return r; - } - /** - * Enable namespaces listed in `localStorage.debug` initially. - */ + if (_typeof(value) == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } // Add the object to the stack of traversed objects. - 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 = browser.log; - var browser_2 = browser.formatArgs; - var browser_3 = browser.save; - var browser_4 = browser.load; - var browser_5 = browser.useColors; - var browser_6 = browser.storage; - var browser_7 = browser.colors; + stack.push(value); + results = []; // Save the current indentation level and indent one additional level. - /** - * Module dependencies. - */ + prefix = indentation; + indentation += whitespace; - var debug = browser('cookie'); -======= - return target; - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * Recurses on objects. - * - * @name defaultsDeep - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} The input `target`. - */ + if (className == arrayClass) { + // Recursively serialize array elements. + for (index = 0, length = value.length; index < length; index++) { + element = serialize(index, value, callback, properties, whitespace, indentation, stack); + results.push(element === undefined$1 ? "null" : element); + } + result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; + } else { + // Recursively serialize object members. Members are selected from + // either a user-specified list of property names, or the object + // itself. + _forOwn(properties || value, function (property) { + var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - var defaultsDeep = function defaultsDeep(target - /*, sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * - * @name defaults - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} - * @example - * var a = { a: 1 }; - * var b = { a: 2, b: 2 }; - * - * defaults(a, b); - * console.log(a); //=> { a: 1, b: 2 } - */ + if (element !== undefined$1) { + // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} + // is not the empty string, let `member` {quote(property) + ":"} + // be the concatenation of `member` and the `space` character." + // The "`space` character" refers to the literal space + // character, not the `space` {width} argument provided to + // `JSON.stringify`. + results.push(quote(property) + ":" + (whitespace ? " " : "") + element); + } + }); + + result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; + } // Remove the object from the traversed object stack. - var defaults = function defaults(target - /*, ...sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); - }; - /* - * Exports. - */ + stack.pop(); + return result; + } + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - var defaults_1 = defaults; - var deep = defaultsDeep; - defaults_1.deep = deep; + exports.stringify = function (source, filter, width) { + var whitespace, callback, properties, className; - var json3 = createCommonjsModule(function (module, exports) { - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. + if (objectTypes[_typeof(filter)] && filter) { + className = getClass.call(filter); - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. + if (className == functionClass) { + callback = filter; + } else if (className == arrayClass) { + // Convert the property names array into a makeshift set. + properties = {}; - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. + for (var index = 0, length = filter.length, value; index < length;) { + value = filter[index++]; + className = getClass.call(value); - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; + if (className == "[object String]" || className == "[object Number]") { + properties[value] = 1; + } + } + } + } - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. + if (width) { + className = getClass.call(width); + if (className == numberClass) { + // Convert the `width` to an integer and create a string containing + // `width` number of space characters. + if ((width -= width % 1) > 0) { + if (width > 10) { + width = 10; + } - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. + for (whitespace = ""; whitespace.length < width;) { + whitespace += " "; + } + } + } else if (className == stringClass) { + whitespace = width.length <= 10 ? width : width.slice(0, 10); + } + } // Opera <= 7.54u2 discards the values associated with empty string keys + // (`""`) only if they are used directly within an object member list + // (e.g., `!("" in { "": 1})`). - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. + return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); + }; + } + } // Public: Parses a JSON source string. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. + if (!has("json-parse")) { + var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped + // equivalents. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" + }; // Internal: Stores the parser state. + var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. - var isExtended = new Date(-3509827334573292); - attempt(function () { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - }); // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. + var abort = function abort() { + Index = Source = null; + throw SyntaxError(); + }; // Internal: Returns the next token, or `"$"` if the parser has reached + // the end of the source string. A token may be a string, number, `null` + // literal, or Boolean literal. - function has(name) { - if (has[name] != null) { - // Return cached feature test result. - return has[name]; - } - var isSupported; + var lex = function lex() { + var source = Source, + length = source.length, + value, + begin, + position, + isSigned, + charCode; - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); - } else if (name == "date-serialization") { - // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. - isSupported = has("json-stringify") && isExtended; + while (Index < length) { + charCode = source.charCodeAt(Index); - if (isSupported) { - var stringify = exports.stringify; - attempt(function () { - isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - var value, - serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. + switch (charCode) { + case 9: + case 10: + case 13: + case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; - if (name == "json-stringify") { - var stringify = exports.stringify, - stringifySupported = typeof stringify == "function"; + case 123: + case 125: + case 91: + case 93: + case 58: + case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; + Index++; + return value; - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function value() { - return 1; - }).toJSON = value; - attempt(function () { - stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ - "a": [value, true, false, null, "\x00\b\n\f\r\t"] - }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, function () { - stringifySupported = false; - }); - } + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); - isSupported = stringifySupported; - } // Test `JSON.parse`. + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); + switch (charCode) { + case 92: + case 34: + case 47: + case 98: + case 116: + case 110: + case 102: + case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; - if (name == "json-parse") { - var parse = exports.parse, - parseSupported; + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; - if (typeof parse == "function") { - attempt(function () { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - parseSupported = value["a"].length == 5 && value["a"][0] === 1; + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. - if (parseSupported) { - attempt(function () { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - }); + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } // Revive the escaped character. - if (parseSupported) { - attempt(function () { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - }); - } - if (parseSupported) { - attempt(function () { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - }); - } - } - } - }, function () { - parseSupported = false; - }); - } + value += fromCharCode("0x" + source.slice(begin, Index)); + break; - isSupported = parseSupported; - } - } + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } - return has[name] = !!isSupported; - } + charCode = source.charCodeAt(Index); + begin = Index; // Optimize for the common case where a string is valid. - has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } // Append the string as-is. - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. + value += source.slice(begin, Index); + } + } - var _forOwn = function forOwn(object, callback) { - var size = 0, - Properties, - dontEnums, - property; // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } // Unterminated string. - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - dontEnums = new Properties(); + abort(); - for (property in dontEnums) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(dontEnums, property)) { - size++; - } - } + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. - Properties = dontEnums = null; // Normalize the iteration algorithm. + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } // Manually invoke the callback for each non-enumerable property. + isSigned = false; // Parse the integer component. + for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { + } // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. - for (length = dontEnums.length; property = dontEnums[--length];) { - if (hasProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - isConstructor; - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. + if (source.charCodeAt(Index) == 46) { + position = ++Index; // Parse the decimal component. + for (; position < length; position++) { + charCode = source.charCodeAt(position); - if (isConstructor || isProperty.call(object, property = "constructor")) { - callback(property); - } - }; - } + if (charCode < 48 || charCode > 57) { + break; + } + } - return _forOwn(object, callback); - }; // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. + if (position == Index) { + // Illegal trailing decimal. + abort(); + } + Index = position; + } // Parse exponents. The `e` denoting the exponent is + // case-insensitive. - if (!has("json-stringify") && !has("date-serialization")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. - var leadingZeroes = "000000"; + charCode = source.charCodeAt(Index); - var toPaddedString = function toPaddedString(width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; // Internal: Serializes a date object. + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is + // specified. + if (charCode == 43 || charCode == 45) { + Index++; + } // Parse the exponential component. - var _serializeDate = function serializeDate(value) { - var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. - if (!isExtended) { - var floor = Math.floor; // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. + for (position = Index; position < length; position++) { + charCode = source.charCodeAt(position); - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. + if (charCode < 48 || charCode > 57) { + break; + } + } - var getDay = function getDay(year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; + if (position == Index) { + // Illegal empty exponent. + abort(); + } - getData = function getData(value) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); + Index = position; + } // Coerce the parsed value to a JavaScript number. - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { - } - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { - } + return +source.slice(begin, Index); + } // A negative sign may only precede numbers. - date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. - time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. + if (isSigned) { + abort(); + } // `true`, `false`, and `null` literals. - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - }; - } else { - getData = function getData(value) { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - }; - } - _serializeDate = function serializeDate(value) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - getData(value); // Serialize extended years correctly. + var temp = source.slice(Index, Index + 4); - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - year = month = date = hours = minutes = seconds = milliseconds = null; - } else { - value = null; - } + if (temp == "true") { + Index += 4; + return true; + } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { + Index += 5; + return false; + } else if (temp == "null") { + Index += 4; + return null; + } // Unrecognized token. - return value; - }; - return _serializeDate(value); - }; // For environments with `JSON.stringify` but buggy date serialization, - // we override the native `Date#toJSON` implementation with a - // spec-compliant one. + abort(); + } + } // Return the sentinel `$` character if the parser has reached the end + // of the source string. - if (has("json-stringify") && !has("date-serialization")) { - // Internal: the `Date#toJSON` implementation used to override the native one. - var dateToJSON = function dateToJSON(key) { - return _serializeDate(this); - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + return "$"; + }; // Internal: Parses a JSON `value` token. - var nativeStringify = exports.stringify; + var get = function get(value) { + var results, hasMembers; - exports.stringify = function (source, filter, width) { - var nativeToJSON = Date.prototype.toJSON; - Date.prototype.toJSON = dateToJSON; - var result = nativeStringify(source, filter, width); - Date.prototype.toJSON = nativeToJSON; - return result; - }; - } else { - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; + if (value == "$") { + // Unexpected end of input. + abort(); + } - var escapeChar = function escapeChar(character) { - var charCode = character.charCodeAt(0), - escaped = Escapes[charCode]; + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } // Parse object and array literals. - if (escaped) { - return escaped; - } - return unicodePrefix + toPaddedString(2, charCode.toString(16)); - }; + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; - var reEscape = /[\x00-\x1f\x22\x5c]/g; + for (;;) { + value = lex(); // A closing square bracket marks the end of the array literal. - var quote = function quote(value) { - reEscape.lastIndex = 0; - return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; - }; // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. + if (value == "]") { + break; + } // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. - var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { - var value, type, className, results, element, index, length, prefix, result; - attempt(function () { - // Necessary for host object support. - value = object[property]; - }); + if (hasMembers) { + if (value == ",") { + value = lex(); - if (_typeof(value) == "object" && value) { - if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { - value = _serializeDate(value); - } else if (typeof value.toJSON == "function") { - value = value.toJSON(property); - } - } + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. + abort(); + } + } else { + hasMembers = true; + } // Elisions and leading commas are not permitted. - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } // Exit early if value is `undefined` or `null`. + if (value == ",") { + abort(); + } - if (value == undefined$1) { - return value === undefined$1 ? value : "null"; - } + results.push(get(value)); + } - type = _typeof(value); // Only call `getClass` if the value is an object. + return results; + } else if (value == "{") { + // Parses a JSON object, returning a new JavaScript object. + results = {}; - if (type == "object") { - className = getClass.call(value); - } + for (;;) { + value = lex(); // A closing curly brace marks the end of the object literal. - switch (className || type) { - case "boolean": - case booleanClass: - // Booleans are represented literally. - return "" + value; + if (value == "}") { + break; + } // If the object literal contains members, the current token + // should be a comma separator. - case "number": - case numberClass: - // JSON numbers must be finite. `Infinity` and `NaN` are serialized as - // `"null"`. - return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - case "string": - case stringClass: - // Strings are double-quoted and escaped. - return quote("" + value); - } // Recursively serialize objects and arrays. + if (hasMembers) { + if (value == ",") { + value = lex(); + if (value == "}") { + // Unexpected trailing `,` in object literal. + abort(); + } + } else { + // A `,` must separate each object member. + abort(); + } + } else { + hasMembers = true; + } // Leading commas are not permitted, object property names must be + // double-quoted strings, and a `:` must separate each property + // name and value. - if (_typeof(value) == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); + + if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { + abort(); } - } // Add the object to the stack of traversed objects. + results[value.slice(1)] = get(lex()); + } - stack.push(value); - results = []; // Save the current indentation level and indent one additional level. + return results; + } // Unexpected token encountered. - prefix = indentation; - indentation += whitespace; - if (className == arrayClass) { - // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; index++) { - element = serialize(index, value, callback, properties, whitespace, indentation, stack); - results.push(element === undefined$1 ? "null" : element); - } + abort(); + } - result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; - } else { - // Recursively serialize object members. Members are selected from - // either a user-specified list of property names, or the object - // itself. - _forOwn(properties || value, function (property) { - var element = serialize(property, value, callback, properties, whitespace, indentation, stack); + return value; + }; // Internal: Updates a traversed object member. - if (element !== undefined$1) { - // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} - // is not the empty string, let `member` {quote(property) + ":"} - // be the concatenation of `member` and the `space` character." - // The "`space` character" refers to the literal space - // character, not the `space` {width} argument provided to - // `JSON.stringify`. - results.push(quote(property) + ":" + (whitespace ? " " : "") + element); - } - }); - result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; - } // Remove the object from the traversed object stack. + var update = function update(source, property, callback) { + var element = walk(source, property, callback); + + if (element === undefined$1) { + delete source[property]; + } else { + source[property] = element; + } + }; // Internal: Recursively traverses a parsed JSON object, invoking the + // `callback` function for each value. This is an implementation of the + // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - stack.pop(); - return result; + var walk = function walk(source, property, callback) { + var value = source[property], + length; + + if (_typeof(value) == "object" && value) { + // `forOwn` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { + for (length = value.length; length--;) { + update(getClass, _forOwn, value, length, callback); + } + } else { + _forOwn(value, function (property) { + update(value, property, callback); + }); } - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + } + return callback.call(source, property, value); + }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. - exports.stringify = function (source, filter, width) { - var whitespace, callback, properties, className; - if (objectTypes[_typeof(filter)] && filter) { - className = getClass.call(filter); + exports.parse = function (source, callback) { + var result, value; + Index = 0; + Source = "" + source; + result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. - if (className == functionClass) { - callback = filter; - } else if (className == arrayClass) { - // Convert the property names array into a makeshift set. - properties = {}; + if (lex() != "$") { + abort(); + } // Reset the parser state. - for (var index = 0, length = filter.length, value; index < length;) { - value = filter[index++]; - className = getClass.call(value); - if (className == "[object String]" || className == "[object Number]") { - properties[value] = 1; - } - } - } - } + Index = Source = null; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; + }; + } + } - if (width) { - className = getClass.call(width); + exports.runInContext = runInContext; + return exports; + } - if (className == numberClass) { - // Convert the `width` to an integer and create a string containing - // `width` number of space characters. - if ((width -= width % 1) > 0) { - if (width > 10) { - width = 10; - } + if (freeExports && !isLoader) { + // Export for CommonJS environments. + runInContext(root, freeExports); + } else { + // Export for web browsers and JavaScript engines. + var nativeJSON = root.JSON, + previousJSON = root.JSON3, + isRestored = false; + var JSON3 = runInContext(root, root.JSON3 = { + // Public: Restores the original value of the global `JSON` object and + // returns a reference to the `JSON3` object. + "noConflict": function noConflict() { + if (!isRestored) { + isRestored = true; + root.JSON = nativeJSON; + root.JSON3 = previousJSON; + nativeJSON = previousJSON = null; + } - for (whitespace = ""; whitespace.length < width;) { - whitespace += " "; - } - } - } else if (className == stringClass) { - whitespace = width.length <= 10 ? width : width.slice(0, 10); - } - } // Opera <= 7.54u2 discards the values associated with empty string keys - // (`""`) only if they are used directly within an object member list - // (e.g., `!("" in { "": 1})`). + return JSON3; + } + }); + root.JSON = { + "parse": JSON3.parse, + "stringify": JSON3.stringify + }; + } // Export for asynchronous module loaders. + }).call(commonjsGlobal); + }); + + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ - return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); - }; - } - } // Public: Parses a JSON source string. + exports.formatters = {}; + /** + * Previously assigned color. + */ + var prevColor = 0; + /** + * Previous log timestamp. + */ - if (!has("json-parse")) { - var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped - // equivalents. + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ - var Unescapes = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r" - }; // Internal: Stores the parser state. + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ - var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. - var abort = function abort() { - Index = Source = null; - throw SyntaxError(); - }; // Internal: Returns the next token, or `"$"` if the parser has reached - // the end of the source string. A token may be a string, number, `null` - // literal, or Boolean literal. + function debug(namespace) { + // define the `disabled` version + function disabled() {} + disabled.enabled = false; // define the `enabled` version - var lex = function lex() { - var source = Source, - length = source.length, - value, - begin, - position, - isSigned, - charCode; + function enabled() { + var self = enabled; // set `diff` timestamp - while (Index < length) { - charCode = source.charCodeAt(Index); + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set - switch (charCode) { - case 9: - case 10: - case 13: - case 32: - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - break; + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); - case 123: - case 125: - case 91: - case 93: - case 58: - case 44: - // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at - // the current position. - value = charIndexBuggy ? source.charAt(Index) : source[Index]; - Index++; - return value; + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // apply any `formatters` transformations - case 34: - // `"` delimits a JSON string; advance to the next character and - // begin parsing the string. String tokens are prefixed with the - // sentinel `@` character to distinguish them from punctuators and - // end-of-string tokens. - for (value = "@", Index++; Index < length;) { - charCode = source.charCodeAt(Index); - if (charCode < 32) { - // Unescaped ASCII control characters (those with a code unit - // less than the space character) are not permitted. - abort(); - } else if (charCode == 92) { - // A reverse solidus (`\`) marks the beginning of an escaped - // control character (including `"`, `\`, and `/`) or Unicode - // escape sequence. - charCode = source.charCodeAt(++Index); + 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; + }); - switch (charCode) { - case 92: - case 34: - case 47: - case 98: - case 116: - case 110: - case 102: - case 114: - // Revive escaped control characters. - value += Unescapes[charCode]; - Index++; - break; + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } - case 117: - // `\u` marks the beginning of a Unicode escape sequence. - // Advance to the first character and validate the - // four-digit code point. - begin = ++Index; + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } - for (position = Index + 4; Index < position; Index++) { - charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- - // insensitive) that form a single hexadecimal value. + 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 + */ - if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { - // Invalid Unicode escape sequence. - abort(); - } - } // Revive the escaped character. + function enable(namespaces) { + exports.save(namespaces); + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; - value += fromCharCode("0x" + source.slice(begin, Index)); - break; + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } + namespaces = split[i].replace(/\*/g, '.*?'); - charCode = source.charCodeAt(Index); - begin = Index; // Optimize for the common case where a string is valid. + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + /** + * Disable debug output. + * + * @api public + */ - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } // Append the string as-is. + function disable() { + exports.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ - value += source.slice(begin, Index); - } - } - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } // Unterminated string. + function enabled(name) { + var i, len; + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } - abort(); + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. + 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; - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } + 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. + */ - isSigned = false; // Parse the integer component. + 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 + */ - for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { - } // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. + 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. + */ - if (source.charCodeAt(Index) == 46) { - position = ++Index; // Parse the decimal component. + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; + /** + * Colorize log arguments if enabled. + * + * @api public + */ - for (; position < length; position++) { - charCode = source.charCodeAt(position); - if (charCode < 48 || charCode > 57) { - break; - } - } + 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 - if (position == Index) { - // Illegal trailing decimal. - abort(); - } + var index = 0; + var lastC = 0; + args[0].replace(/%[a-z%]/g, function (match) { + if ('%%' === match) return; + index++; - Index = position; - } // Parse exponents. The `e` denoting the exponent is - // case-insensitive. + 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 === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ - charCode = source.charCodeAt(Index); + 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 + */ - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is - // specified. - if (charCode == 43 || charCode == 45) { - Index++; - } // Parse the exponential component. + function load() { + var r; + try { + r = exports.storage.debug; + } catch (e) {} - for (position = Index; position < length; position++) { - charCode = source.charCodeAt(position); + return r; + } + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ - if (charCode < 48 || charCode > 57) { - break; - } - } - if (position == Index) { - // Illegal empty exponent. - abort(); - } + 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 + */ - Index = position; - } // Coerce the parsed value to a JavaScript number. + 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. + */ +<<<<<<< HEAD +<<<<<<< HEAD - return +source.slice(begin, Index); - } // A negative sign may only precede numbers. + var debug$1 = browser$1('cookie'); +>>>>>>> branch for npm and latest release +======= + var toString$2 = Object.prototype.toString; +>>>>>>> NPM release version 1.0.11 +======= + var toString$1 = Object.prototype.toString; +>>>>>>> branch for npm and latest release + /** + * Set or get cookie `name` with `value` and `options` object. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @return {Mixed} + * @api public + */ +<<<<<<< HEAD +<<<<<<< HEAD +<<<<<<< HEAD + var rudderComponentCookie = function rudderComponentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set(name, value, options); +======= + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { +======= + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { +>>>>>>> branch for npm and latest release + case '[object Date]': + return 'date'; - if (isSigned) { - abort(); - } // `true`, `false`, and `null` literals. + case '[object RegExp]': + return 'regexp'; +>>>>>>> NPM release version 1.0.11 + case 1: + return get$1(name); +======= + var componentCookie = function componentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set$1(name, value, options); - var temp = source.slice(Index, Index + 4); + case 1: + return get$2(name); +>>>>>>> branch for npm and latest release - if (temp == "true") { - Index += 4; - return true; - } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { - Index += 5; - return false; - } else if (temp == "null") { - Index += 4; - return null; - } // Unrecognized token. + default: + return all(); + } + }; + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ - abort(); - } - } // Return the sentinel `$` character if the parser has reached the end - // of the source string. +<<<<<<< HEAD + function set(name, value, options) { +======= + function set$1(name, value, options) { +>>>>>>> branch for npm and latest release + 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); + } - return "$"; - }; // Internal: Parses a JSON `value` token. + 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; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ - var get = function get(value) { - var results, hasMembers; +<<<<<<< HEAD +<<<<<<< HEAD + function all() { +======= + function all$1() { +>>>>>>> branch for npm and latest release + var str; +======= + var clone = function clone(obj) { + var t = componentType$1(obj); - if (value == "$") { - // Unexpected end of input. - abort(); - } + if (t === 'object') { + var copy = {}; +>>>>>>> NPM release version 1.0.11 - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } // Parse object and array literals. + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } + return {}; + } - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; + return parse$2(str); + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ - for (;;) { - value = lex(); // A closing square bracket marks the end of the array literal. - if (value == "]") { - break; - } // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. +<<<<<<< HEAD + function get$1(name) { + return all()[name]; +======= + function get$2(name) { + return all$1()[name]; +>>>>>>> branch for npm and latest release + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - if (hasMembers) { - if (value == ",") { - value = lex(); + function parse$2(str) { + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); - } - } else { - // A `,` must separate each array element. - abort(); - } - } else { - hasMembers = true; - } // Elisions and leading commas are not permitted. + for (var i = 0; i < pairs.length; ++i) { + pair = pairs[i].split('='); + obj[decode$1(pair[0])] = decode$1(pair[1]); + } + return obj; + } + /** + * Encode. + */ - if (value == ",") { - abort(); - } - results.push(get(value)); - } + function encode$1(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ - return results; - } else if (value == "{") { - // Parses a JSON object, returning a new JavaScript object. - results = {}; - for (;;) { - value = lex(); // A closing curly brace marks the end of the object literal. + function decode$1(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); + } + } - if (value == "}") { - break; - } // If the object literal contains members, the current token - // should be a comma separator. +<<<<<<< HEAD + var max = Math.max; + /** + * Produce a new array composed of all but the first `n` elements of an input `collection`. + * + * @name drop + * @api public + * @param {number} count The number of elements to drop. + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * drop(0, [1, 2, 3]); // => [1, 2, 3] + * drop(1, [1, 2, 3]); // => [2, 3] + * drop(2, [1, 2, 3]); // => [3] + * drop(3, [1, 2, 3]); // => [] + * drop(4, [1, 2, 3]); // => [] + */ +<<<<<<< HEAD + var drop = function drop(count, collection) { + var length = collection ? collection.length : 0; - if (hasMembers) { - if (value == ",") { - value = lex(); + if (!length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - if (value == "}") { - // Unexpected trailing `,` in object literal. - abort(); - } - } else { - // A `,` must separate each object member. - abort(); - } - } else { - hasMembers = true; - } // Leading commas are not permitted, object property names must be - // double-quoted strings, and a `:` must separate each property - // name and value. + var toDrop = max(Number(count) || 0, 0); + var resultsLength = max(length - toDrop, 0); + var results = new Array(resultsLength); - if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { - abort(); - } + for (var i = 0; i < resultsLength; i += 1) { + results[i] = collection[i + toDrop]; + } - results[value.slice(1)] = get(lex()); - } + return results; +======= + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse(val); +>>>>>>> branch for npm and latest release + return options["long"] ? _long(val) : _short(val); +>>>>>>> NPM release version 1.0.11 + }; + /* + * Exports. + */ - return results; - } // Unexpected token encountered. + var drop_1 = drop; - abort(); - } + var max$1 = Math.max; + /** + * Produce a new array by passing each value in the input `collection` through a transformative + * `iterator` function. The `iterator` function is passed three arguments: + * `(value, index, collection)`. + * + * @name rest + * @api public + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * rest([1, 2, 3]); // => [2, 3] + */ - return value; - }; // Internal: Updates a traversed object member. + var rest = function rest(collection) { + if (collection == null || !collection.length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments +<<<<<<< HEAD +<<<<<<< HEAD +======= +======= +>>>>>>> branch for npm and latest release + function parse$1(str) { +======= + function parse(str) { +>>>>>>> branch for npm and latest release + 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(); +>>>>>>> NPM release version 1.0.11 - var update = function update(source, property, callback) { - var element = walk(source, property, callback); + var results = new Array(max$1(collection.length - 2, 0)); - if (element === undefined$1) { - delete source[property]; - } else { - source[property] = element; - } - }; // Internal: Recursively traverses a parsed JSON object, invoking the - // `callback` function for each value. This is an implementation of the - // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. + for (var i = 1; i < collection.length; i += 1) { + results[i - 1] = collection[i]; + } + return results; + }; + /* + * Exports. + */ - var walk = function walk(source, property, callback) { - var value = source[property], - length; - if (_typeof(value) == "object" && value) { - // `forOwn` can't be used to traverse an array in Opera <= 8.54 - // because its `Object#hasOwnProperty` implementation returns `false` - // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). - if (getClass.call(value) == arrayClass) { - for (length = value.length; length--;) { - update(getClass, _forOwn, value, length, callback); - } - } else { - _forOwn(value, function (property) { - update(value, property, callback); - }); - } - } + var rest_1 = rest; - return callback.call(source, property, value); - }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. + /* + * Module dependencies. + */ - exports.parse = function (source, callback) { - var result, value; - Index = 0; - Source = "" + source; - result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. + var has$3 = Object.prototype.hasOwnProperty; + var objToString$1 = Object.prototype.toString; + /** + * Returns `true` if a value is an object, otherwise `false`. + * + * @name isObject + * @api private + * @param {*} val The value to test. + * @return {boolean} + */ + // TODO: Move to a library - if (lex() != "$") { - abort(); - } // Reset the parser state. + var isObject = function isObject(value) { + return Boolean(value) && _typeof(value) === 'object'; + }; + /** + * Returns `true` if a value is a plain object, otherwise `false`. + * + * @name isPlainObject + * @api private + * @param {*} val The value to test. + * @return {boolean} + */ + // TODO: Move to a library - Index = Source = null; - return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; - }; - } - } + var isPlainObject = function isPlainObject(value) { + return Boolean(value) && objToString$1.call(value) === '[object Object]'; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined. + * + * @name shallowCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + */ - exports.runInContext = runInContext; - return exports; - } - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root.JSON3, - isRestored = false; - var JSON3 = runInContext(root, root.JSON3 = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function noConflict() { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root.JSON3 = previousJSON; - nativeJSON = previousJSON = null; - } + var shallowCombiner = function shallowCombiner(target, source, value, key) { + if (has$3.call(source, key) && target[key] === undefined) { + target[key] = value; + } - return JSON3; - } - }); - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } // Export for asynchronous module loaders. - }).call(commonjsGlobal); - }); + return source; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined; also merges objects recursively. + * + * @name deepCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + * @return {Object} + */ - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ + var deepCombiner = function deepCombiner(target, source, value, key) { + if (has$3.call(source, key)) { + if (isPlainObject(target[key]) && isPlainObject(value)) { + target[key] = defaultsDeep(target[key], value); + } else if (target[key] === undefined) { + target[key] = value; + } + } - exports.formatters = {}; - /** - * Previously assigned color. - */ + return source; + }; + /** + * TODO: Document + * + * @name defaultsWith + * @api private + * @param {Function} combiner + * @param {Object} target + * @param {...Object} sources + * @return {Object} Return the input `target`. + */ - var prevColor = 0; - /** - * Previous log timestamp. - */ - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ + var defaultsWith = function defaultsWith(combiner, target + /*, ...sources */ + ) { + if (!isObject(target)) { + return target; + } - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; + combiner = combiner || shallowCombiner; + var sources = drop_1(2, arguments); + + for (var i = 0; i < sources.length; i += 1) { + for (var key in sources[i]) { + combiner(target, sources[i], sources[i][key], key); + } } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ + return target; + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * Recurses on objects. + * + * @name defaultsDeep + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} The input `target`. + */ - function debug(namespace) { - // define the `disabled` version - function disabled() {} - disabled.enabled = false; // define the `enabled` version + var defaultsDeep = function defaultsDeep(target + /*, sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * + * @name defaults + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} + * @example + * var a = { a: 1 }; + * var b = { a: 2, b: 2 }; + * + * defaults(a, b); + * console.log(a); //=> { a: 1, b: 2 } + */ - function enabled() { - var self = enabled; // set `diff` timestamp - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set + var defaults = function defaults(target + /*, ...sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); + }; + /* + * Exports. + */ - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // apply any `formatters` transformations + var defaults_1 = defaults; + var deep = defaultsDeep; + defaults_1.deep = deep; + var json3 = createCommonjsModule(function (module, exports) { + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - 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]; + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. - 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` + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. - args.splice(index, 1); - index--; - } + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - return match; - }); + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); - } +<<<<<<< HEAD + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. +======= var logFn = enabled.log || exports.log || console.log.bind(console); logFn.apply(self, args); } +<<<<<<< HEAD enabled.enabled = true; var fn = exports.enabled(namespace) ? enabled : disabled; @@ -14993,11 +18590,48 @@ var split = (namespaces || '').split(/[\s,]+/); var len = split.length; - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings + + namespaces = split[i].replace(/\*/g, '.*?'); + +======= +>>>>>>> branch for npm and latest release + + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. + - namespaces = split[i].replace(/\*/g, '.*?'); + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. +<<<<<<< HEAD +======= +>>>>>>> branch for npm and latest release if (namespaces[0] === '-') { exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); } else { @@ -15010,27 +18644,104 @@ * * @api public */ +>>>>>>> branch for npm and latest release + var isExtended = new Date(-3509827334573292); + attempt(function () { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + }); // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. - function disable() { - exports.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ + function has(name) { + if (has[name] != null) { + // Return cached feature test result. + return has[name]; + } + var isSupported; - function enabled(name) { - var i, len; + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); + } else if (name == "date-serialization") { + // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. + isSupported = has("json-stringify") && isExtended; + + if (isSupported) { + var stringify = exports.stringify; + attempt(function () { + isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + }); + } + } else { + var value, + serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. + + if (name == "json-stringify") { + var stringify = exports.stringify, + stringifySupported = typeof stringify == "function"; +<<<<<<< HEAD + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function value() { + return 1; + }).toJSON = value; + attempt(function () { + stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ + "a": [value, true, false, null, "\x00\b\n\f\r\t"] + }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; + }, function () { + stringifySupported = false; + }); + } +======= for (i = 0, len = exports.skips.length; i < len; i++) { if (exports.skips[i].test(name)) { return false; } +<<<<<<< HEAD } for (i = 0, len = exports.names.length; i < len; i++) { @@ -15050,288 +18761,198 @@ */ - 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 +======= + } +>>>>>>> branch for npm and latest release - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function (match) { - if ('%%' === match) return; - index++; + isSupported = stringifySupported; + } // Test `JSON.parse`. - 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 - */ + if (name == "json-parse") { + var parse = exports.parse, + parseSupported; - function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); +<<<<<<< HEAD + if (typeof parse == "function") { + attempt(function () { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + parseSupported = value["a"].length == 5 && value["a"][0] === 1; +======= +>>>>>>> branch for npm and latest release + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ + }); + var debug_2 = debug_1.coerce; + var debug_3 = debug_1.disable; + var debug_4 = debug_1.enable; + var debug_5 = debug_1.enabled; + var debug_6 = debug_1.humanize; + var debug_7 = debug_1.names; + var debug_8 = debug_1.skips; + var debug_9 = debug_1.formatters; +>>>>>>> branch for npm and latest release + if (parseSupported) { + attempt(function () { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + }); - 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 - */ + if (parseSupported) { + attempt(function () { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + }); + } + if (parseSupported) { + attempt(function () { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + }); + } + } + } + }, function () { + parseSupported = false; + }); + } - function load() { - var r; + isSupported = parseSupported; + } + } - try { - r = exports.storage.debug; - } catch (e) {} + return has[name] = !!isSupported; + } - return r; - } - /** - * Enable namespaces listed in `localStorage.debug` initially. - */ + has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - 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 - */ + var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. - 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; + var _forOwn = function forOwn(object, callback) { + var size = 0, + Properties, + dontEnums, + property; // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - /** - * Module dependencies. - */ -<<<<<<< HEAD + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - var debug$1 = browser$1('cookie'); ->>>>>>> branch for npm and latest release -======= - var toString$2 = Object.prototype.toString; ->>>>>>> NPM release version 1.0.11 - /** - * Set or get cookie `name` with `value` and `options` object. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @return {Mixed} - * @api public - */ + dontEnums = new Properties(); -<<<<<<< HEAD -<<<<<<< HEAD - var rudderComponentCookie = function rudderComponentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set(name, value, options); -======= - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { - case '[object Date]': - return 'date'; + for (property in dontEnums) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(dontEnums, property)) { + size++; + } + } - case '[object RegExp]': - return 'regexp'; ->>>>>>> NPM release version 1.0.11 + Properties = dontEnums = null; // Normalize the iteration algorithm. - case 1: - return get$1(name); -======= - var componentCookie = function componentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set$1(name, value, options); + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. - case 1: - return get$2(name); ->>>>>>> branch for npm and latest release + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; - default: - return all(); - } - }; - /** - * Set cookie `name` to `value`. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @api private - */ + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } // Manually invoke the callback for each non-enumerable property. <<<<<<< HEAD - function set(name, value, options) { + for (length = dontEnums.length; property = dontEnums[--length];) { + if (hasProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + isConstructor; ======= - function set$1(name, value, options) { ->>>>>>> branch for npm and latest release + function set(name, value, options) { options = options || {}; var str = encode$1(name) + '=' + encode$1(value); if (null == value) options.maxage = -1; +>>>>>>> NPM release version 1.0.11 - 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.samesite) str += '; samesite=' + options.samesite; - if (options.secure) str += '; secure'; - document.cookie = str; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. -<<<<<<< HEAD -<<<<<<< HEAD - function all() { -======= - function all$1() { ->>>>>>> branch for npm and latest release - var str; -======= - var clone = function clone(obj) { - var t = componentType$2(obj); + if (isConstructor || isProperty.call(object, property = "constructor")) { + callback(property); + } + }; + } - if (t === 'object') { - var copy = {}; ->>>>>>> NPM release version 1.0.11 + return _forOwn(object, callback); + }; // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); - } - return {}; - } + if (!has("json-stringify") && !has("date-serialization")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. +<<<<<<< HEAD + var leadingZeroes = "000000"; +======= return parse$2(str); } /** @@ -15341,25 +18962,37 @@ * @return {String} * @api private */ +>>>>>>> NPM release version 1.0.11 + var toPaddedString = function toPaddedString(width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; // Internal: Serializes a date object. <<<<<<< HEAD - function get$1(name) { - return all()[name]; ======= - function get$2(name) { - return all$1()[name]; + function set(name, value, options) { + options = options || {}; +<<<<<<< HEAD + var str = encode$1(name) + '=' + encode$1(value); +======= + var str = encode(name) + '=' + encode(value); >>>>>>> branch for npm and latest release - } - /** - * Parse cookie `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ + if (null == value) options.maxage = -1; +>>>>>>> branch for npm and latest release + + var _serializeDate = function serializeDate(value) { + var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. +<<<<<<< HEAD + if (!isExtended) { + var floor = Math.floor; // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. +======= function parse$2(str) { var obj = {}; var pairs = str.split(/ *; */); @@ -15370,14 +19003,25 @@ pair = pairs[i].split('='); obj[decode$1(pair[0])] = decode$1(pair[1]); } +>>>>>>> NPM release version 1.0.11 - return obj; - } - /** - * Encode. - */ + var getDay = function getDay(year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; + + getData = function getData(value) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { + } +<<<<<<< HEAD + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { + } +======= function encode$1(value) { try { return encodeURIComponent(value); @@ -15388,8 +19032,17 @@ /** * Decode. */ +>>>>>>> NPM release version 1.0.11 + date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. +<<<<<<< HEAD + time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. +======= function decode$1(value) { try { return decodeURIComponent(value); @@ -15397,1216 +19050,977 @@ debug('error `decode(%o)` - %o', value, e); } } - -<<<<<<< HEAD - var max = Math.max; - /** - * Produce a new array composed of all but the first `n` elements of an input `collection`. - * - * @name drop - * @api public - * @param {number} count The number of elements to drop. - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * drop(0, [1, 2, 3]); // => [1, 2, 3] - * drop(1, [1, 2, 3]); // => [2, 3] - * drop(2, [1, 2, 3]); // => [3] - * drop(3, [1, 2, 3]); // => [] - * drop(4, [1, 2, 3]); // => [] - */ - -<<<<<<< HEAD - var drop = function drop(count, collection) { - var length = collection ? collection.length : 0; - - if (!length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var toDrop = max(Number(count) || 0, 0); - var resultsLength = max(length - toDrop, 0); - var results = new Array(resultsLength); - - for (var i = 0; i < resultsLength; i += 1) { - results[i] = collection[i + toDrop]; - } - - return results; -======= - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse$1(val); - return options["long"] ? _long(val) : _short(val); ->>>>>>> NPM release version 1.0.11 - }; - /* - * Exports. - */ - - - var drop_1 = drop; - - var max$1 = Math.max; - /** - * Produce a new array by passing each value in the input `collection` through a transformative - * `iterator` function. The `iterator` function is passed three arguments: - * `(value, index, collection)`. - * - * @name rest - * @api public - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * rest([1, 2, 3]); // => [2, 3] - */ - - var rest = function rest(collection) { - if (collection == null || !collection.length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - -<<<<<<< HEAD -======= - function parse$1(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(); >>>>>>> NPM release version 1.0.11 - var results = new Array(max$1(collection.length - 2, 0)); - - for (var i = 1; i < collection.length; i += 1) { - results[i - 1] = collection[i]; - } - - return results; - }; - /* - * Exports. - */ - - - var rest_1 = rest; - - /* - * Module dependencies. - */ - - - var has$3 = Object.prototype.hasOwnProperty; - var objToString$1 = Object.prototype.toString; - /** - * Returns `true` if a value is an object, otherwise `false`. - * - * @name isObject - * @api private - * @param {*} val The value to test. - * @return {boolean} - */ - // TODO: Move to a library - - var isObject = function isObject(value) { - return Boolean(value) && _typeof(value) === 'object'; - }; - /** - * Returns `true` if a value is a plain object, otherwise `false`. - * - * @name isPlainObject - * @api private - * @param {*} val The value to test. - * @return {boolean} - */ - // TODO: Move to a library - - - var isPlainObject = function isPlainObject(value) { - return Boolean(value) && objToString$1.call(value) === '[object Object]'; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined. - * - * @name shallowCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - */ - - - var shallowCombiner = function shallowCombiner(target, source, value, key) { - if (has$3.call(source, key) && target[key] === undefined) { - target[key] = value; - } - - return source; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined; also merges objects recursively. - * - * @name deepCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - * @return {Object} - */ + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + }; + } else { + getData = function getData(value) { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + }; + } + _serializeDate = function serializeDate(value) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + getData(value); // Serialize extended years correctly. - var deepCombiner = function deepCombiner(target, source, value, key) { - if (has$3.call(source, key)) { - if (isPlainObject(target[key]) && isPlainObject(value)) { - target[key] = defaultsDeep(target[key], value); - } else if (target[key] === undefined) { - target[key] = value; - } - } + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + year = month = date = hours = minutes = seconds = milliseconds = null; + } else { + value = null; + } - return source; - }; - /** - * TODO: Document - * - * @name defaultsWith - * @api private - * @param {Function} combiner - * @param {Object} target - * @param {...Object} sources - * @return {Object} Return the input `target`. - */ + return value; + }; + return _serializeDate(value); + }; // For environments with `JSON.stringify` but buggy date serialization, + // we override the native `Date#toJSON` implementation with a + // spec-compliant one. - var defaultsWith = function defaultsWith(combiner, target - /*, ...sources */ - ) { - if (!isObject(target)) { - return target; - } - combiner = combiner || shallowCombiner; - var sources = drop_1(2, arguments); + if (has("json-stringify") && !has("date-serialization")) { + // Internal: the `Date#toJSON` implementation used to override the native one. + var dateToJSON = function dateToJSON(key) { + return _serializeDate(this); + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - for (var i = 0; i < sources.length; i += 1) { - for (var key in sources[i]) { - combiner(target, sources[i], sources[i][key], key); - } - } - return target; - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * Recurses on objects. - * - * @name defaultsDeep - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} The input `target`. - */ + var nativeStringify = exports.stringify; + exports.stringify = function (source, filter, width) { + var nativeToJSON = Date.prototype.toJSON; + Date.prototype.toJSON = dateToJSON; + var result = nativeStringify(source, filter, width); + Date.prototype.toJSON = nativeToJSON; + return result; + }; + } else { + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; - var defaultsDeep = function defaultsDeep(target - /*, sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); - }; +<<<<<<< HEAD + var escapeChar = function escapeChar(character) { + var charCode = character.charCodeAt(0), + escaped = Escapes[charCode]; +======= +<<<<<<< HEAD + return parse$2(str); +======= + return parse$1(str); +>>>>>>> branch for npm and latest release + } /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * - * @name defaults - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} - * @example - * var a = { a: 1 }; - * var b = { a: 2, b: 2 }; + * Get cookie `name`. * - * defaults(a, b); - * console.log(a); //=> { a: 1, b: 2 } + * @param {String} name + * @return {String} + * @api private */ +>>>>>>> branch for npm and latest release + + if (escaped) { + return escaped; + } + return unicodePrefix + toPaddedString(2, charCode.toString(16)); + }; - var defaults = function defaults(target - /*, ...sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); - }; - /* - * Exports. - */ + var reEscape = /[\x00-\x1f\x22\x5c]/g; +<<<<<<< HEAD + var quote = function quote(value) { + reEscape.lastIndex = 0; + return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; + }; // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. +======= +<<<<<<< HEAD + function parse$2(str) { +======= + function parse$1(str) { +>>>>>>> branch for npm and latest release + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; +>>>>>>> branch for npm and latest release - var defaults_1 = defaults; - var deep = defaultsDeep; - defaults_1.deep = deep; - var json3 = createCommonjsModule(function (module, exports) { - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. + var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { + var value, type, className, results, element, index, length, prefix, result; + attempt(function () { + // Necessary for host object support. + value = object[property]; + }); - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. + if (_typeof(value) == "object" && value) { + if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { + value = _serializeDate(value); + } else if (typeof value.toJSON == "function") { + value = value.toJSON(property); + } + } - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. +<<<<<<< HEAD + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } // Exit early if value is `undefined` or `null`. - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. + if (value == undefined$1) { + return value === undefined$1 ? value : "null"; + } +======= +<<<<<<< HEAD + function encode$1(value) { +======= + function encode(value) { +>>>>>>> branch for npm and latest release + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. +<<<<<<< HEAD + function decode$1(value) { +======= + function decode(value) { +>>>>>>> branch for npm and latest release + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); + } + } +>>>>>>> branch for npm and latest release - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + type = _typeof(value); // Only call `getClass` if the value is an object. - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. + if (type == "object") { + className = getClass.call(value); + } + + switch (className || type) { + case "boolean": + case booleanClass: + // Booleans are represented literally. + return "" + value; + + case "number": + case numberClass: + // JSON numbers must be finite. `Infinity` and `NaN` are serialized as + // `"null"`. + return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; + case "string": + case stringClass: + // Strings are double-quoted and escaped. + return quote("" + value); + } // Recursively serialize objects and arrays. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. + if (_typeof(value) == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } // Add the object to the stack of traversed objects. - var isExtended = new Date(-3509827334573292); - attempt(function () { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - }); // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. + stack.push(value); + results = []; // Save the current indentation level and indent one additional level. - function has(name) { - if (has[name] != null) { - // Return cached feature test result. - return has[name]; - } + prefix = indentation; + indentation += whitespace; - var isSupported; + if (className == arrayClass) { + // Recursively serialize array elements. + for (index = 0, length = value.length; index < length; index++) { + element = serialize(index, value, callback, properties, whitespace, indentation, stack); + results.push(element === undefined$1 ? "null" : element); + } - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); - } else if (name == "date-serialization") { - // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. - isSupported = has("json-stringify") && isExtended; + result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; + } else { + // Recursively serialize object members. Members are selected from + // either a user-specified list of property names, or the object + // itself. + _forOwn(properties || value, function (property) { + var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - if (isSupported) { - var stringify = exports.stringify; - attempt(function () { - isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - var value, - serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. + if (element !== undefined$1) { + // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} + // is not the empty string, let `member` {quote(property) + ":"} + // be the concatenation of `member` and the `space` character." + // The "`space` character" refers to the literal space + // character, not the `space` {width} argument provided to + // `JSON.stringify`. + results.push(quote(property) + ":" + (whitespace ? " " : "") + element); + } + }); - if (name == "json-stringify") { - var stringify = exports.stringify, - stringifySupported = typeof stringify == "function"; + result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; + } // Remove the object from the traversed object stack. - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function value() { - return 1; - }).toJSON = value; - attempt(function () { - stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ - "a": [value, true, false, null, "\x00\b\n\f\r\t"] - }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, function () { - stringifySupported = false; - }); - } - isSupported = stringifySupported; - } // Test `JSON.parse`. + stack.pop(); + return result; + } + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - if (name == "json-parse") { - var parse = exports.parse, - parseSupported; + exports.stringify = function (source, filter, width) { + var whitespace, callback, properties, className; - if (typeof parse == "function") { - attempt(function () { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - parseSupported = value["a"].length == 5 && value["a"][0] === 1; + if (objectTypes[_typeof(filter)] && filter) { + className = getClass.call(filter); - if (parseSupported) { - attempt(function () { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - }); + if (className == functionClass) { + callback = filter; + } else if (className == arrayClass) { + // Convert the property names array into a makeshift set. + properties = {}; - if (parseSupported) { - attempt(function () { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - }); - } + for (var index = 0, length = filter.length, value; index < length;) { + value = filter[index++]; + className = getClass.call(value); - if (parseSupported) { - attempt(function () { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - }); + if (className == "[object String]" || className == "[object Number]") { + properties[value] = 1; } } } - }, function () { - parseSupported = false; - }); - } - - isSupported = parseSupported; - } - } - - return has[name] = !!isSupported; - } - - has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. + } - var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. + if (width) { + className = getClass.call(width); - var _forOwn = function forOwn(object, callback) { - var size = 0, - Properties, - dontEnums, - property; // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + if (className == numberClass) { + // Convert the `width` to an integer and create a string containing + // `width` number of space characters. + if ((width -= width % 1) > 0) { + if (width > 10) { + width = 10; + } - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. + for (whitespace = ""; whitespace.length < width;) { + whitespace += " "; + } + } + } else if (className == stringClass) { + whitespace = width.length <= 10 ? width : width.slice(0, 10); + } + } // Opera <= 7.54u2 discards the values associated with empty string keys + // (`""`) only if they are used directly within an object member list + // (e.g., `!("" in { "": 1})`). - dontEnums = new Properties(); - for (property in dontEnums) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(dontEnums, property)) { - size++; - } + return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); + }; } + } // Public: Parses a JSON source string. - Properties = dontEnums = null; // Normalize the iteration algorithm. - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. + if (!has("json-parse")) { + var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped + // equivalents. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" + }; // Internal: Stores the parser state. - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } // Manually invoke the callback for each non-enumerable property. + var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. + var abort = function abort() { + Index = Source = null; + throw SyntaxError(); + }; // Internal: Returns the next token, or `"$"` if the parser has reached + // the end of the source string. A token may be a string, number, `null` + // literal, or Boolean literal. -<<<<<<< HEAD - for (length = dontEnums.length; property = dontEnums[--length];) { - if (hasProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - isConstructor; -======= - function set(name, value, options) { - options = options || {}; - var str = encode$1(name) + '=' + encode$1(value); - if (null == value) options.maxage = -1; ->>>>>>> NPM release version 1.0.11 - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. + var lex = function lex() { + var source = Source, + length = source.length, + value, + begin, + position, + isSigned, + charCode; + while (Index < length) { + charCode = source.charCodeAt(Index); - if (isConstructor || isProperty.call(object, property = "constructor")) { - callback(property); - } - }; - } + switch (charCode) { + case 9: + case 10: + case 13: + case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; - return _forOwn(object, callback); - }; // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. + case 123: + case 125: + case 91: + case 93: + case 58: + case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; + Index++; + return value; + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); - if (!has("json-stringify") && !has("date-serialization")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); + + switch (charCode) { + case 92: + case 34: + case 47: + case 98: + case 116: + case 110: + case 102: + case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; + + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; <<<<<<< HEAD - var leadingZeroes = "000000"; + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. ======= - return parse$2(str); - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ ->>>>>>> NPM release version 1.0.11 - - var toPaddedString = function toPaddedString(width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; // Internal: Serializes a date object. + var json3 = createCommonjsModule(function (module, exports) { +<<<<<<< HEAD +<<<<<<< HEAD + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. +>>>>>>> Updated npm distribution files + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } // Revive the escaped character. - var _serializeDate = function serializeDate(value) { - var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. -<<<<<<< HEAD - if (!isExtended) { - var floor = Math.floor; // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. + value += fromCharCode("0x" + source.slice(begin, Index)); + break; - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. -======= - function parse$2(str) { - var obj = {}; - var pairs = str.split(/ *; */); - var pair; - if ('' == pairs[0]) return obj; + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } - for (var i = 0; i < pairs.length; ++i) { - pair = pairs[i].split('='); - obj[decode$1(pair[0])] = decode$1(pair[1]); - } ->>>>>>> NPM release version 1.0.11 + charCode = source.charCodeAt(Index); + begin = Index; // Optimize for the common case where a string is valid. - var getDay = function getDay(year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } // Append the string as-is. - getData = function getData(value) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { - } + value += source.slice(begin, Index); + } + } -<<<<<<< HEAD - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { - } -======= - function encode$1(value) { - try { - return encodeURIComponent(value); - } catch (e) { - debug('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ ->>>>>>> NPM release version 1.0.11 + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } // Unterminated string. - date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. <<<<<<< HEAD - time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. + abort(); ======= - function decode$1(value) { - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } ->>>>>>> NPM release version 1.0.11 - - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - }; - } else { - getData = function getData(value) { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - }; - } - - _serializeDate = function serializeDate(value) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - getData(value); // Serialize extended years correctly. - - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - year = month = date = hours = minutes = seconds = milliseconds = null; - } else { - value = null; - } + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } +======= +======= +>>>>>>> branch for npm and latest release + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; - return value; - }; + // A set of types used to distinguish objects from primitives. + var objectTypes = { + "function": true, + "object": true + }; - return _serializeDate(value); - }; // For environments with `JSON.stringify` but buggy date serialization, - // we override the native `Date#toJSON` implementation with a - // spec-compliant one. + // Detect the `exports` object exposed by CommonJS implementations. + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; + // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + var root = objectTypes[typeof window] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; - if (has("json-stringify") && !has("date-serialization")) { - // Internal: the `Date#toJSON` implementation used to override the native one. - var dateToJSON = function dateToJSON(key) { - return _serializeDate(this); - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } + // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); - var nativeStringify = exports.stringify; + // Native constructor aliases. + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; - exports.stringify = function (source, filter, width) { - var nativeToJSON = Date.prototype.toJSON; - Date.prototype.toJSON = dateToJSON; - var result = nativeStringify(source, filter, width); - Date.prototype.toJSON = nativeToJSON; - return result; - }; - } else { - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; + // Delegate to the native `stringify` and `parse` implementations. + if (typeof nativeJSON == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } - var escapeChar = function escapeChar(character) { - var charCode = character.charCodeAt(0), - escaped = Escapes[charCode]; + // Convenience aliases. + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; - if (escaped) { - return escaped; - } + // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); +<<<<<<< HEAD +>>>>>>> Updated npm distribution files +======= +======= + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - return unicodePrefix + toPaddedString(2, charCode.toString(16)); - }; + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. - var reEscape = /[\x00-\x1f\x22\x5c]/g; + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. - var quote = function quote(value) { - reEscape.lastIndex = 0; - return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; - }; // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. - var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { - var value, type, className, results, element, index, length, prefix, result; - attempt(function () { - // Necessary for host object support. - value = object[property]; - }); - if (_typeof(value) == "object" && value) { - if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { - value = _serializeDate(value); - } else if (typeof value.toJSON == "function") { - value = value.toJSON(property); - } - } + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } // Exit early if value is `undefined` or `null`. + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. - if (value == undefined$1) { - return value === undefined$1 ? value : "null"; - } - type = _typeof(value); // Only call `getClass` if the value is an object. + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. - if (type == "object") { - className = getClass.call(value); - } + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. +>>>>>>> Updated npm distribution files - switch (className || type) { - case "boolean": - case booleanClass: - // Booleans are represented literally. - return "" + value; + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. - case "number": - case numberClass: - // JSON numbers must be finite. `Infinity` and `NaN` are serialized as - // `"null"`. - return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. - case "string": - case stringClass: - // Strings are double-quoted and escaped. - return quote("" + value); - } // Recursively serialize objects and arrays. + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } - if (_typeof(value) == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); - } - } // Add the object to the stack of traversed objects. + isSigned = false; // Parse the integer component. + for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { + } // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. - stack.push(value); - results = []; // Save the current indentation level and indent one additional level. - prefix = indentation; - indentation += whitespace; + if (source.charCodeAt(Index) == 46) { + position = ++Index; // Parse the decimal component. - if (className == arrayClass) { - // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; index++) { - element = serialize(index, value, callback, properties, whitespace, indentation, stack); - results.push(element === undefined$1 ? "null" : element); - } + for (; position < length; position++) { + charCode = source.charCodeAt(position); - result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; - } else { - // Recursively serialize object members. Members are selected from - // either a user-specified list of property names, or the object - // itself. - _forOwn(properties || value, function (property) { - var element = serialize(property, value, callback, properties, whitespace, indentation, stack); +<<<<<<< HEAD + if (charCode < 48 || charCode > 57) { + break; + } + } - if (element !== undefined$1) { - // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} - // is not the empty string, let `member` {quote(property) + ":"} - // be the concatenation of `member` and the `space` character." - // The "`space` character" refers to the literal space - // character, not the `space` {width} argument provided to - // `JSON.stringify`. - results.push(quote(property) + ":" + (whitespace ? " " : "") + element); - } - }); + if (position == Index) { + // Illegal trailing decimal. + abort(); + } - result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; - } // Remove the object from the traversed object stack. + Index = position; + } // Parse exponents. The `e` denoting the exponent is + // case-insensitive. - stack.pop(); - return result; - } - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + charCode = source.charCodeAt(Index); + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is + // specified. - exports.stringify = function (source, filter, width) { - var whitespace, callback, properties, className; + if (charCode == 43 || charCode == 45) { + Index++; + } // Parse the exponential component. - if (objectTypes[_typeof(filter)] && filter) { - className = getClass.call(filter); - if (className == functionClass) { - callback = filter; - } else if (className == arrayClass) { - // Convert the property names array into a makeshift set. - properties = {}; + for (position = Index; position < length; position++) { + charCode = source.charCodeAt(position); - for (var index = 0, length = filter.length, value; index < length;) { - value = filter[index++]; - className = getClass.call(value); + if (charCode < 48 || charCode > 57) { + break; + } + } - if (className == "[object String]" || className == "[object Number]") { - properties[value] = 1; - } - } - } - } + if (position == Index) { + // Illegal empty exponent. + abort(); + } - if (width) { - className = getClass.call(width); + Index = position; + } // Coerce the parsed value to a JavaScript number. +======= + if (parseSupported) { + attempt(function () { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + }); - if (className == numberClass) { - // Convert the `width` to an integer and create a string containing - // `width` number of space characters. - if ((width -= width % 1) > 0) { - if (width > 10) { - width = 10; + if (parseSupported) { + attempt(function () { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + }); } - for (whitespace = ""; whitespace.length < width;) { - whitespace += " "; + if (parseSupported) { + attempt(function () { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + }); } } - } else if (className == stringClass) { - whitespace = width.length <= 10 ? width : width.slice(0, 10); } - } // Opera <= 7.54u2 discards the values associated with empty string keys - // (`""`) only if they are used directly within an object member list - // (e.g., `!("" in { "": 1})`). - + }, function () { + parseSupported = false; + }); + } - return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); - }; + isSupported = parseSupported; } - } // Public: Parses a JSON source string. + } + return has[name] = !!isSupported; + } - if (!has("json-parse")) { - var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped - // equivalents. + has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - var Unescapes = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r" - }; // Internal: Stores the parser state. + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. + var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. - var abort = function abort() { - Index = Source = null; - throw SyntaxError(); - }; // Internal: Returns the next token, or `"$"` if the parser has reached - // the end of the source string. A token may be a string, number, `null` - // literal, or Boolean literal. + var _forOwn = function forOwn(object, callback) { + var size = 0, + Properties, + dontEnums, + property; // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - var lex = function lex() { - var source = Source, - length = source.length, - value, - begin, - position, - isSigned, - charCode; + dontEnums = new Properties(); - while (Index < length) { - charCode = source.charCodeAt(Index); + for (property in dontEnums) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(dontEnums, property)) { + size++; + } + } +<<<<<<< HEAD - switch (charCode) { - case 9: - case 10: - case 13: - case 32: - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - break; + Properties = dontEnums = null; // Normalize the iteration algorithm. - case 123: - case 125: - case 91: - case 93: - case 58: - case 44: - // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at - // the current position. - value = charIndexBuggy ? source.charAt(Index) : source[Index]; - Index++; - return value; + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. - case 34: - // `"` delimits a JSON string; advance to the next character and - // begin parsing the string. String tokens are prefixed with the - // sentinel `@` character to distinguish them from punctuators and - // end-of-string tokens. - for (value = "@", Index++; Index < length;) { - charCode = source.charCodeAt(Index); + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; - if (charCode < 32) { - // Unescaped ASCII control characters (those with a code unit - // less than the space character) are not permitted. - abort(); - } else if (charCode == 92) { - // A reverse solidus (`\`) marks the beginning of an escaped - // control character (including `"`, `\`, and `/`) or Unicode - // escape sequence. - charCode = source.charCodeAt(++Index); + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } // Manually invoke the callback for each non-enumerable property. - switch (charCode) { - case 92: - case 34: - case 47: - case 98: - case 116: - case 110: - case 102: - case 114: - // Revive escaped control characters. - value += Unescapes[charCode]; - Index++; - break; - case 117: - // `\u` marks the beginning of a Unicode escape sequence. - // Advance to the first character and validate the - // four-digit code point. - begin = ++Index; + for (length = dontEnums.length; property = dontEnums[--length];) { + if (hasProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + isConstructor; -<<<<<<< HEAD - for (position = Index + 4; Index < position; Index++) { - charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- - // insensitive) that form a single hexadecimal value. -======= - var json3 = createCommonjsModule(function (module, exports) { -<<<<<<< HEAD - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. ->>>>>>> Updated npm distribution files + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. - if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { - // Invalid Unicode escape sequence. - abort(); - } - } // Revive the escaped character. + if (isConstructor || isProperty.call(object, property = "constructor")) { + callback(property); + } + }; + } - value += fromCharCode("0x" + source.slice(begin, Index)); - break; + return _forOwn(object, callback); + }; // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } - charCode = source.charCodeAt(Index); - begin = Index; // Optimize for the common case where a string is valid. + if (!has("json-stringify") && !has("date-serialization")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } // Append the string as-is. + var leadingZeroes = "000000"; + var toPaddedString = function toPaddedString(width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; // Internal: Serializes a date object. - value += source.slice(begin, Index); - } - } - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } // Unterminated string. + var _serializeDate = function serializeDate(value) { + var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. + if (!isExtended) { + var floor = Math.floor; // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. -<<<<<<< HEAD - abort(); -======= - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } -======= - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. - // A set of types used to distinguish objects from primitives. - var objectTypes = { - "function": true, - "object": true - }; + var getDay = function getDay(year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; - // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; + getData = function getData(value) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); - // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - var root = objectTypes[typeof window] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { + } - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { + } - // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); + date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. - // Native constructor aliases. - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; + time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. - // Delegate to the native `stringify` and `parse` implementations. - if (typeof nativeJSON == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + }; + } else { + getData = function getData(value) { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + }; + } - // Convenience aliases. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; + _serializeDate = function serializeDate(value) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + getData(value); // Serialize extended years correctly. - // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); ->>>>>>> Updated npm distribution files - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. ->>>>>>> Updated npm distribution files + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + year = month = date = hours = minutes = seconds = milliseconds = null; + } else { + value = null; + } - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. + return value; + }; - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. + return _serializeDate(value); + }; // For environments with `JSON.stringify` but buggy date serialization, + // we override the native `Date#toJSON` implementation with a + // spec-compliant one. - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } + if (has("json-stringify") && !has("date-serialization")) { + // Internal: the `Date#toJSON` implementation used to override the native one. + var dateToJSON = function dateToJSON(key) { + return _serializeDate(this); + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - isSigned = false; // Parse the integer component. - for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { - } // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. + var nativeStringify = exports.stringify; + exports.stringify = function (source, filter, width) { + var nativeToJSON = Date.prototype.toJSON; + Date.prototype.toJSON = dateToJSON; + var result = nativeStringify(source, filter, width); + Date.prototype.toJSON = nativeToJSON; + return result; + }; + } else { + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; - if (source.charCodeAt(Index) == 46) { - position = ++Index; // Parse the decimal component. + var escapeChar = function escapeChar(character) { + var charCode = character.charCodeAt(0), + escaped = Escapes[charCode]; - for (; position < length; position++) { - charCode = source.charCodeAt(position); + if (escaped) { + return escaped; + } - if (charCode < 48 || charCode > 57) { - break; - } - } + return unicodePrefix + toPaddedString(2, charCode.toString(16)); + }; - if (position == Index) { - // Illegal trailing decimal. - abort(); - } + var reEscape = /[\x00-\x1f\x22\x5c]/g; - Index = position; - } // Parse exponents. The `e` denoting the exponent is - // case-insensitive. + var quote = function quote(value) { + reEscape.lastIndex = 0; + return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; + }; // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - charCode = source.charCodeAt(Index); + var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { + var value, type, className, results, element, index, length, prefix, result; + attempt(function () { + // Necessary for host object support. + value = object[property]; + }); - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is - // specified. + if (_typeof(value) == "object" && value) { + if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { + value = _serializeDate(value); + } else if (typeof value.toJSON == "function") { + value = value.toJSON(property); + } + } - if (charCode == 43 || charCode == 45) { - Index++; - } // Parse the exponential component. + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } // Exit early if value is `undefined` or `null`. - for (position = Index; position < length; position++) { - charCode = source.charCodeAt(position); + if (value == undefined$1) { + return value === undefined$1 ? value : "null"; + } - if (charCode < 48 || charCode > 57) { - break; - } - } + type = _typeof(value); // Only call `getClass` if the value is an object. - if (position == Index) { - // Illegal empty exponent. - abort(); - } + if (type == "object") { + className = getClass.call(value); + } - Index = position; - } // Coerce the parsed value to a JavaScript number. +======= +>>>>>>> branch for npm and latest release return +source.slice(begin, Index); @@ -16782,11 +20196,20 @@ }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. +<<<<<<< HEAD exports.parse = function (source, callback) { var result, value; Index = 0; Source = "" + source; result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. +======= +>>>>>>> branch for npm and latest release + switch (className || type) { + case "boolean": + case booleanClass: + // Booleans are represented literally. + return "" + value; +>>>>>>> branch for npm and latest release if (lex() != "$") { abort(); @@ -17068,6 +20491,7 @@ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. */ +<<<<<<< HEAD exports.formatters.j = function (v) { return JSON.stringify(v); @@ -17077,8 +20501,187 @@ * * @api public */ +======= + charCode = source.charCodeAt(Index); + begin = Index; // Optimize for the common case where a string is valid. + + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } // Append the string as-is. + + + value += source.slice(begin, Index); + } + } + + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } // Unterminated string. + + + abort(); + + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. + + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. + + + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } +<<<<<<< HEAD + + isSigned = false; // Parse the integer component. + + for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { + } // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. + + + if (source.charCodeAt(Index) == 46) { + position = ++Index; // Parse the decimal component. + + for (; position < length; position++) { + charCode = source.charCodeAt(position); + +<<<<<<< HEAD + if (charCode < 48 || charCode > 57) { + break; + } + } + + if (position == Index) { + // Illegal trailing decimal. + abort(); + } + + Index = position; + } // Parse exponents. The `e` denoting the exponent is + // case-insensitive. + + + charCode = source.charCodeAt(Index); + + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is + // specified. + + if (charCode == 43 || charCode == 45) { + Index++; + } // Parse the exponential component. + + + for (position = Index; position < length; position++) { + charCode = source.charCodeAt(position); + + if (charCode < 48 || charCode > 57) { + break; + } + } + + if (position == Index) { + // Illegal empty exponent. + abort(); + } + + Index = position; + } // Coerce the parsed value to a JavaScript number. + + + return +source.slice(begin, Index); + } // A negative sign may only precede numbers. + + + if (isSigned) { + abort(); + } // `true`, `false`, and `null` literals. + + + var temp = source.slice(Index, Index + 4); + + if (temp == "true") { + Index += 4; + return true; + } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { + Index += 5; + return false; + } else if (temp == "null") { + Index += 4; + return null; + } // Unrecognized token. + + + abort(); + } + } // Return the sentinel `$` character if the parser has reached the end + // of the source string. + + + return "$"; + }; // Internal: Parses a JSON `value` token. + + + var get = function get(value) { + var results, hasMembers; + + if (value == "$") { + // Unexpected end of input. + abort(); + } + + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } // Parse object and array literals. + + + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; + + for (;;) { + value = lex(); // A closing square bracket marks the end of the array literal. + + if (value == "]") { + break; + } // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. + + + if (hasMembers) { + if (value == ",") { + value = lex(); +======= + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ +>>>>>>> branch for npm and latest release + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; +>>>>>>> Updated npm distribution files +<<<<<<< HEAD function formatArgs() { var args = arguments; var useColors = this.useColors; @@ -17094,6 +20697,19 @@ args[0].replace(/%[a-z%]/g, function (match) { if ('%%' === match) return; index++; +======= + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. + abort(); + } + } else { + hasMembers = true; + } // Elisions and leading commas are not permitted. +>>>>>>> branch for npm and latest release if ('%c' === match) { // we only are interested in the *last* %c @@ -17111,6 +20727,7 @@ * @api public */ +<<<<<<< HEAD function log() { // this hackery is required for IE8/9, where @@ -17141,6 +20758,28 @@ * @api private */ +======= + if (value == ",") { + abort(); + } + + results.push(get(value)); + } + + return results; + } else if (value == "{") { + // Parses a JSON object, returning a new JavaScript object. + results = {}; + + for (;;) { + value = lex(); // A closing curly brace marks the end of the object literal. + + if (value == "}") { + break; + } // If the object literal contains members, the current token + // should be a comma separator. +======= +>>>>>>> branch for npm and latest release function load() { var r; @@ -17186,6 +20825,7 @@ * Module dependencies. */ +<<<<<<< HEAD <<<<<<< HEAD var debug$1 = browser$1('cookie'); /** @@ -17199,6 +20839,8 @@ */ ======= <<<<<<< HEAD +======= +>>>>>>> branch for npm and latest release if (charCode < 48 || charCode > 57) { break; } @@ -17264,6 +20906,7 @@ return {}; } +<<<<<<< HEAD return parse$3(str); } /** @@ -17273,8 +20916,223 @@ * @return {String} * @api private */ +======= + return +source.slice(begin, Index); + } // A negative sign may only precede numbers. + + + if (isSigned) { + abort(); + } // `true`, `false`, and `null` literals. + + + var temp = source.slice(Index, Index + 4); + + if (temp == "true") { + Index += 4; + return true; + } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { + Index += 5; + return false; + } else if (temp == "null") { + Index += 4; + return null; + } // Unrecognized token. + + + abort(); + } + } // Return the sentinel `$` character if the parser has reached the end + // of the source string. + + + return "$"; + }; // Internal: Parses a JSON `value` token. + + + var get = function get(value) { + var results, hasMembers; + + if (value == "$") { + // Unexpected end of input. + abort(); + } + + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } // Parse object and array literals. + + + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; + + for (;;) { + value = lex(); // A closing square bracket marks the end of the array literal. + + if (value == "]") { + break; + } // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. +>>>>>>> branch for npm and latest release + + + if (hasMembers) { + if (value == ",") { + value = lex(); + +<<<<<<< HEAD + if (value == "}") { + // Unexpected trailing `,` in object literal. + abort(); + } + } else { + // A `,` must separate each object member. +======= + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. +>>>>>>> branch for npm and latest release + abort(); + } + } else { + hasMembers = true; +<<<<<<< HEAD + } // Leading commas are not permitted, object property names must be + // double-quoted strings, and a `:` must separate each property + // name and value. + + + if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { + abort(); + } + + results[value.slice(1)] = get(lex()); + } + + return results; + } // Unexpected token encountered. + + + abort(); + } + + return value; + }; // Internal: Updates a traversed object member. + + + var update = function update(source, property, callback) { + var element = walk(source, property, callback); + + if (element === undefined$1) { + delete source[property]; + } else { + source[property] = element; + } + }; // Internal: Recursively traverses a parsed JSON object, invoking the + // `callback` function for each value. This is an implementation of the + // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. + + + var walk = function walk(source, property, callback) { + var value = source[property], + length; + + if (_typeof(value) == "object" && value) { + // `forOwn` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { + for (length = value.length; length--;) { + update(getClass, _forOwn, value, length, callback); + } + } else { + _forOwn(value, function (property) { + update(value, property, callback); + }); + } + } + + return callback.call(source, property, value); + }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. + + + exports.parse = function (source, callback) { + var result, value; + Index = 0; + Source = "" + source; + result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. + + if (lex() != "$") { + abort(); + } // Reset the parser state. + + + Index = Source = null; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; + }; + } + } + + exports.runInContext = runInContext; + return exports; + } + + if (freeExports && !isLoader) { + // Export for CommonJS environments. + runInContext(root, freeExports); + } else { + // Export for web browsers and JavaScript engines. + var nativeJSON = root.JSON, + previousJSON = root.JSON3, + isRestored = false; + var JSON3 = runInContext(root, root.JSON3 = { + // Public: Restores the original value of the global `JSON` object and + // returns a reference to the `JSON3` object. + "noConflict": function noConflict() { + if (!isRestored) { + isRestored = true; + root.JSON = nativeJSON; + root.JSON3 = previousJSON; + nativeJSON = previousJSON = null; + } + + return JSON3; + } + }); + root.JSON = { + "parse": JSON3.parse, + "stringify": JSON3.stringify + }; + } // Export for asynchronous module loaders. + }).call(commonjsGlobal); + }); +>>>>>>> branch for npm and latest release + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ +<<<<<<< HEAD function get$2(name) { return all$1()[name]; } @@ -17285,8 +21143,22 @@ * @return {Object} * @api private */ +======= + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ +>>>>>>> branch for npm and latest release + exports.formatters = {}; + /** + * Previously assigned color. + */ +<<<<<<< HEAD function parse$3(str) { var obj = {}; var pairs = str.split(/ *; */); @@ -17366,6 +21238,58 @@ function domain(url) { var cookie = exports.cookie; var levels = exports.levels(url); // Lookup the real top level one. +======= + var prevColor = 0; + /** + * Previous log timestamp. + */ + + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ + + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + + function debug(namespace) { + // define the `disabled` version + function disabled() {} + + disabled.enabled = false; // define the `enabled` version + + function enabled() { + var self = enabled; // set `diff` timestamp + + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set + + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // apply any `formatters` transformations +>>>>>>> branch for npm and latest release for (var i = 0; i < levels.length; ++i) { var cname = '__tld__'; @@ -17375,6 +21299,7 @@ }; cookie(cname, 1, opts); +<<<<<<< HEAD if (cookie(cname)) { cookie(cname, null, opts); return domain; @@ -17401,8 +21326,27 @@ if (parts.length === 4 && last === parseInt(last, 10)) { return levels; } // Localhost. +======= + 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--; + } +>>>>>>> branch for npm and latest release + return match; + }); + +<<<<<<< HEAD <<<<<<< HEAD if (parts.length <= 1) { return levels; @@ -17429,6 +21373,10 @@ >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +======= +======= + } // Elisions and leading commas are not permitted. +>>>>>>> branch for npm and latest release for (var i = parts.length - 2; i >= 0; --i) { levels.push(parts.slice(i).join('.')); @@ -17512,6 +21460,7 @@ * @param {*} key */ +<<<<<<< HEAD }, { key: "get", value: function get(key) { @@ -17521,6 +21470,26 @@ * * @param {*} key */ +======= +<<<<<<< HEAD + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; +======= + results[value.slice(1)] = get(lex()); + } +>>>>>>> branch for npm and latest release }, { key: "remove", @@ -17588,9 +21557,18 @@ store.forEach = function () {}; +<<<<<<< HEAD store.serialize = function (value) { return json3.stringify(value); }; +======= + Index = Source = null; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; + }; + } + } +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release store.deserialize = function (value) { if (typeof value != 'string') { @@ -17721,8 +21699,14 @@ var attributes = storage.XMLDocument.documentElement.attributes; storage.load(localStorageName); +<<<<<<< HEAD for (var i = attributes.length - 1; i >= 0; i--) { storage.removeAttribute(attributes[i].name); +======= +>>>>>>> branch for npm and latest release + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); +>>>>>>> branch for npm and latest release } storage.save(localStorageName); @@ -18019,7 +22003,11 @@ ======= function set$1(name, value, options) { options = options || {}; +<<<<<<< HEAD var str = encode$2(name) + '=' + encode$2(value); +======= + var str = encode$1(name) + '=' + encode$1(value); +>>>>>>> branch for npm and latest release if (null == value) options.maxage = -1; >>>>>>> NPM release version 1.0.11 @@ -18082,7 +22070,11 @@ return {}; } <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +<<<<<<< HEAD +>>>>>>> branch for npm and latest release <<<<<<< HEAD }, { @@ -18097,9 +22089,19 @@ ======= return parse$3(str); ======= +======= +>>>>>>> branch for npm and latest release return parse$2(str); >>>>>>> Updated npm distribution files } +<<<<<<< HEAD +======= +======= +>>>>>>> branch for npm and latest release + + return parse$2(str); + } +>>>>>>> branch for npm and latest release /** * Get cookie `name`. * @@ -18118,6 +22120,7 @@ lotame_synch_time_key: "lt_synch_timestamp" }; +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { @@ -18125,11 +22128,18 @@ _classCallCheck(this, LotameStorage); ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> branch for npm and latest release this.storage = Storage$1; // new Storage(); ======= function parse$3(str) { ======= +======= +======= + +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release function parse$2(str) { >>>>>>> Updated npm distribution files var obj = {}; @@ -18160,12 +22170,18 @@ var lotameStorage = new LotameStorage(); +<<<<<<< HEAD <<<<<<< HEAD var Lotame = /*#__PURE__*/function () { function Lotame(config, analytics) { var _this = this; ======= +======= +>>>>>>> branch for npm and latest release function encode$2(value) { +======= + function encode$1(value) { +>>>>>>> branch for npm and latest release try { return encodeURIComponent(value); } catch (e) { @@ -18179,6 +22195,7 @@ _classCallCheck(this, Lotame); +<<<<<<< HEAD <<<<<<< HEAD this.name = "LOTAME"; this.analytics = analytics; @@ -18194,7 +22211,12 @@ _this.mappings[key] = value; }); ======= +======= +>>>>>>> branch for npm and latest release function decode$2(value) { +======= + function decode$1(value) { +>>>>>>> branch for npm and latest release try { return decodeURIComponent(value); } catch (e) { @@ -18287,6 +22309,15 @@ /** * Expose cookie on domain. */ +<<<<<<< HEAD + + + domain.cookie = componentCookie; + /* + * Exports. + */ + +======= domain.cookie = componentCookie; @@ -18294,6 +22325,7 @@ * Exports. */ +>>>>>>> branch for npm and latest release exports = module.exports = domain; }); >>>>>>> branch for npm and latest release @@ -19598,17 +23630,22 @@ return Fullstory; }(); +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { ======= <<<<<<< HEAD ======= +======= +>>>>>>> branch for npm and latest release <<<<<<< HEAD var Optimizely = /*#__PURE__*/ function () { ======= +======= +>>>>>>> branch for npm and latest release var Optimizely = /*#__PURE__*/function () { >>>>>>> update npm module function Optimizely(config, analytics) { @@ -19620,7 +23657,13 @@ var Optimizely = /*#__PURE__*/ function () { +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + var Optimizely = /*#__PURE__*/function () { +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release function Optimizely(config, analytics) { var _this = this; @@ -20162,6 +24205,7 @@ case "bools": return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); +<<<<<<< HEAD } } // No type suffix found. Camel case the whole field name. @@ -20270,6 +24314,8 @@ if (value) { action[key] = value; } +======= +>>>>>>> branch for npm and latest release } } @@ -20324,6 +24370,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -20338,6 +24385,12 @@ ======= this.version = "1.0.11"; >>>>>>> rebase with production branch +======= + this.version = "1.0.11"; +======= + this.version = "1.0.9"; +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release }; <<<<<<< HEAD ======= @@ -20388,7 +24441,7 @@ }; ======= this.name = "RudderLabs JavaScript SDK"; - this.version = "1.0.8"; + this.version = "1.0.9"; }; // Operating System information class >>>>>>> update npm module >>>>>>> update npm module @@ -21278,11 +25331,14 @@ function bytesToUuid(buf, offset) { var i = offset || 0; +<<<<<<< HEAD <<<<<<< HEAD var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); ======= +======= +>>>>>>> branch for npm and latest release var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return ([ @@ -21295,7 +25351,15 @@ bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]] ]).join(''); +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + + return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release } var bytesToUuid_1 = bytesToUuid; @@ -21312,10 +25376,16 @@ var _lastMSecs = 0; var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details +<<<<<<< HEAD <<<<<<< HEAD ======= // See https://github.com/uuidjs/uuid for API details >>>>>>> Updated npm distribution files +======= + // See https://github.com/uuidjs/uuid for API details +======= +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; @@ -21619,6 +25689,7 @@ switch (e.code) { case 22: quotaExceeded = true; +<<<<<<< HEAD <<<<<<< HEAD break; @@ -21633,6 +25704,21 @@ } break; >>>>>>> Updated npm distribution files +======= + } + break; +======= + break; + + case 1014: + // Firefox + if (e.name === 'NS_ERROR_DOM_QUOTA_REACHED') { + quotaExceeded = true; + } + + break; +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release } } else if (e.number === -2147024882) { // Internet Explorer 8 From 3023fa6289dc13d79fd7600e3a0a95e5e159b5a9 Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Tue, 8 Sep 2020 21:32:07 +0530 Subject: [PATCH 15/20] add querystring parse to npm module --- dist/rudder-sdk-js/index.js | 176 +++++++++++++++++++++++++++++++++++- 1 file changed, 173 insertions(+), 3 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 0a338ac45c..62f13361b3 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -638,10 +638,54 @@ */ +<<<<<<< HEAD Emitter.prototype.emit = function (event) { this._callbacks = this._callbacks || {}; var args = new Array(arguments.length - 1), callbacks = this._callbacks['$' + event]; +======= +<<<<<<< HEAD +<<<<<<< HEAD +<<<<<<< HEAD +<<<<<<< HEAD + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; +>>>>>>> Updated npm distribution files +======= +======= +>>>>>>> branch for npm and latest release +======= +>>>>>>> add querystring parse to npm module + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; +>>>>>>> update npm module +<<<<<<< HEAD +>>>>>>> update npm module +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; +>>>>>>> branch for npm and latest release +<<<<<<< HEAD +>>>>>>> branch for npm and latest release +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module + var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; + var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; + /* module.exports = { + MessageType: MessageType, + ECommerceParamNames: ECommerceParamNames, + ECommerceEvents: ECommerceEvents, + RudderIntegrationPlatform: RudderIntegrationPlatform, + BASE_URL: BASE_URL, + CONFIG_URL: CONFIG_URL, + FLUSH_QUEUE_SIZE: FLUSH_QUEUE_SIZE + }; */ +>>>>>>> add querystring parse to npm module for (var i = 1; i < arguments.length; i++) { args[i - 1] = arguments[i]; @@ -2566,18 +2610,27 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> add querystring parse to npm module var toString$1 = Object.prototype.toString; ======= var toString = Object.prototype.toString; >>>>>>> branch for npm and latest release <<<<<<< HEAD +<<<<<<< HEAD ======= var toString$1 = Object.prototype.toString; >>>>>>> NPM release version 1.0.11 ======= >>>>>>> branch for npm and latest release +======= +======= + var toString$1 = Object.prototype.toString; +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module /** * Return the type of `val`. * @@ -2588,6 +2641,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { @@ -2600,13 +2654,22 @@ switch (toString$1.call(val)) { >>>>>>> NPM release version 1.0.11 ======= +======= +>>>>>>> add querystring parse to npm module var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { ======= var componentType = function componentType(val) { switch (toString.call(val)) { >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module case '[object Function]': return 'function'; @@ -18081,6 +18144,7 @@ * Module dependencies. */ <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var debug$1 = browser$1('cookie'); @@ -18091,6 +18155,9 @@ ======= var toString$1 = Object.prototype.toString; >>>>>>> branch for npm and latest release +======= + var toString$2 = Object.prototype.toString; +>>>>>>> add querystring parse to npm module /** * Set or get cookie `name` with `value` and `options` object. * @@ -18103,6 +18170,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var rudderComponentCookie = function rudderComponentCookie(name, value, options) { switch (arguments.length) { @@ -18116,6 +18184,10 @@ var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { >>>>>>> branch for npm and latest release +======= + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { +>>>>>>> add querystring parse to npm module case '[object Date]': return 'date'; @@ -18187,7 +18259,7 @@ var str; ======= var clone = function clone(obj) { - var t = componentType$1(obj); + var t = componentType$2(obj); if (t === 'object') { var copy = {}; @@ -18310,8 +18382,12 @@ ======= var ms = function ms(val, options) { options = options || {}; +<<<<<<< HEAD if ('string' == typeof val) return parse(val); >>>>>>> branch for npm and latest release +======= + if ('string' == typeof val) return parse$1(val); +>>>>>>> add querystring parse to npm module return options["long"] ? _long(val) : _short(val); >>>>>>> NPM release version 1.0.11 }; @@ -18343,15 +18419,21 @@ // `arguments` objects on v8. For a summary, see: // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> add querystring parse to npm module function parse$1(str) { ======= function parse(str) { >>>>>>> branch for npm and latest release +======= + function parse$1(str) { +>>>>>>> add querystring parse to npm module 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); @@ -18910,7 +18992,19 @@ ======= function set(name, value, options) { options = options || {}; +<<<<<<< HEAD + var str = encode$1(name) + '=' + encode$1(value); +======= +<<<<<<< HEAD +<<<<<<< HEAD + var str = encode$1(name) + '=' + encode$1(value); +======= + var str = encode(name) + '=' + encode(value); +>>>>>>> branch for npm and latest release +======= var str = encode$1(name) + '=' + encode$1(value); +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module if (null == value) options.maxage = -1; >>>>>>> NPM release version 1.0.11 @@ -18950,10 +19044,21 @@ }; // Internal: Converts `value` into a zero-padded string such that its // length is at least equal to `width`. The `width` must be <= 6. +<<<<<<< HEAD <<<<<<< HEAD var leadingZeroes = "000000"; ======= return parse$2(str); +======= +<<<<<<< HEAD + return parse$2(str); +======= + return parse$1(str); +>>>>>>> branch for npm and latest release +======= + return parse$2(str); +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module } /** * Get cookie `name`. @@ -18985,6 +19090,7 @@ var _serializeDate = function serializeDate(value) { var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. +<<<<<<< HEAD <<<<<<< HEAD if (!isExtended) { var floor = Math.floor; // A mapping between the months of the year and the number of days between @@ -18994,6 +19100,16 @@ // first day of the given month. ======= function parse$2(str) { +======= +<<<<<<< HEAD + function parse$2(str) { +======= + function parse$1(str) { +>>>>>>> branch for npm and latest release +======= + function parse$2(str) { +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module var obj = {}; var pairs = str.split(/ *; */); var pair; @@ -19018,11 +19134,22 @@ for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { } +<<<<<<< HEAD <<<<<<< HEAD for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { } ======= function encode$1(value) { +======= +<<<<<<< HEAD + function encode$1(value) { +======= + function encode(value) { +>>>>>>> branch for npm and latest release +======= + function encode$1(value) { +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module try { return encodeURIComponent(value); } catch (e) { @@ -19039,11 +19166,22 @@ // to compute `A modulo B`, as the `%` operator does not // correspond to the `modulo` operation for negative numbers. +<<<<<<< HEAD <<<<<<< HEAD time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by // decomposing the time within the day. See section 15.9.1.10. ======= function decode$1(value) { +======= +<<<<<<< HEAD + function decode$1(value) { +======= + function decode(value) { +>>>>>>> branch for npm and latest release +======= + function decode$1(value) { +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module try { return decodeURIComponent(value); } catch (e) { @@ -22003,11 +22141,15 @@ ======= function set$1(name, value, options) { options = options || {}; +<<<<<<< HEAD <<<<<<< HEAD var str = encode$2(name) + '=' + encode$2(value); ======= var str = encode$1(name) + '=' + encode$1(value); >>>>>>> branch for npm and latest release +======= + var str = encode$2(name) + '=' + encode$2(value); +>>>>>>> add querystring parse to npm module if (null == value) options.maxage = -1; >>>>>>> NPM release version 1.0.11 @@ -22099,7 +22241,7 @@ ======= >>>>>>> branch for npm and latest release - return parse$2(str); + return parse$3(str); } >>>>>>> branch for npm and latest release /** @@ -22138,10 +22280,17 @@ ======= ======= +<<<<<<< HEAD >>>>>>> branch for npm and latest release >>>>>>> branch for npm and latest release function parse$2(str) { +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + function parse$3(str) { +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module var obj = {}; var pairs = str.split(/ *; */); var pair; @@ -22170,6 +22319,7 @@ var lotameStorage = new LotameStorage(); +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD var Lotame = /*#__PURE__*/function () { @@ -22178,10 +22328,15 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> add querystring parse to npm module function encode$2(value) { ======= function encode$1(value) { >>>>>>> branch for npm and latest release +======= + function encode$2(value) { +>>>>>>> add querystring parse to npm module try { return encodeURIComponent(value); } catch (e) { @@ -22195,6 +22350,7 @@ _classCallCheck(this, Lotame); +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD this.name = "LOTAME"; @@ -22213,10 +22369,15 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> add querystring parse to npm module function decode$2(value) { ======= function decode$1(value) { >>>>>>> branch for npm and latest release +======= + function decode$2(value) { +>>>>>>> add querystring parse to npm module try { return decodeURIComponent(value); } catch (e) { @@ -24371,6 +24532,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -24386,11 +24548,19 @@ this.version = "1.0.11"; >>>>>>> rebase with production branch ======= +======= +>>>>>>> add querystring parse to npm module this.version = "1.0.11"; ======= this.version = "1.0.9"; >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= + this.version = "1.0.10"; +>>>>>>> add querystring parse to npm module +>>>>>>> add querystring parse to npm module }; <<<<<<< HEAD ======= @@ -24441,7 +24611,7 @@ }; ======= this.name = "RudderLabs JavaScript SDK"; - this.version = "1.0.9"; + this.version = "1.0.10"; }; // Operating System information class >>>>>>> update npm module >>>>>>> update npm module From 09a3a635275a974a75b199cbdad4306841b26a81 Mon Sep 17 00:00:00 2001 From: Arnab Date: Wed, 12 Aug 2020 18:40:01 +0530 Subject: [PATCH 16/20] Updated npm distribution files --- dist/rudder-sdk-js/index.js | 353 ++++++++++++++++++++++++++++++++++++ 1 file changed, 353 insertions(+) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 62f13361b3..2028a762fa 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -1,5 +1,6 @@ (function (global, factory) { <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -8,6 +9,8 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); @@ -19,12 +22,29 @@ >>>>>>> Updated npm distribution files ======= ======= +======= +>>>>>>> Updated npm distribution files typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.rudderanalytics = {})); }(this, (function (exports) { 'use strict'; +<<<<<<< HEAD >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= +======= + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : + typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : + (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); +}(this, (function (exports, AES, Utf8) { 'use strict'; + + AES = AES && Object.prototype.hasOwnProperty.call(AES, 'default') ? AES['default'] : AES; + Utf8 = Utf8 && Object.prototype.hasOwnProperty.call(Utf8, 'default') ? Utf8['default'] : Utf8; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files function _typeof(obj) { "@babel/helpers - typeof"; @@ -1211,6 +1231,7 @@ >>>>>>> update npm module ======= >>>>>>> branch for npm and latest release +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ======= @@ -1224,7 +1245,13 @@ ======= ======= ======= +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +>>>>>>> add querystring parse to npm module +======= +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; @@ -1242,8 +1269,32 @@ var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; >>>>>>> branch for npm and latest release >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +>>>>>>> add querystring parse to npm module +<<<<<<< HEAD +>>>>>>> add querystring parse to npm module +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +======= +<<<<<<< HEAD + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -19401,6 +19452,7 @@ prefix = indentation; indentation += whitespace; +<<<<<<< HEAD if (className == arrayClass) { // Recursively serialize array elements. for (index = 0, length = value.length; index < length; index++) { @@ -19426,6 +19478,28 @@ results.push(quote(property) + ":" + (whitespace ? " " : "") + element); } }); +======= +<<<<<<< HEAD + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } +======= +======= +>>>>>>> branch for npm and latest release +======= + var json3 = createCommonjsModule(function (module, exports) { +<<<<<<< HEAD +<<<<<<< HEAD +>>>>>>> Updated npm distribution files + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; +>>>>>>> Updated npm distribution files result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; } // Remove the object from the traversed object stack. @@ -19453,12 +19527,33 @@ value = filter[index++]; className = getClass.call(value); +<<<<<<< HEAD if (className == "[object String]" || className == "[object Number]") { properties[value] = 1; } } } } +======= + // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); +<<<<<<< HEAD +>>>>>>> Updated npm distribution files +======= +======= +======= +>>>>>>> Updated npm distribution files + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. +>>>>>>> Updated npm distribution files if (width) { className = getClass.call(width); @@ -19513,6 +19608,89 @@ // the end of the source string. A token may be a string, number, `null` // literal, or Boolean literal. +<<<<<<< HEAD +======= + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } +<<<<<<< HEAD +>>>>>>> branch for npm and latest release +<<<<<<< HEAD +>>>>>>> branch for npm and latest release +======= +======= +======= + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; + + // A set of types used to distinguish objects from primitives. + var objectTypes = { + "function": true, + "object": true + }; + + // Detect the `exports` object exposed by CommonJS implementations. + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; + + // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + var root = objectTypes[typeof window] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; + + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } + + // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); + + // Native constructor aliases. + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; + + // Delegate to the native `stringify` and `parse` implementations. + if (typeof nativeJSON == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } + + // Convenience aliases. + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; + + // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. +>>>>>>> Updated npm distribution files var lex = function lex() { var source = Source, @@ -21598,6 +21776,7 @@ * @param {*} key */ +<<<<<<< HEAD <<<<<<< HEAD }, { key: "get", @@ -21609,6 +21788,8 @@ * @param {*} key */ ======= +======= +>>>>>>> Updated npm distribution files <<<<<<< HEAD var debug_1$1 = createCommonjsModule(function (module, exports) { /** @@ -21625,6 +21806,8 @@ exports.enabled = enabled; exports.humanize = ms; ======= +======= +>>>>>>> Updated npm distribution files results[value.slice(1)] = get(lex()); } >>>>>>> branch for npm and latest release @@ -21705,8 +21888,30 @@ }; } } +<<<<<<< HEAD >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= +======= + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files store.deserialize = function (value) { if (typeof value != 'string') { @@ -22213,10 +22418,14 @@ } <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> Updated npm distribution files ======= <<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +<<<<<<< HEAD +>>>>>>> Updated npm distribution files <<<<<<< HEAD }, { @@ -22233,6 +22442,8 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files return parse$2(str); >>>>>>> Updated npm distribution files } @@ -22240,8 +22451,13 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files return parse$3(str); +======= + return parse$2(str); +>>>>>>> Updated npm distribution files } >>>>>>> branch for npm and latest release /** @@ -22264,6 +22480,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { function LotameStorage() { @@ -22272,13 +22489,18 @@ >>>>>>> Updated npm distribution files ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files this.storage = Storage$1; // new Storage(); ======= function parse$3(str) { ======= ======= +>>>>>>> Updated npm distribution files +======= ======= +>>>>>>> Updated npm distribution files <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -22289,8 +22511,17 @@ ======= ======= function parse$3(str) { +<<<<<<< HEAD >>>>>>> add querystring parse to npm module +<<<<<<< HEAD >>>>>>> add querystring parse to npm module +======= +======= +======= + function parse$2(str) { +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files var obj = {}; var pairs = str.split(/ *; */); var pair; @@ -23088,6 +23319,7 @@ return value; } +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); @@ -23095,11 +23327,22 @@ var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); >>>>>>> Updated npm distribution files ======= +======= +>>>>>>> Updated npm distribution files var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); ======= var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); >>>>>>> update npm module +<<<<<<< HEAD >>>>>>> update npm module +======= +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files return prefixedVal; } /** @@ -23116,17 +23359,29 @@ if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ======= return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); >>>>>>> Updated npm distribution files ======= +======= +>>>>>>> Updated npm distribution files return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); ======= return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); >>>>>>> update npm module +<<<<<<< HEAD >>>>>>> update npm module +======= +======= + return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); +======= + return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files } return value; @@ -23793,6 +24048,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { ======= @@ -23800,6 +24056,8 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files <<<<<<< HEAD var Optimizely = /*#__PURE__*/ @@ -23807,6 +24065,8 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files var Optimizely = /*#__PURE__*/function () { >>>>>>> update npm module function Optimizely(config, analytics) { @@ -23824,7 +24084,19 @@ ======= var Optimizely = /*#__PURE__*/function () { >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= + var Optimizely = /*#__PURE__*/function () { +======= +<<<<<<< HEAD + var Optimizely = + /*#__PURE__*/ + function () { +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files function Optimizely(config, analytics) { var _this = this; @@ -24563,6 +24835,7 @@ >>>>>>> add querystring parse to npm module }; <<<<<<< HEAD +<<<<<<< HEAD ======= var Optimizely = /*#__PURE__*/function () { function Optimizely(config, analytics) { @@ -24575,12 +24848,27 @@ >>>>>>> update npm module >>>>>>> update npm module +======= +>>>>>>> update npm module + +======= +======= + var Optimizely = /*#__PURE__*/function () { + function Optimizely(config, analytics) { + var _this = this; + + _classCallCheck(this, Optimizely); +>>>>>>> Updated npm distribution files + +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files this.referrerOverride = function (referrer) { if (referrer) { window.optimizelyEffectiveReferrer = referrer; return referrer; } +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD this.name = "RudderLabs JavaScript SDK"; @@ -24607,6 +24895,8 @@ }; >>>>>>> Updated npm distribution files ======= +======= +>>>>>>> Updated npm distribution files return undefined; }; ======= @@ -24614,7 +24904,19 @@ this.version = "1.0.10"; }; // Operating System information class >>>>>>> update npm module +<<<<<<< HEAD >>>>>>> update npm module +======= +======= + this.name = "RudderLabs JavaScript SDK"; + this.version = "1.0.10"; + }; // Operating System information class +======= + return undefined; + }; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files this.sendDataToRudder = function (campaignState) { logger.debug(campaignState); @@ -25502,6 +25804,7 @@ function bytesToUuid(buf, offset) { var i = offset || 0; <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 @@ -25509,6 +25812,8 @@ ======= ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> Updated npm distribution files var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return ([ @@ -25529,7 +25834,29 @@ return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= + var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + + return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); +======= + var bth = byteToHex; + // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + return ([ + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], '-', + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]], + bth[buf[i++]], bth[buf[i++]] + ]).join(''); +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files } var bytesToUuid_1 = bytesToUuid; @@ -25546,6 +25873,7 @@ var _lastMSecs = 0; var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD ======= @@ -25556,6 +25884,16 @@ ======= >>>>>>> branch for npm and latest release >>>>>>> branch for npm and latest release +======= + // See https://github.com/uuidjs/uuid for API details +======= +>>>>>>> branch for npm and latest release +======= +======= + // See https://github.com/uuidjs/uuid for API details +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; @@ -25860,6 +26198,7 @@ case 22: quotaExceeded = true; <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD break; @@ -25875,9 +26214,13 @@ break; >>>>>>> Updated npm distribution files ======= +======= +>>>>>>> Updated npm distribution files } break; ======= +======= +>>>>>>> Updated npm distribution files break; case 1014: @@ -25887,8 +26230,18 @@ } break; +<<<<<<< HEAD >>>>>>> branch for npm and latest release +<<<<<<< HEAD >>>>>>> branch for npm and latest release +======= +======= +======= + } + break; +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files } } else if (e.number === -2147024882) { // Internet Explorer 8 From f86128aa2205ca28b2be802567f1c71c350c5b76 Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Tue, 8 Sep 2020 21:45:20 +0530 Subject: [PATCH 17/20] update npm module --- dist/rudder-sdk-js/index.js | 1091 +++++++++++++++-------------------- 1 file changed, 464 insertions(+), 627 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 2028a762fa..5be24f3537 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -1,6 +1,7 @@ (function (global, factory) { <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -11,6 +12,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); @@ -24,11 +27,14 @@ ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.rudderanalytics = {})); }(this, (function (exports) { 'use strict'; <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -44,7 +50,12 @@ Utf8 = Utf8 && Object.prototype.hasOwnProperty.call(Utf8, 'default') ? Utf8['default'] : Utf8; >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module function _typeof(obj) { "@babel/helpers - typeof"; @@ -1232,6 +1243,7 @@ ======= >>>>>>> branch for npm and latest release <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ======= @@ -1251,7 +1263,12 @@ >>>>>>> add querystring parse to npm module ======= >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; ======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; @@ -1292,9 +1309,21 @@ >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +>>>>>>> update npm module +>>>>>>> update npm module +>>>>>>> update npm module +>>>>>>> update npm module var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -19544,11 +19573,15 @@ if (errorFunc) { errorFunc(); <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> Updated npm distribution files ======= ======= ======= >>>>>>> Updated npm distribution files +======= +<<<<<<< HEAD +>>>>>>> update npm module (function () { // Detect the `define` function exposed by asynchronous module loaders. The // strict `define` check is necessary for compatibility with `r.js`. @@ -19624,6 +19657,16 @@ ======= ======= ======= +<<<<<<< HEAD +======= + var json3 = createCommonjsModule(function (module, exports) { +<<<<<<< HEAD +<<<<<<< HEAD +>>>>>>> Updated npm distribution files +======= +<<<<<<< HEAD +>>>>>>> update npm module +>>>>>>> update npm module (function () { // Detect the `define` function exposed by asynchronous module loaders. The // strict `define` check is necessary for compatibility with `r.js`. @@ -19687,6 +19730,7 @@ errorFunc(); >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files } } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. @@ -19772,6 +19816,10 @@ var json3 = createCommonjsModule(function (module, exports) { <<<<<<< HEAD <<<<<<< HEAD +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module (function () { // Detect the `define` function exposed by asynchronous module loaders. The // strict `define` check is necessary for compatibility with `r.js`. @@ -19828,6 +19876,15 @@ if (errorFunc) { errorFunc(); } +<<<<<<< HEAD +======= +<<<<<<< HEAD +<<<<<<< HEAD +>>>>>>> branch for npm and latest release +<<<<<<< HEAD +>>>>>>> branch for npm and latest release +======= +>>>>>>> update npm module ======= ======= >>>>>>> branch for npm and latest release @@ -19883,6 +19940,8 @@ getClass = objectProto.toString, isProperty = objectProto.hasOwnProperty, undefined$1; +<<<<<<< HEAD +======= // Internal: Contains `try...catch` logic used by other functions. // This prevents other functions from being deoptimized. @@ -19892,93 +19951,330 @@ } catch (exception) { if (errorFunc) { errorFunc(); +>>>>>>> Updated npm distribution files +>>>>>>> Updated npm distribution files <<<<<<< HEAD >>>>>>> Updated npm distribution files ======= ======= - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. +>>>>>>> update npm module +>>>>>>> update npm module + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. + var isExtended = new Date(-3509827334573292); + attempt(function () { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + }); // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; + function has(name) { + if (has[name] != null) { + // Return cached feature test result. + return has[name]; + } - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. + var isSupported; + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); + } else if (name == "date-serialization") { + // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. + isSupported = has("json-stringify") && isExtended; - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. + if (isSupported) { + var stringify = exports.stringify; + attempt(function () { + isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + }); + } + } else { + var value, + serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + if (name == "json-stringify") { + var stringify = exports.stringify, + stringifySupported = typeof stringify == "function"; - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function value() { + return 1; + }).toJSON = value; + attempt(function () { + stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ + "a": [value, true, false, null, "\x00\b\n\f\r\t"] + }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; + }, function () { + stringifySupported = false; + }); + } + isSupported = stringifySupported; + } // Test `JSON.parse`. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } ->>>>>>> branch for npm and latest release ->>>>>>> branch for npm and latest release - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. ->>>>>>> Updated npm distribution files + if (name == "json-parse") { + var parse = exports.parse, + parseSupported; - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. + if (typeof parse == "function") { + attempt(function () { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + parseSupported = value["a"].length == 5 && value["a"][0] === 1; - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. + if (parseSupported) { + attempt(function () { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + }); + if (parseSupported) { + attempt(function () { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + }); + } - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); + if (parseSupported) { + attempt(function () { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + }); } + } + } + }, function () { + parseSupported = false; + }); + } - isSigned = false; // Parse the integer component. + isSupported = parseSupported; + } + } - for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { - } // Floats cannot contain a leading decimal point; however, this + return has[name] = !!isSupported; + } + + has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; + + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. + + var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. + + var _forOwn = function forOwn(object, callback) { + var size = 0, + Properties, + dontEnums, + property; // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. + + dontEnums = new Properties(); + + for (property in dontEnums) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(dontEnums, property)) { + size++; + } + } +<<<<<<< HEAD + + Properties = dontEnums = null; // Normalize the iteration algorithm. + + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. + + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } // Manually invoke the callback for each non-enumerable property. + + + for (length = dontEnums.length; property = dontEnums[--length];) { + if (hasProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + isConstructor; +>>>>>>> update npm module + + // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); +<<<<<<< HEAD +>>>>>>> Updated npm distribution files +======= +======= + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. + + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. + + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; + + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. + + + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. + + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. + + + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } +>>>>>>> branch for npm and latest release +>>>>>>> branch for npm and latest release + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. +>>>>>>> Updated npm distribution files + + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. + + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. + + + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } + + isSigned = false; // Parse the integer component. + + for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { + } // Floats cannot contain a leading decimal point; however, this // case is already accounted for by the parser. @@ -21776,6 +22072,7 @@ * @param {*} key */ +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD }, { @@ -21790,6 +22087,8 @@ ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module <<<<<<< HEAD var debug_1$1 = createCommonjsModule(function (module, exports) { /** @@ -21808,6 +22107,8 @@ ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module results[value.slice(1)] = get(lex()); } >>>>>>> branch for npm and latest release @@ -21889,6 +22190,7 @@ } } <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -21911,7 +22213,12 @@ exports.humanize = ms; >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module store.deserialize = function (value) { if (typeof value != 'string') { @@ -22419,6 +22726,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> Updated npm distribution files ======= <<<<<<< HEAD @@ -22426,6 +22734,9 @@ ======= <<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +<<<<<<< HEAD +>>>>>>> update npm module <<<<<<< HEAD }, { @@ -22444,6 +22755,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module return parse$2(str); >>>>>>> Updated npm distribution files } @@ -22453,11 +22766,10 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module return parse$3(str); -======= - return parse$2(str); ->>>>>>> Updated npm distribution files } >>>>>>> branch for npm and latest release /** @@ -22481,6 +22793,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { function LotameStorage() { @@ -22491,6 +22804,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module this.storage = Storage$1; // new Storage(); ======= @@ -22499,8 +22814,12 @@ ======= >>>>>>> Updated npm distribution files ======= +>>>>>>> update npm module +======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -22512,6 +22831,7 @@ ======= function parse$3(str) { <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> add querystring parse to npm module <<<<<<< HEAD >>>>>>> add querystring parse to npm module @@ -22521,7 +22841,12 @@ function parse$2(str) { >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module var obj = {}; var pairs = str.split(/ *; */); var pair; @@ -23321,6 +23646,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); ======= @@ -23329,6 +23655,8 @@ ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); ======= var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); @@ -23342,7 +23670,13 @@ var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); +>>>>>>> update npm module +>>>>>>> update npm module return prefixedVal; } /** @@ -23360,6 +23694,7 @@ if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ======= @@ -23368,6 +23703,8 @@ ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); ======= return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); @@ -23381,7 +23718,13 @@ return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); +>>>>>>> update npm module +>>>>>>> update npm module } return value; @@ -24049,6 +24392,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { ======= @@ -24058,6 +24402,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module <<<<<<< HEAD var Optimizely = /*#__PURE__*/ @@ -24067,6 +24413,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module var Optimizely = /*#__PURE__*/function () { >>>>>>> update npm module function Optimizely(config, analytics) { @@ -24096,7 +24444,13 @@ function () { >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + var Optimizely = /*#__PURE__*/function () { +>>>>>>> update npm module +>>>>>>> update npm module function Optimizely(config, analytics) { var _this = this; @@ -24836,6 +25190,7 @@ }; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= var Optimizely = /*#__PURE__*/function () { function Optimizely(config, analytics) { @@ -24849,6 +25204,8 @@ >>>>>>> update npm module ======= +======= +>>>>>>> update npm module >>>>>>> update npm module ======= @@ -24916,570 +25273,20 @@ }; >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module - this.sendDataToRudder = function (campaignState) { - logger.debug(campaignState); - var experiment = campaignState.experiment; - var variation = campaignState.variation; - var context = { - integrations: { - All: true - } - }; - var audiences = campaignState.audiences; // Reformatting this data structure into hash map so concatenating variation ids and names is easier later - - var audiencesMap = {}; - audiences.forEach(function (audience) { - audiencesMap[audience.id] = audience.name; - }); - var audienceIds = Object.keys(audiencesMap).sort().join(); - var audienceNames = Object.values(audiencesMap).sort().join(", "); - - if (_this.sendExperimentTrack) { - var props = { - campaignName: campaignState.campaignName, - campaignId: campaignState.id, - experimentId: experiment.id, - experimentName: experiment.name, - variationName: variation.name, - variationId: variation.id, - audienceId: audienceIds, - // eg. '7527562222,7527111138' - audienceName: audienceNames, - // eg. 'Peaky Blinders, Trust Tree' - isInCampaignHoldback: campaignState.isInCampaignHoldback - }; // If this was a redirect experiment and the effective referrer is different from document.referrer, - // this value is made available. So if a customer came in via google.com/ad -> tb12.com -> redirect experiment -> Belichickgoat.com - // `experiment.referrer` would be google.com/ad here NOT `tb12.com`. - - if (experiment.referrer) { - props.referrer = experiment.referrer; - context.page = { - referrer: experiment.referrer - }; - } // For Google's nonInteraction flag - - - if (_this.sendExperimentTrackAsNonInteractive) props.nonInteraction = 1; // If customCampaignProperties is provided overide the props with it. - // If valid customCampaignProperties present it will override existing props. - // const data = window.optimizely && window.optimizely.get("data"); - - var data = campaignState; - - if (data && _this.customCampaignProperties.length > 0) { - for (var index = 0; index < _this.customCampaignProperties.length; index += 1) { - var rudderProp = _this.customCampaignProperties[index].from; - var optimizelyProp = _this.customCampaignProperties[index].to; - - if (typeof props[optimizelyProp] !== "undefined") { - props[rudderProp] = props[optimizelyProp]; - delete props[optimizelyProp]; - } - } - } // Send to Rudder - - - _this.analytics.track("Experiment Viewed", props, context); - } - - if (_this.sendExperimentIdentify) { - var traits = {}; - traits["Experiment: ".concat(experiment.name)] = variation.name; // Send to Rudder - - _this.analytics.identify(traits); - } - }; - - this.analytics = analytics; - this.sendExperimentTrack = config.sendExperimentTrack; - this.sendExperimentIdentify = config.sendExperimentIdentify; - this.sendExperimentTrackAsNonInteractive = config.sendExperimentTrackAsNonInteractive; - this.revenueOnlyOnOrderCompleted = config.revenueOnlyOnOrderCompleted; - this.trackCategorizedPages = config.trackCategorizedPages; - this.trackNamedPages = config.trackNamedPages; - this.customCampaignProperties = config.customCampaignProperties ? config.customCampaignProperties : []; - this.customExperimentProperties = config.customExperimentProperties ? config.customExperimentProperties : []; - this.name = "OPTIMIZELY"; - } - - _createClass(Optimizely, [{ - key: "init", - value: function init() { - logger.debug("=== in optimizely init ==="); - this.initOptimizelyIntegration(this.referrerOverride, this.sendDataToRudder); - } - }, { - key: "initOptimizelyIntegration", - value: function initOptimizelyIntegration(referrerOverride, sendCampaignData) { - var newActiveCampaign = function newActiveCampaign(id, referrer) { - var state = window.optimizely.get && window.optimizely.get("state"); - - if (state) { - var activeCampaigns = state.getCampaignStates({ - isActive: true - }); - var campaignState = activeCampaigns[id]; - if (referrer) campaignState.experiment.referrer = referrer; - sendCampaignData(campaignState); - } - }; - - var checkReferrer = function checkReferrer() { - var state = window.optimizely.get && window.optimizely.get("state"); - - if (state) { - var referrer = state.getRedirectInfo() && state.getRedirectInfo().referrer; - - if (referrer) { - referrerOverride(referrer); - return referrer; - } - } - - return undefined; - }; - - var registerFutureActiveCampaigns = function registerFutureActiveCampaigns() { - window.optimizely = window.optimizely || []; - window.optimizely.push({ - type: "addListener", - filter: { - type: "lifecycle", - name: "campaignDecided" - }, - handler: function handler(event) { - var id = event.data.campaign.id; - newActiveCampaign(id); - } - }); - }; - - var registerCurrentlyActiveCampaigns = function registerCurrentlyActiveCampaigns() { - window.optimizely = window.optimizely || []; - var state = window.optimizely.get && window.optimizely.get("state"); - - if (state) { - var referrer = checkReferrer(); - var activeCampaigns = state.getCampaignStates({ - isActive: true - }); - Object.keys(activeCampaigns).forEach(function (id) { - if (referrer) { - newActiveCampaign(id, referrer); - } else { - newActiveCampaign(id); - } - }); - } else { - window.optimizely.push({ - type: "addListener", - filter: { - type: "lifecycle", - name: "initialized" - }, - handler: function handler() { - checkReferrer(); - } - }); - } - }; - - registerCurrentlyActiveCampaigns(); - registerFutureActiveCampaigns(); - } - }, { - key: "track", - value: function track(rudderElement) { - logger.debug("in Optimizely web track"); - var eventProperties = rudderElement.message.properties; - var event = rudderElement.message.event; - - if (eventProperties.revenue && this.revenueOnlyOnOrderCompleted) { - if (event === "Order Completed") { - eventProperties.revenue = Math.round(eventProperties.revenue * 100); - } else if (event !== "Order Completed") { - delete eventProperties.revenue; - } - } - - var eventName = event.replace(/:/g, "_"); // can't have colons so replacing with underscores - - var payload = { - type: "event", - eventName: eventName, - tags: eventProperties - }; - window.optimizely.push(payload); - } - }, { - key: "page", - value: function page(rudderElement) { - logger.debug("in Optimizely web page"); - var category = rudderElement.message.properties.category; - var name = rudderElement.message.name; - /* const contextOptimizely = { - integrations: { All: false, Optimizely: true }, - }; */ - // categorized pages - - if (category && this.trackCategorizedPages) { - // this.analytics.track(`Viewed ${category} page`, {}, contextOptimizely); - rudderElement.message.event = "Viewed ".concat(category, " page"); - rudderElement.message.type = "track"; - this.track(rudderElement); - } // named pages - - - if (name && this.trackNamedPages) { - // this.analytics.track(`Viewed ${name} page`, {}, contextOptimizely); - rudderElement.message.event = "Viewed ".concat(name, " page"); - rudderElement.message.type = "track"; - this.track(rudderElement); - } - } - }, { - key: "isLoaded", - value: function isLoaded() { - return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); - } - }, { - key: "isReady", - value: function isReady() { - return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); - } - }]); - - return Optimizely; - }(); - - var Bugsnag = /*#__PURE__*/function () { - function Bugsnag(config) { - _classCallCheck(this, Bugsnag); - - this.releaseStage = config.releaseStage; - this.apiKey = config.apiKey; - this.name = "BUGSNAG"; - this.setIntervalHandler = undefined; - } - - _createClass(Bugsnag, [{ - key: "init", - value: function init() { - logger.debug("===in init Bugsnag==="); - ScriptLoader("bugsnag-id", "https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js"); - this.setIntervalHandler = setInterval(this.initBugsnagClient.bind(this), 1000); - } - }, { - key: "initBugsnagClient", - value: function initBugsnagClient() { - if (window.bugsnag !== undefined) { - window.bugsnagClient = window.bugsnag(this.apiKey); - window.bugsnagClient.releaseStage = this.releaseStage; - clearInterval(this.setIntervalHandler); - } - } - }, { - key: "isLoaded", - value: function isLoaded() { - logger.debug("in bugsnag isLoaded"); - return !!window.bugsnagClient; - } - }, { - key: "isReady", - value: function isReady() { - logger.debug("in bugsnag isReady"); - return !!window.bugsnagClient; - } - }, { - key: "identify", - value: function identify(rudderElement) { - var traits = rudderElement.message.context.traits; - var traitsFinal = { - id: rudderElement.message.userId || rudderElement.message.anonymousId, - name: traits.name, - email: traits.email - }; - window.bugsnagClient.user = traitsFinal; - window.bugsnagClient.notify(new Error("error in identify")); - } - }]); - - return Bugsnag; - }(); - - function preserveCamelCase(str) { - let isLastCharLower = false; - let isLastCharUpper = false; - let isLastLastCharUpper = false; - - for (let i = 0; i < str.length; i++) { - const c = str[i]; - - if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { - str = str.substr(0, i) + '-' + str.substr(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { - str = str.substr(0, i - 1) + '-' + str.substr(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = c.toLowerCase() === c; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = c.toUpperCase() === c; - } - } - - return str; - } - - var camelcase = function (str) { - if (arguments.length > 1) { - str = Array.from(arguments) - .map(x => x.trim()) - .filter(x => x.length) - .join('-'); - } else { - str = str.trim(); - } - - if (str.length === 0) { - return ''; - } - - if (str.length === 1) { - return str.toLowerCase(); - } - - if (/^[a-z0-9]+$/.test(str)) { - return str; - } - - const hasUpperCase = str !== str.toLowerCase(); - - if (hasUpperCase) { - str = preserveCamelCase(str); - } - - return str - .replace(/^[_.\- ]+/, '') - .toLowerCase() - .replace(/[_.\- ]+(\w|$)/g, (m, p1) => p1.toUpperCase()); - }; - - var Fullstory = /*#__PURE__*/function () { - function Fullstory(config) { - _classCallCheck(this, Fullstory); - - this.fs_org = config.fs_org; - this.fs_debug_mode = config.fs_debug_mode; - this.name = "FULLSTORY"; - } - - _createClass(Fullstory, [{ - key: "init", - value: function init() { - logger.debug("===in init FULLSTORY==="); - window._fs_debug = this.fs_debug_mode; - window._fs_host = "fullstory.com"; - window._fs_script = "edge.fullstory.com/s/fs.js"; - window._fs_org = this.fs_org; - window._fs_namespace = "FS"; - - (function (m, n, e, t, l, o, g, y) { - if (e in m) { - if (m.console && m.console.log) { - m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'); - } - - return; - } - - g = m[e] = function (a, b, s) { - g.q ? g.q.push([a, b, s]) : g._api(a, b, s); - }; - - g.q = []; - o = n.createElement(t); - o.async = 1; - o.crossOrigin = "anonymous"; - o.src = "https://".concat(_fs_script); - y = n.getElementsByTagName(t)[0]; - y.parentNode.insertBefore(o, y); - - g.identify = function (i, v, s) { - g(l, { - uid: i - }, s); - if (v) g(l, v, s); - }; - - g.setUserVars = function (v, s) { - g(l, v, s); - }; - - g.event = function (i, v, s) { - g("event", { - n: i, - p: v - }, s); - }; - - g.shutdown = function () { - g("rec", !1); - }; - - g.restart = function () { - g("rec", !0); - }; - - g.log = function (a, b) { - g("log", [a, b]); - }; - - g.consent = function (a) { - g("consent", !arguments.length || a); - }; - - g.identifyAccount = function (i, v) { - o = "account"; - v = v || {}; - v.acctId = i; - g(o, v); - }; - - g.clearUserCookie = function () {}; - - g._w = {}; - y = "XMLHttpRequest"; - g._w[y] = m[y]; - y = "fetch"; - g._w[y] = m[y]; - if (m[y]) m[y] = function () { - return g._w[y].apply(this, arguments); - }; - })(window, document, window._fs_namespace, "script", "user"); - } - }, { - key: "page", - value: function page(rudderElement) { - logger.debug("in FULLSORY page"); - var rudderMessage = rudderElement.message; - var pageName = rudderMessage.name; - - var props = _objectSpread2({ - name: pageName - }, rudderMessage.properties); - - window.FS.event("Viewed a Page", Fullstory.getFSProperties(props)); - } - }, { - key: "identify", - value: function identify(rudderElement) { - logger.debug("in FULLSORY identify"); - var userId = rudderElement.message.userId; - var traits = rudderElement.message.context.traits; - if (!userId) userId = rudderElement.message.anonymousId; - if (Object.keys(traits).length === 0 && traits.constructor === Object) window.FS.identify(userId);else window.FS.identify(userId, Fullstory.getFSProperties(traits)); - } - }, { - key: "track", - value: function track(rudderElement) { - logger.debug("in FULLSTORY track"); - window.FS.event(rudderElement.message.event, Fullstory.getFSProperties(rudderElement.message.properties)); - } - }, { - key: "isLoaded", - value: function isLoaded() { - logger.debug("in FULLSTORY isLoaded"); - return !!window.FS; - } - }], [{ - key: "getFSProperties", - value: function getFSProperties(properties) { - var FS_properties = {}; - Object.keys(properties).map(function (key, index) { - FS_properties[key === "displayName" || key === "email" ? key : Fullstory.camelCaseField(key)] = properties[key]; - }); - return FS_properties; - } - }, { - key: "camelCaseField", - value: function camelCaseField(fieldName) { - // Do not camel case across type suffixes. - var parts = fieldName.split("_"); - - if (parts.length > 1) { - var typeSuffix = parts.pop(); - - switch (typeSuffix) { - case "str": - case "int": - case "date": - case "real": - case "bool": - case "strs": - case "ints": - case "dates": - case "reals": - case "bools": - return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); - - } - } // No type suffix found. Camel case the whole field name. - - - return camelcase(fieldName); - } - }]); - - return Fullstory; - }(); - - // (config-plan name, native destination.name , exported integration name(this one below)) - - var integrations = { - HS: index, - GA: index$1, - HOTJAR: index$2, - GOOGLEADS: index$3, - VWO: VWO, - GTM: GoogleTagManager, - BRAZE: Braze, - INTERCOM: INTERCOM, - KEEN: Keen, - KISSMETRICS: Kissmetrics, - CUSTOMERIO: CustomerIO, - CHARTBEAT: Chartbeat, - COMSCORE: Comscore, - FACEBOOK_PIXEL: FacebookPixel, - LOTAME: Lotame, - OPTIMIZELY: Optimizely, - BUGSNAG: Bugsnag, - FULLSTORY: Fullstory - }; - - // Application class - var RudderApp = function RudderApp() { - _classCallCheck(this, RudderApp); - - this.build = "1.0.0"; - this.name = "RudderLabs JavaScript SDK"; - this.namespace = "com.rudderlabs.javascript"; - this.version = "1.0.7"; - }; - - // Library information class - var RudderLibraryInfo = function RudderLibraryInfo() { - _classCallCheck(this, RudderLibraryInfo); + // Library information class + var RudderLibraryInfo = function RudderLibraryInfo() { + _classCallCheck(this, RudderLibraryInfo); this.name = "RudderLabs JavaScript SDK"; - this.version = "1.0.7"; + this.version = "1.0.10"; }; // Operating System information class +>>>>>>> update npm module var RudderOSInfo = function RudderOSInfo() { @@ -25805,6 +25612,7 @@ var i = offset || 0; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 @@ -25814,6 +25622,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return ([ @@ -25856,7 +25666,15 @@ ]).join(''); >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= + var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + + return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); +>>>>>>> update npm module +>>>>>>> update npm module } var bytesToUuid_1 = bytesToUuid; @@ -25876,6 +25694,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= // See https://github.com/uuidjs/uuid for API details >>>>>>> Updated npm distribution files @@ -25885,6 +25704,8 @@ >>>>>>> branch for npm and latest release >>>>>>> branch for npm and latest release ======= +======= +>>>>>>> update npm module // See https://github.com/uuidjs/uuid for API details ======= >>>>>>> branch for npm and latest release @@ -25893,7 +25714,12 @@ // See https://github.com/uuidjs/uuid for API details >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; @@ -26199,6 +26025,7 @@ quotaExceeded = true; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD break; @@ -26216,11 +26043,15 @@ ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module } break; ======= ======= >>>>>>> Updated npm distribution files +======= +>>>>>>> update npm module break; case 1014: @@ -26231,6 +26062,7 @@ break; <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -26241,7 +26073,12 @@ break; >>>>>>> Updated npm distribution files >>>>>>> Updated npm distribution files +<<<<<<< HEAD >>>>>>> Updated npm distribution files +======= +======= +>>>>>>> update npm module +>>>>>>> update npm module } } else if (e.number === -2147024882) { // Internet Explorer 8 From ba24390f698de25d61f1e328919689a08abfe505 Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Tue, 8 Sep 2020 22:16:22 +0530 Subject: [PATCH 18/20] update npm module --- dist/rudder-sdk-js/index.js | 78 ++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 2 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 5be24f3537..96b1ac9c5e 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -2,6 +2,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -28,6 +29,8 @@ ======= >>>>>>> Updated npm distribution files ======= +>>>>>>> update npm module +======= >>>>>>> update npm module typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : @@ -35,6 +38,7 @@ }(this, (function (exports) { 'use strict'; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -55,6 +59,8 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= >>>>>>> update npm module function _typeof(obj) { @@ -1244,6 +1250,7 @@ >>>>>>> branch for npm and latest release <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ======= @@ -1322,6 +1329,11 @@ var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; >>>>>>> update npm module >>>>>>> update npm module +<<<<<<< HEAD +======= +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; +>>>>>>> update npm module >>>>>>> update npm module >>>>>>> update npm module var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; @@ -19581,6 +19593,10 @@ >>>>>>> Updated npm distribution files ======= <<<<<<< HEAD +<<<<<<< HEAD +>>>>>>> update npm module +======= +<<<<<<< HEAD >>>>>>> update npm module (function () { // Detect the `define` function exposed by asynchronous module loaders. The @@ -19819,6 +19835,8 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= >>>>>>> update npm module (function () { // Detect the `define` function exposed by asynchronous module loaders. The @@ -19880,6 +19898,7 @@ ======= <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -19958,6 +19977,8 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= >>>>>>> update npm module } } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. @@ -22035,6 +22056,7 @@ var domain = ".".concat(lib(window.location.href)); if (domain === ".") domain = null; // the default maxage and path +<<<<<<< HEAD this._options = defaults_1(_options, { maxage: 31536000000, path: "/", @@ -22108,6 +22130,8 @@ ======= >>>>>>> Updated npm distribution files ======= +>>>>>>> update npm module +======= >>>>>>> update npm module results[value.slice(1)] = get(lex()); } @@ -22191,6 +22215,7 @@ } <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -22218,6 +22243,8 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= >>>>>>> update npm module store.deserialize = function (value) { @@ -22727,6 +22754,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> Updated npm distribution files ======= <<<<<<< HEAD @@ -22737,6 +22765,9 @@ ======= <<<<<<< HEAD >>>>>>> update npm module +======= +<<<<<<< HEAD +>>>>>>> update npm module <<<<<<< HEAD }, { @@ -22767,6 +22798,8 @@ ======= >>>>>>> Updated npm distribution files ======= +>>>>>>> update npm module +======= >>>>>>> update npm module return parse$3(str); @@ -22794,6 +22827,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { function LotameStorage() { @@ -22805,6 +22839,8 @@ ======= >>>>>>> Updated npm distribution files ======= +>>>>>>> update npm module +======= >>>>>>> update npm module this.storage = Storage$1; // new Storage(); @@ -22846,6 +22882,10 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= + + function parse$3(str) { >>>>>>> update npm module var obj = {}; var pairs = str.split(/ *; */); @@ -23647,6 +23687,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); ======= @@ -23676,6 +23717,9 @@ ======= var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); >>>>>>> update npm module +>>>>>>> update npm module +======= + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); >>>>>>> update npm module return prefixedVal; } @@ -23695,6 +23739,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ======= @@ -23724,6 +23769,9 @@ ======= return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); >>>>>>> update npm module +>>>>>>> update npm module +======= + return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); >>>>>>> update npm module } @@ -24393,6 +24441,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { ======= @@ -24404,6 +24453,8 @@ >>>>>>> Updated npm distribution files ======= >>>>>>> update npm module +======= +>>>>>>> update npm module <<<<<<< HEAD var Optimizely = /*#__PURE__*/ @@ -24436,6 +24487,7 @@ >>>>>>> branch for npm and latest release ======= ======= +<<<<<<< HEAD var Optimizely = /*#__PURE__*/function () { ======= <<<<<<< HEAD @@ -24448,8 +24500,13 @@ >>>>>>> Updated npm distribution files ======= ======= - var Optimizely = /*#__PURE__*/function () { >>>>>>> update npm module +======= +>>>>>>> update npm module +<<<<<<< HEAD +>>>>>>> update npm module +======= + var Optimizely = /*#__PURE__*/function () { >>>>>>> update npm module function Optimizely(config, analytics) { var _this = this; @@ -25191,6 +25248,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= var Optimizely = /*#__PURE__*/function () { function Optimizely(config, analytics) { @@ -25277,6 +25335,8 @@ >>>>>>> Updated npm distribution files ======= ======= +>>>>>>> update npm module +======= >>>>>>> update npm module // Library information class @@ -25286,7 +25346,6 @@ this.name = "RudderLabs JavaScript SDK"; this.version = "1.0.10"; }; // Operating System information class ->>>>>>> update npm module var RudderOSInfo = function RudderOSInfo() { @@ -25613,6 +25672,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 @@ -25674,6 +25734,11 @@ return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); >>>>>>> update npm module +>>>>>>> update npm module +======= + var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 + + return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); >>>>>>> update npm module } @@ -25695,6 +25760,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= // See https://github.com/uuidjs/uuid for API details >>>>>>> Updated npm distribution files @@ -25719,6 +25785,8 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= >>>>>>> update npm module function v1(options, buf, offset) { var i = buf && offset || 0; @@ -26026,6 +26094,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD break; @@ -26051,6 +26120,8 @@ ======= >>>>>>> Updated npm distribution files ======= +>>>>>>> update npm module +======= >>>>>>> update npm module break; @@ -26063,6 +26134,7 @@ break; <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> branch for npm and latest release <<<<<<< HEAD >>>>>>> branch for npm and latest release @@ -26078,6 +26150,8 @@ ======= ======= >>>>>>> update npm module +>>>>>>> update npm module +======= >>>>>>> update npm module } } else if (e.number === -2147024882) { From f54eadb026f96a739d823599bace2ff16121db5b Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Wed, 16 Sep 2020 11:37:30 +0530 Subject: [PATCH 19/20] resolve conflicts --- dist/rudder-sdk-js/index.js | 2773 +++++++++++++++++------------------ 1 file changed, 1365 insertions(+), 1408 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 96b1ac9c5e..00de07c9a7 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -1,67 +1,8 @@ (function (global, factory) { -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : - typeof define === 'function' && define.amd ? define(['exports'], factory) : - (global = global || self, factory(global.rudderanalytics = {})); -}(this, (function (exports) { 'use strict'; -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : - typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : - (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); -}(this, (function (exports, AES, Utf8) { 'use strict'; - - AES = AES && Object.prototype.hasOwnProperty.call(AES, 'default') ? AES['default'] : AES; - Utf8 = Utf8 && Object.prototype.hasOwnProperty.call(Utf8, 'default') ? Utf8['default'] : Utf8; -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.rudderanalytics = {})); }(this, (function (exports) { 'use strict'; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= -======= - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('crypto-js/aes'), require('crypto-js/enc-utf8')) : - typeof define === 'function' && define.amd ? define(['exports', 'crypto-js/aes', 'crypto-js/enc-utf8'], factory) : - (global = global || self, factory(global.rudderanalytics = {}, global.AES, global.Utf8)); -}(this, (function (exports, AES, Utf8) { 'use strict'; - - AES = AES && Object.prototype.hasOwnProperty.call(AES, 'default') ? AES['default'] : AES; - Utf8 = Utf8 && Object.prototype.hasOwnProperty.call(Utf8, 'default') ? Utf8['default'] : Utf8; ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> update npm module function _typeof(obj) { "@babel/helpers - typeof"; @@ -220,7 +161,6 @@ } return obj; -<<<<<<< HEAD } /** * Listen on the given `event` with `fn`. @@ -580,6 +520,7 @@ * @api public */ +<<<<<<< HEAD ======= } /** @@ -882,120 +823,8 @@ ======= >>>>>>> branch for npm and latest release - - exports.isAbsolute = function (url) { - return 0 == url.indexOf('//') || !!~url.indexOf('://'); - }; - /** - * Check if `url` is relative. - * - * @param {String} url - * @return {Boolean} - * @api public - */ - -<<<<<<< HEAD - - exports.isRelative = function (url) { - return !exports.isAbsolute(url); - }; - /** - * Check if `url` is cross domain. - * - * @param {String} url - * @return {Boolean} - * @api public - */ - - - exports.isCrossDomain = function (url) { - url = exports.parse(url); - var location = exports.parse(window.location.href); - return url.hostname !== location.hostname || url.port !== location.port || url.protocol !== location.protocol; - }; - /** - * Return default port for `protocol`. - * - * @param {String} protocol - * @return {String} - * @api private - */ ======= - function after(count, callback, err_cb) { - var bail = false; - err_cb = err_cb || noop; - proxy.count = count; - return count === 0 ? callback() : proxy; - - function proxy(err, result) { - if (proxy.count <= 0) { - throw new Error('after called too many times'); - } - - --proxy.count; // after first error, rest are passed to err_cb - - if (err) { - bail = true; - callback(err); // future error callbacks will go to error handler - - callback = err_cb; - } else if (proxy.count === 0 && !bail) { - callback(null, result); - } - } - } ->>>>>>> branch for npm and latest release - - - function port(protocol) { - switch (protocol) { - case 'http:': - return 80; - - case 'https:': - return 443; - - default: - return location.port; - } - } - }); - var componentUrl_1 = componentUrl.parse; - var componentUrl_2 = componentUrl.isAbsolute; - var componentUrl_3 = componentUrl.isRelative; - var componentUrl_4 = componentUrl.isCrossDomain; - - var componentUrl = createCommonjsModule(function (module, exports) { - /** - * Parse the given `url`. - * - * @param {String} str - * @return {Object} - * @api public - */ - exports.parse = function (url) { - var a = document.createElement('a'); - a.href = url; - return { - href: a.href, - host: a.host || location.host, - port: '0' === a.port || '' === a.port ? port(a.protocol) : a.port, - hash: a.hash, - hostname: a.hostname || location.hostname, - pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname, - protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol, - search: a.search, - query: a.search.slice(1) - }; - }; - /** - * Check if `url` is absolute. - * - * @param {String} url - * @return {Boolean} - * @api public - */ - +>>>>>>> resolve conflicts exports.isAbsolute = function (url) { return 0 == url.indexOf('//') || !!~url.indexOf('://'); @@ -1219,6 +1048,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ======= @@ -1336,6 +1166,9 @@ >>>>>>> update npm module >>>>>>> update npm module >>>>>>> update npm module +======= + var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; +>>>>>>> resolve conflicts var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -2703,6 +2536,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= >>>>>>> branch for npm and latest release ======= @@ -2723,6 +2557,9 @@ var toString$1 = Object.prototype.toString; >>>>>>> add querystring parse to npm module >>>>>>> add querystring parse to npm module +======= + var toString$1 = Object.prototype.toString; +>>>>>>> resolve conflicts /** * Return the type of `val`. * @@ -2734,6 +2571,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { @@ -2762,6 +2600,10 @@ switch (toString$1.call(val)) { >>>>>>> add querystring parse to npm module >>>>>>> add querystring parse to npm module +======= + var componentType$1 = function componentType(val) { + switch (toString$1.call(val)) { +>>>>>>> resolve conflicts case '[object Function]': return 'function'; @@ -4527,6 +4369,7 @@ for (var i = 0; i < n.length; i++) { n[i] = crypt.endian(n[i]); } +<<<<<<< HEAD <<<<<<< HEAD return n; @@ -4581,6 +4424,8 @@ >>>>>>> branch for npm and latest release ======= +======= +>>>>>>> resolve conflicts return n; }, @@ -4631,7 +4476,6 @@ for (var base64 = [], i = 0; i < bytes.length; i += 3) { var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; ->>>>>>> branch for npm and latest release for (var j = 0; j < 4; j++) { if (i * 8 + j * 6 <= bytes.length * 8) base64.push(base64map.charAt(triplet >>> 6 * (3 - j) & 0x3F));else base64.push('='); } @@ -5293,42 +5137,6 @@ } } } -<<<<<<< HEAD - - key = undefined; // if we found no matching properties - // on the current object, there's no match. - - finished = true; - } - - if (!key) return; - if (null == obj) return obj; // the `obj` and `key` is one above the leaf object and key, so - // start object: { a: { 'b.c': 10 } } - // end object: { 'b.c': 10 } - // end key: 'b.c' - // this way, you can do `obj[key]` and get `10`. - - return fn(obj, key, val); - }; - } - /** - * Find an object by its key - * - * find({ first_name : 'Calvin' }, 'firstName') - */ - - - function find(obj, key) { - if (obj.hasOwnProperty(key)) return obj[key]; - } - /** - * Delete a value for a given key - * - * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } - */ - - -======= key = undefined; // if we found no matching properties // on the current object, there's no match. @@ -5397,7 +5205,6 @@ ======= >>>>>>> branch for npm and latest release ->>>>>>> branch for npm and latest release function del(obj, key) { if (obj.hasOwnProperty(key)) delete obj[key]; return obj; @@ -6968,6 +6775,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD ======= (function (root, factory) { { @@ -7725,6 +7533,8 @@ >>>>>>> branch for npm and latest release ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> resolve conflicts (function (root, factory) { { @@ -8166,323 +7976,16 @@ words.push(_r() * 0x100000000 | 0); } -======= - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(); - } - })(commonjsGlobal, function () { - /** - * CryptoJS core components. - */ - var CryptoJS = CryptoJS || function (Math, undefined$1) { - /* - * Local polyfil of Object.create - */ - var create = Object.create || function () { - function F() {} - return function (obj) { - var subtype; - F.prototype = obj; - subtype = new F(); - F.prototype = null; - return subtype; - }; - }(); - /** - * CryptoJS namespace. - */ - - - var C = {}; + return new WordArray.init(words, nBytes); + } + }); /** - * Library namespace. + * Encoder namespace. */ - var C_lib = C.lib = {}; + var C_enc = C.enc = {}; /** - * Base object for prototypal inheritance. - */ - - var Base = C_lib.Base = function () { - return { - /** - * Creates a new object that inherits from this object. - * - * @param {Object} overrides Properties to copy into the new object. - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * field: 'value', - * - * method: function () { - * } - * }); - */ - extend: function extend(overrides) { - // Spawn - var subtype = create(this); // Augment - - if (overrides) { - subtype.mixIn(overrides); - } // Create default initializer - - - if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { - subtype.init = function () { - subtype.$super.init.apply(this, arguments); - }; - } // Initializer's prototype is the subtype object - - - subtype.init.prototype = subtype; // Reference supertype - - subtype.$super = this; - return subtype; - }, - - /** - * Extends this object and runs the init method. - * Arguments to create() will be passed to init(). - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var instance = MyType.create(); - */ - create: function create() { - var instance = this.extend(); - instance.init.apply(instance, arguments); - return instance; - }, - - /** - * Initializes a newly created object. - * Override this method to add some logic when your objects are created. - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * init: function () { - * // ... - * } - * }); - */ - init: function init() {}, - - /** - * Copies properties into this object. - * - * @param {Object} properties The properties to mix in. - * - * @example - * - * MyType.mixIn({ - * field: 'value' - * }); - */ - mixIn: function mixIn(properties) { - for (var propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - this[propertyName] = properties[propertyName]; - } - } // IE won't copy toString using the loop above - - - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function clone() { - return this.init.prototype.extend(this); - } - }; - }(); - /** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ - - - var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function init(words, sigBytes) { - words = this.words = words || []; - - if (sigBytes != undefined$1) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, - - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function toString(encoder) { - return (encoder || Hex).stringify(this); - }, - - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function concat(wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; // Clamp excess bits - - this.clamp(); // Concat - - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; - } - } - - this.sigBytes += thatSigBytes; // Chainable - - return this; - }, - - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function clamp() { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; // Clamp - - words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; - words.length = Math.ceil(sigBytes / 4); - }, - - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - return clone; - }, - - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function random(nBytes) { - var words = []; - - var r = function r(m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - return function () { - m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; - m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; - var result = (m_z << 0x10) + m_w & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - }; - }; - - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); - - rcache = _r() * 0x3ade67b7; - words.push(_r() * 0x100000000 | 0); - } - ->>>>>>> branch for npm and latest release - return new WordArray.init(words, nBytes); - } - }); - /** - * Encoder namespace. - */ - - var C_enc = C.enc = {}; - /** - * Hex encoding strategy. + * Hex encoding strategy. */ var Hex = C_enc.Hex = { @@ -8511,7 +8014,6 @@ hexChars.push((bite >>> 4).toString(16)); hexChars.push((bite & 0x0f).toString(16)); } -<<<<<<< HEAD return hexChars.join(''); }, @@ -10700,136 +10202,52 @@ /** * toString ref. */ - var toString$2 = Object.prototype.toString; - /** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ - - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { - 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'; - } - - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - if (isBuffer$1(val)) return 'buffer'; - val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); - return _typeof(val); - }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - - - function isBuffer$1(obj) { - return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); - } -======= - - return hexChars.join(''); - }, - - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Hex.parse(hexString); - */ - parse: function parse(hexStr) { - // Shortcut - var hexStrLength = hexStr.length; // Convert - - var words = []; - - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; - } - - return new WordArray.init(words, hexStrLength / 2); - } - }; - /** - * Latin1 encoding strategy. - */ - - var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert + var toString$2 = Object.prototype.toString; + /** + * Return the type of `val`. + * + * @param {Mixed} val + * @return {String} + * @api public + */ - var latin1Chars = []; + var componentType$2 = function componentType(val) { + switch (toString$2.call(val)) { + case '[object Date]': + return 'date'; - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } ->>>>>>> branch for npm and latest release + case '[object RegExp]': + return 'regexp'; - return latin1Chars.join(''); - }, + case '[object Arguments]': + return 'arguments'; - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function parse(latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; // Convert + case '[object Array]': + return 'array'; - var words = []; + case '[object Error]': + return 'error'; + } - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; - } + if (val === null) return 'null'; + if (val === undefined) return 'undefined'; + if (val !== val) return 'nan'; + if (val && val.nodeType === 1) return 'element'; + if (isBuffer$1(val)) return 'buffer'; + val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); + return _typeof(val); + }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js + + + function isBuffer$1(obj) { + return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) + obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); + } + + /* + * Module dependencies. + */ -<<<<<<< HEAD /** * Deeply clone an object. * @@ -10861,94 +10279,29 @@ return copy; } -======= - return new WordArray.init(words, latin1StrLength); - } - }; - /** - * UTF-8 encoding strategy. - */ - - var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function parse(utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); - } - }; - /** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 - */ + if (t === 'regexp') { + // from millermedeiros/amd-utils - MIT + var flags = ''; + flags += obj.multiline ? 'm' : ''; + flags += obj.global ? 'g' : ''; + flags += obj.ignoreCase ? 'i' : ''; + return new RegExp(obj.source, flags); + } - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function reset() { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; - }, + if (t === 'date') { + return new Date(obj.getTime()); + } // string, number, boolean, etc. - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function _append(data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } // Append + return obj; + }; + /* + * Exports. + */ - this._data.concat(data); +<<<<<<< HEAD this._nDataBytes += data.sigBytes; }, @@ -19151,11 +18504,99 @@ return parse$2(str); >>>>>>> add querystring parse to npm module >>>>>>> add querystring parse to npm module +======= + var clone_1 = clone; + + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse$1(val); + return options["long"] ? _long(val) : _short(val); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + + + function parse$1(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; + + case 'days': + case 'day': + case 'd': + return n * d; + + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } +>>>>>>> resolve conflicts } /** - * Get cookie `name`. + * Short format for `ms`. * - * @param {String} name + * @param {Number} ms * @return {String} * @api private */ @@ -19167,6 +18608,7 @@ return (leadingZeroes + (value || 0)).slice(-width); }; // Internal: Serializes a date object. +<<<<<<< HEAD <<<<<<< HEAD ======= function set(name, value, options) { @@ -19178,10 +18620,27 @@ >>>>>>> branch for npm and latest release if (null == value) options.maxage = -1; >>>>>>> branch for npm and latest release +======= + function _short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ +>>>>>>> resolve conflicts var _serializeDate = function serializeDate(value) { var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD if (!isExtended) { @@ -19222,10 +18681,19 @@ // seconds, and milliseconds if the `getUTC*` methods are // buggy. Adapted from @Yaffle's `date-shim` project. date = floor(value / 864e5); +======= + function _long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } + /** + * Pluralization helper. + */ +>>>>>>> resolve conflicts for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { } +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { @@ -19331,69 +18799,321 @@ }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - var nativeStringify = exports.stringify; + var nativeStringify = exports.stringify; + + exports.stringify = function (source, filter, width) { + var nativeToJSON = Date.prototype.toJSON; + Date.prototype.toJSON = dateToJSON; + var result = nativeStringify(source, filter, width); + Date.prototype.toJSON = nativeToJSON; + return result; + }; + } else { + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; + +<<<<<<< HEAD + var escapeChar = function escapeChar(character) { + var charCode = character.charCodeAt(0), + escaped = Escapes[charCode]; +======= +<<<<<<< HEAD + return parse$2(str); +======= + return parse$1(str); +>>>>>>> branch for npm and latest release + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ +>>>>>>> branch for npm and latest release + + if (escaped) { + return escaped; + } + + return unicodePrefix + toPaddedString(2, charCode.toString(16)); + }; + + var reEscape = /[\x00-\x1f\x22\x5c]/g; + +<<<<<<< HEAD + var quote = function quote(value) { + reEscape.lastIndex = 0; + return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; + }; // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. +======= +<<<<<<< HEAD + function parse$2(str) { +======= + function parse$1(str) { +>>>>>>> branch for npm and latest release + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; +>>>>>>> branch for npm and latest release + +======= + function plural(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 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ + + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ + + exports.formatters = {}; + /** + * Previously assigned color. + */ + + var prevColor = 0; + /** + * Previous log timestamp. + */ + + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ + + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + + + function debug(namespace) { + // define the `disabled` version + function disabled() {} + + disabled.enabled = false; // define the `enabled` version + + function enabled() { + var self = enabled; // set `diff` timestamp + + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set + + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); + + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // 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; + } + } - exports.stringify = function (source, filter, width) { - var nativeToJSON = Date.prototype.toJSON; - Date.prototype.toJSON = dateToJSON; - var result = nativeStringify(source, filter, width); - Date.prototype.toJSON = nativeToJSON; - return result; - }; - } else { - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } + } -<<<<<<< HEAD - var escapeChar = function escapeChar(character) { - var charCode = character.charCodeAt(0), - escaped = Escapes[charCode]; -======= -<<<<<<< HEAD - return parse$2(str); -======= - return parse$1(str); ->>>>>>> branch for npm and latest release - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ ->>>>>>> branch for npm and latest release + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ - if (escaped) { - return escaped; - } - return unicodePrefix + toPaddedString(2, charCode.toString(16)); - }; + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + }); + var debug_2 = debug_1.coerce; + var debug_3 = debug_1.disable; + var debug_4 = debug_1.enable; + var debug_5 = debug_1.enabled; + var debug_6 = debug_1.humanize; + var debug_7 = debug_1.names; + var debug_8 = debug_1.skips; + var debug_9 = debug_1.formatters; - var reEscape = /[\x00-\x1f\x22\x5c]/g; + var browser = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug_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. + */ -<<<<<<< HEAD - var quote = function quote(value) { - reEscape.lastIndex = 0; - return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; - }; // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. -======= -<<<<<<< HEAD - function parse$2(str) { -======= - function parse$1(str) { ->>>>>>> branch for npm and latest release - var obj = {}; - var pairs = str.split(/ *; */); - var pair; - if ('' == pairs[0]) return obj; ->>>>>>> branch for npm and latest release + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; + /** + * Colorize log arguments if enabled. + * + * @api public + */ +>>>>>>> resolve conflicts var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { var value, type, className, results, element, index, length, prefix, result; @@ -19402,6 +19122,7 @@ value = object[property]; }); +<<<<<<< HEAD if (_typeof(value) == "object" && value) { if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { value = _serializeDate(value); @@ -19436,8 +19157,54 @@ /** * Decode. */ +======= + 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 + */ + +>>>>>>> resolve conflicts + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +<<<<<<< HEAD <<<<<<< HEAD function decode$1(value) { ======= @@ -19476,22 +19243,118 @@ } // Recursively serialize objects and arrays. - if (_typeof(value) == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); - } - } // Add the object to the stack of traversed objects. + if (_typeof(value) == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } // Add the object to the stack of traversed objects. + + + stack.push(value); + results = []; // Save the current indentation level and indent one additional level. + + prefix = indentation; + indentation += whitespace; +======= + + 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 = browser.log; + var browser_2 = browser.formatArgs; + var browser_3 = browser.save; + var browser_4 = browser.load; + var browser_5 = browser.useColors; + var browser_6 = browser.storage; + var browser_7 = browser.colors; + + /** + * Module dependencies. + */ + + var debug = browser('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 rudderComponentCookie = function rudderComponentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set(name, value, options); - stack.push(value); - results = []; // Save the current indentation level and indent one additional level. + case 1: + return get$1(name); - prefix = indentation; - indentation += whitespace; + default: + return all(); + } + }; + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ +>>>>>>> resolve conflicts <<<<<<< HEAD if (className == arrayClass) { @@ -19501,6 +19364,7 @@ results.push(element === undefined$1 ? "null" : element); } +<<<<<<< HEAD result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; } else { // Recursively serialize object members. Members are selected from @@ -19703,11 +19567,18 @@ // instead. var root = objectTypes[typeof window] && window || this, freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; +======= + function set(name, value, options) { + options = options || {}; + var str = encode$1(name) + '=' + encode$1(value); + if (null == value) options.maxage = -1; +>>>>>>> resolve conflicts - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; + if (options.maxage) { + options.expires = new Date(+new Date() + options.maxage); } +<<<<<<< HEAD // Public: Initializes JSON 3 using the given `context` object, attaching the // `stringify` and `parse` functions to the specified `exports` object. function runInContext(context, exports) { @@ -19864,10 +19735,50 @@ // string. break; } +======= + 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; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ + + + function all() { + var str; + + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } + + return {}; + } + + return parse$2(str); + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ +>>>>>>> resolve conflicts charCode = source.charCodeAt(Index); begin = Index; // Optimize for the common case where a string is valid. +<<<<<<< HEAD while (charCode >= 32 && charCode != 92 && charCode != 34) { charCode = source.charCodeAt(++Index); } // Append the string as-is. @@ -19917,21 +19828,59 @@ "function": true, "object": true }; +======= + function get$1(name) { + return all()[name]; + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; - // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - var root = objectTypes[typeof window] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; + function parse$2(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. + */ - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; +>>>>>>> resolve conflicts + + function encode$1(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ + + + function decode$1(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); } + } +<<<<<<< HEAD // Public: Initializes JSON 3 using the given `context` object, attaching the // `stringify` and `parse` functions to the specified `exports` object. function runInContext(context, exports) { @@ -19982,211 +19931,181 @@ >>>>>>> update npm module } } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. +======= + var max = Math.max; + /** + * Produce a new array composed of all but the first `n` elements of an input `collection`. + * + * @name drop + * @api public + * @param {number} count The number of elements to drop. + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * drop(0, [1, 2, 3]); // => [1, 2, 3] + * drop(1, [1, 2, 3]); // => [2, 3] + * drop(2, [1, 2, 3]); // => [3] + * drop(3, [1, 2, 3]); // => [] + * drop(4, [1, 2, 3]); // => [] + */ +>>>>>>> resolve conflicts + var drop = function drop(count, collection) { + var length = collection ? collection.length : 0; - var isExtended = new Date(-3509827334573292); - attempt(function () { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - }); // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. - - function has(name) { - if (has[name] != null) { - // Return cached feature test result. - return has[name]; - } - - var isSupported; - - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); - } else if (name == "date-serialization") { - // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. - isSupported = has("json-stringify") && isExtended; - - if (isSupported) { - var stringify = exports.stringify; - attempt(function () { - isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - var value, - serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - - if (name == "json-stringify") { - var stringify = exports.stringify, - stringifySupported = typeof stringify == "function"; - - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function value() { - return 1; - }).toJSON = value; - attempt(function () { - stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ - "a": [value, true, false, null, "\x00\b\n\f\r\t"] - }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, function () { - stringifySupported = false; - }); - } - - isSupported = stringifySupported; - } // Test `JSON.parse`. + if (!length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - if (name == "json-parse") { - var parse = exports.parse, - parseSupported; + var toDrop = max(Number(count) || 0, 0); + var resultsLength = max(length - toDrop, 0); + var results = new Array(resultsLength); - if (typeof parse == "function") { - attempt(function () { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - parseSupported = value["a"].length == 5 && value["a"][0] === 1; + for (var i = 0; i < resultsLength; i += 1) { + results[i] = collection[i + toDrop]; + } - if (parseSupported) { - attempt(function () { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - }); + return results; + }; + /* + * Exports. + */ - if (parseSupported) { - attempt(function () { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - }); - } - if (parseSupported) { - attempt(function () { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - }); - } - } - } - }, function () { - parseSupported = false; - }); - } + var drop_1 = drop; - isSupported = parseSupported; - } - } + var max$1 = Math.max; + /** + * Produce a new array by passing each value in the input `collection` through a transformative + * `iterator` function. The `iterator` function is passed three arguments: + * `(value, index, collection)`. + * + * @name rest + * @api public + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * rest([1, 2, 3]); // => [2, 3] + */ - return has[name] = !!isSupported; - } + var rest = function rest(collection) { + if (collection == null || !collection.length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. + var results = new Array(max$1(collection.length - 2, 0)); - var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. + for (var i = 1; i < collection.length; i += 1) { + results[i - 1] = collection[i]; + } - var _forOwn = function forOwn(object, callback) { - var size = 0, - Properties, - dontEnums, - property; // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + return results; + }; + /* + * Exports. + */ - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - dontEnums = new Properties(); + var rest_1 = rest; - for (property in dontEnums) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(dontEnums, property)) { - size++; - } - } -<<<<<<< HEAD + /* + * Module dependencies. + */ - Properties = dontEnums = null; // Normalize the iteration algorithm. - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. + var has$3 = Object.prototype.hasOwnProperty; + var objToString$1 = Object.prototype.toString; + /** + * Returns `true` if a value is an object, otherwise `false`. + * + * @name isObject + * @api private + * @param {*} val The value to test. + * @return {boolean} + */ + // TODO: Move to a library - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + var isObject = function isObject(value) { + return Boolean(value) && _typeof(value) === 'object'; + }; + /** + * Returns `true` if a value is a plain object, otherwise `false`. + * + * @name isPlainObject + * @api private + * @param {*} val The value to test. + * @return {boolean} + */ + // TODO: Move to a library - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } // Manually invoke the callback for each non-enumerable property. + + var isPlainObject = function isPlainObject(value) { + return Boolean(value) && objToString$1.call(value) === '[object Object]'; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined. + * + * @name shallowCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + */ + + + var shallowCombiner = function shallowCombiner(target, source, value, key) { + if (has$3.call(source, key) && target[key] === undefined) { + target[key] = value; + } + + return source; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined; also merges objects recursively. + * + * @name deepCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + * @return {Object} + */ + + + var deepCombiner = function deepCombiner(target, source, value, key) { + if (has$3.call(source, key)) { + if (isPlainObject(target[key]) && isPlainObject(value)) { + target[key] = defaultsDeep(target[key], value); + } else if (target[key] === undefined) { + target[key] = value; + } + } + + return source; + }; + /** + * TODO: Document + * + * @name defaultsWith + * @api private + * @param {Function} combiner + * @param {Object} target + * @param {...Object} sources + * @return {Object} Return the input `target`. + */ +<<<<<<< HEAD for (length = dontEnums.length; property = dontEnums[--length];) { if (hasProperty.call(object, property)) { callback(property); @@ -20223,19 +20142,75 @@ "object": true }; // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; +======= + var defaultsWith = function defaultsWith(combiner, target + /*, ...sources */ + ) { + if (!isObject(target)) { + return target; + } + + combiner = combiner || shallowCombiner; + var sources = drop_1(2, arguments); + + for (var i = 0; i < sources.length; i += 1) { + for (var key in sources[i]) { + combiner(target, sources[i], sources[i][key], key); + } + } + + return target; + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * Recurses on objects. + * + * @name defaultsDeep + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} The input `target`. + */ + - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; + var defaultsDeep = function defaultsDeep(target + /*, sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * + * @name defaults + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} + * @example + * var a = { a: 1 }; + * var b = { a: 2, b: 2 }; + * + * defaults(a, b); + * console.log(a); //=> { a: 1, b: 2 } + */ +>>>>>>> resolve conflicts if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { root = freeGlobal; } // Public: Initializes JSON 3 using the given `context` object, attaching the // `stringify` and `parse` functions to the specified `exports` object. +<<<<<<< HEAD function runInContext(context, exports) { context || (context = root.Object()); @@ -20348,6 +20323,192 @@ Index = position; } // Coerce the parsed value to a JavaScript number. ======= +======= + var defaults = function defaults(target + /*, ...sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); + }; + /* + * Exports. + */ + + + var defaults_1 = defaults; + var deep = defaultsDeep; + defaults_1.deep = deep; + + var json3 = createCommonjsModule(function (module, exports) { + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. + + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. + + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; + + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. + + + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. + + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. + + + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. + + function attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. + + + var isExtended = new Date(-3509827334573292); + attempt(function () { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + }); // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. + + function has(name) { + if (has[name] != null) { + // Return cached feature test result. + return has[name]; + } + + var isSupported; + + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); + } else if (name == "date-serialization") { + // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. + isSupported = has("json-stringify") && isExtended; + + if (isSupported) { + var stringify = exports.stringify; + attempt(function () { + isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + }); + } + } else { + var value, + serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. + + if (name == "json-stringify") { + var stringify = exports.stringify, + stringifySupported = typeof stringify == "function"; + + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function value() { + return 1; + }).toJSON = value; + attempt(function () { + stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ + "a": [value, true, false, null, "\x00\b\n\f\r\t"] + }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; + }, function () { + stringifySupported = false; + }); + } + + isSupported = stringifySupported; + } // Test `JSON.parse`. + + + if (name == "json-parse") { + var parse = exports.parse, + parseSupported; + + if (typeof parse == "function") { + attempt(function () { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + parseSupported = value["a"].length == 5 && value["a"][0] === 1; + +>>>>>>> resolve conflicts if (parseSupported) { attempt(function () { // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. @@ -20406,6 +20567,15 @@ property; // Tests for bugs in the current environment's `for...in` algorithm. The // `valueOf` property inherits the non-enumerable flag from // `Object.prototype` in older versions of IE, Netscape, and Mozilla. +<<<<<<< HEAD + + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. + + dontEnums = new Properties(); + +======= (Properties = function Properties() { this.valueOf = 0; @@ -20413,6 +20583,7 @@ dontEnums = new Properties(); +>>>>>>> resolve conflicts for (property in dontEnums) { // Ignore all properties inherited from `Object.prototype`. if (isProperty.call(dontEnums, property)) { @@ -20420,6 +20591,9 @@ } } <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> resolve conflicts Properties = dontEnums = null; // Normalize the iteration algorithm. @@ -20829,6 +21003,7 @@ }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. +<<<<<<< HEAD <<<<<<< HEAD exports.parse = function (source, callback) { var result, value; @@ -20837,6 +21012,8 @@ result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> resolve conflicts switch (className || type) { case "boolean": case booleanClass: @@ -21087,6 +21264,7 @@ var debug_8$1 = debug_1$1.skips; var debug_9$1 = debug_1$1.formatters; +<<<<<<< HEAD var browser$1 = createCommonjsModule(function (module, exports) { /** * This is the web browser implementation of `debug()`. @@ -21391,28 +21569,71 @@ * @api private */ -======= - if (value == ",") { - abort(); +======= + if (value == ",") { + abort(); +======= + value += fromCharCode("0x" + source.slice(begin, Index)); + break; + + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } + + charCode = source.charCodeAt(Index); + begin = Index; // Optimize for the common case where a string is valid. + + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } // Append the string as-is. + + + value += source.slice(begin, Index); + } +>>>>>>> resolve conflicts } - results.push(get(value)); - } + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } // Unterminated string. - return results; - } else if (value == "{") { - // Parses a JSON object, returning a new JavaScript object. - results = {}; - for (;;) { - value = lex(); // A closing curly brace marks the end of the object literal. + abort(); +<<<<<<< HEAD if (value == "}") { break; } // If the object literal contains members, the current token // should be a comma separator. ======= >>>>>>> branch for npm and latest release +======= + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. + + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. + + + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } +>>>>>>> resolve conflicts function load() { var r; @@ -21529,6 +21750,7 @@ function all$1() { var str; +<<<<<<< HEAD try { str = document.cookie; } catch (err) { @@ -21747,24 +21969,16 @@ }).call(commonjsGlobal); }); >>>>>>> branch for npm and latest release +======= + Index = position; + } // Coerce the parsed value to a JavaScript number. - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ +>>>>>>> resolve conflicts + + return +source.slice(begin, Index); + } // A negative sign may only precede numbers. +<<<<<<< HEAD <<<<<<< HEAD function get$2(name) { return all$1()[name]; @@ -21785,12 +21999,14 @@ * Valid key names are a single, lowercased letter, i.e. "n". */ >>>>>>> branch for npm and latest release +======= +>>>>>>> resolve conflicts - exports.formatters = {}; - /** - * Previously assigned color. - */ + if (isSigned) { + abort(); + } // `true`, `false`, and `null` literals. +<<<<<<< HEAD <<<<<<< HEAD function parse$3(str) { var obj = {}; @@ -21876,48 +22092,37 @@ /** * Previous log timestamp. */ +======= +>>>>>>> resolve conflicts - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ + var temp = source.slice(Index, Index + 4); - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; - } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ + if (temp == "true") { + Index += 4; + return true; + } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { + Index += 5; + return false; + } else if (temp == "null") { + Index += 4; + return null; + } // Unrecognized token. - function debug(namespace) { - // define the `disabled` version - function disabled() {} + abort(); + } + } // Return the sentinel `$` character if the parser has reached the end + // of the source string. - disabled.enabled = false; // define the `enabled` version - function enabled() { - var self = enabled; // set `diff` timestamp + return "$"; + }; // Internal: Parses a JSON `value` token. - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); + var get = function get(value) { + var results, hasMembers; +<<<<<<< HEAD if ('string' !== typeof args[0]) { // anything else let's inspect with %o args = ['%o'].concat(args); @@ -21948,8 +22153,20 @@ * @return {Array} * @api public */ +======= + if (value == "$") { + // Unexpected end of input. + abort(); + } +>>>>>>> resolve conflicts + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } // Parse object and array literals. +<<<<<<< HEAD domain.levels = function (url) { var host = parse(url).hostname; var parts = host.split('.'); @@ -21966,19 +22183,35 @@ if (match === '%%') return match; index++; var formatter = exports.formatters[format]; +======= +>>>>>>> resolve conflicts - 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` + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; +<<<<<<< HEAD args.splice(index, 1); index--; } >>>>>>> branch for npm and latest release +======= + for (;;) { + value = lex(); // A closing square bracket marks the end of the array literal. +>>>>>>> resolve conflicts - return match; - }); + if (value == "]") { + break; + } // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. + + + if (hasMembers) { + if (value == ",") { + value = lex(); +<<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD if (parts.length <= 1) { @@ -22008,6 +22241,18 @@ ======= ======= +======= + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. + abort(); + } + } else { + hasMembers = true; +>>>>>>> resolve conflicts } // Elisions and leading commas are not permitted. >>>>>>> branch for npm and latest release @@ -22376,11 +22621,14 @@ var attributes = storage.XMLDocument.documentElement.attributes; storage.load(localStorageName); +<<<<<<< HEAD <<<<<<< HEAD for (var i = attributes.length - 1; i >= 0; i--) { storage.removeAttribute(attributes[i].name); ======= >>>>>>> branch for npm and latest release +======= +>>>>>>> resolve conflicts if ('function' === typeof exports.formatArgs) { args = exports.formatArgs.apply(self, args); >>>>>>> branch for npm and latest release @@ -22680,15 +22928,7 @@ ======= function set$1(name, value, options) { options = options || {}; -<<<<<<< HEAD -<<<<<<< HEAD - var str = encode$2(name) + '=' + encode$2(value); -======= - var str = encode$1(name) + '=' + encode$1(value); ->>>>>>> branch for npm and latest release -======= var str = encode$2(name) + '=' + encode$2(value); ->>>>>>> add querystring parse to npm module if (null == value) options.maxage = -1; >>>>>>> NPM release version 1.0.11 @@ -22755,6 +22995,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> Updated npm distribution files ======= <<<<<<< HEAD @@ -22801,10 +23042,11 @@ >>>>>>> update npm module ======= >>>>>>> update npm module +======= +>>>>>>> resolve conflicts return parse$3(str); } ->>>>>>> branch for npm and latest release /** * Get cookie `name`. * @@ -22828,6 +23070,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var LotameStorage = /*#__PURE__*/function () { function LotameStorage() { @@ -22884,9 +23127,10 @@ >>>>>>> update npm module >>>>>>> update npm module ======= +======= +>>>>>>> resolve conflicts function parse$3(str) { ->>>>>>> update npm module var obj = {}; var pairs = str.split(/ *; */); var pair; @@ -22917,6 +23161,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD var Lotame = /*#__PURE__*/function () { function Lotame(config, analytics) { @@ -22931,8 +23176,9 @@ function encode$1(value) { >>>>>>> branch for npm and latest release ======= +======= +>>>>>>> resolve conflicts function encode$2(value) { ->>>>>>> add querystring parse to npm module try { return encodeURIComponent(value); } catch (e) { @@ -22948,6 +23194,7 @@ <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.name = "LOTAME"; this.analytics = analytics; @@ -22972,8 +23219,9 @@ function decode$1(value) { >>>>>>> branch for npm and latest release ======= +======= +>>>>>>> resolve conflicts function decode$2(value) { ->>>>>>> add querystring parse to npm module try { return decodeURIComponent(value); } catch (e) { @@ -23067,6 +23315,9 @@ * Expose cookie on domain. */ <<<<<<< HEAD +<<<<<<< HEAD +======= +>>>>>>> resolve conflicts domain.cookie = componentCookie; @@ -23074,6 +23325,7 @@ * Exports. */ +<<<<<<< HEAD ======= @@ -23126,6 +23378,15 @@ value: function syncPixel(userId) { var _this2 = this; ======= +======= + exports = module.exports = domain; + }); + + /** + * An object utility to persist values in cookies + */ + +>>>>>>> resolve conflicts var CookieLocal = /*#__PURE__*/function () { function CookieLocal(options) { _classCallCheck(this, CookieLocal); @@ -23668,59 +23929,23 @@ */ }, { - key: "trim", - value: function trim(value) { - return value.replace(/^\s+|\s+$/gm, ""); - } - /** - * AES encrypt value with constant prefix - * @param {*} value - */ - - }, { - key: "encryptValue", - value: function encryptValue(value) { - if (this.trim(value) == "") { - return value; - } - -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); -======= - var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); -======= - var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -======= -======= - var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); -======= - var prefixedVal = "".concat(defaults$1.prefix).concat(AES.encrypt(value, defaults$1.key).toString()); ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); ->>>>>>> update npm module ->>>>>>> update npm module -======= + key: "trim", + value: function trim(value) { + return value.replace(/^\s+|\s+$/gm, ""); + } + /** + * AES encrypt value with constant prefix + * @param {*} value + */ + + }, { + key: "encryptValue", + value: function encryptValue(value) { + if (this.trim(value) == "") { + return value; + } + var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); ->>>>>>> update npm module return prefixedVal; } /** @@ -23736,43 +23961,7 @@ } if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); -======= - return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); -======= - return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -======= -======= - return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); -======= - return AES.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(Utf8); ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ->>>>>>> update npm module ->>>>>>> update npm module -======= return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); ->>>>>>> update npm module } return value; @@ -24437,77 +24626,7 @@ return Fullstory; }(); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var Optimizely = /*#__PURE__*/function () { -======= -<<<<<<< HEAD -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module -<<<<<<< HEAD - var Optimizely = - /*#__PURE__*/ - function () { -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - var Optimizely = /*#__PURE__*/function () { ->>>>>>> update npm module - function Optimizely(config, analytics) { - var _this = this; - - _classCallCheck(this, Optimizely); -======= ->>>>>>> update npm module - var Optimizely = - /*#__PURE__*/ - function () { -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - var Optimizely = /*#__PURE__*/function () { ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= -<<<<<<< HEAD - var Optimizely = /*#__PURE__*/function () { -======= -<<<<<<< HEAD - var Optimizely = - /*#__PURE__*/ - function () { ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -======= var Optimizely = /*#__PURE__*/function () { ->>>>>>> update npm module function Optimizely(config, analytics) { var _this = this; @@ -25049,7 +25168,6 @@ case "bools": return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); -<<<<<<< HEAD } } // No type suffix found. Camel case the whole field name. @@ -25158,8 +25276,6 @@ if (value) { action[key] = value; } -======= ->>>>>>> branch for npm and latest release } } @@ -25216,6 +25332,7 @@ <<<<<<< HEAD <<<<<<< HEAD <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD this.version = "1.0.10"; ======= @@ -25338,13 +25455,17 @@ >>>>>>> update npm module ======= >>>>>>> update npm module +======= + this.version = "1.0.11"; + }; +>>>>>>> resolve conflicts // Library information class var RudderLibraryInfo = function RudderLibraryInfo() { _classCallCheck(this, RudderLibraryInfo); this.name = "RudderLabs JavaScript SDK"; - this.version = "1.0.10"; + this.version = "1.0.11"; }; // Operating System information class @@ -25669,77 +25790,9 @@ function bytesToUuid(buf, offset) { var i = offset || 0; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - - return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - var bth = byteToHex; - // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - return ([ - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]] - ]).join(''); -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - - return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= - var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - - return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); -======= - var bth = byteToHex; - // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - return ([ - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], '-', - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]], - bth[buf[i++]], bth[buf[i++]] - ]).join(''); ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 - - return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); ->>>>>>> update npm module ->>>>>>> update npm module -======= var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4 return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join(''); ->>>>>>> update npm module } var bytesToUuid_1 = bytesToUuid; @@ -25756,38 +25809,6 @@ var _lastMSecs = 0; var _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= - // See https://github.com/uuidjs/uuid for API details ->>>>>>> Updated npm distribution files -======= - // See https://github.com/uuidjs/uuid for API details -======= ->>>>>>> branch for npm and latest release ->>>>>>> branch for npm and latest release -======= -======= ->>>>>>> update npm module - // See https://github.com/uuidjs/uuid for API details -======= ->>>>>>> branch for npm and latest release -======= -======= - // See https://github.com/uuidjs/uuid for API details ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> update npm module function v1(options, buf, offset) { var i = buf && offset || 0; var b = buf || []; @@ -25856,15 +25877,9 @@ b[i++] = tmh >>> 24 & 0xf | 0x10; // include version b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) -<<<<<<< HEAD - - b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` - -======= b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` ->>>>>>> branch for npm and latest release b[i++] = clockseq & 0xff; // `node` for (var n = 0; n < 6; ++n) { @@ -26028,13 +26043,8 @@ /** * Get original engine */ -<<<<<<< HEAD - - -======= ->>>>>>> branch for npm and latest release Store$1.prototype.getOriginalEngine = function () { return this.originalEngine; }; @@ -26091,38 +26101,6 @@ switch (e.code) { case 22: quotaExceeded = true; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - break; - - case 1014: - // Firefox - if (e.name === 'NS_ERROR_DOM_QUOTA_REACHED') { - quotaExceeded = true; - } - - break; -======= - } - break; ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - } - break; -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module break; case 1014: @@ -26132,27 +26110,6 @@ } break; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= -======= - } - break; ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> update npm module } } else if (e.number === -2147024882) { // Internet Explorer 8 From 423bc3519b03f190c0d054f12ce1d7526107617f Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Wed, 16 Sep 2020 11:45:18 +0530 Subject: [PATCH 20/20] resolve conflicts --- dist/rudder-sdk-js/index.js | 17273 +++++----------------------------- 1 file changed, 2224 insertions(+), 15049 deletions(-) diff --git a/dist/rudder-sdk-js/index.js b/dist/rudder-sdk-js/index.js index 00de07c9a7..3e77d19033 100644 --- a/dist/rudder-sdk-js/index.js +++ b/dist/rudder-sdk-js/index.js @@ -520,193 +520,6 @@ * @api public */ -<<<<<<< HEAD -======= - } - /** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - - Emitter.prototype.on = Emitter.prototype.addEventListener = function (event, fn) { - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []).push(fn); - return this; - }; - /** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - - Emitter.prototype.once = function (event, fn) { - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; - }; - /** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - - Emitter.prototype.off = Emitter.prototype.removeListener = Emitter.prototype.removeAllListeners = Emitter.prototype.removeEventListener = function (event, fn) { - this._callbacks = this._callbacks || {}; // all - - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } // specific event - - - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; // remove all handlers - - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } // remove specific handler - - - var cb; - - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } // Remove event specific arrays for event types that no - // one is subscribed for to avoid memory leak. - - - if (callbacks.length === 0) { - delete this._callbacks['$' + event]; - } - - return this; - }; - /** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - - -<<<<<<< HEAD - Emitter.prototype.emit = function (event) { - this._callbacks = this._callbacks || {}; - var args = new Array(arguments.length - 1), - callbacks = this._callbacks['$' + event]; -======= -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> add querystring parse to npm module - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module - var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; - var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; - /* module.exports = { - MessageType: MessageType, - ECommerceParamNames: ECommerceParamNames, - ECommerceEvents: ECommerceEvents, - RudderIntegrationPlatform: RudderIntegrationPlatform, - BASE_URL: BASE_URL, - CONFIG_URL: CONFIG_URL, - FLUSH_QUEUE_SIZE: FLUSH_QUEUE_SIZE - }; */ ->>>>>>> add querystring parse to npm module - - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - - if (callbacks) { - callbacks = callbacks.slice(0); - - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; - }; - /** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - - - Emitter.prototype.listeners = function (event) { - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; - }; - /** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - - - Emitter.prototype.hasListeners = function (event) { - return !!this.listeners(event).length; - }; - }); ->>>>>>> branch for npm and latest release -<<<<<<< HEAD exports.isAbsolute = function (url) { return 0 == url.indexOf('//') || !!~url.indexOf('://'); @@ -719,7 +532,6 @@ * @api public */ -<<<<<<< HEAD exports.isRelative = function (url) { return !exports.isAbsolute(url); @@ -745,31 +557,6 @@ * @return {String} * @api private */ -======= - function after(count, callback, err_cb) { - var bail = false; - err_cb = err_cb || noop; - proxy.count = count; - return count === 0 ? callback() : proxy; - - function proxy(err, result) { - if (proxy.count <= 0) { - throw new Error('after called too many times'); - } - - --proxy.count; // after first error, rest are passed to err_cb - - if (err) { - bail = true; - callback(err); // future error callbacks will go to error handler - - callback = err_cb; - } else if (proxy.count === 0 && !bail) { - callback(null, result); - } - } - } ->>>>>>> branch for npm and latest release function port(protocol) { @@ -790,135 +577,43 @@ var componentUrl_3 = componentUrl.isRelative; var componentUrl_4 = componentUrl.isCrossDomain; - var componentUrl = createCommonjsModule(function (module, exports) { - /** - * Parse the given `url`. - * - * @param {String} str - * @return {Object} - * @api public - */ - exports.parse = function (url) { - var a = document.createElement('a'); - a.href = url; - return { - href: a.href, - host: a.host || location.host, - port: '0' === a.port || '' === a.port ? port(a.protocol) : a.port, - hash: a.hash, - hostname: a.hostname || location.hostname, - pathname: a.pathname.charAt(0) != '/' ? '/' + a.pathname : a.pathname, - protocol: !a.protocol || ':' == a.protocol ? location.protocol : a.protocol, - search: a.search, - query: a.search.slice(1) - }; - }; - /** - * Check if `url` is absolute. - * - * @param {String} url - * @return {Boolean} - * @api public - */ + var LOG_LEVEL_INFO = 1; + var LOG_LEVEL_DEBUG = 2; + var LOG_LEVEL_WARN = 3; + var LOG_LEVEL_ERROR = 4; + var LOG_LEVEL = LOG_LEVEL_ERROR; + var logger = { + setLogLevel: function setLogLevel(logLevel) { + switch (logLevel.toUpperCase()) { + case "INFO": + LOG_LEVEL = LOG_LEVEL_INFO; + return; -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> resolve conflicts + case "DEBUG": + LOG_LEVEL = LOG_LEVEL_DEBUG; + return; - exports.isAbsolute = function (url) { - return 0 == url.indexOf('//') || !!~url.indexOf('://'); - }; - /** - * Check if `url` is relative. - * - * @param {String} url - * @return {Boolean} - * @api public - */ + case "WARN": + LOG_LEVEL = LOG_LEVEL_WARN; + } + }, + info: function info() { + if (LOG_LEVEL <= LOG_LEVEL_INFO) { + var _console; + (_console = console).log.apply(_console, arguments); + } + }, + debug: function debug() { + if (LOG_LEVEL <= LOG_LEVEL_DEBUG) { + var _console2; - exports.isRelative = function (url) { - return !exports.isAbsolute(url); - }; - /** - * Check if `url` is cross domain. - * - * @param {String} url - * @return {Boolean} - * @api public - */ - - - exports.isCrossDomain = function (url) { - url = exports.parse(url); - var location = exports.parse(window.location.href); - return url.hostname !== location.hostname || url.port !== location.port || url.protocol !== location.protocol; - }; - /** - * Return default port for `protocol`. - * - * @param {String} protocol - * @return {String} - * @api private - */ - - - function port(protocol) { - switch (protocol) { - case 'http:': - return 80; - - case 'https:': - return 443; - - default: - return location.port; - } - } - }); - var componentUrl_1 = componentUrl.parse; - var componentUrl_2 = componentUrl.isAbsolute; - var componentUrl_3 = componentUrl.isRelative; - var componentUrl_4 = componentUrl.isCrossDomain; - - var LOG_LEVEL_INFO = 1; - var LOG_LEVEL_DEBUG = 2; - var LOG_LEVEL_WARN = 3; - var LOG_LEVEL_ERROR = 4; - var LOG_LEVEL = LOG_LEVEL_ERROR; - var logger = { - setLogLevel: function setLogLevel(logLevel) { - switch (logLevel.toUpperCase()) { - case "INFO": - LOG_LEVEL = LOG_LEVEL_INFO; - return; - - case "DEBUG": - LOG_LEVEL = LOG_LEVEL_DEBUG; - return; - - case "WARN": - LOG_LEVEL = LOG_LEVEL_WARN; - } - }, - info: function info() { - if (LOG_LEVEL <= LOG_LEVEL_INFO) { - var _console; - - (_console = console).log.apply(_console, arguments); - } - }, - debug: function debug() { - if (LOG_LEVEL <= LOG_LEVEL_DEBUG) { - var _console2; - - (_console2 = console).log.apply(_console2, arguments); - } - }, - warn: function warn() { - if (LOG_LEVEL <= LOG_LEVEL_WARN) { - var _console3; + (_console2 = console).log.apply(_console2, arguments); + } + }, + warn: function warn() { + if (LOG_LEVEL <= LOG_LEVEL_WARN) { + var _console3; (_console3 = console).log.apply(_console3, arguments); } @@ -1042,133 +737,7 @@ PRODUCT_REVIEWED: "Product Reviewed" }; // Enumeration for integrations supported -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ->>>>>>> update npm module -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; ->>>>>>> branch for npm and latest release -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ->>>>>>> add querystring parse to npm module -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; ->>>>>>> rebase with production branch -======= var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; -======= ->>>>>>> branch for npm and latest release -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> branch for npm and latest release -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= -======= -======= -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= ->>>>>>> add querystring parse to npm module -======= ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -======= -======= -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.9"; ->>>>>>> branch for npm and latest release ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ->>>>>>> add querystring parse to npm module -<<<<<<< HEAD ->>>>>>> add querystring parse to npm module -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; -======= -<<<<<<< HEAD - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.8"; -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.7"; ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ->>>>>>> update npm module ->>>>>>> update npm module -<<<<<<< HEAD -======= -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.10"; ->>>>>>> update npm module ->>>>>>> update npm module ->>>>>>> update npm module -======= - var CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=npm&v=1.0.11"; ->>>>>>> resolve conflicts var MAX_WAIT_FOR_INTEGRATION_LOAD = 10000; var INTEGRATION_LOAD_CHECK_INTERVAL = 1000; /* module.exports = { @@ -2532,34 +2101,7 @@ /** * toString ref. */ -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> add querystring parse to npm module - var toString$1 = Object.prototype.toString; -======= - var toString = Object.prototype.toString; ->>>>>>> branch for npm and latest release -<<<<<<< HEAD -<<<<<<< HEAD -======= - var toString$1 = Object.prototype.toString; ->>>>>>> NPM release version 1.0.11 -======= ->>>>>>> branch for npm and latest release -======= -======= var toString$1 = Object.prototype.toString; ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module -======= - var toString$1 = Object.prototype.toString; ->>>>>>> resolve conflicts /** * Return the type of `val`. * @@ -2568,42 +2110,8 @@ * @api public */ -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { -======= - var componentType = function componentType(val) { - switch (toString.call(val)) { ->>>>>>> branch for npm and latest release -======= - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { ->>>>>>> NPM release version 1.0.11 -======= -======= ->>>>>>> add querystring parse to npm module - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { -======= - var componentType = function componentType(val) { - switch (toString.call(val)) { ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module -======= var componentType$1 = function componentType(val) { switch (toString$1.call(val)) { ->>>>>>> resolve conflicts case '[object Function]': return 'function'; @@ -4369,63 +3877,6 @@ for (var i = 0; i < n.length; i++) { n[i] = crypt.endian(n[i]); } -<<<<<<< HEAD -<<<<<<< HEAD - - return n; - }, - // Generate an array of any length of random bytes - randomBytes: function randomBytes(n) { - for (var bytes = []; n > 0; n--) { - bytes.push(Math.floor(Math.random() * 256)); - } - -<<<<<<< HEAD -======= - return bytes; - }, - // Convert a byte array to big-endian 32-bit words - bytesToWords: function bytesToWords(bytes) { - for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8) { - words[b >>> 5] |= bytes[i] << 24 - b % 32; - } - - return words; - }, - // Convert big-endian 32-bit words to a byte array - wordsToBytes: function wordsToBytes(words) { - for (var bytes = [], b = 0; b < words.length * 32; b += 8) { - bytes.push(words[b >>> 5] >>> 24 - b % 32 & 0xFF); - } - - return bytes; - }, - // Convert a byte array to a hex string - bytesToHex: function bytesToHex(bytes) { - for (var hex = [], i = 0; i < bytes.length; i++) { - hex.push((bytes[i] >>> 4).toString(16)); - hex.push((bytes[i] & 0xF).toString(16)); - } - - return hex.join(''); - }, - // Convert a hex string to a byte array - hexToBytes: function hexToBytes(hex) { - for (var bytes = [], c = 0; c < hex.length; c += 2) { - bytes.push(parseInt(hex.substr(c, 2), 16)); - } - - return bytes; - }, - // Convert a byte array to a base-64 string - bytesToBase64: function bytesToBase64(bytes) { - for (var base64 = [], i = 0; i < bytes.length; i += 3) { - var triplet = bytes[i] << 16 | bytes[i + 1] << 8 | bytes[i + 2]; - ->>>>>>> branch for npm and latest release -======= -======= ->>>>>>> resolve conflicts return n; }, @@ -4435,7 +3886,6 @@ bytes.push(Math.floor(Math.random() * 256)); } ->>>>>>> branch for npm and latest release return bytes; }, // Convert a byte array to big-endian 32-bit words @@ -5140,27 +4590,6 @@ key = undefined; // if we found no matching properties // on the current object, there's no match. -<<<<<<< HEAD - - finished = true; - } - - if (!key) return; - if (null == obj) return obj; // the `obj` and `key` is one above the leaf object and key, so - // start object: { a: { 'b.c': 10 } } - // end object: { 'b.c': 10 } - // end key: 'b.c' - // this way, you can do `obj[key]` and get `10`. - - return fn(obj, key, val); - }; - } - /** - * Find an object by its key - * - * find({ first_name : 'Calvin' }, 'firstName') - */ -======= finished = true; } @@ -5181,18 +4610,7 @@ * find({ first_name : 'Calvin' }, 'firstName') */ ->>>>>>> branch for npm and latest release - - function find(obj, key) { - if (obj.hasOwnProperty(key)) return obj[key]; - } - /** - * Delete a value for a given key - * - * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } - */ -<<<<<<< HEAD function find(obj, key) { if (obj.hasOwnProperty(key)) return obj[key]; } @@ -5202,8 +4620,6 @@ * del({ a : 'b', x : 'y' }, 'X' }) -> { a : 'b' } */ -======= ->>>>>>> branch for npm and latest release function del(obj, key) { if (obj.hasOwnProperty(key)) delete obj[key]; @@ -6772,769 +6188,6 @@ }(); var core = createCommonjsModule(function (module, exports) { -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(); - } - }(commonjsGlobal, function () { - - /** - * CryptoJS core components. - */ - var CryptoJS = CryptoJS || (function (Math, undefined$1) { - /* - * Local polyfil of Object.create - */ - var create = Object.create || (function () { - function F() {} - return function (obj) { - var subtype; - - F.prototype = obj; - - subtype = new F(); - - F.prototype = null; - - return subtype; - }; - }()); - - /** - * CryptoJS namespace. - */ - var C = {}; - - /** - * Library namespace. - */ - var C_lib = C.lib = {}; - - /** - * Base object for prototypal inheritance. - */ - var Base = C_lib.Base = (function () { - - - return { - /** - * Creates a new object that inherits from this object. - * - * @param {Object} overrides Properties to copy into the new object. - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * field: 'value', - * - * method: function () { - * } - * }); - */ - extend: function (overrides) { - // Spawn - var subtype = create(this); - - // Augment - if (overrides) { - subtype.mixIn(overrides); - } - - // Create default initializer - if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { - subtype.init = function () { - subtype.$super.init.apply(this, arguments); - }; - } - - // Initializer's prototype is the subtype object - subtype.init.prototype = subtype; - - // Reference supertype - subtype.$super = this; - - return subtype; - }, - - /** - * Extends this object and runs the init method. - * Arguments to create() will be passed to init(). - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var instance = MyType.create(); - */ - create: function () { - var instance = this.extend(); - instance.init.apply(instance, arguments); - - return instance; - }, - - /** - * Initializes a newly created object. - * Override this method to add some logic when your objects are created. - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * init: function () { - * // ... - * } - * }); - */ - init: function () { - }, - - /** - * Copies properties into this object. - * - * @param {Object} properties The properties to mix in. - * - * @example - * - * MyType.mixIn({ - * field: 'value' - * }); - */ - mixIn: function (properties) { - for (var propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - this[propertyName] = properties[propertyName]; - } - } - - // IE won't copy toString using the loop above - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function () { - return this.init.prototype.extend(this); - } - }; - }()); - - /** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ - var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function (words, sigBytes) { - words = this.words = words || []; - - if (sigBytes != undefined$1) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, - - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function (encoder) { - return (encoder || Hex).stringify(this); - }, - - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function (wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; - - // Clamp excess bits - this.clamp(); - - // Concat - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8); - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2]; - } - } - this.sigBytes += thatSigBytes; - - // Chainable - return this; - }, - - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function () { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; - - // Clamp - words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8); - words.length = Math.ceil(sigBytes / 4); - }, - - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function () { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - - return clone; - }, - - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function (nBytes) { - var words = []; - - var r = (function (m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - - return function () { - m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask; - m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask; - var result = ((m_z << 0x10) + m_w) & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - } - }); - - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); - - rcache = _r() * 0x3ade67b7; - words.push((_r() * 0x100000000) | 0); - } - - return new WordArray.init(words, nBytes); - } - }); - - /** - * Encoder namespace. - */ - var C_enc = C.enc = {}; - - /** - * Hex encoding strategy. - */ - var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. - * - * @static - * - * @example - * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - - // Convert - var hexChars = []; - for (var i = 0; i < sigBytes; i++) { - var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); - } - - return hexChars.join(''); - }, - - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Hex.parse(hexString); - */ - parse: function (hexStr) { - // Shortcut - var hexStrLength = hexStr.length; - - // Convert - var words = []; - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4); - } - - return new WordArray.init(words, hexStrLength / 2); - } - }; - - /** - * Latin1 encoding strategy. - */ - var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function (wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - - // Convert - var latin1Chars = []; - for (var i = 0; i < sigBytes; i++) { - var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } - - return latin1Chars.join(''); - }, - - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function (latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; - - // Convert - var words = []; - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8); - } - - return new WordArray.init(words, latin1StrLength); - } - }; - - /** - * UTF-8 encoding strategy. - */ - var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function (wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, - - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function (utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); - } - }; - - /** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 - */ - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function () { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; - }, - - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function (data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } - - // Append - this._data.concat(data); - this._nDataBytes += data.sigBytes; - }, - - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function (doFlush) { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; - - // Count blocks ready - var nBlocksReady = dataSigBytes / blockSizeBytes; - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } - - // Count words ready - var nWordsReady = nBlocksReady * blockSize; - - // Count bytes ready - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); - - // Process blocks - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } - - // Remove processed words - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } - - // Return processed words - return new WordArray.init(processedWords, nBytesReady); - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ - clone: function () { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); - - return clone; - }, - - _minBufferSize: 0 - }); - - /** - * Abstract hasher template. - * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) - */ - var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), - - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function (cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); - - // Set initial values - this.reset(); - }, - - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function () { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); - - // Perform concrete-hasher logic - this._doReset(); - }, - - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function (messageUpdate) { - // Append - this._append(messageUpdate); - - // Update the hash - this._process(); - - // Chainable - return this; - }, - - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function (messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } - - // Perform concrete-hasher logic - var hash = this._doFinalize(); - - return hash; - }, - - blockSize: 512/32, - - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function (hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, - - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function (hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; - } - }); - - /** - * Algorithm namespace. - */ - var C_algo = C.algo = {}; - - return C; - }(Math)); - - - return CryptoJS; - - })); - }); -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> resolve conflicts (function (root, factory) { { @@ -7666,168 +6319,32 @@ } } // IE won't copy toString using the loop above -<<<<<<< HEAD - /** - * toString ref. - */ ->>>>>>> update npm module - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(); - } - })(commonjsGlobal, function () { - /** - * CryptoJS core components. - */ - var CryptoJS = CryptoJS || function (Math, undefined$1) { - /* - * Local polyfil of Object.create - */ - var create = Object.create || function () { - function F() {} - return function (obj) { - var subtype; - F.prototype = obj; - subtype = new F(); - F.prototype = null; - return subtype; - }; - }(); - /** - * CryptoJS namespace. - */ - - var C = {}; - /** - * Library namespace. - */ - - var C_lib = C.lib = {}; - /** - * Base object for prototypal inheritance. - */ + if (properties.hasOwnProperty('toString')) { + this.toString = properties.toString; + } + }, - var Base = C_lib.Base = function () { - return { /** - * Creates a new object that inherits from this object. - * - * @param {Object} overrides Properties to copy into the new object. - * - * @return {Object} The new object. + * Creates a copy of this object. * - * @static + * @return {Object} The clone. * * @example * - * var MyType = CryptoJS.lib.Base.extend({ - * field: 'value', - * - * method: function () { - * } - * }); + * var clone = instance.clone(); */ - extend: function extend(overrides) { - // Spawn - var subtype = create(this); // Augment - - if (overrides) { - subtype.mixIn(overrides); - } // Create default initializer - - - if (!subtype.hasOwnProperty('init') || this.init === subtype.init) { - subtype.init = function () { - subtype.$super.init.apply(this, arguments); - }; - } // Initializer's prototype is the subtype object - - - subtype.init.prototype = subtype; // Reference supertype - - subtype.$super = this; - return subtype; - }, - - /** - * Extends this object and runs the init method. - * Arguments to create() will be passed to init(). - * - * @return {Object} The new object. - * - * @static - * - * @example - * - * var instance = MyType.create(); - */ - create: function create() { - var instance = this.extend(); - instance.init.apply(instance, arguments); - return instance; - }, - - /** - * Initializes a newly created object. - * Override this method to add some logic when your objects are created. - * - * @example - * - * var MyType = CryptoJS.lib.Base.extend({ - * init: function () { - * // ... - * } - * }); - */ - init: function init() {}, - - /** - * Copies properties into this object. - * - * @param {Object} properties The properties to mix in. - * - * @example - * - * MyType.mixIn({ - * field: 'value' - * }); - */ - mixIn: function mixIn(properties) { - for (var propertyName in properties) { - if (properties.hasOwnProperty(propertyName)) { - this[propertyName] = properties[propertyName]; - } - } // IE won't copy toString using the loop above -======= - - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function clone() { - return this.init.prototype.extend(this); - } - }; - }(); - /** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ + clone: function clone() { + return this.init.prototype.extend(this); + } + }; + }(); + /** + * An array of 32-bit words. + * + * @property {Array} words The array of 32-bit words. + * @property {number} sigBytes The number of significant bytes in this word array. + */ var WordArray = C_lib.WordArray = Base.extend({ @@ -10301,11799 +8818,1679 @@ */ -<<<<<<< HEAD - this._nDataBytes += data.sigBytes; - }, + var clone_1 = clone; - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function _process(doFlush) { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; // Count blocks ready + /** + * Helpers. + */ + var s = 1000; + var m = s * 60; + var h = m * 60; + var d = h * 24; + var y = d * 365.25; + /** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ - var nBlocksReady = dataSigBytes / blockSizeBytes; + var ms = function ms(val, options) { + options = options || {}; + if ('string' == typeof val) return parse$1(val); + return options["long"] ? _long(val) : _short(val); + }; + /** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } // Count words ready + function parse$1(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(); - var nWordsReady = nBlocksReady * blockSize; // Count bytes ready + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks + case 'days': + case 'day': + case 'd': + return n * d; - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } // Remove processed words + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } // Return processed words + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + } + } + /** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - return new WordArray.init(processedWords, nBytesReady); - }, - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); - return clone; - }, - _minBufferSize: 0 - }); - /** - * Abstract hasher template. - * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) - */ + function _short(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; + } + /** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ - var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function init(cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Set initial values - - this.reset(); - }, - - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic - - this._doReset(); - }, - - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function update(messageUpdate) { - // Append - this._append(messageUpdate); // Update the hash - - - this._process(); // Chainable - - - return this; - }, - - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } // Perform concrete-hasher logic - - - var hash = this._doFinalize(); - - return hash; - }, - blockSize: 512 / 32, - - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function _createHelper(hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, - - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function _createHmacHelper(hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; - } - }); - /** - * Algorithm namespace. - */ ->>>>>>> branch for npm and latest release - - var C_algo = C.algo = {}; - return C; - }(Math); - -<<<<<<< HEAD - if (properties.hasOwnProperty('toString')) { - this.toString = properties.toString; - } - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = instance.clone(); - */ - clone: function clone() { - return this.init.prototype.extend(this); - } - }; - }(); - /** - * An array of 32-bit words. - * - * @property {Array} words The array of 32-bit words. - * @property {number} sigBytes The number of significant bytes in this word array. - */ - - - var WordArray = C_lib.WordArray = Base.extend({ - /** - * Initializes a newly created word array. - * - * @param {Array} words (Optional) An array of 32-bit words. - * @param {number} sigBytes (Optional) The number of significant bytes in the words. - * - * @example - * - * var wordArray = CryptoJS.lib.WordArray.create(); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]); - * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6); - */ - init: function init(words, sigBytes) { - words = this.words = words || []; - - if (sigBytes != undefined$1) { - this.sigBytes = sigBytes; - } else { - this.sigBytes = words.length * 4; - } - }, - - /** - * Converts this word array to a string. - * - * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex - * - * @return {string} The stringified word array. - * - * @example - * - * var string = wordArray + ''; - * var string = wordArray.toString(); - * var string = wordArray.toString(CryptoJS.enc.Utf8); - */ - toString: function toString(encoder) { - return (encoder || Hex).stringify(this); - }, - - /** - * Concatenates a word array to this word array. - * - * @param {WordArray} wordArray The word array to append. - * - * @return {WordArray} This word array. - * - * @example - * - * wordArray1.concat(wordArray2); - */ - concat: function concat(wordArray) { - // Shortcuts - var thisWords = this.words; - var thatWords = wordArray.words; - var thisSigBytes = this.sigBytes; - var thatSigBytes = wordArray.sigBytes; // Clamp excess bits - - this.clamp(); // Concat - - if (thisSigBytes % 4) { - // Copy one byte at a time - for (var i = 0; i < thatSigBytes; i++) { - var thatByte = thatWords[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - thisWords[thisSigBytes + i >>> 2] |= thatByte << 24 - (thisSigBytes + i) % 4 * 8; - } - } else { - // Copy one word at a time - for (var i = 0; i < thatSigBytes; i += 4) { - thisWords[thisSigBytes + i >>> 2] = thatWords[i >>> 2]; - } - } - - this.sigBytes += thatSigBytes; // Chainable - - return this; - }, - - /** - * Removes insignificant bits. - * - * @example - * - * wordArray.clamp(); - */ - clamp: function clamp() { - // Shortcuts - var words = this.words; - var sigBytes = this.sigBytes; // Clamp - - words[sigBytes >>> 2] &= 0xffffffff << 32 - sigBytes % 4 * 8; - words.length = Math.ceil(sigBytes / 4); - }, - - /** - * Creates a copy of this word array. - * - * @return {WordArray} The clone. - * - * @example - * - * var clone = wordArray.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone.words = this.words.slice(0); - return clone; - }, - - /** - * Creates a word array filled with random bytes. - * - * @param {number} nBytes The number of random bytes to generate. - * - * @return {WordArray} The random word array. -======= - return CryptoJS; - }); - }); - - var encBase64 = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var C_enc = C.enc; - /** - * Base64 encoding strategy. - */ - - var Base64 = C_enc.Base64 = { - /** - * Converts a word array to a Base64 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Base64 string. ->>>>>>> branch for npm and latest release - * - * @static - * - * @example - * -<<<<<<< HEAD - * var wordArray = CryptoJS.lib.WordArray.random(16); - */ - random: function random(nBytes) { - var words = []; - - var r = function r(m_w) { - var m_w = m_w; - var m_z = 0x3ade68b1; - var mask = 0xffffffff; - return function () { - m_z = 0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10) & mask; - m_w = 0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10) & mask; - var result = (m_z << 0x10) + m_w & mask; - result /= 0x100000000; - result += 0.5; - return result * (Math.random() > .5 ? 1 : -1); - }; - }; - - for (var i = 0, rcache; i < nBytes; i += 4) { - var _r = r((rcache || Math.random()) * 0x100000000); - - rcache = _r() * 0x3ade67b7; - words.push(_r() * 0x100000000 | 0); - } - - return new WordArray.init(words, nBytes); - } - }); - /** - * Encoder namespace. - */ - - var C_enc = C.enc = {}; - /** - * Hex encoding strategy. - */ - - var Hex = C_enc.Hex = { - /** - * Converts a word array to a hex string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The hex string. - * - * @static - * - * @example - * - * var hexString = CryptoJS.enc.Hex.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert - - var hexChars = []; - - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - hexChars.push((bite >>> 4).toString(16)); - hexChars.push((bite & 0x0f).toString(16)); - } - - return hexChars.join(''); - }, - - /** - * Converts a hex string to a word array. - * - * @param {string} hexStr The hex string. -======= - * var base64String = CryptoJS.enc.Base64.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - var map = this._map; // Clamp excess bits - - wordArray.clamp(); // Convert - - var base64Chars = []; - - for (var i = 0; i < sigBytes; i += 3) { - var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; - var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; - var triplet = byte1 << 16 | byte2 << 8 | byte3; - - for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { - base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); - } - } // Add padding - ->>>>>>> branch for npm and latest release - - var paddingChar = map.charAt(64); - -<<<<<<< HEAD - if (t === 'date') { - return new Date(obj.getTime()); - } // string, number, boolean, etc. - - - return obj; - }; - /* - * Exports. - */ - - - var clone_1 = clone; - - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse$1(val); -======= - if (paddingChar) { - while (base64Chars.length % 4) { - base64Chars.push(paddingChar); - } - } - - return base64Chars.join(''); - }, - - /** - * Converts a Base64 string to a word array. - * - * @param {string} base64Str The Base64 string. ->>>>>>> branch for npm and latest release - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * -<<<<<<< HEAD - * var wordArray = CryptoJS.enc.Hex.parse(hexString); - */ - parse: function parse(hexStr) { - // Shortcut - var hexStrLength = hexStr.length; // Convert - - var words = []; - - for (var i = 0; i < hexStrLength; i += 2) { - words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << 24 - i % 8 * 4; - } - - return new WordArray.init(words, hexStrLength / 2); - } - }; - /** - * Latin1 encoding strategy. - */ - - var Latin1 = C_enc.Latin1 = { - /** - * Converts a word array to a Latin1 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Latin1 string. - * - * @static - * - * @example - * - * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; // Convert - - var latin1Chars = []; - - for (var i = 0; i < sigBytes; i++) { - var bite = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - latin1Chars.push(String.fromCharCode(bite)); - } - - return latin1Chars.join(''); - }, - - /** - * Converts a Latin1 string to a word array. - * - * @param {string} latin1Str The Latin1 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Latin1.parse(latin1String); - */ - parse: function parse(latin1Str) { - // Shortcut - var latin1StrLength = latin1Str.length; // Convert - - var words = []; - - for (var i = 0; i < latin1StrLength; i++) { - words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << 24 - i % 4 * 8; - } - - return new WordArray.init(words, latin1StrLength); - } - }; - /** - * UTF-8 encoding strategy. - */ - - var Utf8 = C_enc.Utf8 = { - /** - * Converts a word array to a UTF-8 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The UTF-8 string. - * - * @static - * - * @example - * - * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - try { - return decodeURIComponent(escape(Latin1.stringify(wordArray))); - } catch (e) { - throw new Error('Malformed UTF-8 data'); - } - }, - - /** - * Converts a UTF-8 string to a word array. - * - * @param {string} utf8Str The UTF-8 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Utf8.parse(utf8String); - */ - parse: function parse(utf8Str) { - return Latin1.parse(unescape(encodeURIComponent(utf8Str))); - } - }; - /** - * Abstract buffered block algorithm template. - * - * The property blockSize must be implemented in a concrete subtype. - * - * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0 - */ - - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({ - /** - * Resets this block algorithm's data buffer to its initial state. - * - * @example - * - * bufferedBlockAlgorithm.reset(); - */ - reset: function reset() { - // Initial values - this._data = new WordArray.init(); - this._nDataBytes = 0; - }, - - /** - * Adds new data to this block algorithm's buffer. - * - * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8. - * - * @example - * - * bufferedBlockAlgorithm._append('data'); - * bufferedBlockAlgorithm._append(wordArray); - */ - _append: function _append(data) { - // Convert string to WordArray, else assume WordArray already - if (typeof data == 'string') { - data = Utf8.parse(data); - } // Append - - - this._data.concat(data); - - this._nDataBytes += data.sigBytes; - }, - - /** - * Processes available data blocks. - * - * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype. - * - * @param {boolean} doFlush Whether all blocks and partial blocks should be processed. - * - * @return {WordArray} The processed data. - * - * @example - * - * var processedData = bufferedBlockAlgorithm._process(); - * var processedData = bufferedBlockAlgorithm._process(!!'flush'); - */ - _process: function _process(doFlush) { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var dataSigBytes = data.sigBytes; - var blockSize = this.blockSize; - var blockSizeBytes = blockSize * 4; // Count blocks ready - - var nBlocksReady = dataSigBytes / blockSizeBytes; - - if (doFlush) { - // Round up to include partial blocks - nBlocksReady = Math.ceil(nBlocksReady); - } else { - // Round down to include only full blocks, - // less the number of blocks that must remain in the buffer - nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0); - } // Count words ready - - - var nWordsReady = nBlocksReady * blockSize; // Count bytes ready - - var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes); // Process blocks - - if (nWordsReady) { - for (var offset = 0; offset < nWordsReady; offset += blockSize) { - // Perform concrete-algorithm logic - this._doProcessBlock(dataWords, offset); - } // Remove processed words - - - var processedWords = dataWords.splice(0, nWordsReady); - data.sigBytes -= nBytesReady; - } // Return processed words - - - return new WordArray.init(processedWords, nBytesReady); - }, - - /** - * Creates a copy of this object. - * - * @return {Object} The clone. - * - * @example - * - * var clone = bufferedBlockAlgorithm.clone(); - */ - clone: function clone() { - var clone = Base.clone.call(this); - clone._data = this._data.clone(); - return clone; - }, - _minBufferSize: 0 - }); - /** - * Abstract hasher template. - * - * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits) - */ - - var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - */ - cfg: Base.extend(), - - /** - * Initializes a newly created hasher. - * - * @param {Object} cfg (Optional) The configuration options to use for this hash computation. - * - * @example - * - * var hasher = CryptoJS.algo.SHA256.create(); - */ - init: function init(cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Set initial values - - this.reset(); - }, - - /** - * Resets this hasher to its initial state. - * - * @example - * - * hasher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-hasher logic - - this._doReset(); - }, - - /** - * Updates this hasher with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {Hasher} This hasher. - * - * @example - * - * hasher.update('message'); - * hasher.update(wordArray); - */ - update: function update(messageUpdate) { - // Append - this._append(messageUpdate); // Update the hash - - - this._process(); // Chainable - - - return this; - }, - - /** - * Finalizes the hash computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The hash. - * - * @example - * - * var hash = hasher.finalize(); - * var hash = hasher.finalize('message'); - * var hash = hasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Final message update - if (messageUpdate) { - this._append(messageUpdate); - } // Perform concrete-hasher logic - - - var hash = this._doFinalize(); - - return hash; - }, - blockSize: 512 / 32, - - /** - * Creates a shortcut function to a hasher's object interface. - * - * @param {Hasher} hasher The hasher to create a helper for. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256); - */ - _createHelper: function _createHelper(hasher) { - return function (message, cfg) { - return new hasher.init(cfg).finalize(message); - }; - }, - - /** - * Creates a shortcut function to the HMAC's object interface. - * - * @param {Hasher} hasher The hasher to use in this HMAC helper. - * - * @return {Function} The shortcut function. - * - * @static - * - * @example - * - * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256); - */ - _createHmacHelper: function _createHmacHelper(hasher) { - return function (message, key) { - return new C_algo.HMAC.init(hasher, key).finalize(message); - }; - } - }); - /** - * Algorithm namespace. - */ - - var C_algo = C.algo = {}; - return C; - }(Math); - - return CryptoJS; - }); - }); - - var encBase64 = createCommonjsModule(function (module, exports) { - -======= - * var wordArray = CryptoJS.enc.Base64.parse(base64String); - */ - parse: function parse(base64Str) { - // Shortcuts - var base64StrLength = base64Str.length; - var map = this._map; - var reverseMap = this._reverseMap; - - if (!reverseMap) { - reverseMap = this._reverseMap = []; - - for (var j = 0; j < map.length; j++) { - reverseMap[map.charCodeAt(j)] = j; - } - } // Ignore padding - - - var paddingChar = map.charAt(64); - - if (paddingChar) { - var paddingIndex = base64Str.indexOf(paddingChar); - - if (paddingIndex !== -1) { - base64StrLength = paddingIndex; - } - } // Convert - - - return parseLoop(base64Str, base64StrLength, reverseMap); - }, - _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' - }; - - function parseLoop(base64Str, base64StrLength, reverseMap) { - var words = []; - var nBytes = 0; - - for (var i = 0; i < base64StrLength; i++) { - if (i % 4) { - var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; - var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; - words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; - nBytes++; - } - } - - return WordArray.create(words, nBytes); - } - })(); - - return CryptoJS.enc.Base64; - }); - }); - - var md5$1 = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function (Math) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Constants table - - var T = []; // Compute constants - - (function () { - for (var i = 0; i < 64; i++) { - T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; - } - })(); - /** - * MD5 hash algorithm. - */ - - - var MD5 = C_algo.MD5 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Swap endian - for (var i = 0; i < 16; i++) { - // Shortcuts - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; - } // Shortcuts - - - var H = this._hash.words; - var M_offset_0 = M[offset + 0]; - var M_offset_1 = M[offset + 1]; - var M_offset_2 = M[offset + 2]; - var M_offset_3 = M[offset + 3]; - var M_offset_4 = M[offset + 4]; - var M_offset_5 = M[offset + 5]; - var M_offset_6 = M[offset + 6]; - var M_offset_7 = M[offset + 7]; - var M_offset_8 = M[offset + 8]; - var M_offset_9 = M[offset + 9]; - var M_offset_10 = M[offset + 10]; - var M_offset_11 = M[offset + 11]; - var M_offset_12 = M[offset + 12]; - var M_offset_13 = M[offset + 13]; - var M_offset_14 = M[offset + 14]; - var M_offset_15 = M[offset + 15]; // Working varialbes - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; // Computation - - a = FF(a, b, c, d, M_offset_0, 7, T[0]); - d = FF(d, a, b, c, M_offset_1, 12, T[1]); - c = FF(c, d, a, b, M_offset_2, 17, T[2]); - b = FF(b, c, d, a, M_offset_3, 22, T[3]); - a = FF(a, b, c, d, M_offset_4, 7, T[4]); - d = FF(d, a, b, c, M_offset_5, 12, T[5]); - c = FF(c, d, a, b, M_offset_6, 17, T[6]); - b = FF(b, c, d, a, M_offset_7, 22, T[7]); - a = FF(a, b, c, d, M_offset_8, 7, T[8]); - d = FF(d, a, b, c, M_offset_9, 12, T[9]); - c = FF(c, d, a, b, M_offset_10, 17, T[10]); - b = FF(b, c, d, a, M_offset_11, 22, T[11]); - a = FF(a, b, c, d, M_offset_12, 7, T[12]); - d = FF(d, a, b, c, M_offset_13, 12, T[13]); - c = FF(c, d, a, b, M_offset_14, 17, T[14]); - b = FF(b, c, d, a, M_offset_15, 22, T[15]); - a = GG(a, b, c, d, M_offset_1, 5, T[16]); - d = GG(d, a, b, c, M_offset_6, 9, T[17]); - c = GG(c, d, a, b, M_offset_11, 14, T[18]); - b = GG(b, c, d, a, M_offset_0, 20, T[19]); - a = GG(a, b, c, d, M_offset_5, 5, T[20]); - d = GG(d, a, b, c, M_offset_10, 9, T[21]); - c = GG(c, d, a, b, M_offset_15, 14, T[22]); - b = GG(b, c, d, a, M_offset_4, 20, T[23]); - a = GG(a, b, c, d, M_offset_9, 5, T[24]); - d = GG(d, a, b, c, M_offset_14, 9, T[25]); - c = GG(c, d, a, b, M_offset_3, 14, T[26]); - b = GG(b, c, d, a, M_offset_8, 20, T[27]); - a = GG(a, b, c, d, M_offset_13, 5, T[28]); - d = GG(d, a, b, c, M_offset_2, 9, T[29]); - c = GG(c, d, a, b, M_offset_7, 14, T[30]); - b = GG(b, c, d, a, M_offset_12, 20, T[31]); - a = HH(a, b, c, d, M_offset_5, 4, T[32]); - d = HH(d, a, b, c, M_offset_8, 11, T[33]); - c = HH(c, d, a, b, M_offset_11, 16, T[34]); - b = HH(b, c, d, a, M_offset_14, 23, T[35]); - a = HH(a, b, c, d, M_offset_1, 4, T[36]); - d = HH(d, a, b, c, M_offset_4, 11, T[37]); - c = HH(c, d, a, b, M_offset_7, 16, T[38]); - b = HH(b, c, d, a, M_offset_10, 23, T[39]); - a = HH(a, b, c, d, M_offset_13, 4, T[40]); - d = HH(d, a, b, c, M_offset_0, 11, T[41]); - c = HH(c, d, a, b, M_offset_3, 16, T[42]); - b = HH(b, c, d, a, M_offset_6, 23, T[43]); - a = HH(a, b, c, d, M_offset_9, 4, T[44]); - d = HH(d, a, b, c, M_offset_12, 11, T[45]); - c = HH(c, d, a, b, M_offset_15, 16, T[46]); - b = HH(b, c, d, a, M_offset_2, 23, T[47]); - a = II(a, b, c, d, M_offset_0, 6, T[48]); - d = II(d, a, b, c, M_offset_7, 10, T[49]); - c = II(c, d, a, b, M_offset_14, 15, T[50]); - b = II(b, c, d, a, M_offset_5, 21, T[51]); - a = II(a, b, c, d, M_offset_12, 6, T[52]); - d = II(d, a, b, c, M_offset_3, 10, T[53]); - c = II(c, d, a, b, M_offset_10, 15, T[54]); - b = II(b, c, d, a, M_offset_1, 21, T[55]); - a = II(a, b, c, d, M_offset_8, 6, T[56]); - d = II(d, a, b, c, M_offset_15, 10, T[57]); - c = II(c, d, a, b, M_offset_6, 15, T[58]); - b = II(b, c, d, a, M_offset_13, 21, T[59]); - a = II(a, b, c, d, M_offset_4, 6, T[60]); - d = II(d, a, b, c, M_offset_11, 10, T[61]); - c = II(c, d, a, b, M_offset_2, 15, T[62]); - b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value - - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding - - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); - var nBitsTotalL = nBitsTotal; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; - data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks - - this._process(); // Shortcuts - - - var hash = this._hash; - var H = hash.words; // Swap endian - - for (var i = 0; i < 4; i++) { - // Shortcut - var H_i = H[i]; - H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; - } // Return final computed hash - - - return hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - - function FF(a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function GG(a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function HH(a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function II(a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + x + t; - return (n << s | n >>> 32 - s) + b; - } - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.MD5('message'); - * var hash = CryptoJS.MD5(wordArray); - */ - - - C.MD5 = Hasher._createHelper(MD5); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacMD5(message, key); - */ - - C.HmacMD5 = Hasher._createHmacHelper(MD5); - })(Math); - - return CryptoJS.MD5; - }); - }); - - var sha1 = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Reusable object - - var W = []; - /** - * SHA-1 hash algorithm. - */ - - var SHA1 = C_algo.SHA1 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Shortcut - var H = this._hash.words; // Working variables - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; // Computation - - for (var i = 0; i < 80; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = n << 1 | n >>> 31; - } - - var t = (a << 5 | a >>> 27) + e + W[i]; - - if (i < 20) { - t += (b & c | ~b & d) + 0x5a827999; - } else if (i < 40) { - t += (b ^ c ^ d) + 0x6ed9eba1; - } else if (i < 60) { - t += (b & c | b & d | c & d) - 0x70e44324; - } else - /* if (i < 80) */ - { - t += (b ^ c ^ d) - 0x359d3e2a; - } - - e = d; - d = c; - c = b << 30 | b >>> 2; - b = a; - a = t; - } // Intermediate hash value - - - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - H[4] = H[4] + e | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding - - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; // Hash final blocks - - this._process(); // Return final computed hash - - - return this._hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA1('message'); - * var hash = CryptoJS.SHA1(wordArray); - */ - - C.SHA1 = Hasher._createHelper(SHA1); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA1(message, key); - */ - - C.HmacSHA1 = Hasher._createHmacHelper(SHA1); - })(); - - return CryptoJS.SHA1; - }); - }); - - var hmac = createCommonjsModule(function (module, exports) { - ->>>>>>> branch for npm and latest release - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; -<<<<<<< HEAD - var WordArray = C_lib.WordArray; - var C_enc = C.enc; - /** - * Base64 encoding strategy. - */ - - var Base64 = C_enc.Base64 = { - /** - * Converts a word array to a Base64 string. - * - * @param {WordArray} wordArray The word array. - * - * @return {string} The Base64 string. -======= - var Base = C_lib.Base; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var C_algo = C.algo; - /** - * HMAC algorithm. - */ - - var HMAC = C_algo.HMAC = Base.extend({ - /** - * Initializes a newly created HMAC. - * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. - * - * @example - * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); - */ - init: function init(hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already - - if (typeof key == 'string') { - key = Utf8.parse(key); - } // Shortcuts - - - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys - - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } // Clamp excess bits - - - key.clamp(); // Clone key for inner and outer pads - - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); // Shortcuts - - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; // XOR keys with pad constants - - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } - - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values - - this.reset(); - }, - - /** - * Resets this HMAC to its initial state. - * - * @example - * - * hmacHasher.reset(); - */ - reset: function reset() { - // Shortcut - var hasher = this._hasher; // Reset - - hasher.reset(); - hasher.update(this._iKey); - }, - - /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {HMAC} This HMAC instance. - * - * @example - * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); - */ - update: function update(messageUpdate) { - this._hasher.update(messageUpdate); // Chainable - - - return this; - }, - - /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. - * - * @example - * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Shortcut - var hasher = this._hasher; // Compute HMAC - - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - return hmac; - } - }); - })(); - }); - }); - - var evpkdf = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, sha1, hmac); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var C_algo = C.algo; - var MD5 = C_algo.MD5; - /** - * This key derivation function is meant to conform with EVP_BytesToKey. - * www.openssl.org/docs/crypto/EVP_BytesToKey.html - */ - - var EvpKDF = C_algo.EvpKDF = Base.extend({ - /** - * Configuration options. - * - * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) - * @property {Hasher} hasher The hash algorithm to use. Default: MD5 - * @property {number} iterations The number of iterations to perform. Default: 1 - */ - cfg: Base.extend({ - keySize: 128 / 32, - hasher: MD5, - iterations: 1 - }), - - /** - * Initializes a newly created key derivation function. - * - * @param {Object} cfg (Optional) The configuration options to use for the derivation. - * - * @example - * - * var kdf = CryptoJS.algo.EvpKDF.create(); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); - */ - init: function init(cfg) { - this.cfg = this.cfg.extend(cfg); - }, - - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * - * @return {WordArray} The derived key. - * - * @example - * - * var key = kdf.compute(password, salt); - */ - compute: function compute(password, salt) { - // Shortcut - var cfg = this.cfg; // Init hasher - - var hasher = cfg.hasher.create(); // Initial values - - var derivedKey = WordArray.create(); // Shortcuts - - var derivedKeyWords = derivedKey.words; - var keySize = cfg.keySize; - var iterations = cfg.iterations; // Generate key - - while (derivedKeyWords.length < keySize) { - if (block) { - hasher.update(block); - } - - var block = hasher.update(password).finalize(salt); - hasher.reset(); // Iterations - - for (var i = 1; i < iterations; i++) { - block = hasher.finalize(block); - hasher.reset(); - } - - derivedKey.concat(block); - } - - derivedKey.sigBytes = keySize * 4; - return derivedKey; - } - }); - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * @param {Object} cfg (Optional) The configuration options to use for this computation. - * - * @return {WordArray} The derived key. - * - * @static - * - * @example - * - * var key = CryptoJS.EvpKDF(password, salt); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); - */ - - C.EvpKDF = function (password, salt, cfg) { - return EvpKDF.create(cfg).compute(password, salt); - }; - })(); - - return CryptoJS.EvpKDF; - }); - }); - - var cipherCore = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, evpkdf); - } - })(commonjsGlobal, function (CryptoJS) { - /** - * Cipher core components. - */ - CryptoJS.lib.Cipher || function (undefined$1) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var Base64 = C_enc.Base64; - var C_algo = C.algo; - var EvpKDF = C_algo.EvpKDF; - /** - * Abstract base cipher template. - * - * @property {number} keySize This cipher's key size. Default: 4 (128 bits) - * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) - * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. - * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. - */ - - var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - * - * @property {WordArray} iv The IV to use for this operation. - */ - cfg: Base.extend(), - - /** - * Creates this cipher in encryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. ->>>>>>> branch for npm and latest release - * - * @static - * - * @example - * -<<<<<<< HEAD - * var base64String = CryptoJS.enc.Base64.stringify(wordArray); - */ - stringify: function stringify(wordArray) { - // Shortcuts - var words = wordArray.words; - var sigBytes = wordArray.sigBytes; - var map = this._map; // Clamp excess bits - - wordArray.clamp(); // Convert - - var base64Chars = []; - - for (var i = 0; i < sigBytes; i += 3) { - var byte1 = words[i >>> 2] >>> 24 - i % 4 * 8 & 0xff; - var byte2 = words[i + 1 >>> 2] >>> 24 - (i + 1) % 4 * 8 & 0xff; - var byte3 = words[i + 2 >>> 2] >>> 24 - (i + 2) % 4 * 8 & 0xff; - var triplet = byte1 << 16 | byte2 << 8 | byte3; - - for (var j = 0; j < 4 && i + j * 0.75 < sigBytes; j++) { - base64Chars.push(map.charAt(triplet >>> 6 * (3 - j) & 0x3f)); - } - } // Add padding - - - var paddingChar = map.charAt(64); - - if (paddingChar) { - while (base64Chars.length % 4) { - base64Chars.push(paddingChar); - } - } - - return base64Chars.join(''); - }, - - /** - * Converts a Base64 string to a word array. - * - * @param {string} base64Str The Base64 string. - * - * @return {WordArray} The word array. - * - * @static - * - * @example - * - * var wordArray = CryptoJS.enc.Base64.parse(base64String); - */ - parse: function parse(base64Str) { - // Shortcuts - var base64StrLength = base64Str.length; - var map = this._map; - var reverseMap = this._reverseMap; - - if (!reverseMap) { - reverseMap = this._reverseMap = []; - - for (var j = 0; j < map.length; j++) { - reverseMap[map.charCodeAt(j)] = j; - } - } // Ignore padding - - - var paddingChar = map.charAt(64); - - if (paddingChar) { - var paddingIndex = base64Str.indexOf(paddingChar); - - if (paddingIndex !== -1) { - base64StrLength = paddingIndex; - } - } // Convert - - - return parseLoop(base64Str, base64StrLength, reverseMap); - }, - _map: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=' - }; - - function parseLoop(base64Str, base64StrLength, reverseMap) { - var words = []; - var nBytes = 0; - - for (var i = 0; i < base64StrLength; i++) { - if (i % 4) { - var bits1 = reverseMap[base64Str.charCodeAt(i - 1)] << i % 4 * 2; - var bits2 = reverseMap[base64Str.charCodeAt(i)] >>> 6 - i % 4 * 2; - words[nBytes >>> 2] |= (bits1 | bits2) << 24 - nBytes % 4 * 8; - nBytes++; - } - } - - return WordArray.create(words, nBytes); - } - })(); - - return CryptoJS.enc.Base64; - }); - }); - - var md5$1 = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function (Math) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Constants table - - var T = []; // Compute constants - - (function () { - for (var i = 0; i < 64; i++) { - T[i] = Math.abs(Math.sin(i + 1)) * 0x100000000 | 0; - } - })(); - /** - * MD5 hash algorithm. - */ - - - var MD5 = C_algo.MD5 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Swap endian - for (var i = 0; i < 16; i++) { - // Shortcuts - var offset_i = offset + i; - var M_offset_i = M[offset_i]; - M[offset_i] = (M_offset_i << 8 | M_offset_i >>> 24) & 0x00ff00ff | (M_offset_i << 24 | M_offset_i >>> 8) & 0xff00ff00; - } // Shortcuts - - - var H = this._hash.words; - var M_offset_0 = M[offset + 0]; - var M_offset_1 = M[offset + 1]; - var M_offset_2 = M[offset + 2]; - var M_offset_3 = M[offset + 3]; - var M_offset_4 = M[offset + 4]; - var M_offset_5 = M[offset + 5]; - var M_offset_6 = M[offset + 6]; - var M_offset_7 = M[offset + 7]; - var M_offset_8 = M[offset + 8]; - var M_offset_9 = M[offset + 9]; - var M_offset_10 = M[offset + 10]; - var M_offset_11 = M[offset + 11]; - var M_offset_12 = M[offset + 12]; - var M_offset_13 = M[offset + 13]; - var M_offset_14 = M[offset + 14]; - var M_offset_15 = M[offset + 15]; // Working varialbes - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; // Computation - - a = FF(a, b, c, d, M_offset_0, 7, T[0]); - d = FF(d, a, b, c, M_offset_1, 12, T[1]); - c = FF(c, d, a, b, M_offset_2, 17, T[2]); - b = FF(b, c, d, a, M_offset_3, 22, T[3]); - a = FF(a, b, c, d, M_offset_4, 7, T[4]); - d = FF(d, a, b, c, M_offset_5, 12, T[5]); - c = FF(c, d, a, b, M_offset_6, 17, T[6]); - b = FF(b, c, d, a, M_offset_7, 22, T[7]); - a = FF(a, b, c, d, M_offset_8, 7, T[8]); - d = FF(d, a, b, c, M_offset_9, 12, T[9]); - c = FF(c, d, a, b, M_offset_10, 17, T[10]); - b = FF(b, c, d, a, M_offset_11, 22, T[11]); - a = FF(a, b, c, d, M_offset_12, 7, T[12]); - d = FF(d, a, b, c, M_offset_13, 12, T[13]); - c = FF(c, d, a, b, M_offset_14, 17, T[14]); - b = FF(b, c, d, a, M_offset_15, 22, T[15]); - a = GG(a, b, c, d, M_offset_1, 5, T[16]); - d = GG(d, a, b, c, M_offset_6, 9, T[17]); - c = GG(c, d, a, b, M_offset_11, 14, T[18]); - b = GG(b, c, d, a, M_offset_0, 20, T[19]); - a = GG(a, b, c, d, M_offset_5, 5, T[20]); - d = GG(d, a, b, c, M_offset_10, 9, T[21]); - c = GG(c, d, a, b, M_offset_15, 14, T[22]); - b = GG(b, c, d, a, M_offset_4, 20, T[23]); - a = GG(a, b, c, d, M_offset_9, 5, T[24]); - d = GG(d, a, b, c, M_offset_14, 9, T[25]); - c = GG(c, d, a, b, M_offset_3, 14, T[26]); - b = GG(b, c, d, a, M_offset_8, 20, T[27]); - a = GG(a, b, c, d, M_offset_13, 5, T[28]); - d = GG(d, a, b, c, M_offset_2, 9, T[29]); - c = GG(c, d, a, b, M_offset_7, 14, T[30]); - b = GG(b, c, d, a, M_offset_12, 20, T[31]); - a = HH(a, b, c, d, M_offset_5, 4, T[32]); - d = HH(d, a, b, c, M_offset_8, 11, T[33]); - c = HH(c, d, a, b, M_offset_11, 16, T[34]); - b = HH(b, c, d, a, M_offset_14, 23, T[35]); - a = HH(a, b, c, d, M_offset_1, 4, T[36]); - d = HH(d, a, b, c, M_offset_4, 11, T[37]); - c = HH(c, d, a, b, M_offset_7, 16, T[38]); - b = HH(b, c, d, a, M_offset_10, 23, T[39]); - a = HH(a, b, c, d, M_offset_13, 4, T[40]); - d = HH(d, a, b, c, M_offset_0, 11, T[41]); - c = HH(c, d, a, b, M_offset_3, 16, T[42]); - b = HH(b, c, d, a, M_offset_6, 23, T[43]); - a = HH(a, b, c, d, M_offset_9, 4, T[44]); - d = HH(d, a, b, c, M_offset_12, 11, T[45]); - c = HH(c, d, a, b, M_offset_15, 16, T[46]); - b = HH(b, c, d, a, M_offset_2, 23, T[47]); - a = II(a, b, c, d, M_offset_0, 6, T[48]); - d = II(d, a, b, c, M_offset_7, 10, T[49]); - c = II(c, d, a, b, M_offset_14, 15, T[50]); - b = II(b, c, d, a, M_offset_5, 21, T[51]); - a = II(a, b, c, d, M_offset_12, 6, T[52]); - d = II(d, a, b, c, M_offset_3, 10, T[53]); - c = II(c, d, a, b, M_offset_10, 15, T[54]); - b = II(b, c, d, a, M_offset_1, 21, T[55]); - a = II(a, b, c, d, M_offset_8, 6, T[56]); - d = II(d, a, b, c, M_offset_15, 10, T[57]); - c = II(c, d, a, b, M_offset_6, 15, T[58]); - b = II(b, c, d, a, M_offset_13, 21, T[59]); - a = II(a, b, c, d, M_offset_4, 6, T[60]); - d = II(d, a, b, c, M_offset_11, 10, T[61]); - c = II(c, d, a, b, M_offset_2, 15, T[62]); - b = II(b, c, d, a, M_offset_9, 21, T[63]); // Intermediate hash value - - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding - - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - var nBitsTotalH = Math.floor(nBitsTotal / 0x100000000); - var nBitsTotalL = nBitsTotal; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = (nBitsTotalH << 8 | nBitsTotalH >>> 24) & 0x00ff00ff | (nBitsTotalH << 24 | nBitsTotalH >>> 8) & 0xff00ff00; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = (nBitsTotalL << 8 | nBitsTotalL >>> 24) & 0x00ff00ff | (nBitsTotalL << 24 | nBitsTotalL >>> 8) & 0xff00ff00; - data.sigBytes = (dataWords.length + 1) * 4; // Hash final blocks - - this._process(); // Shortcuts - - - var hash = this._hash; - var H = hash.words; // Swap endian - - for (var i = 0; i < 4; i++) { - // Shortcut - var H_i = H[i]; - H[i] = (H_i << 8 | H_i >>> 24) & 0x00ff00ff | (H_i << 24 | H_i >>> 8) & 0xff00ff00; - } // Return final computed hash - - - return hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - - function FF(a, b, c, d, x, s, t) { - var n = a + (b & c | ~b & d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function GG(a, b, c, d, x, s, t) { - var n = a + (b & d | c & ~d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function HH(a, b, c, d, x, s, t) { - var n = a + (b ^ c ^ d) + x + t; - return (n << s | n >>> 32 - s) + b; - } - - function II(a, b, c, d, x, s, t) { - var n = a + (c ^ (b | ~d)) + x + t; - return (n << s | n >>> 32 - s) + b; - } - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.MD5('message'); - * var hash = CryptoJS.MD5(wordArray); - */ - - - C.MD5 = Hasher._createHelper(MD5); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacMD5(message, key); - */ - - C.HmacMD5 = Hasher._createHmacHelper(MD5); - })(Math); - - return CryptoJS.MD5; - }); - }); - - var sha1 = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var WordArray = C_lib.WordArray; - var Hasher = C_lib.Hasher; - var C_algo = C.algo; // Reusable object - - var W = []; - /** - * SHA-1 hash algorithm. - */ - - var SHA1 = C_algo.SHA1 = Hasher.extend({ - _doReset: function _doReset() { - this._hash = new WordArray.init([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0]); - }, - _doProcessBlock: function _doProcessBlock(M, offset) { - // Shortcut - var H = this._hash.words; // Working variables - - var a = H[0]; - var b = H[1]; - var c = H[2]; - var d = H[3]; - var e = H[4]; // Computation - - for (var i = 0; i < 80; i++) { - if (i < 16) { - W[i] = M[offset + i] | 0; - } else { - var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]; - W[i] = n << 1 | n >>> 31; - } - - var t = (a << 5 | a >>> 27) + e + W[i]; - - if (i < 20) { - t += (b & c | ~b & d) + 0x5a827999; - } else if (i < 40) { - t += (b ^ c ^ d) + 0x6ed9eba1; - } else if (i < 60) { - t += (b & c | b & d | c & d) - 0x70e44324; - } else - /* if (i < 80) */ - { - t += (b ^ c ^ d) - 0x359d3e2a; - } - - e = d; - d = c; - c = b << 30 | b >>> 2; - b = a; - a = t; - } // Intermediate hash value - - - H[0] = H[0] + a | 0; - H[1] = H[1] + b | 0; - H[2] = H[2] + c | 0; - H[3] = H[3] + d | 0; - H[4] = H[4] + e | 0; - }, - _doFinalize: function _doFinalize() { - // Shortcuts - var data = this._data; - var dataWords = data.words; - var nBitsTotal = this._nDataBytes * 8; - var nBitsLeft = data.sigBytes * 8; // Add padding - - dataWords[nBitsLeft >>> 5] |= 0x80 << 24 - nBitsLeft % 32; - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 14] = Math.floor(nBitsTotal / 0x100000000); - dataWords[(nBitsLeft + 64 >>> 9 << 4) + 15] = nBitsTotal; - data.sigBytes = dataWords.length * 4; // Hash final blocks - - this._process(); // Return final computed hash - - - return this._hash; - }, - clone: function clone() { - var clone = Hasher.clone.call(this); - clone._hash = this._hash.clone(); - return clone; - } - }); - /** - * Shortcut function to the hasher's object interface. - * - * @param {WordArray|string} message The message to hash. - * - * @return {WordArray} The hash. - * - * @static - * - * @example - * - * var hash = CryptoJS.SHA1('message'); - * var hash = CryptoJS.SHA1(wordArray); - */ - - C.SHA1 = Hasher._createHelper(SHA1); - /** - * Shortcut function to the HMAC's object interface. - * - * @param {WordArray|string} message The message to hash. - * @param {WordArray|string} key The secret key. - * - * @return {WordArray} The HMAC. - * - * @static - * - * @example - * - * var hmac = CryptoJS.HmacSHA1(message, key); - */ - - C.HmacSHA1 = Hasher._createHmacHelper(SHA1); - })(); - - return CryptoJS.SHA1; - }); - }); - - var hmac = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var C_algo = C.algo; - /** - * HMAC algorithm. - */ - - var HMAC = C_algo.HMAC = Base.extend({ - /** - * Initializes a newly created HMAC. - * - * @param {Hasher} hasher The hash algorithm to use. - * @param {WordArray|string} key The secret key. - * - * @example - * - * var hmacHasher = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, key); - */ - init: function init(hasher, key) { - // Init hasher - hasher = this._hasher = new hasher.init(); // Convert string to WordArray, else assume WordArray already - - if (typeof key == 'string') { - key = Utf8.parse(key); - } // Shortcuts - - - var hasherBlockSize = hasher.blockSize; - var hasherBlockSizeBytes = hasherBlockSize * 4; // Allow arbitrary length keys - - if (key.sigBytes > hasherBlockSizeBytes) { - key = hasher.finalize(key); - } // Clamp excess bits - - - key.clamp(); // Clone key for inner and outer pads - - var oKey = this._oKey = key.clone(); - var iKey = this._iKey = key.clone(); // Shortcuts - - var oKeyWords = oKey.words; - var iKeyWords = iKey.words; // XOR keys with pad constants - - for (var i = 0; i < hasherBlockSize; i++) { - oKeyWords[i] ^= 0x5c5c5c5c; - iKeyWords[i] ^= 0x36363636; - } - - oKey.sigBytes = iKey.sigBytes = hasherBlockSizeBytes; // Set initial values - - this.reset(); - }, - - /** - * Resets this HMAC to its initial state. - * - * @example - * - * hmacHasher.reset(); - */ - reset: function reset() { - // Shortcut - var hasher = this._hasher; // Reset - - hasher.reset(); - hasher.update(this._iKey); - }, - - /** - * Updates this HMAC with a message. - * - * @param {WordArray|string} messageUpdate The message to append. - * - * @return {HMAC} This HMAC instance. - * - * @example - * - * hmacHasher.update('message'); - * hmacHasher.update(wordArray); - */ - update: function update(messageUpdate) { - this._hasher.update(messageUpdate); // Chainable - - - return this; - }, - - /** - * Finalizes the HMAC computation. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} messageUpdate (Optional) A final message update. - * - * @return {WordArray} The HMAC. - * - * @example - * - * var hmac = hmacHasher.finalize(); - * var hmac = hmacHasher.finalize('message'); - * var hmac = hmacHasher.finalize(wordArray); - */ - finalize: function finalize(messageUpdate) { - // Shortcut - var hasher = this._hasher; // Compute HMAC - - var innerHash = hasher.finalize(messageUpdate); - hasher.reset(); - var hmac = hasher.finalize(this._oKey.clone().concat(innerHash)); - return hmac; - } - }); - })(); - }); - }); - - var evpkdf = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, sha1, hmac); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var C_algo = C.algo; - var MD5 = C_algo.MD5; - /** - * This key derivation function is meant to conform with EVP_BytesToKey. - * www.openssl.org/docs/crypto/EVP_BytesToKey.html - */ - - var EvpKDF = C_algo.EvpKDF = Base.extend({ - /** - * Configuration options. - * - * @property {number} keySize The key size in words to generate. Default: 4 (128 bits) - * @property {Hasher} hasher The hash algorithm to use. Default: MD5 - * @property {number} iterations The number of iterations to perform. Default: 1 - */ - cfg: Base.extend({ - keySize: 128 / 32, - hasher: MD5, - iterations: 1 - }), - - /** - * Initializes a newly created key derivation function. - * - * @param {Object} cfg (Optional) The configuration options to use for the derivation. - * - * @example - * - * var kdf = CryptoJS.algo.EvpKDF.create(); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8 }); - * var kdf = CryptoJS.algo.EvpKDF.create({ keySize: 8, iterations: 1000 }); - */ - init: function init(cfg) { - this.cfg = this.cfg.extend(cfg); - }, - - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * - * @return {WordArray} The derived key. - * - * @example - * - * var key = kdf.compute(password, salt); - */ - compute: function compute(password, salt) { - // Shortcut - var cfg = this.cfg; // Init hasher - - var hasher = cfg.hasher.create(); // Initial values - - var derivedKey = WordArray.create(); // Shortcuts - - var derivedKeyWords = derivedKey.words; - var keySize = cfg.keySize; - var iterations = cfg.iterations; // Generate key - - while (derivedKeyWords.length < keySize) { - if (block) { - hasher.update(block); - } - - var block = hasher.update(password).finalize(salt); - hasher.reset(); // Iterations - - for (var i = 1; i < iterations; i++) { - block = hasher.finalize(block); - hasher.reset(); - } - - derivedKey.concat(block); - } - - derivedKey.sigBytes = keySize * 4; - return derivedKey; - } - }); - /** - * Derives a key from a password. - * - * @param {WordArray|string} password The password. - * @param {WordArray|string} salt A salt. - * @param {Object} cfg (Optional) The configuration options to use for this computation. - * - * @return {WordArray} The derived key. - * - * @static - * - * @example - * - * var key = CryptoJS.EvpKDF(password, salt); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8 }); - * var key = CryptoJS.EvpKDF(password, salt, { keySize: 8, iterations: 1000 }); - */ - - C.EvpKDF = function (password, salt, cfg) { - return EvpKDF.create(cfg).compute(password, salt); - }; - })(); - - return CryptoJS.EvpKDF; - }); - }); - - var cipherCore = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, evpkdf); - } - })(commonjsGlobal, function (CryptoJS) { - /** - * Cipher core components. - */ - CryptoJS.lib.Cipher || function (undefined$1) { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var Base = C_lib.Base; - var WordArray = C_lib.WordArray; - var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm; - var C_enc = C.enc; - var Utf8 = C_enc.Utf8; - var Base64 = C_enc.Base64; - var C_algo = C.algo; - var EvpKDF = C_algo.EvpKDF; - /** - * Abstract base cipher template. - * - * @property {number} keySize This cipher's key size. Default: 4 (128 bits) - * @property {number} ivSize This cipher's IV size. Default: 4 (128 bits) - * @property {number} _ENC_XFORM_MODE A constant representing encryption mode. - * @property {number} _DEC_XFORM_MODE A constant representing decryption mode. - */ - - var Cipher = C_lib.Cipher = BufferedBlockAlgorithm.extend({ - /** - * Configuration options. - * - * @property {WordArray} iv The IV to use for this operation. - */ - cfg: Base.extend(), - - /** - * Creates this cipher in encryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); - */ - createEncryptor: function createEncryptor(key, cfg) { - return this.create(this._ENC_XFORM_MODE, key, cfg); - }, - - /** - * Creates this cipher in decryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); - */ - createDecryptor: function createDecryptor(key, cfg) { - return this.create(this._DEC_XFORM_MODE, key, cfg); - }, - - /** - * Initializes a newly created cipher. - * - * @param {number} xformMode Either the encryption or decryption transormation mode constant. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @example - * - * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); - */ - init: function init(xformMode, key, cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Store transform mode and key - - this._xformMode = xformMode; - this._key = key; // Set initial values - - this.reset(); - }, - - /** - * Resets this cipher to its initial state. - * - * @example - * - * cipher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic - - this._doReset(); - }, - - /** - * Adds data to be encrypted or decrypted. - * - * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. - * - * @return {WordArray} The data after processing. - * - * @example - * - * var encrypted = cipher.process('data'); - * var encrypted = cipher.process(wordArray); - */ - process: function process(dataUpdate) { - // Append - this._append(dataUpdate); // Process available blocks - - - return this._process(); - }, - - /** - * Finalizes the encryption or decryption process. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. - * - * @return {WordArray} The data after final processing. - * - * @example - * - * var encrypted = cipher.finalize(); - * var encrypted = cipher.finalize('data'); - * var encrypted = cipher.finalize(wordArray); - */ - finalize: function finalize(dataUpdate) { - // Final data update - if (dataUpdate) { - this._append(dataUpdate); - } // Perform concrete-cipher logic - - - var finalProcessedData = this._doFinalize(); - - return finalProcessedData; - }, - keySize: 128 / 32, - ivSize: 128 / 32, - _ENC_XFORM_MODE: 1, - _DEC_XFORM_MODE: 2, - - /** - * Creates shortcut functions to a cipher's object interface. - * - * @param {Cipher} cipher The cipher to create a helper for. - * - * @return {Object} An object with encrypt and decrypt shortcut functions. - * - * @static - * - * @example - * - * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); - */ - _createHelper: function () { - function selectCipherStrategy(key) { - if (typeof key == 'string') { - return PasswordBasedCipher; - } else { - return SerializableCipher; - } - } - - return function (cipher) { - return { - encrypt: function encrypt(message, key, cfg) { - return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); - }, - decrypt: function decrypt(ciphertext, key, cfg) { - return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); - } - }; - }; - }() - }); - /** - * Abstract base stream cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) - */ - - var StreamCipher = C_lib.StreamCipher = Cipher.extend({ - _doFinalize: function _doFinalize() { - // Process partial blocks - var finalProcessedBlocks = this._process(!!'flush'); - - return finalProcessedBlocks; - }, - blockSize: 1 - }); - /** - * Mode namespace. - */ - - var C_mode = C.mode = {}; - /** - * Abstract base block cipher mode template. - */ - - var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ - /** - * Creates this mode for encryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); - */ - createEncryptor: function createEncryptor(cipher, iv) { - return this.Encryptor.create(cipher, iv); - }, - - /** - * Creates this mode for decryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); - */ - createDecryptor: function createDecryptor(cipher, iv) { - return this.Decryptor.create(cipher, iv); - }, - - /** - * Initializes a newly created mode. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @example - * - * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); - */ - init: function init(cipher, iv) { - this._cipher = cipher; - this._iv = iv; - } - }); - /** - * Cipher Block Chaining mode. - */ - - var CBC = C_mode.CBC = function () { - /** - * Abstract base CBC mode. - */ - var CBC = BlockCipherMode.extend(); - /** - * CBC encryptor. - */ - - CBC.Encryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // XOR and encrypt - - xorBlock.call(this, words, offset, blockSize); - cipher.encryptBlock(words, offset); // Remember this block to use with next block - - this._prevBlock = words.slice(offset, offset + blockSize); - } - }); - /** - * CBC decryptor. - */ - - CBC.Decryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // Remember this block to use with next block - - var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR - - cipher.decryptBlock(words, offset); - xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block - - this._prevBlock = thisBlock; - } - }); - - function xorBlock(words, offset, blockSize) { - // Shortcut - var iv = this._iv; // Choose mixing block - - if (iv) { - var block = iv; // Remove IV for subsequent blocks - - this._iv = undefined$1; - } else { - var block = this._prevBlock; - } // XOR blocks - - - for (var i = 0; i < blockSize; i++) { - words[offset + i] ^= block[i]; - } - } - - return CBC; - }(); - /** - * Padding namespace. - */ - - - var C_pad = C.pad = {}; - /** - * PKCS #5/7 padding strategy. - */ - - var Pkcs7 = C_pad.Pkcs7 = { - /** - * Pads data using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to pad. - * @param {number} blockSize The multiple that the data should be padded to. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.pad(wordArray, 4); - */ - pad: function pad(data, blockSize) { - // Shortcut - var blockSizeBytes = blockSize * 4; // Count padding bytes - - var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word - - var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding - - var paddingWords = []; - - for (var i = 0; i < nPaddingBytes; i += 4) { - paddingWords.push(paddingWord); - } - - var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding - - data.concat(padding); - }, - - /** - * Unpads data that had been padded using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to unpad. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.unpad(wordArray); - */ - unpad: function unpad(data) { - // Get number of padding bytes from last byte - var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding - - data.sigBytes -= nPaddingBytes; - } - }; - /** - * Abstract base block cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) - */ - - var BlockCipher = C_lib.BlockCipher = Cipher.extend({ - /** - * Configuration options. - * - * @property {Mode} mode The block mode to use. Default: CBC - * @property {Padding} padding The padding strategy to use. Default: Pkcs7 - */ - cfg: Cipher.cfg.extend({ - mode: CBC, - padding: Pkcs7 - }), - reset: function reset() { - // Reset cipher - Cipher.reset.call(this); // Shortcuts - - var cfg = this.cfg; - var iv = cfg.iv; - var mode = cfg.mode; // Reset block mode - - if (this._xformMode == this._ENC_XFORM_MODE) { - var modeCreator = mode.createEncryptor; - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding - - this._minBufferSize = 1; - } - - if (this._mode && this._mode.__creator == modeCreator) { - this._mode.init(this, iv && iv.words); - } else { - this._mode = modeCreator.call(mode, this, iv && iv.words); - this._mode.__creator = modeCreator; - } - }, - _doProcessBlock: function _doProcessBlock(words, offset) { - this._mode.processBlock(words, offset); - }, - _doFinalize: function _doFinalize() { - // Shortcut - var padding = this.cfg.padding; // Finalize - - if (this._xformMode == this._ENC_XFORM_MODE) { - // Pad data - padding.pad(this._data, this.blockSize); // Process final blocks - - var finalProcessedBlocks = this._process(!!'flush'); - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - // Process final blocks - var finalProcessedBlocks = this._process(!!'flush'); // Unpad data - - - padding.unpad(finalProcessedBlocks); - } - - return finalProcessedBlocks; - }, - blockSize: 128 / 32 - }); - /** - * A collection of cipher parameters. - * - * @property {WordArray} ciphertext The raw ciphertext. - * @property {WordArray} key The key to this ciphertext. - * @property {WordArray} iv The IV used in the ciphering operation. - * @property {WordArray} salt The salt used with a key derivation function. - * @property {Cipher} algorithm The cipher algorithm. - * @property {Mode} mode The block mode used in the ciphering operation. - * @property {Padding} padding The padding scheme used in the ciphering operation. - * @property {number} blockSize The block size of the cipher. - * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. - */ - - var CipherParams = C_lib.CipherParams = Base.extend({ - /** - * Initializes a newly created cipher params object. - * - * @param {Object} cipherParams An object with any of the possible cipher parameters. - * - * @example - * - * var cipherParams = CryptoJS.lib.CipherParams.create({ - * ciphertext: ciphertextWordArray, - * key: keyWordArray, - * iv: ivWordArray, - * salt: saltWordArray, - * algorithm: CryptoJS.algo.AES, - * mode: CryptoJS.mode.CBC, - * padding: CryptoJS.pad.PKCS7, - * blockSize: 4, - * formatter: CryptoJS.format.OpenSSL - * }); - */ - init: function init(cipherParams) { - this.mixIn(cipherParams); - }, - - /** - * Converts this cipher params object to a string. - * - * @param {Format} formatter (Optional) The formatting strategy to use. - * - * @return {string} The stringified cipher params. - * - * @throws Error If neither the formatter nor the default formatter is set. - * - * @example - * - * var string = cipherParams + ''; - * var string = cipherParams.toString(); - * var string = cipherParams.toString(CryptoJS.format.OpenSSL); - */ - toString: function toString(formatter) { - return (formatter || this.formatter).stringify(this); - } - }); - /** - * Format namespace. - */ - - var C_format = C.format = {}; - /** - * OpenSSL formatting strategy. - */ - - var OpenSSLFormatter = C_format.OpenSSL = { - /** - * Converts a cipher params object to an OpenSSL-compatible string. - * - * @param {CipherParams} cipherParams The cipher params object. - * - * @return {string} The OpenSSL-compatible string. - * - * @static - * - * @example - * - * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); - */ - stringify: function stringify(cipherParams) { - // Shortcuts - var ciphertext = cipherParams.ciphertext; - var salt = cipherParams.salt; // Format - - if (salt) { - var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); - } else { - var wordArray = ciphertext; - } - - return wordArray.toString(Base64); - }, - - /** - * Converts an OpenSSL-compatible string to a cipher params object. - * - * @param {string} openSSLStr The OpenSSL-compatible string. - * - * @return {CipherParams} The cipher params object. - * - * @static - * - * @example - * - * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); - */ - parse: function parse(openSSLStr) { - // Parse base64 - var ciphertext = Base64.parse(openSSLStr); // Shortcut - - var ciphertextWords = ciphertext.words; // Test for salt - - if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { - // Extract salt - var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext - - ciphertextWords.splice(0, 4); - ciphertext.sigBytes -= 16; - } - - return CipherParams.create({ - ciphertext: ciphertext, - salt: salt - }); - } - }; - /** - * A cipher wrapper that returns ciphertext as a serializable cipher params object. - */ - - var SerializableCipher = C_lib.SerializableCipher = Base.extend({ - /** - * Configuration options. - * - * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL - */ - cfg: Base.extend({ - format: OpenSSLFormatter - }), - - /** - * Encrypts a message. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Encrypt - - var encryptor = cipher.createEncryptor(key, cfg); - var ciphertext = encryptor.finalize(message); // Shortcut - - var cipherCfg = encryptor.cfg; // Create and return serializable cipher params - - return CipherParams.create({ - ciphertext: ciphertext, - key: key, - iv: cipherCfg.iv, - algorithm: cipher, - mode: cipherCfg.mode, - padding: cipherCfg.padding, - blockSize: cipher.blockSize, - formatter: cfg.format - }); - }, - - /** - * Decrypts serialized ciphertext. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams - - ciphertext = this._parse(ciphertext, cfg.format); // Decrypt - - var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); - return plaintext; - }, - - /** - * Converts serialized ciphertext to CipherParams, - * else assumed CipherParams already and returns ciphertext unchanged. - * - * @param {CipherParams|string} ciphertext The ciphertext. - * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. - * - * @return {CipherParams} The unserialized ciphertext. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); - */ - _parse: function _parse(ciphertext, format) { - if (typeof ciphertext == 'string') { - return format.parse(ciphertext, this); - } else { - return ciphertext; - } - } - }); - /** - * Key derivation function namespace. - */ - - var C_kdf = C.kdf = {}; - /** - * OpenSSL key derivation function. - */ - - var OpenSSLKdf = C_kdf.OpenSSL = { - /** - * Derives a key and IV from a password. - * - * @param {string} password The password to derive from. - * @param {number} keySize The size in words of the key to generate. - * @param {number} ivSize The size in words of the IV to generate. - * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. - * - * @return {CipherParams} A cipher params object with the key, IV, and salt. - * - * @static - * - * @example - * - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); - */ - execute: function execute(password, keySize, ivSize, salt) { - // Generate random salt - if (!salt) { - salt = WordArray.random(64 / 8); - } // Derive key and IV - - - var key = EvpKDF.create({ - keySize: keySize + ivSize - }).compute(password, salt); // Separate key and IV - - var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); - key.sigBytes = keySize * 4; // Return params - - return CipherParams.create({ - key: key, - iv: iv, - salt: salt - }); - } - }; - /** - * A serializable cipher wrapper that derives the key from a password, - * and returns ciphertext as a serializable cipher params object. - */ - - var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ - /** - * Configuration options. - * - * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL - */ - cfg: SerializableCipher.cfg.extend({ - kdf: OpenSSLKdf - }), - - /** - * Encrypts a message using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Derive key and other params - - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config - - cfg.iv = derivedParams.iv; // Encrypt - - var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params - - ciphertext.mixIn(derivedParams); - return ciphertext; - }, - - /** - * Decrypts serialized ciphertext using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams - - ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params - - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config - - cfg.iv = derivedParams.iv; // Decrypt - - var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); - return plaintext; - } - }); - }(); - }); -======= - * var cipher = CryptoJS.algo.AES.createEncryptor(keyWordArray, { iv: ivWordArray }); - */ - createEncryptor: function createEncryptor(key, cfg) { - return this.create(this._ENC_XFORM_MODE, key, cfg); - }, - - /** - * Creates this cipher in decryption mode. - * - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {Cipher} A cipher instance. - * - * @static - * - * @example - * - * var cipher = CryptoJS.algo.AES.createDecryptor(keyWordArray, { iv: ivWordArray }); - */ - createDecryptor: function createDecryptor(key, cfg) { - return this.create(this._DEC_XFORM_MODE, key, cfg); - }, - - /** - * Initializes a newly created cipher. - * - * @param {number} xformMode Either the encryption or decryption transormation mode constant. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @example - * - * var cipher = CryptoJS.algo.AES.create(CryptoJS.algo.AES._ENC_XFORM_MODE, keyWordArray, { iv: ivWordArray }); - */ - init: function init(xformMode, key, cfg) { - // Apply config defaults - this.cfg = this.cfg.extend(cfg); // Store transform mode and key - - this._xformMode = xformMode; - this._key = key; // Set initial values - - this.reset(); - }, - - /** - * Resets this cipher to its initial state. - * - * @example - * - * cipher.reset(); - */ - reset: function reset() { - // Reset data buffer - BufferedBlockAlgorithm.reset.call(this); // Perform concrete-cipher logic - - this._doReset(); - }, - - /** - * Adds data to be encrypted or decrypted. - * - * @param {WordArray|string} dataUpdate The data to encrypt or decrypt. - * - * @return {WordArray} The data after processing. - * - * @example - * - * var encrypted = cipher.process('data'); - * var encrypted = cipher.process(wordArray); - */ - process: function process(dataUpdate) { - // Append - this._append(dataUpdate); // Process available blocks - - - return this._process(); - }, - - /** - * Finalizes the encryption or decryption process. - * Note that the finalize operation is effectively a destructive, read-once operation. - * - * @param {WordArray|string} dataUpdate The final data to encrypt or decrypt. - * - * @return {WordArray} The data after final processing. - * - * @example - * - * var encrypted = cipher.finalize(); - * var encrypted = cipher.finalize('data'); - * var encrypted = cipher.finalize(wordArray); - */ - finalize: function finalize(dataUpdate) { - // Final data update - if (dataUpdate) { - this._append(dataUpdate); - } // Perform concrete-cipher logic - - - var finalProcessedData = this._doFinalize(); - - return finalProcessedData; - }, - keySize: 128 / 32, - ivSize: 128 / 32, - _ENC_XFORM_MODE: 1, - _DEC_XFORM_MODE: 2, - - /** - * Creates shortcut functions to a cipher's object interface. - * - * @param {Cipher} cipher The cipher to create a helper for. - * - * @return {Object} An object with encrypt and decrypt shortcut functions. - * - * @static - * - * @example - * - * var AES = CryptoJS.lib.Cipher._createHelper(CryptoJS.algo.AES); - */ - _createHelper: function () { - function selectCipherStrategy(key) { - if (typeof key == 'string') { - return PasswordBasedCipher; - } else { - return SerializableCipher; - } - } - - return function (cipher) { - return { - encrypt: function encrypt(message, key, cfg) { - return selectCipherStrategy(key).encrypt(cipher, message, key, cfg); - }, - decrypt: function decrypt(ciphertext, key, cfg) { - return selectCipherStrategy(key).decrypt(cipher, ciphertext, key, cfg); - } - }; - }; - }() - }); - /** - * Abstract base stream cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 1 (32 bits) - */ - - var StreamCipher = C_lib.StreamCipher = Cipher.extend({ - _doFinalize: function _doFinalize() { - // Process partial blocks - var finalProcessedBlocks = this._process(!!'flush'); - - return finalProcessedBlocks; - }, - blockSize: 1 - }); - /** - * Mode namespace. - */ - - var C_mode = C.mode = {}; - /** - * Abstract base block cipher mode template. - */ - - var BlockCipherMode = C_lib.BlockCipherMode = Base.extend({ - /** - * Creates this mode for encryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createEncryptor(cipher, iv.words); - */ - createEncryptor: function createEncryptor(cipher, iv) { - return this.Encryptor.create(cipher, iv); - }, - - /** - * Creates this mode for decryption. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @static - * - * @example - * - * var mode = CryptoJS.mode.CBC.createDecryptor(cipher, iv.words); - */ - createDecryptor: function createDecryptor(cipher, iv) { - return this.Decryptor.create(cipher, iv); - }, - - /** - * Initializes a newly created mode. - * - * @param {Cipher} cipher A block cipher instance. - * @param {Array} iv The IV words. - * - * @example - * - * var mode = CryptoJS.mode.CBC.Encryptor.create(cipher, iv.words); - */ - init: function init(cipher, iv) { - this._cipher = cipher; - this._iv = iv; - } - }); - /** - * Cipher Block Chaining mode. - */ - - var CBC = C_mode.CBC = function () { - /** - * Abstract base CBC mode. - */ - var CBC = BlockCipherMode.extend(); - /** - * CBC encryptor. - */ - - CBC.Encryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // XOR and encrypt - - xorBlock.call(this, words, offset, blockSize); - cipher.encryptBlock(words, offset); // Remember this block to use with next block - - this._prevBlock = words.slice(offset, offset + blockSize); - } - }); - /** - * CBC decryptor. - */ - - CBC.Decryptor = CBC.extend({ - /** - * Processes the data block at offset. - * - * @param {Array} words The data words to operate on. - * @param {number} offset The offset where the block starts. - * - * @example - * - * mode.processBlock(data.words, offset); - */ - processBlock: function processBlock(words, offset) { - // Shortcuts - var cipher = this._cipher; - var blockSize = cipher.blockSize; // Remember this block to use with next block - - var thisBlock = words.slice(offset, offset + blockSize); // Decrypt and XOR - - cipher.decryptBlock(words, offset); - xorBlock.call(this, words, offset, blockSize); // This block becomes the previous block - - this._prevBlock = thisBlock; - } - }); - - function xorBlock(words, offset, blockSize) { - // Shortcut - var iv = this._iv; // Choose mixing block - - if (iv) { - var block = iv; // Remove IV for subsequent blocks - - this._iv = undefined$1; - } else { - var block = this._prevBlock; - } // XOR blocks - - - for (var i = 0; i < blockSize; i++) { - words[offset + i] ^= block[i]; - } - } - - return CBC; - }(); - /** - * Padding namespace. - */ - - - var C_pad = C.pad = {}; - /** - * PKCS #5/7 padding strategy. - */ - - var Pkcs7 = C_pad.Pkcs7 = { - /** - * Pads data using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to pad. - * @param {number} blockSize The multiple that the data should be padded to. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.pad(wordArray, 4); - */ - pad: function pad(data, blockSize) { - // Shortcut - var blockSizeBytes = blockSize * 4; // Count padding bytes - - var nPaddingBytes = blockSizeBytes - data.sigBytes % blockSizeBytes; // Create padding word - - var paddingWord = nPaddingBytes << 24 | nPaddingBytes << 16 | nPaddingBytes << 8 | nPaddingBytes; // Create padding - - var paddingWords = []; - - for (var i = 0; i < nPaddingBytes; i += 4) { - paddingWords.push(paddingWord); - } - - var padding = WordArray.create(paddingWords, nPaddingBytes); // Add padding - - data.concat(padding); - }, - - /** - * Unpads data that had been padded using the algorithm defined in PKCS #5/7. - * - * @param {WordArray} data The data to unpad. - * - * @static - * - * @example - * - * CryptoJS.pad.Pkcs7.unpad(wordArray); - */ - unpad: function unpad(data) { - // Get number of padding bytes from last byte - var nPaddingBytes = data.words[data.sigBytes - 1 >>> 2] & 0xff; // Remove padding - - data.sigBytes -= nPaddingBytes; - } - }; - /** - * Abstract base block cipher template. - * - * @property {number} blockSize The number of 32-bit words this cipher operates on. Default: 4 (128 bits) - */ - - var BlockCipher = C_lib.BlockCipher = Cipher.extend({ - /** - * Configuration options. - * - * @property {Mode} mode The block mode to use. Default: CBC - * @property {Padding} padding The padding strategy to use. Default: Pkcs7 - */ - cfg: Cipher.cfg.extend({ - mode: CBC, - padding: Pkcs7 - }), - reset: function reset() { - // Reset cipher - Cipher.reset.call(this); // Shortcuts - - var cfg = this.cfg; - var iv = cfg.iv; - var mode = cfg.mode; // Reset block mode - - if (this._xformMode == this._ENC_XFORM_MODE) { - var modeCreator = mode.createEncryptor; - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - var modeCreator = mode.createDecryptor; // Keep at least one block in the buffer for unpadding - - this._minBufferSize = 1; - } - - if (this._mode && this._mode.__creator == modeCreator) { - this._mode.init(this, iv && iv.words); - } else { - this._mode = modeCreator.call(mode, this, iv && iv.words); - this._mode.__creator = modeCreator; - } - }, - _doProcessBlock: function _doProcessBlock(words, offset) { - this._mode.processBlock(words, offset); - }, - _doFinalize: function _doFinalize() { - // Shortcut - var padding = this.cfg.padding; // Finalize - - if (this._xformMode == this._ENC_XFORM_MODE) { - // Pad data - padding.pad(this._data, this.blockSize); // Process final blocks - - var finalProcessedBlocks = this._process(!!'flush'); - } else - /* if (this._xformMode == this._DEC_XFORM_MODE) */ - { - // Process final blocks - var finalProcessedBlocks = this._process(!!'flush'); // Unpad data - - - padding.unpad(finalProcessedBlocks); - } - - return finalProcessedBlocks; - }, - blockSize: 128 / 32 - }); - /** - * A collection of cipher parameters. - * - * @property {WordArray} ciphertext The raw ciphertext. - * @property {WordArray} key The key to this ciphertext. - * @property {WordArray} iv The IV used in the ciphering operation. - * @property {WordArray} salt The salt used with a key derivation function. - * @property {Cipher} algorithm The cipher algorithm. - * @property {Mode} mode The block mode used in the ciphering operation. - * @property {Padding} padding The padding scheme used in the ciphering operation. - * @property {number} blockSize The block size of the cipher. - * @property {Format} formatter The default formatting strategy to convert this cipher params object to a string. - */ - - var CipherParams = C_lib.CipherParams = Base.extend({ - /** - * Initializes a newly created cipher params object. - * - * @param {Object} cipherParams An object with any of the possible cipher parameters. - * - * @example - * - * var cipherParams = CryptoJS.lib.CipherParams.create({ - * ciphertext: ciphertextWordArray, - * key: keyWordArray, - * iv: ivWordArray, - * salt: saltWordArray, - * algorithm: CryptoJS.algo.AES, - * mode: CryptoJS.mode.CBC, - * padding: CryptoJS.pad.PKCS7, - * blockSize: 4, - * formatter: CryptoJS.format.OpenSSL - * }); - */ - init: function init(cipherParams) { - this.mixIn(cipherParams); - }, - - /** - * Converts this cipher params object to a string. - * - * @param {Format} formatter (Optional) The formatting strategy to use. - * - * @return {string} The stringified cipher params. - * - * @throws Error If neither the formatter nor the default formatter is set. - * - * @example - * - * var string = cipherParams + ''; - * var string = cipherParams.toString(); - * var string = cipherParams.toString(CryptoJS.format.OpenSSL); - */ - toString: function toString(formatter) { - return (formatter || this.formatter).stringify(this); - } - }); - /** - * Format namespace. - */ - - var C_format = C.format = {}; - /** - * OpenSSL formatting strategy. - */ - - var OpenSSLFormatter = C_format.OpenSSL = { - /** - * Converts a cipher params object to an OpenSSL-compatible string. - * - * @param {CipherParams} cipherParams The cipher params object. - * - * @return {string} The OpenSSL-compatible string. - * - * @static - * - * @example - * - * var openSSLString = CryptoJS.format.OpenSSL.stringify(cipherParams); - */ - stringify: function stringify(cipherParams) { - // Shortcuts - var ciphertext = cipherParams.ciphertext; - var salt = cipherParams.salt; // Format - - if (salt) { - var wordArray = WordArray.create([0x53616c74, 0x65645f5f]).concat(salt).concat(ciphertext); - } else { - var wordArray = ciphertext; - } - - return wordArray.toString(Base64); - }, - - /** - * Converts an OpenSSL-compatible string to a cipher params object. - * - * @param {string} openSSLStr The OpenSSL-compatible string. - * - * @return {CipherParams} The cipher params object. - * - * @static - * - * @example - * - * var cipherParams = CryptoJS.format.OpenSSL.parse(openSSLString); - */ - parse: function parse(openSSLStr) { - // Parse base64 - var ciphertext = Base64.parse(openSSLStr); // Shortcut - - var ciphertextWords = ciphertext.words; // Test for salt - - if (ciphertextWords[0] == 0x53616c74 && ciphertextWords[1] == 0x65645f5f) { - // Extract salt - var salt = WordArray.create(ciphertextWords.slice(2, 4)); // Remove salt from ciphertext - - ciphertextWords.splice(0, 4); - ciphertext.sigBytes -= 16; - } - - return CipherParams.create({ - ciphertext: ciphertext, - salt: salt - }); - } - }; - /** - * A cipher wrapper that returns ciphertext as a serializable cipher params object. - */ - - var SerializableCipher = C_lib.SerializableCipher = Base.extend({ - /** - * Configuration options. - * - * @property {Formatter} format The formatting strategy to convert cipher param objects to and from a string. Default: OpenSSL - */ - cfg: Base.extend({ - format: OpenSSLFormatter - }), - - /** - * Encrypts a message. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv }); - * var ciphertextParams = CryptoJS.lib.SerializableCipher.encrypt(CryptoJS.algo.AES, message, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Encrypt - - var encryptor = cipher.createEncryptor(key, cfg); - var ciphertext = encryptor.finalize(message); // Shortcut - - var cipherCfg = encryptor.cfg; // Create and return serializable cipher params - - return CipherParams.create({ - ciphertext: ciphertext, - key: key, - iv: cipherCfg.iv, - algorithm: cipher, - mode: cipherCfg.mode, - padding: cipherCfg.padding, - blockSize: cipher.blockSize, - formatter: cfg.format - }); - }, - - /** - * Decrypts serialized ciphertext. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {WordArray} key The key. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.SerializableCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, key, { iv: iv, format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, key, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams - - ciphertext = this._parse(ciphertext, cfg.format); // Decrypt - - var plaintext = cipher.createDecryptor(key, cfg).finalize(ciphertext.ciphertext); - return plaintext; - }, - - /** - * Converts serialized ciphertext to CipherParams, - * else assumed CipherParams already and returns ciphertext unchanged. - * - * @param {CipherParams|string} ciphertext The ciphertext. - * @param {Formatter} format The formatting strategy to use to parse serialized ciphertext. - * - * @return {CipherParams} The unserialized ciphertext. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.SerializableCipher._parse(ciphertextStringOrParams, format); - */ - _parse: function _parse(ciphertext, format) { - if (typeof ciphertext == 'string') { - return format.parse(ciphertext, this); - } else { - return ciphertext; - } - } - }); - /** - * Key derivation function namespace. - */ - - var C_kdf = C.kdf = {}; - /** - * OpenSSL key derivation function. - */ - - var OpenSSLKdf = C_kdf.OpenSSL = { - /** - * Derives a key and IV from a password. - * - * @param {string} password The password to derive from. - * @param {number} keySize The size in words of the key to generate. - * @param {number} ivSize The size in words of the IV to generate. - * @param {WordArray|string} salt (Optional) A 64-bit salt to use. If omitted, a salt will be generated randomly. - * - * @return {CipherParams} A cipher params object with the key, IV, and salt. - * - * @static - * - * @example - * - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32); - * var derivedParams = CryptoJS.kdf.OpenSSL.execute('Password', 256/32, 128/32, 'saltsalt'); - */ - execute: function execute(password, keySize, ivSize, salt) { - // Generate random salt - if (!salt) { - salt = WordArray.random(64 / 8); - } // Derive key and IV - - - var key = EvpKDF.create({ - keySize: keySize + ivSize - }).compute(password, salt); // Separate key and IV - - var iv = WordArray.create(key.words.slice(keySize), ivSize * 4); - key.sigBytes = keySize * 4; // Return params - - return CipherParams.create({ - key: key, - iv: iv, - salt: salt - }); - } - }; - /** - * A serializable cipher wrapper that derives the key from a password, - * and returns ciphertext as a serializable cipher params object. - */ - - var PasswordBasedCipher = C_lib.PasswordBasedCipher = SerializableCipher.extend({ - /** - * Configuration options. - * - * @property {KDF} kdf The key derivation function to use to generate a key and IV from a password. Default: OpenSSL - */ - cfg: SerializableCipher.cfg.extend({ - kdf: OpenSSLKdf - }), - - /** - * Encrypts a message using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {WordArray|string} message The message to encrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {CipherParams} A cipher params object. - * - * @static - * - * @example - * - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password'); - * var ciphertextParams = CryptoJS.lib.PasswordBasedCipher.encrypt(CryptoJS.algo.AES, message, 'password', { format: CryptoJS.format.OpenSSL }); - */ - encrypt: function encrypt(cipher, message, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Derive key and other params - - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize); // Add IV to config - - cfg.iv = derivedParams.iv; // Encrypt - - var ciphertext = SerializableCipher.encrypt.call(this, cipher, message, derivedParams.key, cfg); // Mix in derived params - - ciphertext.mixIn(derivedParams); - return ciphertext; - }, - - /** - * Decrypts serialized ciphertext using a password. - * - * @param {Cipher} cipher The cipher algorithm to use. - * @param {CipherParams|string} ciphertext The ciphertext to decrypt. - * @param {string} password The password. - * @param {Object} cfg (Optional) The configuration options to use for this operation. - * - * @return {WordArray} The plaintext. - * - * @static - * - * @example - * - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, formattedCiphertext, 'password', { format: CryptoJS.format.OpenSSL }); - * var plaintext = CryptoJS.lib.PasswordBasedCipher.decrypt(CryptoJS.algo.AES, ciphertextParams, 'password', { format: CryptoJS.format.OpenSSL }); - */ - decrypt: function decrypt(cipher, ciphertext, password, cfg) { - // Apply config defaults - cfg = this.cfg.extend(cfg); // Convert string to CipherParams - - ciphertext = this._parse(ciphertext, cfg.format); // Derive key and other params - - var derivedParams = cfg.kdf.execute(password, cipher.keySize, cipher.ivSize, ciphertext.salt); // Add IV to config - - cfg.iv = derivedParams.iv; // Decrypt - - var plaintext = SerializableCipher.decrypt.call(this, cipher, ciphertext, derivedParams.key, cfg); - return plaintext; - } - }); - }(); - }); - }); - - var aes = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var BlockCipher = C_lib.BlockCipher; - var C_algo = C.algo; // Lookup tables - - var SBOX = []; - var INV_SBOX = []; - var SUB_MIX_0 = []; - var SUB_MIX_1 = []; - var SUB_MIX_2 = []; - var SUB_MIX_3 = []; - var INV_SUB_MIX_0 = []; - var INV_SUB_MIX_1 = []; - var INV_SUB_MIX_2 = []; - var INV_SUB_MIX_3 = []; // Compute lookup tables - - (function () { - // Compute double table - var d = []; - - for (var i = 0; i < 256; i++) { - if (i < 128) { - d[i] = i << 1; - } else { - d[i] = i << 1 ^ 0x11b; - } - } // Walk GF(2^8) - - - var x = 0; - var xi = 0; - - for (var i = 0; i < 256; i++) { - // Compute sbox - var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; - sx = sx >>> 8 ^ sx & 0xff ^ 0x63; - SBOX[x] = sx; - INV_SBOX[sx] = x; // Compute multiplication - - var x2 = d[x]; - var x4 = d[x2]; - var x8 = d[x4]; // Compute sub bytes, mix columns tables - - var t = d[sx] * 0x101 ^ sx * 0x1010100; - SUB_MIX_0[x] = t << 24 | t >>> 8; - SUB_MIX_1[x] = t << 16 | t >>> 16; - SUB_MIX_2[x] = t << 8 | t >>> 24; - SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables - - var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; - INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; - INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; - INV_SUB_MIX_3[sx] = t; // Compute next counter - - if (!x) { - x = xi = 1; - } else { - x = x2 ^ d[d[d[x8 ^ x2]]]; - xi ^= d[d[xi]]; - } - } - })(); // Precomputed Rcon lookup - - - var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; - /** - * AES block cipher algorithm. - */ - - var AES = C_algo.AES = BlockCipher.extend({ - _doReset: function _doReset() { - // Skip reset of nRounds has been set before and key did not change - if (this._nRounds && this._keyPriorReset === this._key) { - return; - } // Shortcuts - - - var key = this._keyPriorReset = this._key; - var keyWords = key.words; - var keySize = key.sigBytes / 4; // Compute number of rounds - - var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows - - var ksRows = (nRounds + 1) * 4; // Compute key schedule - - var keySchedule = this._keySchedule = []; - - for (var ksRow = 0; ksRow < ksRows; ksRow++) { - if (ksRow < keySize) { - keySchedule[ksRow] = keyWords[ksRow]; - } else { - var t = keySchedule[ksRow - 1]; - - if (!(ksRow % keySize)) { - // Rot word - t = t << 8 | t >>> 24; // Sub word - - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon - - t ^= RCON[ksRow / keySize | 0] << 24; - } else if (keySize > 6 && ksRow % keySize == 4) { - // Sub word - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; - } - - keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; - } - } // Compute inv key schedule - - - var invKeySchedule = this._invKeySchedule = []; - - for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { - var ksRow = ksRows - invKsRow; - - if (invKsRow % 4) { - var t = keySchedule[ksRow]; - } else { - var t = keySchedule[ksRow - 4]; - } - - if (invKsRow < 4 || ksRow <= 4) { - invKeySchedule[invKsRow] = t; - } else { - invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; - } - } - }, - encryptBlock: function encryptBlock(M, offset) { - this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); - }, - decryptBlock: function decryptBlock(M, offset) { - // Swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - - this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows - - - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - }, - _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { - // Shortcut - var nRounds = this._nRounds; // Get input, add round key - - var s0 = M[offset] ^ keySchedule[0]; - var s1 = M[offset + 1] ^ keySchedule[1]; - var s2 = M[offset + 2] ^ keySchedule[2]; - var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter - - var ksRow = 4; // Rounds - - for (var round = 1; round < nRounds; round++) { - // Shift rows, sub bytes, mix columns, add round key - var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; - var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; - var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; - var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state - - s0 = t0; - s1 = t1; - s2 = t2; - s3 = t3; - } // Shift rows, sub bytes, add round key - - - var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; - var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; - var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; - var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output - - M[offset] = t0; - M[offset + 1] = t1; - M[offset + 2] = t2; - M[offset + 3] = t3; - }, - keySize: 256 / 32 - }); - /** - * Shortcut functions to the cipher's object interface. - * - * @example - * - * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); - * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); - */ - - C.AES = BlockCipher._createHelper(AES); - })(); - - return CryptoJS.AES; - }); - }); - - var encUtf8 = createCommonjsModule(function (module, exports) { - - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - return CryptoJS.enc.Utf8; - }); - }); - - /** - * toString ref. - */ - var toString$1 = Object.prototype.toString; - /** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ - - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { - 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'; - } - - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - if (isBuffer$1(val)) return 'buffer'; - val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); - return _typeof(val); - }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - - - function isBuffer$1(obj) { - return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); - } - - /* - * Module dependencies. - */ - - /** - * Deeply clone an object. - * - * @param {*} obj Any object. - */ - - - var clone = function clone(obj) { - var t = componentType$1(obj); - - if (t === 'object') { - var copy = {}; - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - copy[key] = clone(obj[key]); - } - } - - return copy; - } - - if (t === 'array') { - var copy = new Array(obj.length); - - for (var i = 0, l = obj.length; i < l; i++) { - copy[i] = clone(obj[i]); - } - - return copy; - } - - if (t === 'regexp') { - // from millermedeiros/amd-utils - MIT - var flags = ''; - flags += obj.multiline ? 'm' : ''; - flags += obj.global ? 'g' : ''; - flags += obj.ignoreCase ? 'i' : ''; - return new RegExp(obj.source, flags); - } - - if (t === 'date') { - return new Date(obj.getTime()); - } // string, number, boolean, etc. - - - return obj; - }; - /* - * Exports. - */ - - - var clone_1 = clone; - - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse(val); - return options["long"] ? _long(val) : _short(val); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - - function parse(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; - - case 'days': - case 'day': - case 'd': - return n * d; - - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function _short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ - - - function _long(ms) { - return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; - } - /** - * Pluralization helper. - */ - - - function plural(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 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ - - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - - exports.formatters = {}; - /** - * Previously assigned color. - */ - - var prevColor = 0; - /** - * Previous log timestamp. - */ - - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ - - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; - } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - - function debug(namespace) { - // define the `disabled` version - function disabled() {} - - disabled.enabled = false; // define the `enabled` version - - function enabled() { - var self = enabled; // set `diff` timestamp - - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // 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; - } ->>>>>>> branch for npm and latest release - }); - -<<<<<<< HEAD - var aes = createCommonjsModule(function (module, exports) { - - (function (root, factory, undef) { - { - // CommonJS - module.exports = exports = factory(core, encBase64, md5$1, evpkdf, cipherCore); - } - })(commonjsGlobal, function (CryptoJS) { - (function () { - // Shortcuts - var C = CryptoJS; - var C_lib = C.lib; - var BlockCipher = C_lib.BlockCipher; - var C_algo = C.algo; // Lookup tables - - var SBOX = []; - var INV_SBOX = []; - var SUB_MIX_0 = []; - var SUB_MIX_1 = []; - var SUB_MIX_2 = []; - var SUB_MIX_3 = []; - var INV_SUB_MIX_0 = []; - var INV_SUB_MIX_1 = []; - var INV_SUB_MIX_2 = []; - var INV_SUB_MIX_3 = []; // Compute lookup tables - - (function () { - // Compute double table - var d = []; - - for (var i = 0; i < 256; i++) { - if (i < 128) { - d[i] = i << 1; - } else { - d[i] = i << 1 ^ 0x11b; - } - } // Walk GF(2^8) - - - var x = 0; - var xi = 0; - - for (var i = 0; i < 256; i++) { - // Compute sbox - var sx = xi ^ xi << 1 ^ xi << 2 ^ xi << 3 ^ xi << 4; - sx = sx >>> 8 ^ sx & 0xff ^ 0x63; - SBOX[x] = sx; - INV_SBOX[sx] = x; // Compute multiplication - - var x2 = d[x]; - var x4 = d[x2]; - var x8 = d[x4]; // Compute sub bytes, mix columns tables - - var t = d[sx] * 0x101 ^ sx * 0x1010100; - SUB_MIX_0[x] = t << 24 | t >>> 8; - SUB_MIX_1[x] = t << 16 | t >>> 16; - SUB_MIX_2[x] = t << 8 | t >>> 24; - SUB_MIX_3[x] = t; // Compute inv sub bytes, inv mix columns tables - - var t = x8 * 0x1010101 ^ x4 * 0x10001 ^ x2 * 0x101 ^ x * 0x1010100; - INV_SUB_MIX_0[sx] = t << 24 | t >>> 8; - INV_SUB_MIX_1[sx] = t << 16 | t >>> 16; - INV_SUB_MIX_2[sx] = t << 8 | t >>> 24; - INV_SUB_MIX_3[sx] = t; // Compute next counter - - if (!x) { - x = xi = 1; - } else { - x = x2 ^ d[d[d[x8 ^ x2]]]; - xi ^= d[d[xi]]; - } - } - })(); // Precomputed Rcon lookup - - - var RCON = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36]; - /** - * AES block cipher algorithm. - */ - - var AES = C_algo.AES = BlockCipher.extend({ - _doReset: function _doReset() { - // Skip reset of nRounds has been set before and key did not change - if (this._nRounds && this._keyPriorReset === this._key) { - return; - } // Shortcuts - - - var key = this._keyPriorReset = this._key; - var keyWords = key.words; - var keySize = key.sigBytes / 4; // Compute number of rounds - - var nRounds = this._nRounds = keySize + 6; // Compute number of key schedule rows - - var ksRows = (nRounds + 1) * 4; // Compute key schedule - - var keySchedule = this._keySchedule = []; - - for (var ksRow = 0; ksRow < ksRows; ksRow++) { - if (ksRow < keySize) { - keySchedule[ksRow] = keyWords[ksRow]; - } else { - var t = keySchedule[ksRow - 1]; - - if (!(ksRow % keySize)) { - // Rot word - t = t << 8 | t >>> 24; // Sub word - - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; // Mix Rcon - - t ^= RCON[ksRow / keySize | 0] << 24; - } else if (keySize > 6 && ksRow % keySize == 4) { - // Sub word - t = SBOX[t >>> 24] << 24 | SBOX[t >>> 16 & 0xff] << 16 | SBOX[t >>> 8 & 0xff] << 8 | SBOX[t & 0xff]; - } - - keySchedule[ksRow] = keySchedule[ksRow - keySize] ^ t; - } - } // Compute inv key schedule - - - var invKeySchedule = this._invKeySchedule = []; - - for (var invKsRow = 0; invKsRow < ksRows; invKsRow++) { - var ksRow = ksRows - invKsRow; - - if (invKsRow % 4) { - var t = keySchedule[ksRow]; - } else { - var t = keySchedule[ksRow - 4]; - } - - if (invKsRow < 4 || ksRow <= 4) { - invKeySchedule[invKsRow] = t; - } else { - invKeySchedule[invKsRow] = INV_SUB_MIX_0[SBOX[t >>> 24]] ^ INV_SUB_MIX_1[SBOX[t >>> 16 & 0xff]] ^ INV_SUB_MIX_2[SBOX[t >>> 8 & 0xff]] ^ INV_SUB_MIX_3[SBOX[t & 0xff]]; - } - } - }, - encryptBlock: function encryptBlock(M, offset) { - this._doCryptBlock(M, offset, this._keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX); - }, - decryptBlock: function decryptBlock(M, offset) { - // Swap 2nd and 4th rows - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - - this._doCryptBlock(M, offset, this._invKeySchedule, INV_SUB_MIX_0, INV_SUB_MIX_1, INV_SUB_MIX_2, INV_SUB_MIX_3, INV_SBOX); // Inv swap 2nd and 4th rows - - - var t = M[offset + 1]; - M[offset + 1] = M[offset + 3]; - M[offset + 3] = t; - }, - _doCryptBlock: function _doCryptBlock(M, offset, keySchedule, SUB_MIX_0, SUB_MIX_1, SUB_MIX_2, SUB_MIX_3, SBOX) { - // Shortcut - var nRounds = this._nRounds; // Get input, add round key - - var s0 = M[offset] ^ keySchedule[0]; - var s1 = M[offset + 1] ^ keySchedule[1]; - var s2 = M[offset + 2] ^ keySchedule[2]; - var s3 = M[offset + 3] ^ keySchedule[3]; // Key schedule row counter - - var ksRow = 4; // Rounds - - for (var round = 1; round < nRounds; round++) { - // Shift rows, sub bytes, mix columns, add round key - var t0 = SUB_MIX_0[s0 >>> 24] ^ SUB_MIX_1[s1 >>> 16 & 0xff] ^ SUB_MIX_2[s2 >>> 8 & 0xff] ^ SUB_MIX_3[s3 & 0xff] ^ keySchedule[ksRow++]; - var t1 = SUB_MIX_0[s1 >>> 24] ^ SUB_MIX_1[s2 >>> 16 & 0xff] ^ SUB_MIX_2[s3 >>> 8 & 0xff] ^ SUB_MIX_3[s0 & 0xff] ^ keySchedule[ksRow++]; - var t2 = SUB_MIX_0[s2 >>> 24] ^ SUB_MIX_1[s3 >>> 16 & 0xff] ^ SUB_MIX_2[s0 >>> 8 & 0xff] ^ SUB_MIX_3[s1 & 0xff] ^ keySchedule[ksRow++]; - var t3 = SUB_MIX_0[s3 >>> 24] ^ SUB_MIX_1[s0 >>> 16 & 0xff] ^ SUB_MIX_2[s1 >>> 8 & 0xff] ^ SUB_MIX_3[s2 & 0xff] ^ keySchedule[ksRow++]; // Update state - - s0 = t0; - s1 = t1; - s2 = t2; - s3 = t3; - } // Shift rows, sub bytes, add round key - - - var t0 = (SBOX[s0 >>> 24] << 24 | SBOX[s1 >>> 16 & 0xff] << 16 | SBOX[s2 >>> 8 & 0xff] << 8 | SBOX[s3 & 0xff]) ^ keySchedule[ksRow++]; - var t1 = (SBOX[s1 >>> 24] << 24 | SBOX[s2 >>> 16 & 0xff] << 16 | SBOX[s3 >>> 8 & 0xff] << 8 | SBOX[s0 & 0xff]) ^ keySchedule[ksRow++]; - var t2 = (SBOX[s2 >>> 24] << 24 | SBOX[s3 >>> 16 & 0xff] << 16 | SBOX[s0 >>> 8 & 0xff] << 8 | SBOX[s1 & 0xff]) ^ keySchedule[ksRow++]; - var t3 = (SBOX[s3 >>> 24] << 24 | SBOX[s0 >>> 16 & 0xff] << 16 | SBOX[s1 >>> 8 & 0xff] << 8 | SBOX[s2 & 0xff]) ^ keySchedule[ksRow++]; // Set output - - M[offset] = t0; - M[offset + 1] = t1; - M[offset + 2] = t2; - M[offset + 3] = t3; - }, - keySize: 256 / 32 - }); - /** - * Shortcut functions to the cipher's object interface. - * - * @example - * - * var ciphertext = CryptoJS.AES.encrypt(message, key, cfg); - * var plaintext = CryptoJS.AES.decrypt(ciphertext, key, cfg); - */ - - C.AES = BlockCipher._createHelper(AES); - })(); - - return CryptoJS.AES; - }); -======= - var browser = createCommonjsModule(function (module, exports) { - /** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug_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 === "undefined" ? "undefined" : _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) {} - } ->>>>>>> branch for npm and latest release - }); - - var encUtf8 = createCommonjsModule(function (module, exports) { - -<<<<<<< HEAD - (function (root, factory) { - { - // CommonJS - module.exports = exports = factory(core); - } - })(commonjsGlobal, function (CryptoJS) { - return CryptoJS.enc.Utf8; - }); - }); - -======= - var debug = browser('cookie'); ->>>>>>> branch for npm and latest release - /** - * toString ref. - */ - var toString$2 = Object.prototype.toString; - /** - * Return the type of `val`. - * - * @param {Mixed} val - * @return {String} - * @api public - */ - -<<<<<<< HEAD - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { - 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'; - } - - if (val === null) return 'null'; - if (val === undefined) return 'undefined'; - if (val !== val) return 'nan'; - if (val && val.nodeType === 1) return 'element'; - if (isBuffer$1(val)) return 'buffer'; - val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val); - return _typeof(val); - }; // code borrowed from https://github.com/feross/is-buffer/blob/master/index.js - - - function isBuffer$1(obj) { - return !!(obj != null && (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor) - obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj))); - } - - /* - * Module dependencies. - */ - -======= - var rudderComponentCookie = function rudderComponentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set(name, value, options); - - case 1: - return get$1(name); - - default: - return all(); - } - }; - /** - * Set cookie `name` to `value`. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @api private - */ - - - function set(name, value, options) { - options = options || {}; - var str = encode(name) + '=' + encode(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.samesite) str += '; samesite=' + options.samesite; - if (options.secure) str += '; secure'; - document.cookie = str; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ - - - function all() { - var str; - - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); - } - - return {}; - } - - return parse$1(str); - } ->>>>>>> branch for npm and latest release - /** - * Deeply clone an object. - * - * @param {*} obj Any object. - */ - - -<<<<<<< HEAD - var clone = function clone(obj) { - var t = componentType$2(obj); - - if (t === 'object') { - var copy = {}; - - for (var key in obj) { - if (obj.hasOwnProperty(key)) { - copy[key] = clone(obj[key]); - } - } - - return copy; - } - - if (t === 'array') { - var copy = new Array(obj.length); - - for (var i = 0, l = obj.length; i < l; i++) { - copy[i] = clone(obj[i]); - } - - return copy; - } - - if (t === 'regexp') { - // from millermedeiros/amd-utils - MIT - var flags = ''; - flags += obj.multiline ? 'm' : ''; - flags += obj.global ? 'g' : ''; - flags += obj.ignoreCase ? 'i' : ''; - return new RegExp(obj.source, flags); - } - - if (t === 'date') { - return new Date(obj.getTime()); - } // string, number, boolean, etc. -======= - function get$1(name) { - return all()[name]; - } - /** - * Parse cookie `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - - - function parse$1(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(pair[0])] = decode(pair[1]); - } - - return obj; - } - /** - * Encode. - */ - - - function encode(value) { - try { - return encodeURIComponent(value); - } catch (e) { - debug('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ - - - function decode(value) { - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } - - var max = Math.max; - /** - * Produce a new array composed of all but the first `n` elements of an input `collection`. - * - * @name drop - * @api public - * @param {number} count The number of elements to drop. - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * drop(0, [1, 2, 3]); // => [1, 2, 3] - * drop(1, [1, 2, 3]); // => [2, 3] - * drop(2, [1, 2, 3]); // => [3] - * drop(3, [1, 2, 3]); // => [] - * drop(4, [1, 2, 3]); // => [] - */ - - var drop = function drop(count, collection) { - var length = collection ? collection.length : 0; - - if (!length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var toDrop = max(Number(count) || 0, 0); - var resultsLength = max(length - toDrop, 0); - var results = new Array(resultsLength); ->>>>>>> branch for npm and latest release - - - return obj; - }; - /* - * Exports. - */ - -<<<<<<< HEAD - - var clone_1 = clone; - -======= - - var drop_1 = drop; - - var max$1 = Math.max; ->>>>>>> branch for npm and latest release - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ -<<<<<<< HEAD -======= - - var rest = function rest(collection) { - if (collection == null || !collection.length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var results = new Array(max$1(collection.length - 2, 0)); - - for (var i = 1; i < collection.length; i += 1) { - results[i - 1] = collection[i]; - } ->>>>>>> branch for npm and latest release - - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse$1(val); - return options["long"] ? _long(val) : _short(val); - }; -<<<<<<< HEAD - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - -======= - /* - * Exports. - */ - - - var rest_1 = rest; ->>>>>>> branch for npm and latest release - - function parse$1(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; - - case 'days': - case 'day': - case 'd': - return n * d; - -<<<<<<< HEAD - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } - } -======= - var has$3 = Object.prototype.hasOwnProperty; - var objToString$1 = Object.prototype.toString; ->>>>>>> branch for npm and latest release - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ -<<<<<<< HEAD - - - function _short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; - } -======= - // TODO: Move to a library - - var isObject = function isObject(value) { - return Boolean(value) && _typeof(value) === 'object'; - }; ->>>>>>> branch for npm and latest release - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ -<<<<<<< HEAD - - - function _long(ms) { - return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; - } -======= - // TODO: Move to a library - - - var isPlainObject = function isPlainObject(value) { - return Boolean(value) && objToString$1.call(value) === '[object Object]'; - }; ->>>>>>> branch for npm and latest release - /** - * Pluralization helper. - */ - -<<<<<<< HEAD - - function plural(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 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ -======= - - var shallowCombiner = function shallowCombiner(target, source, value, key) { - if (has$3.call(source, key) && target[key] === undefined) { - target[key] = value; - } - - return source; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined; also merges objects recursively. - * - * @name deepCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - * @return {Object} - */ - - - var deepCombiner = function deepCombiner(target, source, value, key) { - if (has$3.call(source, key)) { - if (isPlainObject(target[key]) && isPlainObject(value)) { - target[key] = defaultsDeep(target[key], value); - } else if (target[key] === undefined) { - target[key] = value; - } - } - - return source; - }; - /** - * TODO: Document - * - * @name defaultsWith - * @api private - * @param {Function} combiner - * @param {Object} target - * @param {...Object} sources - * @return {Object} Return the input `target`. - */ - - - var defaultsWith = function defaultsWith(combiner, target - /*, ...sources */ - ) { - if (!isObject(target)) { - return target; - } ->>>>>>> branch for npm and latest release - - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - - exports.formatters = {}; - /** - * Previously assigned color. - */ - - var prevColor = 0; - /** - * Previous log timestamp. - */ - - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ - - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; - } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - -<<<<<<< HEAD - - function debug(namespace) { - // define the `disabled` version - function disabled() {} - - disabled.enabled = false; // define the `enabled` version - - function enabled() { - var self = enabled; // set `diff` timestamp - - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // 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 = debug_1.coerce; - var debug_3 = debug_1.disable; - var debug_4 = debug_1.enable; - var debug_5 = debug_1.enabled; - var debug_6 = debug_1.humanize; - var debug_7 = debug_1.names; - var debug_8 = debug_1.skips; - var debug_9 = debug_1.formatters; - - var browser = createCommonjsModule(function (module, exports) { - /** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug_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 === "undefined" ? "undefined" : _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 = browser.log; - var browser_2 = browser.formatArgs; - var browser_3 = browser.save; - var browser_4 = browser.load; - var browser_5 = browser.useColors; - var browser_6 = browser.storage; - var browser_7 = browser.colors; - - /** - * Module dependencies. - */ - - var debug = browser('cookie'); -======= - return target; - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * Recurses on objects. - * - * @name defaultsDeep - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} The input `target`. - */ - - - var defaultsDeep = function defaultsDeep(target - /*, sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * - * @name defaults - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} - * @example - * var a = { a: 1 }; - * var b = { a: 2, b: 2 }; - * - * defaults(a, b); - * console.log(a); //=> { a: 1, b: 2 } - */ - - - var defaults = function defaults(target - /*, ...sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); - }; - /* - * Exports. - */ - - - var defaults_1 = defaults; - var deep = defaultsDeep; - defaults_1.deep = deep; - - var json3 = createCommonjsModule(function (module, exports) { - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. - - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - - - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. - - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. - - - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - - - var isExtended = new Date(-3509827334573292); - attempt(function () { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - }); // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. - - function has(name) { - if (has[name] != null) { - // Return cached feature test result. - return has[name]; - } - - var isSupported; - - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); - } else if (name == "date-serialization") { - // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. - isSupported = has("json-stringify") && isExtended; - - if (isSupported) { - var stringify = exports.stringify; - attempt(function () { - isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - var value, - serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - - if (name == "json-stringify") { - var stringify = exports.stringify, - stringifySupported = typeof stringify == "function"; - - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function value() { - return 1; - }).toJSON = value; - attempt(function () { - stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ - "a": [value, true, false, null, "\x00\b\n\f\r\t"] - }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, function () { - stringifySupported = false; - }); - } - - isSupported = stringifySupported; - } // Test `JSON.parse`. - - - if (name == "json-parse") { - var parse = exports.parse, - parseSupported; - - if (typeof parse == "function") { - attempt(function () { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - parseSupported = value["a"].length == 5 && value["a"][0] === 1; - - if (parseSupported) { - attempt(function () { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - }); - - if (parseSupported) { - attempt(function () { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - }); - } - - if (parseSupported) { - attempt(function () { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - }); - } - } - } - }, function () { - parseSupported = false; - }); - } - - isSupported = parseSupported; - } - } - - return has[name] = !!isSupported; - } - - has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - - var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. - - var _forOwn = function forOwn(object, callback) { - var size = 0, - Properties, - dontEnums, - property; // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - - dontEnums = new Properties(); - - for (property in dontEnums) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(dontEnums, property)) { - size++; - } - } - - Properties = dontEnums = null; // Normalize the iteration algorithm. - - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. - - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; - - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } // Manually invoke the callback for each non-enumerable property. - - - for (length = dontEnums.length; property = dontEnums[--length];) { - if (hasProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - isConstructor; - - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. - - - if (isConstructor || isProperty.call(object, property = "constructor")) { - callback(property); - } - }; - } - - return _forOwn(object, callback); - }; // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. - - - if (!has("json-stringify") && !has("date-serialization")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. - - var leadingZeroes = "000000"; - - var toPaddedString = function toPaddedString(width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; // Internal: Serializes a date object. - - - var _serializeDate = function serializeDate(value) { - var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. - - if (!isExtended) { - var floor = Math.floor; // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. - - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. - - var getDay = function getDay(year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; - - getData = function getData(value) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); - - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { - } - - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { - } - - date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. - - time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. - - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - }; - } else { - getData = function getData(value) { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - }; - } - - _serializeDate = function serializeDate(value) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - getData(value); // Serialize extended years correctly. - - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - year = month = date = hours = minutes = seconds = milliseconds = null; - } else { - value = null; - } - - return value; - }; - - return _serializeDate(value); - }; // For environments with `JSON.stringify` but buggy date serialization, - // we override the native `Date#toJSON` implementation with a - // spec-compliant one. - - - if (has("json-stringify") && !has("date-serialization")) { - // Internal: the `Date#toJSON` implementation used to override the native one. - var dateToJSON = function dateToJSON(key) { - return _serializeDate(this); - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - - - var nativeStringify = exports.stringify; - - exports.stringify = function (source, filter, width) { - var nativeToJSON = Date.prototype.toJSON; - Date.prototype.toJSON = dateToJSON; - var result = nativeStringify(source, filter, width); - Date.prototype.toJSON = nativeToJSON; - return result; - }; - } else { - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; - - var escapeChar = function escapeChar(character) { - var charCode = character.charCodeAt(0), - escaped = Escapes[charCode]; - - if (escaped) { - return escaped; - } - - return unicodePrefix + toPaddedString(2, charCode.toString(16)); - }; - - var reEscape = /[\x00-\x1f\x22\x5c]/g; - - var quote = function quote(value) { - reEscape.lastIndex = 0; - return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; - }; // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - - - var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { - var value, type, className, results, element, index, length, prefix, result; - attempt(function () { - // Necessary for host object support. - value = object[property]; - }); - - if (_typeof(value) == "object" && value) { - if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { - value = _serializeDate(value); - } else if (typeof value.toJSON == "function") { - value = value.toJSON(property); - } - } - - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } // Exit early if value is `undefined` or `null`. - - - if (value == undefined$1) { - return value === undefined$1 ? value : "null"; - } - - type = _typeof(value); // Only call `getClass` if the value is an object. - - if (type == "object") { - className = getClass.call(value); - } - - switch (className || type) { - case "boolean": - case booleanClass: - // Booleans are represented literally. - return "" + value; - - case "number": - case numberClass: - // JSON numbers must be finite. `Infinity` and `NaN` are serialized as - // `"null"`. - return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - - case "string": - case stringClass: - // Strings are double-quoted and escaped. - return quote("" + value); - } // Recursively serialize objects and arrays. - - - if (_typeof(value) == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); - } - } // Add the object to the stack of traversed objects. - - - stack.push(value); - results = []; // Save the current indentation level and indent one additional level. - - prefix = indentation; - indentation += whitespace; - - if (className == arrayClass) { - // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; index++) { - element = serialize(index, value, callback, properties, whitespace, indentation, stack); - results.push(element === undefined$1 ? "null" : element); - } - - result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; - } else { - // Recursively serialize object members. Members are selected from - // either a user-specified list of property names, or the object - // itself. - _forOwn(properties || value, function (property) { - var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - - if (element !== undefined$1) { - // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} - // is not the empty string, let `member` {quote(property) + ":"} - // be the concatenation of `member` and the `space` character." - // The "`space` character" refers to the literal space - // character, not the `space` {width} argument provided to - // `JSON.stringify`. - results.push(quote(property) + ":" + (whitespace ? " " : "") + element); - } - }); - - result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; - } // Remove the object from the traversed object stack. - - - stack.pop(); - return result; - } - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - - - exports.stringify = function (source, filter, width) { - var whitespace, callback, properties, className; - - if (objectTypes[_typeof(filter)] && filter) { - className = getClass.call(filter); - - if (className == functionClass) { - callback = filter; - } else if (className == arrayClass) { - // Convert the property names array into a makeshift set. - properties = {}; - - for (var index = 0, length = filter.length, value; index < length;) { - value = filter[index++]; - className = getClass.call(value); - - if (className == "[object String]" || className == "[object Number]") { - properties[value] = 1; - } - } - } - } - - if (width) { - className = getClass.call(width); - - if (className == numberClass) { - // Convert the `width` to an integer and create a string containing - // `width` number of space characters. - if ((width -= width % 1) > 0) { - if (width > 10) { - width = 10; - } - - for (whitespace = ""; whitespace.length < width;) { - whitespace += " "; - } - } - } else if (className == stringClass) { - whitespace = width.length <= 10 ? width : width.slice(0, 10); - } - } // Opera <= 7.54u2 discards the values associated with empty string keys - // (`""`) only if they are used directly within an object member list - // (e.g., `!("" in { "": 1})`). - - - return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); - }; - } - } // Public: Parses a JSON source string. - - - if (!has("json-parse")) { - var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped - // equivalents. - - var Unescapes = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r" - }; // Internal: Stores the parser state. - - var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. - - var abort = function abort() { - Index = Source = null; - throw SyntaxError(); - }; // Internal: Returns the next token, or `"$"` if the parser has reached - // the end of the source string. A token may be a string, number, `null` - // literal, or Boolean literal. - - - var lex = function lex() { - var source = Source, - length = source.length, - value, - begin, - position, - isSigned, - charCode; - - while (Index < length) { - charCode = source.charCodeAt(Index); - - switch (charCode) { - case 9: - case 10: - case 13: - case 32: - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - break; - - case 123: - case 125: - case 91: - case 93: - case 58: - case 44: - // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at - // the current position. - value = charIndexBuggy ? source.charAt(Index) : source[Index]; - Index++; - return value; - - case 34: - // `"` delimits a JSON string; advance to the next character and - // begin parsing the string. String tokens are prefixed with the - // sentinel `@` character to distinguish them from punctuators and - // end-of-string tokens. - for (value = "@", Index++; Index < length;) { - charCode = source.charCodeAt(Index); - - if (charCode < 32) { - // Unescaped ASCII control characters (those with a code unit - // less than the space character) are not permitted. - abort(); - } else if (charCode == 92) { - // A reverse solidus (`\`) marks the beginning of an escaped - // control character (including `"`, `\`, and `/`) or Unicode - // escape sequence. - charCode = source.charCodeAt(++Index); - - switch (charCode) { - case 92: - case 34: - case 47: - case 98: - case 116: - case 110: - case 102: - case 114: - // Revive escaped control characters. - value += Unescapes[charCode]; - Index++; - break; - - case 117: - // `\u` marks the beginning of a Unicode escape sequence. - // Advance to the first character and validate the - // four-digit code point. - begin = ++Index; - - for (position = Index + 4; Index < position; Index++) { - charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- - // insensitive) that form a single hexadecimal value. - - if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { - // Invalid Unicode escape sequence. - abort(); - } - } // Revive the escaped character. - - - value += fromCharCode("0x" + source.slice(begin, Index)); - break; - - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } - - charCode = source.charCodeAt(Index); - begin = Index; // Optimize for the common case where a string is valid. - - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } // Append the string as-is. - - - value += source.slice(begin, Index); - } - } - - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } // Unterminated string. - - - abort(); - - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. - - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. - - - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } - - isSigned = false; // Parse the integer component. - - for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { - } // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. - - - if (source.charCodeAt(Index) == 46) { - position = ++Index; // Parse the decimal component. - - for (; position < length; position++) { - charCode = source.charCodeAt(position); - - if (charCode < 48 || charCode > 57) { - break; - } - } - - if (position == Index) { - // Illegal trailing decimal. - abort(); - } - - Index = position; - } // Parse exponents. The `e` denoting the exponent is - // case-insensitive. - - - charCode = source.charCodeAt(Index); - - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is - // specified. - - if (charCode == 43 || charCode == 45) { - Index++; - } // Parse the exponential component. - - - for (position = Index; position < length; position++) { - charCode = source.charCodeAt(position); - - if (charCode < 48 || charCode > 57) { - break; - } - } - - if (position == Index) { - // Illegal empty exponent. - abort(); - } - - Index = position; - } // Coerce the parsed value to a JavaScript number. - - - return +source.slice(begin, Index); - } // A negative sign may only precede numbers. - - - if (isSigned) { - abort(); - } // `true`, `false`, and `null` literals. - - - var temp = source.slice(Index, Index + 4); - - if (temp == "true") { - Index += 4; - return true; - } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { - Index += 5; - return false; - } else if (temp == "null") { - Index += 4; - return null; - } // Unrecognized token. - - - abort(); - } - } // Return the sentinel `$` character if the parser has reached the end - // of the source string. - - - return "$"; - }; // Internal: Parses a JSON `value` token. - - - var get = function get(value) { - var results, hasMembers; - - if (value == "$") { - // Unexpected end of input. - abort(); - } - - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } // Parse object and array literals. - - - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; - - for (;;) { - value = lex(); // A closing square bracket marks the end of the array literal. - - if (value == "]") { - break; - } // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. - - - if (hasMembers) { - if (value == ",") { - value = lex(); - - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); - } - } else { - // A `,` must separate each array element. - abort(); - } - } else { - hasMembers = true; - } // Elisions and leading commas are not permitted. - - - if (value == ",") { - abort(); - } - - results.push(get(value)); - } - - return results; - } else if (value == "{") { - // Parses a JSON object, returning a new JavaScript object. - results = {}; - - for (;;) { - value = lex(); // A closing curly brace marks the end of the object literal. - - if (value == "}") { - break; - } // If the object literal contains members, the current token - // should be a comma separator. - - - if (hasMembers) { - if (value == ",") { - value = lex(); - - if (value == "}") { - // Unexpected trailing `,` in object literal. - abort(); - } - } else { - // A `,` must separate each object member. - abort(); - } - } else { - hasMembers = true; - } // Leading commas are not permitted, object property names must be - // double-quoted strings, and a `:` must separate each property - // name and value. - - - if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { - abort(); - } - - results[value.slice(1)] = get(lex()); - } - - return results; - } // Unexpected token encountered. - - - abort(); - } - - return value; - }; // Internal: Updates a traversed object member. - - - var update = function update(source, property, callback) { - var element = walk(source, property, callback); - - if (element === undefined$1) { - delete source[property]; - } else { - source[property] = element; - } - }; // Internal: Recursively traverses a parsed JSON object, invoking the - // `callback` function for each value. This is an implementation of the - // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - - - var walk = function walk(source, property, callback) { - var value = source[property], - length; - - if (_typeof(value) == "object" && value) { - // `forOwn` can't be used to traverse an array in Opera <= 8.54 - // because its `Object#hasOwnProperty` implementation returns `false` - // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). - if (getClass.call(value) == arrayClass) { - for (length = value.length; length--;) { - update(getClass, _forOwn, value, length, callback); - } - } else { - _forOwn(value, function (property) { - update(value, property, callback); - }); - } - } - - return callback.call(source, property, value); - }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. - - - exports.parse = function (source, callback) { - var result, value; - Index = 0; - Source = "" + source; - result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. - - if (lex() != "$") { - abort(); - } // Reset the parser state. - - - Index = Source = null; - return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; - }; - } - } - - exports.runInContext = runInContext; - return exports; - } - - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root.JSON3, - isRestored = false; - var JSON3 = runInContext(root, root.JSON3 = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function noConflict() { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root.JSON3 = previousJSON; - nativeJSON = previousJSON = null; - } - - return JSON3; - } - }); - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } // Export for asynchronous module loaders. - }).call(commonjsGlobal); - }); - - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ - - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - - exports.formatters = {}; - /** - * Previously assigned color. - */ - - var prevColor = 0; - /** - * Previous log timestamp. - */ - - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ - - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; - } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - - function debug(namespace) { - // define the `disabled` version - function disabled() {} - - disabled.enabled = false; // define the `enabled` version - - function enabled() { - var self = enabled; // set `diff` timestamp - - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // 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 === "undefined" ? "undefined" : _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. - */ -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - - var debug$1 = browser$1('cookie'); ->>>>>>> branch for npm and latest release -======= - var toString$2 = Object.prototype.toString; ->>>>>>> NPM release version 1.0.11 -======= - var toString$1 = Object.prototype.toString; ->>>>>>> branch for npm and latest release -======= - var toString$2 = Object.prototype.toString; ->>>>>>> add querystring parse to npm module - /** - * Set or get cookie `name` with `value` and `options` object. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @return {Mixed} - * @api public - */ - -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var rudderComponentCookie = function rudderComponentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set(name, value, options); -======= - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { -======= - var componentType$1 = function componentType(val) { - switch (toString$1.call(val)) { ->>>>>>> branch for npm and latest release -======= - var componentType$2 = function componentType(val) { - switch (toString$2.call(val)) { ->>>>>>> add querystring parse to npm module - case '[object Date]': - return 'date'; - - case '[object RegExp]': - return 'regexp'; ->>>>>>> NPM release version 1.0.11 - - case 1: - return get$1(name); -======= - var componentCookie = function componentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set$1(name, value, options); - - case 1: - return get$2(name); ->>>>>>> branch for npm and latest release - - default: - return all(); - } - }; - /** - * Set cookie `name` to `value`. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @api private - */ - - -<<<<<<< HEAD - function set(name, value, options) { -======= - function set$1(name, value, options) { ->>>>>>> branch for npm and latest release - 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.samesite) str += '; samesite=' + options.samesite; - if (options.secure) str += '; secure'; - document.cookie = str; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ - - -<<<<<<< HEAD -<<<<<<< HEAD - function all() { -======= - function all$1() { ->>>>>>> branch for npm and latest release - var str; -======= - var clone = function clone(obj) { - var t = componentType$2(obj); - - if (t === 'object') { - var copy = {}; ->>>>>>> NPM release version 1.0.11 - - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); - } - - return {}; - } - - return parse$2(str); - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ - - -<<<<<<< HEAD - function get$1(name) { - return all()[name]; -======= - function get$2(name) { - return all$1()[name]; ->>>>>>> branch for npm and latest release - } - /** - * Parse cookie `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - - - function parse$2(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('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ - - - function decode$1(value) { - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } - -<<<<<<< HEAD - var max = Math.max; - /** - * Produce a new array composed of all but the first `n` elements of an input `collection`. - * - * @name drop - * @api public - * @param {number} count The number of elements to drop. - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * drop(0, [1, 2, 3]); // => [1, 2, 3] - * drop(1, [1, 2, 3]); // => [2, 3] - * drop(2, [1, 2, 3]); // => [3] - * drop(3, [1, 2, 3]); // => [] - * drop(4, [1, 2, 3]); // => [] - */ - -<<<<<<< HEAD - var drop = function drop(count, collection) { - var length = collection ? collection.length : 0; - - if (!length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var toDrop = max(Number(count) || 0, 0); - var resultsLength = max(length - toDrop, 0); - var results = new Array(resultsLength); - - for (var i = 0; i < resultsLength; i += 1) { - results[i] = collection[i + toDrop]; - } - - return results; -======= - var ms = function ms(val, options) { - options = options || {}; -<<<<<<< HEAD - if ('string' == typeof val) return parse(val); ->>>>>>> branch for npm and latest release -======= - if ('string' == typeof val) return parse$1(val); ->>>>>>> add querystring parse to npm module - return options["long"] ? _long(val) : _short(val); ->>>>>>> NPM release version 1.0.11 - }; - /* - * Exports. - */ - - - var drop_1 = drop; - - var max$1 = Math.max; - /** - * Produce a new array by passing each value in the input `collection` through a transformative - * `iterator` function. The `iterator` function is passed three arguments: - * `(value, index, collection)`. - * - * @name rest - * @api public - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * rest([1, 2, 3]); // => [2, 3] - */ - - var rest = function rest(collection) { - if (collection == null || !collection.length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> add querystring parse to npm module - function parse$1(str) { -======= - function parse(str) { ->>>>>>> branch for npm and latest release -======= - function parse$1(str) { ->>>>>>> add querystring parse to npm module - 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(); ->>>>>>> NPM release version 1.0.11 - - var results = new Array(max$1(collection.length - 2, 0)); - - for (var i = 1; i < collection.length; i += 1) { - results[i - 1] = collection[i]; - } - - return results; - }; - /* - * Exports. - */ - - - var rest_1 = rest; - - /* - * Module dependencies. - */ - - - var has$3 = Object.prototype.hasOwnProperty; - var objToString$1 = Object.prototype.toString; - /** - * Returns `true` if a value is an object, otherwise `false`. - * - * @name isObject - * @api private - * @param {*} val The value to test. - * @return {boolean} - */ - // TODO: Move to a library - - var isObject = function isObject(value) { - return Boolean(value) && _typeof(value) === 'object'; - }; - /** - * Returns `true` if a value is a plain object, otherwise `false`. - * - * @name isPlainObject - * @api private - * @param {*} val The value to test. - * @return {boolean} - */ - // TODO: Move to a library - - - var isPlainObject = function isPlainObject(value) { - return Boolean(value) && objToString$1.call(value) === '[object Object]'; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined. - * - * @name shallowCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - */ - - - var shallowCombiner = function shallowCombiner(target, source, value, key) { - if (has$3.call(source, key) && target[key] === undefined) { - target[key] = value; - } - - return source; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined; also merges objects recursively. - * - * @name deepCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - * @return {Object} - */ - - - var deepCombiner = function deepCombiner(target, source, value, key) { - if (has$3.call(source, key)) { - if (isPlainObject(target[key]) && isPlainObject(value)) { - target[key] = defaultsDeep(target[key], value); - } else if (target[key] === undefined) { - target[key] = value; - } - } - - return source; - }; - /** - * TODO: Document - * - * @name defaultsWith - * @api private - * @param {Function} combiner - * @param {Object} target - * @param {...Object} sources - * @return {Object} Return the input `target`. - */ - - - var defaultsWith = function defaultsWith(combiner, target - /*, ...sources */ - ) { - if (!isObject(target)) { - return target; - } - - combiner = combiner || shallowCombiner; - var sources = drop_1(2, arguments); - - for (var i = 0; i < sources.length; i += 1) { - for (var key in sources[i]) { - combiner(target, sources[i], sources[i][key], key); - } - } - - return target; - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * Recurses on objects. - * - * @name defaultsDeep - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} The input `target`. - */ - - - var defaultsDeep = function defaultsDeep(target - /*, sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * - * @name defaults - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} - * @example - * var a = { a: 1 }; - * var b = { a: 2, b: 2 }; - * - * defaults(a, b); - * console.log(a); //=> { a: 1, b: 2 } - */ - - - var defaults = function defaults(target - /*, ...sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); - }; - /* - * Exports. - */ - - - var defaults_1 = defaults; - var deep = defaultsDeep; - defaults_1.deep = deep; - - var json3 = createCommonjsModule(function (module, exports) { - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. - - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - - -<<<<<<< HEAD - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. -======= - var logFn = enabled.log || exports.log || console.log.bind(console); - logFn.apply(self, args); - } -<<<<<<< HEAD - - 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, '.*?'); - -======= ->>>>>>> branch for npm and latest release - - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. - - - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - -<<<<<<< HEAD -======= ->>>>>>> branch for npm and latest release - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } - } - /** - * Disable debug output. - * - * @api public - */ ->>>>>>> branch for npm and latest release - - var isExtended = new Date(-3509827334573292); - attempt(function () { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - }); // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. - - function has(name) { - if (has[name] != null) { - // Return cached feature test result. - return has[name]; - } - - var isSupported; - - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); - } else if (name == "date-serialization") { - // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. - isSupported = has("json-stringify") && isExtended; - - if (isSupported) { - var stringify = exports.stringify; - attempt(function () { - isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - var value, - serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - - if (name == "json-stringify") { - var stringify = exports.stringify, - stringifySupported = typeof stringify == "function"; - -<<<<<<< HEAD - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function value() { - return 1; - }).toJSON = value; - attempt(function () { - stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ - "a": [value, true, false, null, "\x00\b\n\f\r\t"] - }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, function () { - stringifySupported = false; - }); - } -======= - for (i = 0, len = exports.skips.length; i < len; i++) { - if (exports.skips[i].test(name)) { - return false; - } -<<<<<<< HEAD - } - - 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 - */ - - -======= - } ->>>>>>> branch for npm and latest release - - isSupported = stringifySupported; - } // Test `JSON.parse`. - - - if (name == "json-parse") { - var parse = exports.parse, - parseSupported; - -<<<<<<< HEAD - if (typeof parse == "function") { - attempt(function () { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - parseSupported = value["a"].length == 5 && value["a"][0] === 1; -======= ->>>>>>> branch for npm and latest release - function coerce(val) { - if (val instanceof Error) return val.stack || val.message; - return val; - } - }); - var debug_2 = debug_1.coerce; - var debug_3 = debug_1.disable; - var debug_4 = debug_1.enable; - var debug_5 = debug_1.enabled; - var debug_6 = debug_1.humanize; - var debug_7 = debug_1.names; - var debug_8 = debug_1.skips; - var debug_9 = debug_1.formatters; ->>>>>>> branch for npm and latest release - - if (parseSupported) { - attempt(function () { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - }); - - if (parseSupported) { - attempt(function () { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - }); - } - - if (parseSupported) { - attempt(function () { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - }); - } - } - } - }, function () { - parseSupported = false; - }); - } - - isSupported = parseSupported; - } - } - - return has[name] = !!isSupported; - } - - has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - - var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. - - var _forOwn = function forOwn(object, callback) { - var size = 0, - Properties, - dontEnums, - property; // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - - dontEnums = new Properties(); - - for (property in dontEnums) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(dontEnums, property)) { - size++; - } - } - - Properties = dontEnums = null; // Normalize the iteration algorithm. - - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. - - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; - - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } // Manually invoke the callback for each non-enumerable property. - - -<<<<<<< HEAD - for (length = dontEnums.length; property = dontEnums[--length];) { - if (hasProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - isConstructor; -======= - function set(name, value, options) { - options = options || {}; -<<<<<<< HEAD - var str = encode$1(name) + '=' + encode$1(value); -======= -<<<<<<< HEAD -<<<<<<< HEAD - var str = encode$1(name) + '=' + encode$1(value); -======= - var str = encode(name) + '=' + encode(value); ->>>>>>> branch for npm and latest release -======= - var str = encode$1(name) + '=' + encode$1(value); ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module - if (null == value) options.maxage = -1; ->>>>>>> NPM release version 1.0.11 - - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. - - - if (isConstructor || isProperty.call(object, property = "constructor")) { - callback(property); - } - }; - } - - return _forOwn(object, callback); - }; // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. - - - if (!has("json-stringify") && !has("date-serialization")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. - -<<<<<<< HEAD -<<<<<<< HEAD - var leadingZeroes = "000000"; -======= - return parse$2(str); -======= -<<<<<<< HEAD - return parse$2(str); -======= - return parse$1(str); ->>>>>>> branch for npm and latest release -======= - return parse$2(str); ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module -======= - var clone_1 = clone; - - /** - * Helpers. - */ - var s = 1000; - var m = s * 60; - var h = m * 60; - var d = h * 24; - var y = d * 365.25; - /** - * Parse or format the given `val`. - * - * Options: - * - * - `long` verbose formatting [false] - * - * @param {String|Number} val - * @param {Object} options - * @return {String|Number} - * @api public - */ - - var ms = function ms(val, options) { - options = options || {}; - if ('string' == typeof val) return parse$1(val); - return options["long"] ? _long(val) : _short(val); - }; - /** - * Parse the given `str` and return milliseconds. - * - * @param {String} str - * @return {Number} - * @api private - */ - - - function parse$1(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; - - case 'days': - case 'day': - case 'd': - return n * d; - - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - case 'ms': - return n; - } ->>>>>>> resolve conflicts - } - /** - * Short format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ ->>>>>>> NPM release version 1.0.11 - - var toPaddedString = function toPaddedString(width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; // Internal: Serializes a date object. - -<<<<<<< HEAD -<<<<<<< HEAD -======= - function set(name, value, options) { - options = options || {}; -<<<<<<< HEAD - var str = encode$1(name) + '=' + encode$1(value); -======= - var str = encode(name) + '=' + encode(value); ->>>>>>> branch for npm and latest release - if (null == value) options.maxage = -1; ->>>>>>> branch for npm and latest release -======= - function _short(ms) { - if (ms >= d) return Math.round(ms / d) + 'd'; - if (ms >= h) return Math.round(ms / h) + 'h'; - if (ms >= m) return Math.round(ms / m) + 'm'; - if (ms >= s) return Math.round(ms / s) + 's'; - return ms + 'ms'; - } - /** - * Long format for `ms`. - * - * @param {Number} ms - * @return {String} - * @api private - */ ->>>>>>> resolve conflicts - - var _serializeDate = function serializeDate(value) { - var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. - -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - if (!isExtended) { - var floor = Math.floor; // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. - - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. -======= - function parse$2(str) { -======= -<<<<<<< HEAD - function parse$2(str) { -======= - function parse$1(str) { ->>>>>>> branch for npm and latest release -======= - function parse$2(str) { ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module - 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]); - } ->>>>>>> NPM release version 1.0.11 - - var getDay = function getDay(year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; - - getData = function getData(value) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); -======= - function _long(ms) { - return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; - } - /** - * Pluralization helper. - */ ->>>>>>> resolve conflicts - - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { - } - -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { - } -======= - function encode$1(value) { -======= -<<<<<<< HEAD - function encode$1(value) { -======= - function encode(value) { ->>>>>>> branch for npm and latest release -======= - function encode$1(value) { ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module - try { - return encodeURIComponent(value); - } catch (e) { - debug('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ ->>>>>>> NPM release version 1.0.11 - - date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. - -<<<<<<< HEAD -<<<<<<< HEAD - time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. -======= - function decode$1(value) { -======= -<<<<<<< HEAD - function decode$1(value) { -======= - function decode(value) { ->>>>>>> branch for npm and latest release -======= - function decode$1(value) { ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } ->>>>>>> NPM release version 1.0.11 - - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - }; - } else { - getData = function getData(value) { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - }; - } - - _serializeDate = function serializeDate(value) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - getData(value); // Serialize extended years correctly. - - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - year = month = date = hours = minutes = seconds = milliseconds = null; - } else { - value = null; - } - - return value; - }; - - return _serializeDate(value); - }; // For environments with `JSON.stringify` but buggy date serialization, - // we override the native `Date#toJSON` implementation with a - // spec-compliant one. - - - if (has("json-stringify") && !has("date-serialization")) { - // Internal: the `Date#toJSON` implementation used to override the native one. - var dateToJSON = function dateToJSON(key) { - return _serializeDate(this); - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - - - var nativeStringify = exports.stringify; - - exports.stringify = function (source, filter, width) { - var nativeToJSON = Date.prototype.toJSON; - Date.prototype.toJSON = dateToJSON; - var result = nativeStringify(source, filter, width); - Date.prototype.toJSON = nativeToJSON; - return result; - }; - } else { - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; - -<<<<<<< HEAD - var escapeChar = function escapeChar(character) { - var charCode = character.charCodeAt(0), - escaped = Escapes[charCode]; -======= -<<<<<<< HEAD - return parse$2(str); -======= - return parse$1(str); ->>>>>>> branch for npm and latest release - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ ->>>>>>> branch for npm and latest release - - if (escaped) { - return escaped; - } - - return unicodePrefix + toPaddedString(2, charCode.toString(16)); - }; - - var reEscape = /[\x00-\x1f\x22\x5c]/g; - -<<<<<<< HEAD - var quote = function quote(value) { - reEscape.lastIndex = 0; - return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; - }; // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. -======= -<<<<<<< HEAD - function parse$2(str) { -======= - function parse$1(str) { ->>>>>>> branch for npm and latest release - var obj = {}; - var pairs = str.split(/ *; */); - var pair; - if ('' == pairs[0]) return obj; ->>>>>>> branch for npm and latest release - -======= - function plural(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 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ - - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ - - exports.formatters = {}; - /** - * Previously assigned color. - */ - - var prevColor = 0; - /** - * Previous log timestamp. - */ - - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ - - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; - } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ - - - function debug(namespace) { - // define the `disabled` version - function disabled() {} - - disabled.enabled = false; // define the `enabled` version - - function enabled() { - var self = enabled; // set `diff` timestamp - - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); - - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // 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 = debug_1.coerce; - var debug_3 = debug_1.disable; - var debug_4 = debug_1.enable; - var debug_5 = debug_1.enabled; - var debug_6 = debug_1.humanize; - var debug_7 = debug_1.names; - var debug_8 = debug_1.skips; - var debug_9 = debug_1.formatters; - - var browser = createCommonjsModule(function (module, exports) { - /** - * This is the web browser implementation of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug_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 - */ ->>>>>>> resolve conflicts - - var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { - var value, type, className, results, element, index, length, prefix, result; - attempt(function () { - // Necessary for host object support. - value = object[property]; - }); - -<<<<<<< HEAD - if (_typeof(value) == "object" && value) { - if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { - value = _serializeDate(value); - } else if (typeof value.toJSON == "function") { - value = value.toJSON(property); - } - } - -<<<<<<< HEAD - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } // Exit early if value is `undefined` or `null`. - - - if (value == undefined$1) { - return value === undefined$1 ? value : "null"; - } -======= -<<<<<<< HEAD - function encode$1(value) { -======= - function encode(value) { ->>>>>>> branch for npm and latest release - try { - return encodeURIComponent(value); - } catch (e) { - debug('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ -======= - 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 - */ - ->>>>>>> resolve conflicts - - function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); - } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -<<<<<<< HEAD -<<<<<<< HEAD - function decode$1(value) { -======= - function decode(value) { ->>>>>>> branch for npm and latest release - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } ->>>>>>> branch for npm and latest release - - type = _typeof(value); // Only call `getClass` if the value is an object. - - if (type == "object") { - className = getClass.call(value); - } - - switch (className || type) { - case "boolean": - case booleanClass: - // Booleans are represented literally. - return "" + value; - - case "number": - case numberClass: - // JSON numbers must be finite. `Infinity` and `NaN` are serialized as - // `"null"`. - return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - - case "string": - case stringClass: - // Strings are double-quoted and escaped. - return quote("" + value); - } // Recursively serialize objects and arrays. - - - if (_typeof(value) == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); - } - } // Add the object to the stack of traversed objects. - - - stack.push(value); - results = []; // Save the current indentation level and indent one additional level. - - prefix = indentation; - indentation += whitespace; -======= - - 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 = browser.log; - var browser_2 = browser.formatArgs; - var browser_3 = browser.save; - var browser_4 = browser.load; - var browser_5 = browser.useColors; - var browser_6 = browser.storage; - var browser_7 = browser.colors; - - /** - * Module dependencies. - */ - - var debug = browser('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 rudderComponentCookie = function rudderComponentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set(name, value, options); - - case 1: - return get$1(name); - - default: - return all(); - } - }; - /** - * Set cookie `name` to `value`. - * - * @param {String} name - * @param {String} value - * @param {Object} options - * @api private - */ ->>>>>>> resolve conflicts - -<<<<<<< HEAD - if (className == arrayClass) { - // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; index++) { - element = serialize(index, value, callback, properties, whitespace, indentation, stack); - results.push(element === undefined$1 ? "null" : element); - } - -<<<<<<< HEAD - result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; - } else { - // Recursively serialize object members. Members are selected from - // either a user-specified list of property names, or the object - // itself. - _forOwn(properties || value, function (property) { - var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - - if (element !== undefined$1) { - // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} - // is not the empty string, let `member` {quote(property) + ":"} - // be the concatenation of `member` and the `space` character." - // The "`space` character" refers to the literal space - // character, not the `space` {width} argument provided to - // `JSON.stringify`. - results.push(quote(property) + ":" + (whitespace ? " " : "") + element); - } - }); -======= -<<<<<<< HEAD - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } -======= -======= ->>>>>>> branch for npm and latest release -======= - var json3 = createCommonjsModule(function (module, exports) { -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> Updated npm distribution files - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; ->>>>>>> Updated npm distribution files - - result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; - } // Remove the object from the traversed object stack. - - - stack.pop(); - return result; - } - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - - - exports.stringify = function (source, filter, width) { - var whitespace, callback, properties, className; - - if (objectTypes[_typeof(filter)] && filter) { - className = getClass.call(filter); - - if (className == functionClass) { - callback = filter; - } else if (className == arrayClass) { - // Convert the property names array into a makeshift set. - properties = {}; - - for (var index = 0, length = filter.length, value; index < length;) { - value = filter[index++]; - className = getClass.call(value); - -<<<<<<< HEAD - if (className == "[object String]" || className == "[object Number]") { - properties[value] = 1; - } - } - } - } -======= - // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= -======= ->>>>>>> Updated npm distribution files -======= -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> update npm module -======= -<<<<<<< HEAD ->>>>>>> update npm module - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. ->>>>>>> Updated npm distribution files - - if (width) { - className = getClass.call(width); - - if (className == numberClass) { - // Convert the `width` to an integer and create a string containing - // `width` number of space characters. - if ((width -= width % 1) > 0) { - if (width > 10) { - width = 10; - } - - for (whitespace = ""; whitespace.length < width;) { - whitespace += " "; - } - } - } else if (className == stringClass) { - whitespace = width.length <= 10 ? width : width.slice(0, 10); - } - } // Opera <= 7.54u2 discards the values associated with empty string keys - // (`""`) only if they are used directly within an object member list - // (e.g., `!("" in { "": 1})`). - - - return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); - }; - } - } // Public: Parses a JSON source string. - - - if (!has("json-parse")) { - var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped - // equivalents. - - var Unescapes = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r" - }; // Internal: Stores the parser state. - - var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. - - var abort = function abort() { - Index = Source = null; - throw SyntaxError(); - }; // Internal: Returns the next token, or `"$"` if the parser has reached - // the end of the source string. A token may be a string, number, `null` - // literal, or Boolean literal. - -<<<<<<< HEAD -======= - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= -======= -<<<<<<< HEAD -======= - var json3 = createCommonjsModule(function (module, exports) { -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -<<<<<<< HEAD ->>>>>>> update npm module ->>>>>>> update npm module - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; - - // A set of types used to distinguish objects from primitives. - var objectTypes = { - "function": true, - "object": true - }; - - // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; - - // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - var root = objectTypes[typeof window] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && typeof commonjsGlobal == "object" && commonjsGlobal; -======= - function set(name, value, options) { - options = options || {}; - var str = encode$1(name) + '=' + encode$1(value); - if (null == value) options.maxage = -1; ->>>>>>> resolve conflicts - - if (options.maxage) { - options.expires = new Date(+new Date() + options.maxage); - } - -<<<<<<< HEAD - // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); - - // Native constructor aliases. - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; - - // Delegate to the native `stringify` and `parse` implementations. - if (typeof nativeJSON == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } - - // Convenience aliases. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; - - // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. ->>>>>>> Updated npm distribution files - - var lex = function lex() { - var source = Source, - length = source.length, - value, - begin, - position, - isSigned, - charCode; - - while (Index < length) { - charCode = source.charCodeAt(Index); - - switch (charCode) { - case 9: - case 10: - case 13: - case 32: - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - break; - - case 123: - case 125: - case 91: - case 93: - case 58: - case 44: - // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at - // the current position. - value = charIndexBuggy ? source.charAt(Index) : source[Index]; - Index++; - return value; - - case 34: - // `"` delimits a JSON string; advance to the next character and - // begin parsing the string. String tokens are prefixed with the - // sentinel `@` character to distinguish them from punctuators and - // end-of-string tokens. - for (value = "@", Index++; Index < length;) { - charCode = source.charCodeAt(Index); - - if (charCode < 32) { - // Unescaped ASCII control characters (those with a code unit - // less than the space character) are not permitted. - abort(); - } else if (charCode == 92) { - // A reverse solidus (`\`) marks the beginning of an escaped - // control character (including `"`, `\`, and `/`) or Unicode - // escape sequence. - charCode = source.charCodeAt(++Index); - - switch (charCode) { - case 92: - case 34: - case 47: - case 98: - case 116: - case 110: - case 102: - case 114: - // Revive escaped control characters. - value += Unescapes[charCode]; - Index++; - break; - - case 117: - // `\u` marks the beginning of a Unicode escape sequence. - // Advance to the first character and validate the - // four-digit code point. - begin = ++Index; - -<<<<<<< HEAD - for (position = Index + 4; Index < position; Index++) { - charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- - // insensitive) that form a single hexadecimal value. -======= - var json3 = createCommonjsModule(function (module, exports) { -<<<<<<< HEAD -<<<<<<< HEAD -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> update npm module - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. ->>>>>>> Updated npm distribution files - - if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { - // Invalid Unicode escape sequence. - abort(); - } - } // Revive the escaped character. - - - value += fromCharCode("0x" + source.slice(begin, Index)); - break; - - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } -======= - 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; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ - - - function all() { - var str; - - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); - } - - return {}; - } - - return parse$2(str); - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ ->>>>>>> resolve conflicts - - charCode = source.charCodeAt(Index); - begin = Index; // Optimize for the common case where a string is valid. - -<<<<<<< HEAD - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } // Append the string as-is. - - - value += source.slice(begin, Index); - } - } - - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } // Unterminated string. - - -<<<<<<< HEAD - abort(); -======= - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } -<<<<<<< HEAD -======= -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= ->>>>>>> update npm module -======= -======= ->>>>>>> branch for npm and latest release - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; - - // A set of types used to distinguish objects from primitives. - var objectTypes = { - "function": true, - "object": true - }; -======= - function get$1(name) { - return all()[name]; - } - /** - * Parse cookie `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - - - function parse$2(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. - */ - ->>>>>>> resolve conflicts - - function encode$1(value) { - try { - return encodeURIComponent(value); - } catch (e) { - debug('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ - - - function decode$1(value) { - try { - return decodeURIComponent(value); - } catch (e) { - debug('error `decode(%o)` - %o', value, e); - } - } - -<<<<<<< HEAD - // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); - - // Native constructor aliases. - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; - - // Delegate to the native `stringify` and `parse` implementations. - if (typeof nativeJSON == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } - - // Convenience aliases. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; -<<<<<<< HEAD -======= - - // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> update npm module - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. -======= - var max = Math.max; - /** - * Produce a new array composed of all but the first `n` elements of an input `collection`. - * - * @name drop - * @api public - * @param {number} count The number of elements to drop. - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * drop(0, [1, 2, 3]); // => [1, 2, 3] - * drop(1, [1, 2, 3]); // => [2, 3] - * drop(2, [1, 2, 3]); // => [3] - * drop(3, [1, 2, 3]); // => [] - * drop(4, [1, 2, 3]); // => [] - */ ->>>>>>> resolve conflicts - - var drop = function drop(count, collection) { - var length = collection ? collection.length : 0; - - if (!length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var toDrop = max(Number(count) || 0, 0); - var resultsLength = max(length - toDrop, 0); - var results = new Array(resultsLength); - - for (var i = 0; i < resultsLength; i += 1) { - results[i] = collection[i + toDrop]; - } - - return results; - }; - /* - * Exports. - */ - - - var drop_1 = drop; - - var max$1 = Math.max; - /** - * Produce a new array by passing each value in the input `collection` through a transformative - * `iterator` function. The `iterator` function is passed three arguments: - * `(value, index, collection)`. - * - * @name rest - * @api public - * @param {Array} collection The collection to iterate over. - * @return {Array} A new array containing all but the first element from `collection`. - * @example - * rest([1, 2, 3]); // => [2, 3] - */ - - var rest = function rest(collection) { - if (collection == null || !collection.length) { - return []; - } // Preallocating an array *significantly* boosts performance when dealing with - // `arguments` objects on v8. For a summary, see: - // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - - - var results = new Array(max$1(collection.length - 2, 0)); - - for (var i = 1; i < collection.length; i += 1) { - results[i - 1] = collection[i]; - } - - return results; - }; - /* - * Exports. - */ - - - var rest_1 = rest; - - /* - * Module dependencies. - */ - - - var has$3 = Object.prototype.hasOwnProperty; - var objToString$1 = Object.prototype.toString; - /** - * Returns `true` if a value is an object, otherwise `false`. - * - * @name isObject - * @api private - * @param {*} val The value to test. - * @return {boolean} - */ - // TODO: Move to a library - - var isObject = function isObject(value) { - return Boolean(value) && _typeof(value) === 'object'; - }; - /** - * Returns `true` if a value is a plain object, otherwise `false`. - * - * @name isPlainObject - * @api private - * @param {*} val The value to test. - * @return {boolean} - */ - // TODO: Move to a library - - - var isPlainObject = function isPlainObject(value) { - return Boolean(value) && objToString$1.call(value) === '[object Object]'; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined. - * - * @name shallowCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - */ - - - var shallowCombiner = function shallowCombiner(target, source, value, key) { - if (has$3.call(source, key) && target[key] === undefined) { - target[key] = value; - } - - return source; - }; - /** - * Assigns a key-value pair to a target object when the value assigned is owned, - * and where target[key] is undefined; also merges objects recursively. - * - * @name deepCombiner - * @api private - * @param {Object} target - * @param {Object} source - * @param {*} value - * @param {string} key - * @return {Object} - */ - - - var deepCombiner = function deepCombiner(target, source, value, key) { - if (has$3.call(source, key)) { - if (isPlainObject(target[key]) && isPlainObject(value)) { - target[key] = defaultsDeep(target[key], value); - } else if (target[key] === undefined) { - target[key] = value; - } - } - - return source; - }; - /** - * TODO: Document - * - * @name defaultsWith - * @api private - * @param {Function} combiner - * @param {Object} target - * @param {...Object} sources - * @return {Object} Return the input `target`. - */ - - -<<<<<<< HEAD - for (length = dontEnums.length; property = dontEnums[--length];) { - if (hasProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - isConstructor; ->>>>>>> update npm module - - // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. - - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; -======= - var defaultsWith = function defaultsWith(combiner, target - /*, ...sources */ - ) { - if (!isObject(target)) { - return target; - } - - combiner = combiner || shallowCombiner; - var sources = drop_1(2, arguments); - - for (var i = 0; i < sources.length; i += 1) { - for (var key in sources[i]) { - combiner(target, sources[i], sources[i][key], key); - } - } - - return target; - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * Recurses on objects. - * - * @name defaultsDeep - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} The input `target`. - */ - - - var defaultsDeep = function defaultsDeep(target - /*, sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); - }; - /** - * Copies owned, enumerable properties from a source object(s) to a target - * object when the value of that property on the source object is `undefined`. - * - * @name defaults - * @api public - * @param {Object} target - * @param {...Object} sources - * @return {Object} - * @example - * var a = { a: 1 }; - * var b = { a: 2, b: 2 }; - * - * defaults(a, b); - * console.log(a); //=> { a: 1, b: 2 } - */ ->>>>>>> resolve conflicts - - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - -<<<<<<< HEAD - - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. - - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. - - - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } ->>>>>>> branch for npm and latest release ->>>>>>> branch for npm and latest release - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. ->>>>>>> Updated npm distribution files - - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. - - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. - - - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } - - isSigned = false; // Parse the integer component. - - for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { - } // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. - - - if (source.charCodeAt(Index) == 46) { - position = ++Index; // Parse the decimal component. - - for (; position < length; position++) { - charCode = source.charCodeAt(position); - -<<<<<<< HEAD - if (charCode < 48 || charCode > 57) { - break; - } - } - - if (position == Index) { - // Illegal trailing decimal. - abort(); - } - - Index = position; - } // Parse exponents. The `e` denoting the exponent is - // case-insensitive. - - - charCode = source.charCodeAt(Index); - - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is - // specified. - - if (charCode == 43 || charCode == 45) { - Index++; - } // Parse the exponential component. - - - for (position = Index; position < length; position++) { - charCode = source.charCodeAt(position); - - if (charCode < 48 || charCode > 57) { - break; - } - } - - if (position == Index) { - // Illegal empty exponent. - abort(); - } - - Index = position; - } // Coerce the parsed value to a JavaScript number. -======= -======= - var defaults = function defaults(target - /*, ...sources */ - ) { - // TODO: Replace with `partial` call? - return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); - }; - /* - * Exports. - */ - - - var defaults_1 = defaults; - var deep = defaultsDeep; - defaults_1.deep = deep; - - var json3 = createCommonjsModule(function (module, exports) { - (function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. - - var objectTypes = { - "function": true, - "object": true - }; // Detect the `exports` object exposed by CommonJS implementations. - - var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - - var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, - freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { - root = freeGlobal; - } // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - - - function runInContext(context, exports) { - context || (context = root.Object()); - exports || (exports = root.Object()); // Native constructor aliases. - - var Number = context.Number || root.Number, - String = context.String || root.String, - Object = context.Object || root.Object, - Date = context.Date || root.Date, - SyntaxError = context.SyntaxError || root.SyntaxError, - TypeError = context.TypeError || root.TypeError, - Math = context.Math || root.Math, - nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. - - if (_typeof(nativeJSON) == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } // Convenience aliases. - - - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty = objectProto.hasOwnProperty, - undefined$1; // Internal: Contains `try...catch` logic used by other functions. - // This prevents other functions from being deoptimized. - - function attempt(func, errorFunc) { - try { - func(); - } catch (exception) { - if (errorFunc) { - errorFunc(); - } - } - } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - - - var isExtended = new Date(-3509827334573292); - attempt(function () { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - }); // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. - - function has(name) { - if (has[name] != null) { - // Return cached feature test result. - return has[name]; - } - - var isSupported; - - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); - } else if (name == "date-serialization") { - // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. - isSupported = has("json-stringify") && isExtended; - - if (isSupported) { - var stringify = exports.stringify; - attempt(function () { - isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - }); - } - } else { - var value, - serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. - - if (name == "json-stringify") { - var stringify = exports.stringify, - stringifySupported = typeof stringify == "function"; - - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function value() { - return 1; - }).toJSON = value; - attempt(function () { - stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ - "a": [value, true, false, null, "\x00\b\n\f\r\t"] - }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; - }, function () { - stringifySupported = false; - }); - } - - isSupported = stringifySupported; - } // Test `JSON.parse`. - - - if (name == "json-parse") { - var parse = exports.parse, - parseSupported; - - if (typeof parse == "function") { - attempt(function () { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - parseSupported = value["a"].length == 5 && value["a"][0] === 1; - ->>>>>>> resolve conflicts - if (parseSupported) { - attempt(function () { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - }); - - if (parseSupported) { - attempt(function () { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - }); - } - - if (parseSupported) { - attempt(function () { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - }); - } - } - } - }, function () { - parseSupported = false; - }); - } - - isSupported = parseSupported; - } - } - - return has[name] = !!isSupported; - } - - has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - - var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. - - var _forOwn = function forOwn(object, callback) { - var size = 0, - Properties, - dontEnums, - property; // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. -<<<<<<< HEAD - - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - - dontEnums = new Properties(); - -======= - - (Properties = function Properties() { - this.valueOf = 0; - }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - - dontEnums = new Properties(); - ->>>>>>> resolve conflicts - for (property in dontEnums) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(dontEnums, property)) { - size++; - } - } -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> resolve conflicts - - Properties = dontEnums = null; // Normalize the iteration algorithm. - - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. - - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; - - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } // Manually invoke the callback for each non-enumerable property. - - - for (length = dontEnums.length; property = dontEnums[--length];) { - if (hasProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - _forOwn = function forOwn(object, callback) { - var isFunction = getClass.call(object) == functionClass, - property, - isConstructor; - - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. - - - if (isConstructor || isProperty.call(object, property = "constructor")) { - callback(property); - } - }; - } - - return _forOwn(object, callback); - }; // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. - - - if (!has("json-stringify") && !has("date-serialization")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. - - var leadingZeroes = "000000"; - - var toPaddedString = function toPaddedString(width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; // Internal: Serializes a date object. + function _long(ms) { + return plural(ms, d, 'day') || plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || ms + ' ms'; + } + /** + * Pluralization helper. + */ - var _serializeDate = function serializeDate(value) { - var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. + function plural(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'; + } - if (!isExtended) { - var floor = Math.floor; // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. + var debug_1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ - var getDay = function getDay(year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; + exports.formatters = {}; + /** + * Previously assigned color. + */ - getData = function getData(value) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); + var prevColor = 0; + /** + * Previous log timestamp. + */ - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { - } + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { - } + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ - date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. - time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. + function debug(namespace) { + // define the `disabled` version + function disabled() {} - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - }; - } else { - getData = function getData(value) { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - }; - } + disabled.enabled = false; // define the `enabled` version - _serializeDate = function serializeDate(value) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - getData(value); // Serialize extended years correctly. + function enabled() { + var self = enabled; // set `diff` timestamp - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - year = month = date = hours = minutes = seconds = milliseconds = null; - } else { - value = null; - } + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set - return value; - }; + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); - return _serializeDate(value); - }; // For environments with `JSON.stringify` but buggy date serialization, - // we override the native `Date#toJSON` implementation with a - // spec-compliant one. + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // apply any `formatters` transformations - if (has("json-stringify") && !has("date-serialization")) { - // Internal: the `Date#toJSON` implementation used to override the native one. - var dateToJSON = function dateToJSON(key) { - return _serializeDate(this); - }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + 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` - var nativeStringify = exports.stringify; + args.splice(index, 1); + index--; + } - exports.stringify = function (source, filter, width) { - var nativeToJSON = Date.prototype.toJSON; - Date.prototype.toJSON = dateToJSON; - var result = nativeStringify(source, filter, width); - Date.prototype.toJSON = nativeToJSON; - return result; - }; - } else { - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; + return match; + }); - var escapeChar = function escapeChar(character) { - var charCode = character.charCodeAt(0), - escaped = Escapes[charCode]; + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); + } - if (escaped) { - return escaped; - } + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); + } - return unicodePrefix + toPaddedString(2, charCode.toString(16)); - }; + 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 + */ - var reEscape = /[\x00-\x1f\x22\x5c]/g; - var quote = function quote(value) { - reEscape.lastIndex = 0; - return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; - }; // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. + 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 - var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { - var value, type, className, results, element, index, length, prefix, result; - attempt(function () { - // Necessary for host object support. - value = object[property]; - }); + namespaces = split[i].replace(/\*/g, '.*?'); - if (_typeof(value) == "object" && value) { - if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { - value = _serializeDate(value); - } else if (typeof value.toJSON == "function") { - value = value.toJSON(property); - } - } + if (namespaces[0] === '-') { + exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); + } else { + exports.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + /** + * Disable debug output. + * + * @api public + */ - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } // Exit early if value is `undefined` or `null`. + function disable() { + exports.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ - if (value == undefined$1) { - return value === undefined$1 ? value : "null"; - } - type = _typeof(value); // Only call `getClass` if the value is an object. + function enabled(name) { + var i, len; - if (type == "object") { - className = getClass.call(value); - } + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } + } -======= ->>>>>>> branch for npm and latest release + 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 + */ - return +source.slice(begin, Index); - } // A negative sign may only precede numbers. + function coerce(val) { + if (val instanceof Error) return val.stack || val.message; + return val; + } + }); + var debug_2 = debug_1.coerce; + var debug_3 = debug_1.disable; + var debug_4 = debug_1.enable; + var debug_5 = debug_1.enabled; + var debug_6 = debug_1.humanize; + var debug_7 = debug_1.names; + var debug_8 = debug_1.skips; + var debug_9 = debug_1.formatters; - if (isSigned) { - abort(); - } // `true`, `false`, and `null` literals. + var browser = createCommonjsModule(function (module, exports) { + /** + * This is the web browser implementation of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug_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 + */ - var temp = source.slice(Index, Index + 4); + 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. + */ - if (temp == "true") { - Index += 4; - return true; - } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { - Index += 5; - return false; - } else if (temp == "null") { - Index += 4; - return null; - } // Unrecognized token. + + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; + /** + * Colorize log arguments if enabled. + * + * @api public + */ - abort(); - } - } // Return the sentinel `$` character if the parser has reached the end - // of the source string. + 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++; - return "$"; - }; // Internal: Parses a JSON `value` token. + 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 + */ - var get = function get(value) { - var results, hasMembers; + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ - if (value == "$") { - // Unexpected end of input. - abort(); - } - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } // Parse object and array literals. + 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 + */ - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; + function load() { + var r; - for (;;) { - value = lex(); // A closing square bracket marks the end of the array literal. + try { + r = exports.storage.debug; + } catch (e) {} - if (value == "]") { - break; - } // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. + return r; + } + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ - if (hasMembers) { - if (value == ",") { - value = lex(); + 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 + */ - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); - } - } else { - // A `,` must separate each array element. - abort(); - } - } else { - hasMembers = true; - } // Elisions and leading commas are not permitted. + function localstorage() { + try { + return window.localStorage; + } catch (e) {} + } + }); + var browser_1 = browser.log; + var browser_2 = browser.formatArgs; + var browser_3 = browser.save; + var browser_4 = browser.load; + var browser_5 = browser.useColors; + var browser_6 = browser.storage; + var browser_7 = browser.colors; + /** + * Module dependencies. + */ - if (value == ",") { - abort(); - } + var debug = browser('cookie'); + /** + * Set or get cookie `name` with `value` and `options` object. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @return {Mixed} + * @api public + */ - results.push(get(value)); - } + var rudderComponentCookie = function rudderComponentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set(name, value, options); - return results; - } else if (value == "{") { - // Parses a JSON object, returning a new JavaScript object. - results = {}; + case 1: + return get$1(name); - for (;;) { - value = lex(); // A closing curly brace marks the end of the object literal. + default: + return all(); + } + }; + /** + * Set cookie `name` to `value`. + * + * @param {String} name + * @param {String} value + * @param {Object} options + * @api private + */ - if (value == "}") { - break; - } // If the object literal contains members, the current token - // should be a comma separator. + function set(name, value, options) { + options = options || {}; + var str = encode$1(name) + '=' + encode$1(value); + if (null == value) options.maxage = -1; - if (hasMembers) { - if (value == ",") { - value = lex(); + if (options.maxage) { + options.expires = new Date(+new Date() + options.maxage); + } - if (value == "}") { - // Unexpected trailing `,` in object literal. - abort(); - } - } else { - // A `,` must separate each object member. - abort(); - } - } else { - hasMembers = true; - } // Leading commas are not permitted, object property names must be - // double-quoted strings, and a `:` must separate each property - // name and value. + 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; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ - if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { - abort(); - } + function all() { + var str; - results[value.slice(1)] = get(lex()); - } + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); + } - return results; - } // Unexpected token encountered. + return {}; + } + return parse$2(str); + } + /** + * Get cookie `name`. + * + * @param {String} name + * @return {String} + * @api private + */ - abort(); - } - return value; - }; // Internal: Updates a traversed object member. + function get$1(name) { + return all()[name]; + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - var update = function update(source, property, callback) { - var element = walk(source, property, callback); + function parse$2(str) { + var obj = {}; + var pairs = str.split(/ *; */); + var pair; + if ('' == pairs[0]) return obj; - if (element === undefined$1) { - delete source[property]; - } else { - source[property] = element; - } - }; // Internal: Recursively traverses a parsed JSON object, invoking the - // `callback` function for each value. This is an implementation of the - // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. + for (var i = 0; i < pairs.length; ++i) { + pair = pairs[i].split('='); + obj[decode$1(pair[0])] = decode$1(pair[1]); + } + return obj; + } + /** + * Encode. + */ - var walk = function walk(source, property, callback) { - var value = source[property], - length; - if (_typeof(value) == "object" && value) { - // `forOwn` can't be used to traverse an array in Opera <= 8.54 - // because its `Object#hasOwnProperty` implementation returns `false` - // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). - if (getClass.call(value) == arrayClass) { - for (length = value.length; length--;) { - update(getClass, _forOwn, value, length, callback); - } - } else { - _forOwn(value, function (property) { - update(value, property, callback); - }); - } - } + function encode$1(value) { + try { + return encodeURIComponent(value); + } catch (e) { + debug('error `encode(%o)` - %o', value, e); + } + } + /** + * Decode. + */ - return callback.call(source, property, value); - }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. + function decode$1(value) { + try { + return decodeURIComponent(value); + } catch (e) { + debug('error `decode(%o)` - %o', value, e); + } + } -<<<<<<< HEAD -<<<<<<< HEAD - exports.parse = function (source, callback) { - var result, value; - Index = 0; - Source = "" + source; - result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> resolve conflicts - switch (className || type) { - case "boolean": - case booleanClass: - // Booleans are represented literally. - return "" + value; ->>>>>>> branch for npm and latest release + var max = Math.max; + /** + * Produce a new array composed of all but the first `n` elements of an input `collection`. + * + * @name drop + * @api public + * @param {number} count The number of elements to drop. + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * drop(0, [1, 2, 3]); // => [1, 2, 3] + * drop(1, [1, 2, 3]); // => [2, 3] + * drop(2, [1, 2, 3]); // => [3] + * drop(3, [1, 2, 3]); // => [] + * drop(4, [1, 2, 3]); // => [] + */ - if (lex() != "$") { - abort(); - } // Reset the parser state. + var drop = function drop(count, collection) { + var length = collection ? collection.length : 0; + if (!length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - Index = Source = null; - return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; - }; - } - } - exports.runInContext = runInContext; - return exports; - } + var toDrop = max(Number(count) || 0, 0); + var resultsLength = max(length - toDrop, 0); + var results = new Array(resultsLength); - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root.JSON3, - isRestored = false; - var JSON3 = runInContext(root, root.JSON3 = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function noConflict() { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root.JSON3 = previousJSON; - nativeJSON = previousJSON = null; - } + for (var i = 0; i < resultsLength; i += 1) { + results[i] = collection[i + toDrop]; + } - return JSON3; - } - }); - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } // Export for asynchronous module loaders. - }).call(commonjsGlobal); - }); + return results; + }; + /* + * Exports. + */ - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; - /** - * The currently active debug mode names, and names to skip. - */ - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ + var drop_1 = drop; - exports.formatters = {}; - /** - * Previously assigned color. - */ + var max$1 = Math.max; + /** + * Produce a new array by passing each value in the input `collection` through a transformative + * `iterator` function. The `iterator` function is passed three arguments: + * `(value, index, collection)`. + * + * @name rest + * @api public + * @param {Array} collection The collection to iterate over. + * @return {Array} A new array containing all but the first element from `collection`. + * @example + * rest([1, 2, 3]); // => [2, 3] + */ - var prevColor = 0; - /** - * Previous log timestamp. - */ + var rest = function rest(collection) { + if (collection == null || !collection.length) { + return []; + } // Preallocating an array *significantly* boosts performance when dealing with + // `arguments` objects on v8. For a summary, see: + // https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments - var prevTime; - /** - * Select a color. - * - * @return {Number} - * @api private - */ - function selectColor() { - return exports.colors[prevColor++ % exports.colors.length]; + var results = new Array(max$1(collection.length - 2, 0)); + + for (var i = 1; i < collection.length; i += 1) { + results[i - 1] = collection[i]; } - /** - * Create a debugger with the given `namespace`. - * - * @param {String} namespace - * @return {Function} - * @api public - */ + return results; + }; + /* + * Exports. + */ - function debug(namespace) { - // define the `disabled` version - function disabled() {} - disabled.enabled = false; // define the `enabled` version + var rest_1 = rest; - function enabled() { - var self = enabled; // set `diff` timestamp + /* + * Module dependencies. + */ - var curr = +new Date(); - var ms = curr - (prevTime || curr); - self.diff = ms; - self.prev = prevTime; - self.curr = curr; - prevTime = curr; // add the `color` if not set - if (null == self.useColors) self.useColors = exports.useColors(); - if (null == self.color && self.useColors) self.color = selectColor(); - var args = Array.prototype.slice.call(arguments); - args[0] = exports.coerce(args[0]); + var has$3 = Object.prototype.hasOwnProperty; + var objToString$1 = Object.prototype.toString; + /** + * Returns `true` if a value is an object, otherwise `false`. + * + * @name isObject + * @api private + * @param {*} val The value to test. + * @return {boolean} + */ + // TODO: Move to a library - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // apply any `formatters` transformations + var isObject = function isObject(value) { + return Boolean(value) && _typeof(value) === 'object'; + }; + /** + * Returns `true` if a value is a plain object, otherwise `false`. + * + * @name isPlainObject + * @api private + * @param {*} val The value to test. + * @return {boolean} + */ + // TODO: Move to a library - 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]; + var isPlainObject = function isPlainObject(value) { + return Boolean(value) && objToString$1.call(value) === '[object Object]'; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined. + * + * @name shallowCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + */ - 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--; - } + var shallowCombiner = function shallowCombiner(target, source, value, key) { + if (has$3.call(source, key) && target[key] === undefined) { + target[key] = value; + } - return match; - }); + return source; + }; + /** + * Assigns a key-value pair to a target object when the value assigned is owned, + * and where target[key] is undefined; also merges objects recursively. + * + * @name deepCombiner + * @api private + * @param {Object} target + * @param {Object} source + * @param {*} value + * @param {string} key + * @return {Object} + */ - 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); + var deepCombiner = function deepCombiner(target, source, value, key) { + if (has$3.call(source, key)) { + if (isPlainObject(target[key]) && isPlainObject(value)) { + target[key] = defaultsDeep(target[key], value); + } else if (target[key] === undefined) { + target[key] = value; } + } - enabled.enabled = true; - var fn = exports.enabled(namespace) ? enabled : disabled; - fn.namespace = namespace; - return fn; + return source; + }; + /** + * TODO: Document + * + * @name defaultsWith + * @api private + * @param {Function} combiner + * @param {Object} target + * @param {...Object} sources + * @return {Object} Return the input `target`. + */ + + + var defaultsWith = function defaultsWith(combiner, target + /*, ...sources */ + ) { + if (!isObject(target)) { + return target; } - /** - * Enables a debug mode by namespaces. This can include modes - * separated by a colon and wildcards. - * - * @param {String} namespaces - * @api public - */ + + combiner = combiner || shallowCombiner; + var sources = drop_1(2, arguments); + + for (var i = 0; i < sources.length; i += 1) { + for (var key in sources[i]) { + combiner(target, sources[i], sources[i][key], key); + } + } + + return target; + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * Recurses on objects. + * + * @name defaultsDeep + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} The input `target`. + */ + + + var defaultsDeep = function defaultsDeep(target + /*, sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [deepCombiner, target].concat(rest_1(arguments))); + }; + /** + * Copies owned, enumerable properties from a source object(s) to a target + * object when the value of that property on the source object is `undefined`. + * + * @name defaults + * @api public + * @param {Object} target + * @param {...Object} sources + * @return {Object} + * @example + * var a = { a: 1 }; + * var b = { a: 2, b: 2 }; + * + * defaults(a, b); + * console.log(a); //=> { a: 1, b: 2 } + */ - function enable(namespaces) { - exports.save(namespaces); - var split = (namespaces || '').split(/[\s,]+/); - var len = split.length; + var defaults = function defaults(target + /*, ...sources */ + ) { + // TODO: Replace with `partial` call? + return defaultsWith.apply(null, [null, target].concat(rest_1(arguments))); + }; + /* + * Exports. + */ - for (var i = 0; i < len; i++) { - if (!split[i]) continue; // ignore empty strings - namespaces = split[i].replace(/\*/g, '.*?'); + var defaults_1 = defaults; + var deep = defaultsDeep; + defaults_1.deep = deep; - if (namespaces[0] === '-') { - exports.skips.push(new RegExp('^' + namespaces.substr(1) + '$')); - } else { - exports.names.push(new RegExp('^' + namespaces + '$')); - } - } - } - /** - * Disable debug output. - * - * @api public - */ + var json3 = createCommonjsModule(function (module, exports) { + (function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof undefined === "function" ; // A set of types used to distinguish objects from primitives. + var objectTypes = { + "function": true, + "object": true + }; // Detect the `exports` object exposed by CommonJS implementations. - function disable() { - exports.enable(''); - } - /** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ + var freeExports = objectTypes['object'] && exports && !exports.nodeType && exports; // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + var root = objectTypes[typeof window === "undefined" ? "undefined" : _typeof(window)] && window || this, + freeGlobal = freeExports && objectTypes['object'] && module && !module.nodeType && _typeof(commonjsGlobal) == "object" && commonjsGlobal; - function enabled(name) { - var i, len; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal || freeGlobal.self === freeGlobal)) { + root = freeGlobal; + } // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. - 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; - } - } + function runInContext(context, exports) { + context || (context = root.Object()); + exports || (exports = root.Object()); // Native constructor aliases. - return false; - } - /** - * Coerce `val`. - * - * @param {Mixed} val - * @return {Mixed} - * @api private - */ + var Number = context.Number || root.Number, + String = context.String || root.String, + Object = context.Object || root.Object, + Date = context.Date || root.Date, + SyntaxError = context.SyntaxError || root.SyntaxError, + TypeError = context.TypeError || root.TypeError, + Math = context.Math || root.Math, + nativeJSON = context.JSON || root.JSON; // Delegate to the native `stringify` and `parse` implementations. + if (_typeof(nativeJSON) == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } // Convenience aliases. - 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; -<<<<<<< HEAD - 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. - */ + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty = objectProto.hasOwnProperty, + undefined$1; // Internal: Contains `try...catch` logic used by other functions. + // This prevents other functions from being deoptimized. - 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 attempt(func, errorFunc) { + try { + func(); + } catch (exception) { + if (errorFunc) { + errorFunc(); + } + } + } // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - 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. - */ -<<<<<<< HEAD + var isExtended = new Date(-3509827334573292); + attempt(function () { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + }); // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. - exports.formatters.j = function (v) { - return JSON.stringify(v); - }; - /** - * Colorize log arguments if enabled. - * - * @api public - */ -======= - charCode = source.charCodeAt(Index); - begin = Index; // Optimize for the common case where a string is valid. + function has(name) { + if (has[name] != null) { + // Return cached feature test result. + return has[name]; + } - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } // Append the string as-is. + var isSupported; + + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("date-serialization") && has("json-parse"); + } else if (name == "date-serialization") { + // Indicates whether `Date`s can be serialized accurately by `JSON.stringify`. + isSupported = has("json-stringify") && isExtended; + + if (isSupported) { + var stringify = exports.stringify; + attempt(function () { + isSupported = // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + }); + } + } else { + var value, + serialized = "{\"a\":[1,true,false,null,\"\\u0000\\b\\n\\f\\r\\t\"]}"; // Test `JSON.stringify`. + if (name == "json-stringify") { + var stringify = exports.stringify, + stringifySupported = typeof stringify == "function"; - value += source.slice(begin, Index); - } - } + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function value() { + return 1; + }).toJSON = value; + attempt(function () { + stringifySupported = // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && stringify(new String()) == '""' && // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undefined$1 && // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undefined$1) === undefined$1 && // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undefined$1 && // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && stringify([value]) == "[1]" && // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undefined$1]) == "[null]" && // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undefined$1, getClass, null]) == "[null,null,null]" && // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ + "a": [value, true, false, null, "\x00\b\n\f\r\t"] + }) == serialized && // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && stringify([1, 2], null, 1) == "[\n 1,\n 2\n]"; + }, function () { + stringifySupported = false; + }); + } - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } // Unterminated string. + isSupported = stringifySupported; + } // Test `JSON.parse`. - abort(); + if (name == "json-parse") { + var parse = exports.parse, + parseSupported; - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. + if (typeof parse == "function") { + attempt(function () { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + parseSupported = value["a"].length == 5 && value["a"][0] === 1; - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. + if (parseSupported) { + attempt(function () { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + }); + if (parseSupported) { + attempt(function () { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + }); + } - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); + if (parseSupported) { + attempt(function () { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + }); } -<<<<<<< HEAD + } + } + }, function () { + parseSupported = false; + }); + } - isSigned = false; // Parse the integer component. + isSupported = parseSupported; + } + } - for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { - } // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. + return has[name] = !!isSupported; + } + has["bug-string-char-index"] = has["date-serialization"] = has["json"] = has["json-stringify"] = has["json-parse"] = null; - if (source.charCodeAt(Index) == 46) { - position = ++Index; // Parse the decimal component. + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; // Detect incomplete support for accessing string characters by index. - for (; position < length; position++) { - charCode = source.charCodeAt(position); + var charIndexBuggy = has("bug-string-char-index"); // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. -<<<<<<< HEAD - if (charCode < 48 || charCode > 57) { - break; - } - } + var _forOwn = function forOwn(object, callback) { + var size = 0, + Properties, + dontEnums, + property; // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - if (position == Index) { - // Illegal trailing decimal. - abort(); - } + (Properties = function Properties() { + this.valueOf = 0; + }).prototype.valueOf = 0; // Iterate over a new instance of the `Properties` class. - Index = position; - } // Parse exponents. The `e` denoting the exponent is - // case-insensitive. + dontEnums = new Properties(); + for (property in dontEnums) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(dontEnums, property)) { + size++; + } + } - charCode = source.charCodeAt(Index); + Properties = dontEnums = null; // Normalize the iteration algorithm. - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is - // specified. + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + dontEnums = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. - if (charCode == 43 || charCode == 45) { - Index++; - } // Parse the exponential component. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[_typeof(object.hasOwnProperty)] && object.hasOwnProperty || isProperty; + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } // Manually invoke the callback for each non-enumerable property. - for (position = Index; position < length; position++) { - charCode = source.charCodeAt(position); - if (charCode < 48 || charCode > 57) { - break; - } - } + for (length = dontEnums.length; property = dontEnums[--length];) { + if (hasProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + _forOwn = function forOwn(object, callback) { + var isFunction = getClass.call(object) == functionClass, + property, + isConstructor; - if (position == Index) { - // Illegal empty exponent. - abort(); - } + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. - Index = position; - } // Coerce the parsed value to a JavaScript number. + if (isConstructor || isProperty.call(object, property = "constructor")) { + callback(property); + } + }; + } - return +source.slice(begin, Index); - } // A negative sign may only precede numbers. + return _forOwn(object, callback); + }; // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. - if (isSigned) { - abort(); - } // `true`, `false`, and `null` literals. + if (!has("json-stringify") && !has("date-serialization")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. + var leadingZeroes = "000000"; - var temp = source.slice(Index, Index + 4); + var toPaddedString = function toPaddedString(width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; // Internal: Serializes a date object. - if (temp == "true") { - Index += 4; - return true; - } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { - Index += 5; - return false; - } else if (temp == "null") { - Index += 4; - return null; - } // Unrecognized token. + var _serializeDate = function serializeDate(value) { + var getData, year, month, date, time, hours, minutes, seconds, milliseconds; // Define additional utility methods if the `Date` methods are buggy. - abort(); - } - } // Return the sentinel `$` character if the parser has reached the end - // of the source string. + if (!isExtended) { + var floor = Math.floor; // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. - return "$"; - }; // Internal: Parses a JSON `value` token. + var getDay = function getDay(year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; + getData = function getData(value) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); - var get = function get(value) { - var results, hasMembers; + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++) { + } - if (value == "$") { - // Unexpected end of input. - abort(); - } + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++) { + } - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } // Parse object and array literals. + date = 1 + date - getDay(year, month); // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. + time = (value % 864e5 + 864e5) % 864e5; // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + }; + } else { + getData = function getData(value) { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + }; + } - for (;;) { - value = lex(); // A closing square bracket marks the end of the array literal. + _serializeDate = function serializeDate(value) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + getData(value); // Serialize extended years correctly. - if (value == "]") { - break; - } // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + year = month = date = hours = minutes = seconds = milliseconds = null; + } else { + value = null; + } + return value; + }; - if (hasMembers) { - if (value == ",") { - value = lex(); -======= - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ ->>>>>>> branch for npm and latest release + return _serializeDate(value); + }; // For environments with `JSON.stringify` but buggy date serialization, + // we override the native `Date#toJSON` implementation with a + // spec-compliant one. - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; ->>>>>>> Updated npm distribution files -<<<<<<< HEAD - 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 + if (has("json-stringify") && !has("date-serialization")) { + // Internal: the `Date#toJSON` implementation used to override the native one. + var dateToJSON = function dateToJSON(key) { + return _serializeDate(this); + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function (match) { - if ('%%' === match) return; - index++; -======= - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); - } - } else { - // A `,` must separate each array element. - abort(); - } - } else { - hasMembers = true; - } // Elisions and leading commas are not permitted. ->>>>>>> branch for npm and latest release - 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 - */ + var nativeStringify = exports.stringify; -<<<<<<< HEAD + exports.stringify = function (source, filter, width) { + var nativeToJSON = Date.prototype.toJSON; + Date.prototype.toJSON = dateToJSON; + var result = nativeStringify(source, filter, width); + Date.prototype.toJSON = nativeToJSON; + return result; + }; + } else { + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; - function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); - } - /** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ + var escapeChar = function escapeChar(character) { + var charCode = character.charCodeAt(0), + escaped = Escapes[charCode]; + if (escaped) { + return escaped; + } - 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 - */ + return unicodePrefix + toPaddedString(2, charCode.toString(16)); + }; -======= - if (value == ",") { - abort(); -======= - value += fromCharCode("0x" + source.slice(begin, Index)); - break; + var reEscape = /[\x00-\x1f\x22\x5c]/g; - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } + var quote = function quote(value) { + reEscape.lastIndex = 0; + return '"' + (reEscape.test(value) ? value.replace(reEscape, escapeChar) : value) + '"'; + }; // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - charCode = source.charCodeAt(Index); - begin = Index; // Optimize for the common case where a string is valid. - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } // Append the string as-is. + var serialize = function serialize(property, object, callback, properties, whitespace, indentation, stack) { + var value, type, className, results, element, index, length, prefix, result; + attempt(function () { + // Necessary for host object support. + value = object[property]; + }); + if (_typeof(value) == "object" && value) { + if (value.getUTCFullYear && getClass.call(value) == dateClass && value.toJSON === Date.prototype.toJSON) { + value = _serializeDate(value); + } else if (typeof value.toJSON == "function") { + value = value.toJSON(property); + } + } - value += source.slice(begin, Index); - } ->>>>>>> resolve conflicts - } + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } // Exit early if value is `undefined` or `null`. - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } // Unterminated string. + if (value == undefined$1) { + return value === undefined$1 ? value : "null"; + } - abort(); + type = _typeof(value); // Only call `getClass` if the value is an object. -<<<<<<< HEAD - if (value == "}") { - break; - } // If the object literal contains members, the current token - // should be a comma separator. -======= ->>>>>>> branch for npm and latest release -======= - default: - // Parse numbers and literals. - begin = Index; // Advance past the negative sign, if one is specified. + if (type == "object") { + className = getClass.call(value); + } - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } // Parse an integer or floating-point value. + switch (className || type) { + case "boolean": + case booleanClass: + // Booleans are represented literally. + return "" + value; + case "number": + case numberClass: + // JSON numbers must be finite. `Infinity` and `NaN` are serialized as + // `"null"`. + return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } ->>>>>>> resolve conflicts + case "string": + case stringClass: + // Strings are double-quoted and escaped. + return quote("" + value); + } // Recursively serialize objects and arrays. - function load() { - var r; - try { - r = exports.storage.debug; - } catch (e) {} + if (_typeof(value) == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } // Add the object to the stack of traversed objects. - return r; - } - /** - * Enable namespaces listed in `localStorage.debug` initially. - */ + stack.push(value); + results = []; // Save the current indentation level and indent one additional level. - 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 - */ + prefix = indentation; + indentation += whitespace; - 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; + if (className == arrayClass) { + // Recursively serialize array elements. + for (index = 0, length = value.length; index < length; index++) { + element = serialize(index, value, callback, properties, whitespace, indentation, stack); + results.push(element === undefined$1 ? "null" : element); + } - /** - * Module dependencies. - */ + result = results.length ? whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : "[" + results.join(",") + "]" : "[]"; + } else { + // Recursively serialize object members. Members are selected from + // either a user-specified list of property names, or the object + // itself. + _forOwn(properties || value, function (property) { + var element = serialize(property, value, callback, properties, whitespace, indentation, stack); -<<<<<<< HEAD -<<<<<<< HEAD - 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 - */ -======= -<<<<<<< HEAD -======= ->>>>>>> branch for npm and latest release - if (charCode < 48 || charCode > 57) { - break; - } - } ->>>>>>> Updated npm distribution files + if (element !== undefined$1) { + // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} + // is not the empty string, let `member` {quote(property) + ":"} + // be the concatenation of `member` and the `space` character." + // The "`space` character" refers to the literal space + // character, not the `space` {width} argument provided to + // `JSON.stringify`. + results.push(quote(property) + ":" + (whitespace ? " " : "") + element); + } + }); - var componentCookie = function componentCookie(name, value, options) { - switch (arguments.length) { - case 3: - case 2: - return set$1(name, value, options); + result = results.length ? whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : "{" + results.join(",") + "}" : "{}"; + } // Remove the object from the traversed object stack. - 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 - */ + stack.pop(); + return result; + } + }; // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - function set$1(name, value, options) { - options = options || {}; - var str = encode$2(name) + '=' + encode$2(value); - if (null == value) options.maxage = -1; + exports.stringify = function (source, filter, width) { + var whitespace, callback, properties, className; - if (options.maxage) { - options.expires = new Date(+new Date() + options.maxage); - } + if (objectTypes[_typeof(filter)] && filter) { + className = getClass.call(filter); - 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'; - document.cookie = str; - } - /** - * Return all cookies. - * - * @return {Object} - * @api private - */ + if (className == functionClass) { + callback = filter; + } else if (className == arrayClass) { + // Convert the property names array into a makeshift set. + properties = {}; + + for (var index = 0, length = filter.length, value; index < length;) { + value = filter[index++]; + className = getClass.call(value); + if (className == "[object String]" || className == "[object Number]") { + properties[value] = 1; + } + } + } + } - function all$1() { - var str; + if (width) { + className = getClass.call(width); -<<<<<<< HEAD - try { - str = document.cookie; - } catch (err) { - if (typeof console !== 'undefined' && typeof console.error === 'function') { - console.error(err.stack || err); - } + if (className == numberClass) { + // Convert the `width` to an integer and create a string containing + // `width` number of space characters. + if ((width -= width % 1) > 0) { + if (width > 10) { + width = 10; + } - return {}; - } + for (whitespace = ""; whitespace.length < width;) { + whitespace += " "; + } + } + } else if (className == stringClass) { + whitespace = width.length <= 10 ? width : width.slice(0, 10); + } + } // Opera <= 7.54u2 discards the values associated with empty string keys + // (`""`) only if they are used directly within an object member list + // (e.g., `!("" in { "": 1})`). -<<<<<<< HEAD - return parse$3(str); - } - /** - * Get cookie `name`. - * - * @param {String} name - * @return {String} - * @api private - */ -======= - return +source.slice(begin, Index); - } // A negative sign may only precede numbers. + return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); + }; + } + } // Public: Parses a JSON source string. - if (isSigned) { - abort(); - } // `true`, `false`, and `null` literals. + if (!has("json-parse")) { + var fromCharCode = String.fromCharCode; // Internal: A map of escaped control characters and their unescaped + // equivalents. - var temp = source.slice(Index, Index + 4); + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" + }; // Internal: Stores the parser state. - if (temp == "true") { - Index += 4; - return true; - } else if (temp == "fals" && source.charCodeAt(Index + 4) == 101) { - Index += 5; - return false; - } else if (temp == "null") { - Index += 4; - return null; - } // Unrecognized token. + var Index, Source; // Internal: Resets the parser state and throws a `SyntaxError`. + var abort = function abort() { + Index = Source = null; + throw SyntaxError(); + }; // Internal: Returns the next token, or `"$"` if the parser has reached + // the end of the source string. A token may be a string, number, `null` + // literal, or Boolean literal. - abort(); - } - } // Return the sentinel `$` character if the parser has reached the end - // of the source string. + var lex = function lex() { + var source = Source, + length = source.length, + value, + begin, + position, + isSigned, + charCode; - return "$"; - }; // Internal: Parses a JSON `value` token. + while (Index < length) { + charCode = source.charCodeAt(Index); + switch (charCode) { + case 9: + case 10: + case 13: + case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; - var get = function get(value) { - var results, hasMembers; + case 123: + case 125: + case 91: + case 93: + case 58: + case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; + Index++; + return value; - if (value == "$") { - // Unexpected end of input. - abort(); - } + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } // Parse object and array literals. + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); + switch (charCode) { + case 92: + case 34: + case 47: + case 98: + case 116: + case 110: + case 102: + case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; - for (;;) { - value = lex(); // A closing square bracket marks the end of the array literal. + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. - if (value == "]") { - break; - } // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. ->>>>>>> branch for npm and latest release + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } // Revive the escaped character. - if (hasMembers) { - if (value == ",") { - value = lex(); + value += fromCharCode("0x" + source.slice(begin, Index)); + break; -<<<<<<< HEAD - if (value == "}") { - // Unexpected trailing `,` in object literal. - abort(); + default: + // Invalid escape sequence. + abort(); } } else { - // A `,` must separate each object member. -======= - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; } - } else { - // A `,` must separate each array element. ->>>>>>> branch for npm and latest release - abort(); - } - } else { - hasMembers = true; -<<<<<<< HEAD - } // Leading commas are not permitted, object property names must be - // double-quoted strings, and a `:` must separate each property - // name and value. - - - if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { - abort(); - } - - results[value.slice(1)] = get(lex()); - } - return results; - } // Unexpected token encountered. + charCode = source.charCodeAt(Index); + begin = Index; // Optimize for the common case where a string is valid. + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } // Append the string as-is. - abort(); - } - return value; - }; // Internal: Updates a traversed object member. + value += source.slice(begin, Index); + } + } + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } // Unterminated string. - var update = function update(source, property, callback) { - var element = walk(source, property, callback); - if (element === undefined$1) { - delete source[property]; - } else { - source[property] = element; - } - }; // Internal: Recursively traverses a parsed JSON object, invoking the - // `callback` function for each value. This is an implementation of the - // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. + abort(); + default: + // Parse numbers and literals. + begin = Index; // Advance past the negative sign, if one is specified. - var walk = function walk(source, property, callback) { - var value = source[property], - length; + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } // Parse an integer or floating-point value. - if (_typeof(value) == "object" && value) { - // `forOwn` can't be used to traverse an array in Opera <= 8.54 - // because its `Object#hasOwnProperty` implementation returns `false` - // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). - if (getClass.call(value) == arrayClass) { - for (length = value.length; length--;) { - update(getClass, _forOwn, value, length, callback); - } - } else { - _forOwn(value, function (property) { - update(value, property, callback); - }); - } - } - return callback.call(source, property, value); - }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && (charCode = source.charCodeAt(Index + 1), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } + isSigned = false; // Parse the integer component. - exports.parse = function (source, callback) { - var result, value; - Index = 0; - Source = "" + source; - result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. + for (; Index < length && (charCode = source.charCodeAt(Index), charCode >= 48 && charCode <= 57); Index++) { + } // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. - if (lex() != "$") { - abort(); - } // Reset the parser state. + if (source.charCodeAt(Index) == 46) { + position = ++Index; // Parse the decimal component. - Index = Source = null; - return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; - }; - } - } + for (; position < length; position++) { + charCode = source.charCodeAt(position); - exports.runInContext = runInContext; - return exports; - } + if (charCode < 48 || charCode > 57) { + break; + } + } - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root.JSON3, - isRestored = false; - var JSON3 = runInContext(root, root.JSON3 = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function noConflict() { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root.JSON3 = previousJSON; - nativeJSON = previousJSON = null; - } + if (position == Index) { + // Illegal trailing decimal. + abort(); + } - return JSON3; - } - }); - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } // Export for asynchronous module loaders. - }).call(commonjsGlobal); - }); ->>>>>>> branch for npm and latest release -======= Index = position; - } // Coerce the parsed value to a JavaScript number. + } // Parse exponents. The `e` denoting the exponent is + // case-insensitive. ->>>>>>> resolve conflicts - return +source.slice(begin, Index); - } // A negative sign may only precede numbers. + charCode = source.charCodeAt(Index); -<<<<<<< HEAD -<<<<<<< HEAD - function get$2(name) { - return all$1()[name]; - } - /** - * Parse cookie `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ -======= - exports.names = []; - exports.skips = []; - /** - * Map of special "%n" handling functions, for the debug "format" argument. - * - * Valid key names are a single, lowercased letter, i.e. "n". - */ ->>>>>>> branch for npm and latest release -======= ->>>>>>> resolve conflicts + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); // Skip past the sign following the exponent, if one is + // specified. - if (isSigned) { - abort(); - } // `true`, `false`, and `null` literals. + if (charCode == 43 || charCode == 45) { + Index++; + } // Parse the exponential component. -<<<<<<< HEAD -<<<<<<< HEAD - 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$2(pair[0])] = decode$2(pair[1]); - } + for (position = Index; position < length; position++) { + charCode = source.charCodeAt(position); - return obj; - } - /** - * Encode. - */ + if (charCode < 48 || charCode > 57) { + break; + } + } + if (position == Index) { + // Illegal empty exponent. + abort(); + } - function encode$2(value) { - try { - return encodeURIComponent(value); - } catch (e) { - debug$1('error `encode(%o)` - %o', value, e); - } - } - /** - * Decode. - */ + Index = position; + } // Coerce the parsed value to a JavaScript number. - function decode$2(value) { - try { - return decodeURIComponent(value); - } catch (e) { - debug$1('error `decode(%o)` - %o', value, e); - } - } + return +source.slice(begin, Index); + } // A negative sign may only precede numbers. -======= ->>>>>>> branch for npm and latest release - var lib = createCommonjsModule(function (module, exports) { - /** - * Module dependencies. - */ -<<<<<<< HEAD - 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 - */ + if (isSigned) { + abort(); + } // `true`, `false`, and `null` literals. - function domain(url) { - var cookie = exports.cookie; - var levels = exports.levels(url); // Lookup the real top level one. -======= - var prevColor = 0; - /** - * Previous log timestamp. - */ -======= ->>>>>>> resolve conflicts var temp = source.slice(Index, Index + 4); @@ -22122,43 +10519,10 @@ var get = function get(value) { var results, hasMembers; -<<<<<<< HEAD - if ('string' !== typeof args[0]) { - // anything else let's inspect with %o - args = ['%o'].concat(args); - } // apply any `formatters` transformations ->>>>>>> branch for npm and latest release - - for (var i = 0; i < levels.length; ++i) { - var cname = '__tld__'; - var domain = levels[i]; - var opts = { - domain: '.' + domain - }; - cookie(cname, 1, opts); - -<<<<<<< HEAD - 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 - */ -======= if (value == "$") { // Unexpected end of input. abort(); } ->>>>>>> resolve conflicts if (typeof value == "string") { if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { @@ -22166,39 +10530,13 @@ return value.slice(1); } // Parse object and array literals. -<<<<<<< HEAD - 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. -======= - 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]; -======= ->>>>>>> resolve conflicts if (value == "[") { // Parses a JSON array, returning a new JavaScript array. results = []; -<<<<<<< HEAD - args.splice(index, 1); - index--; - } ->>>>>>> branch for npm and latest release -======= for (;;) { value = lex(); // A closing square bracket marks the end of the array literal. ->>>>>>> resolve conflicts if (value == "]") { break; @@ -22211,37 +10549,6 @@ if (value == ",") { value = lex(); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - if (parts.length <= 1) { - return levels; - } // Create levels. -======= - if (hasMembers) { - if (value == ",") { - value = lex(); -======= - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files - -======= -======= -======= if (value == "]") { // Unexpected trailing `,` in array literal. abort(); @@ -22252,798 +10559,576 @@ } } else { hasMembers = true; ->>>>>>> resolve conflicts } // Elisions and leading commas are not permitted. ->>>>>>> branch for npm and latest release - - 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 (value == ",") { + abort(); + } - if (arguments.length === 0) return this._options; - var domain = ".".concat(lib(window.location.href)); - if (domain === ".") domain = null; // the default maxage and path + results.push(get(value)); + } -<<<<<<< HEAD - this._options = defaults_1(_options, { - maxage: 31536000000, - path: "/", - domain: domain, - samesite: "Lax" - }); // try setting a cookie first + return results; + } else if (value == "{") { + // Parses a JSON object, returning a new JavaScript object. + results = {}; - this.set("test_rudder", true); + for (;;) { + value = lex(); // A closing curly brace marks the end of the object literal. - if (!this.get("test_rudder")) { - this._options.domain = null; - } + if (value == "}") { + break; + } // If the object literal contains members, the current token + // should be a comma separator. - this.remove("test_rudder"); - } - /** - * - * @param {*} key - * @param {*} value - */ - }, { - key: "set", - value: function set(key, value) { - try { - rudderComponentCookie(key, value, clone_1(this._options)); - return true; - } catch (e) { - logger.error(e); - return false; - } - } - /** - * - * @param {*} key - */ + if (hasMembers) { + if (value == ",") { + value = lex(); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - }, { - key: "get", - value: function get(key) { - return rudderComponentCookie(key); - } - /** - * - * @param {*} key - */ -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -<<<<<<< HEAD - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ + if (value == "}") { + // Unexpected trailing `,` in object literal. + abort(); + } + } else { + // A `,` must separate each object member. + abort(); + } + } else { + hasMembers = true; + } // Leading commas are not permitted, object property names must be + // double-quoted strings, and a `:` must separate each property + // name and value. + + + if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { + abort(); + } - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module results[value.slice(1)] = get(lex()); } ->>>>>>> branch for npm and latest release - }, { - key: "remove", - value: function remove(key) { - try { - rudderComponentCookie(key, null, clone_1(this._options)); - return true; - } catch (e) { - return false; - } - } - }]); + return results; + } // Unexpected token encountered. - return CookieLocal; - }(); // Exporting only the instance + abort(); + } - var Cookie = new CookieLocal({}); + return value; + }; // Internal: Updates a traversed object member. - var store = function () { - // Store.js - var store = {}, - win = typeof window != 'undefined' ? window : commonjsGlobal, - doc = win.document, - localStorageName = 'localStorage', - scriptTag = 'script', - storage; - store.disabled = false; - store.version = '1.3.20'; - store.set = function (key, value) {}; + var update = function update(source, property, callback) { + var element = walk(source, property, callback); - store.get = function (key, defaultVal) {}; + if (element === undefined$1) { + delete source[property]; + } else { + source[property] = element; + } + }; // Internal: Recursively traverses a parsed JSON object, invoking the + // `callback` function for each value. This is an implementation of the + // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - store.has = function (key) { - return store.get(key) !== undefined; - }; - store.remove = function (key) {}; + var walk = function walk(source, property, callback) { + var value = source[property], + length; - store.clear = function () {}; + if (_typeof(value) == "object" && value) { + // `forOwn` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { + for (length = value.length; length--;) { + update(getClass, _forOwn, value, length, callback); + } + } else { + _forOwn(value, function (property) { + update(value, property, callback); + }); + } + } - store.transact = function (key, defaultVal, transactionFn) { - if (transactionFn == null) { - transactionFn = defaultVal; - defaultVal = null; - } + return callback.call(source, property, value); + }; // Public: `JSON.parse`. See ES 5.1 section 15.12.2. - if (defaultVal == null) { - defaultVal = {}; - } - var val = store.get(key, defaultVal); - transactionFn(val); - store.set(key, val); - }; + exports.parse = function (source, callback) { + var result, value; + Index = 0; + Source = "" + source; + result = get(lex()); // If a JSON string contains multiple tokens, it is invalid. - store.getAll = function () { - var ret = {}; - store.forEach(function (key, val) { - ret[key] = val; - }); - return ret; - }; + if (lex() != "$") { + abort(); + } // Reset the parser state. - store.forEach = function () {}; -<<<<<<< HEAD - store.serialize = function (value) { - return json3.stringify(value); - }; -======= Index = Source = null; return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; }; } } -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= -======= - var debug_1$1 = createCommonjsModule(function (module, exports) { - /** - * This is the common logic for both the Node.js and web browser - * implementations of `debug()`. - * - * Expose `debug()` as the module. - */ - - exports = module.exports = debug; - exports.coerce = coerce; - exports.disable = disable; - exports.enable = enable; - exports.enabled = enabled; - exports.humanize = ms; ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= ->>>>>>> update npm module - - store.deserialize = function (value) { - if (typeof value != 'string') { - return undefined; - } - try { - return json3.parse(value); - } catch (e) { - return value || undefined; + exports.runInContext = runInContext; + return exports; } - }; // Functions to encapsulate questionable FireFox 3.6.13 behavior - // when about.config::dom.storage.enabled === false - // See https://github.com/marcuswestin/store.js/issues#issue/13 + if (freeExports && !isLoader) { + // Export for CommonJS environments. + runInContext(root, freeExports); + } else { + // Export for web browsers and JavaScript engines. + var nativeJSON = root.JSON, + previousJSON = root.JSON3, + isRestored = false; + var JSON3 = runInContext(root, root.JSON3 = { + // Public: Restores the original value of the global `JSON` object and + // returns a reference to the `JSON3` object. + "noConflict": function noConflict() { + if (!isRestored) { + isRestored = true; + root.JSON = nativeJSON; + root.JSON3 = previousJSON; + nativeJSON = previousJSON = null; + } - function isLocalStorageNameSupported() { - try { - return localStorageName in win && win[localStorageName]; - } catch (err) { - return false; - } - } + return JSON3; + } + }); + root.JSON = { + "parse": JSON3.parse, + "stringify": JSON3.stringify + }; + } // Export for asynchronous module loaders. + }).call(commonjsGlobal); + }); - if (isLocalStorageNameSupported()) { - storage = win[localStorageName]; + var debug_1$1 = createCommonjsModule(function (module, exports) { + /** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + * + * Expose `debug()` as the module. + */ + exports = module.exports = debug; + exports.coerce = coerce; + exports.disable = disable; + exports.enable = enable; + exports.enabled = enabled; + exports.humanize = ms; + /** + * The currently active debug mode names, and names to skip. + */ - store.set = function (key, val) { - if (val === undefined) { - return store.remove(key); - } + exports.names = []; + exports.skips = []; + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lowercased letter, i.e. "n". + */ - storage.setItem(key, store.serialize(val)); - return val; - }; + exports.formatters = {}; + /** + * Previously assigned color. + */ - store.get = function (key, defaultVal) { - var val = store.deserialize(storage.getItem(key)); - return val === undefined ? defaultVal : val; - }; + var prevColor = 0; + /** + * Previous log timestamp. + */ - store.remove = function (key) { - storage.removeItem(key); - }; + var prevTime; + /** + * Select a color. + * + * @return {Number} + * @api private + */ - store.clear = function () { - storage.clear(); - }; + function selectColor() { + return exports.colors[prevColor++ % exports.colors.length]; + } + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ - store.forEach = function (callback) { - for (var i = 0; i < storage.length; i++) { - var key = storage.key(i); - callback(key, store.get(key)); - } - }; - } else if (doc && doc.documentElement.addBehavior) { - var storageOwner, storageContainer; // Since #userData storage applies only to specific paths, we need to - // somehow link our data to a specific path. We choose /favicon.ico - // as a pretty safe option, since all browsers already make a request to - // this URL anyway and being a 404 will not hurt us here. We wrap an - // iframe pointing to the favicon in an ActiveXObject(htmlfile) object - // (see: http://msdn.microsoft.com/en-us/library/aa752574(v=VS.85).aspx) - // since the iframe access rules appear to allow direct access and - // manipulation of the document element, even for a 404 page. This - // document can be used instead of the current document (which would - // have been limited to the current path) to perform #userData storage. - try { - storageContainer = new ActiveXObject('htmlfile'); - storageContainer.open(); - storageContainer.write('<' + scriptTag + '>document.w=window'); - storageContainer.close(); - storageOwner = storageContainer.w.frames[0].document; - storage = storageOwner.createElement('div'); - } catch (e) { - // somehow ActiveXObject instantiation failed (perhaps some special - // security settings or otherwse), fall back to per-path storage - storage = doc.createElement('div'); - storageOwner = doc.body; - } + function debug(namespace) { + // define the `disabled` version + function disabled() {} - var withIEStorage = function withIEStorage(storeFunction) { - return function () { - var args = Array.prototype.slice.call(arguments, 0); - args.unshift(storage); // See http://msdn.microsoft.com/en-us/library/ms531081(v=VS.85).aspx - // and http://msdn.microsoft.com/en-us/library/ms531424(v=VS.85).aspx + disabled.enabled = false; // define the `enabled` version - storageOwner.appendChild(storage); - storage.addBehavior('#default#userData'); - storage.load(localStorageName); - var result = storeFunction.apply(store, args); - storageOwner.removeChild(storage); - return result; - }; - }; // In IE7, keys cannot start with a digit or contain certain chars. - // See https://github.com/marcuswestin/store.js/issues/40 - // See https://github.com/marcuswestin/store.js/issues/83 + function enabled() { + var self = enabled; // set `diff` timestamp + var curr = +new Date(); + var ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; // add the `color` if not set - var forbiddenCharsRegex = new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]", "g"); + if (null == self.useColors) self.useColors = exports.useColors(); + if (null == self.color && self.useColors) self.color = selectColor(); + var args = Array.prototype.slice.call(arguments); + args[0] = exports.coerce(args[0]); - var ieKeyFix = function ieKeyFix(key) { - return key.replace(/^d/, '___$&').replace(forbiddenCharsRegex, '___'); - }; + if ('string' !== typeof args[0]) { + // anything else let's inspect with %o + args = ['%o'].concat(args); + } // apply any `formatters` transformations - store.set = withIEStorage(function (storage, key, val) { - key = ieKeyFix(key); - if (val === undefined) { - return store.remove(key); - } + 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]; - storage.setAttribute(key, store.serialize(val)); - storage.save(localStorageName); - return val; - }); - store.get = withIEStorage(function (storage, key, defaultVal) { - key = ieKeyFix(key); - var val = store.deserialize(storage.getAttribute(key)); - return val === undefined ? defaultVal : val; - }); - store.remove = withIEStorage(function (storage, key) { - key = ieKeyFix(key); - storage.removeAttribute(key); - storage.save(localStorageName); - }); - store.clear = withIEStorage(function (storage) { - var attributes = storage.XMLDocument.documentElement.attributes; - storage.load(localStorageName); + 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` -<<<<<<< HEAD -<<<<<<< HEAD - for (var i = attributes.length - 1; i >= 0; i--) { - storage.removeAttribute(attributes[i].name); -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> resolve conflicts - if ('function' === typeof exports.formatArgs) { - args = exports.formatArgs.apply(self, args); ->>>>>>> branch for npm and latest release - } + args.splice(index, 1); + index--; + } - storage.save(localStorageName); - }); - store.forEach = withIEStorage(function (storage, callback) { - var attributes = storage.XMLDocument.documentElement.attributes; + return match; + }); - for (var i = 0, attr; attr = attributes[i]; ++i) { - callback(attr.name, store.deserialize(storage.getAttribute(attr.name))); + if ('function' === typeof exports.formatArgs) { + args = exports.formatArgs.apply(self, args); } - }); - } - try { - var testKey = '__storejs__'; - store.set(testKey, testKey); - - if (store.get(testKey) != testKey) { - store.disabled = true; + var logFn = enabled.log || exports.log || console.log.bind(console); + logFn.apply(self, args); } - store.remove(testKey); - } catch (e) { - store.disabled = true; + 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 + */ - store.enabled = !store.disabled; - return store; - }(); - /** - * An object utility to persist user and other values in localstorage - */ + function enable(namespaces) { + exports.save(namespaces); + var split = (namespaces || '').split(/[\s,]+/); + var len = split.length; - var StoreLocal = /*#__PURE__*/function () { - function StoreLocal(options) { - _classCallCheck(this, StoreLocal); + for (var i = 0; i < len; i++) { + if (!split[i]) continue; // ignore empty strings - this._options = {}; - this.enabled = false; - this.options(options); + 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. * - * @param {*} options + * @api public */ - _createClass(StoreLocal, [{ - key: "options", - value: function options() { - var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + function disable() { + exports.enable(''); + } + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ - if (arguments.length === 0) return this._options; - defaults_1(_options, { - enabled: true - }); - this.enabled = _options.enabled && store.enabled; - this._options = _options; - } - /** - * - * @param {*} key - * @param {*} value - */ - }, { - key: "set", - value: function set(key, value) { - if (!this.enabled) return false; - return store.set(key, value); - } - /** - * - * @param {*} key - */ + function enabled(name) { + var i, len; - }, { - key: "get", - value: function get(key) { - if (!this.enabled) return null; - return store.get(key); + for (i = 0, len = exports.skips.length; i < len; i++) { + if (exports.skips[i].test(name)) { + return false; + } } - /** - * - * @param {*} key - */ - }, { - key: "remove", - value: function remove(key) { - if (!this.enabled) return false; - return store.remove(key); + for (i = 0, len = exports.names.length; i < len; i++) { + if (exports.names[i].test(name)) { + return true; + } } - }]); - - return StoreLocal; - }(); // Exporting only the instance + return false; + } + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ - var Store = new StoreLocal({}); - var defaults$1 = { - user_storage_key: "rl_user_id", - user_storage_trait: "rl_trait", - user_storage_anonymousId: "rl_anonymous_id", - group_storage_key: "rl_group_id", - group_storage_trait: "rl_group_trait", - prefix: "RudderEncrypt:", - key: "Rudder" - }; - /** - * An object that handles persisting key-val from Analytics - */ + 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 Storage = /*#__PURE__*/function () { - function Storage() { - _classCallCheck(this, Storage); + 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. + */ - // First try setting the storage to cookie else to localstorage - Cookie.set("rudder_cookies", true); + 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 + */ - if (Cookie.get("rudder_cookies")) { - Cookie.remove("rudder_cookies"); - this.storage = Cookie; - return; - } // localStorage is enabled. + 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. + */ - if (Store.enabled) { - this.storage = Store; - } - } + exports.formatters.j = function (v) { + return JSON.stringify(v); + }; /** - * Json stringify the given value - * @param {*} value + * Colorize log arguments if enabled. + * + * @api public */ - _createClass(Storage, [{ - key: "stringify", - value: function stringify(value) { - return JSON.stringify(value); - } - /** - * JSON parse the value - * @param {*} value - */ + 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 - }, { - key: "parse", - value: function parse(value) { - // if not parseable, return as is without json parse - try { - return value ? JSON.parse(value) : null; - } catch (e) { - logger.error(e); - return value || null; + 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; } - } - /** - * trim using regex for browser polyfill - * @param {*} value - */ + }); + args.splice(lastC, 0, c); + return args; + } + /** + * Invokes `console.log()` when available. + * No-op when `console.log` is not a "function". + * + * @api public + */ - }, { - key: "trim", - value: function trim(value) { - return value.replace(/^\s+|\s+$/gm, ""); - } - /** - * AES encrypt value with constant prefix - * @param {*} value - */ - }, { - key: "encryptValue", - value: function encryptValue(value) { - if (this.trim(value) == "") { - return value; - } + function log() { + // this hackery is required for IE8/9, where + // the `console.log` function doesn't have 'apply' + return 'object' === (typeof console === "undefined" ? "undefined" : _typeof(console)) && console.log && Function.prototype.apply.call(console.log, console, arguments); + } + /** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ - var prefixedVal = "".concat(defaults$1.prefix).concat(aes.encrypt(value, defaults$1.key).toString()); - return prefixedVal; - } - /** - * decrypt value - * @param {*} value - */ - }, { - key: "decryptValue", - value: function decryptValue(value) { - if (!value || typeof value === "string" && this.trim(value) == "") { - return value; + 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 + */ - if (value.substring(0, defaults$1.prefix.length) == defaults$1.prefix) { - return aes.decrypt(value.substring(defaults$1.prefix.length), defaults$1.key).toString(encUtf8); - } - return value; - } - /** - * - * @param {*} key - * @param {*} value - */ + function load() { + var r; - }, { - key: "setItem", - value: function setItem(key, value) { - this.storage.set(key, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ + try { + r = exports.storage.debug; + } catch (e) {} - }, { - key: "setUserId", - value: function setUserId(value) { - if (typeof value !== "string") { - logger.error("[Storage] setUserId:: userId should be string"); - return; - } + return r; + } + /** + * Enable namespaces listed in `localStorage.debug` initially. + */ - this.storage.set(defaults$1.user_storage_key, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ - }, { - key: "setUserTraits", - value: function setUserTraits(value) { - this.storage.set(defaults$1.user_storage_trait, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ + 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 + */ - }, { - key: "setGroupId", - value: function setGroupId(value) { - if (typeof value !== "string") { - logger.error("[Storage] setGroupId:: groupId should be string"); - return; - } + 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; - this.storage.set(defaults$1.group_storage_key, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ + /** + * Module dependencies. + */ - }, { - key: "setGroupTraits", - value: function setGroupTraits(value) { - this.storage.set(defaults$1.group_storage_trait, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} value - */ + 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 componentCookie(name, value, options) { + switch (arguments.length) { + case 3: + case 2: + return set$1(name, value, options); - }, { - key: "setAnonymousId", - value: function setAnonymousId(value) { - if (typeof value !== "string") { - logger.error("[Storage] setAnonymousId:: anonymousId should be string"); - return; - } + 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 + */ - this.storage.set(defaults$1.user_storage_anonymousId, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} key - */ -<<<<<<< HEAD - }, { - key: "getItem", - value: function getItem(key) { - return this.parse(this.decryptValue(this.storage.get(key))); - } - /** - * get the stored userId - */ -======= function set$1(name, value, options) { options = options || {}; var str = encode$2(name) + '=' + encode$2(value); if (null == value) options.maxage = -1; ->>>>>>> NPM release version 1.0.11 - }, { - key: "getUserId", - value: function getUserId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_key))); - } - /** - * get the stored user traits - */ + if (options.maxage) { + options.expires = new Date(+new Date() + options.maxage); + } - }, { - key: "getUserTraits", - value: function getUserTraits() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_trait))); - } - /** - * get the stored userId - */ + 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'; + document.cookie = str; + } + /** + * Return all cookies. + * + * @return {Object} + * @api private + */ - }, { - key: "getGroupId", - value: function getGroupId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_key))); - } - /** - * get the stored user traits - */ -<<<<<<< HEAD - }, { - key: "getGroupTraits", - value: function getGroupTraits() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_trait))); - } - /** - * get stored anonymous id - */ + function all$1() { + var str; - }, { - key: "getAnonymousId", - value: function getAnonymousId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_anonymousId))); + try { + str = document.cookie; + } catch (err) { + if (typeof console !== 'undefined' && typeof console.error === 'function') { + console.error(err.stack || err); } - /** - * - * @param {*} key - */ - }, { - key: "removeItem", - value: function removeItem(key) { - return this.storage.remove(key); - } - /** - * remove stored keys - */ -======= return {}; } -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -<<<<<<< HEAD ->>>>>>> update npm module -======= -<<<<<<< HEAD ->>>>>>> update npm module - -<<<<<<< HEAD - }, { - key: "clear", - value: function clear() { - this.storage.remove(defaults$1.user_storage_key); - this.storage.remove(defaults$1.user_storage_trait); - this.storage.remove(defaults$1.group_storage_key); - this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); - } - }]); -======= - return parse$3(str); -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - return parse$2(str); ->>>>>>> Updated npm distribution files - } -<<<<<<< HEAD -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module -======= ->>>>>>> resolve conflicts return parse$3(str); } @@ -23054,81 +11139,19 @@ * @return {String} * @api private */ ->>>>>>> NPM release version 1.0.11 - return Storage; - }(); - - var Storage$1 = new Storage(); - - var defaults$2 = { - lotame_synch_time_key: "lt_synch_timestamp" - }; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var LotameStorage = /*#__PURE__*/function () { - function LotameStorage() { - _classCallCheck(this, LotameStorage); -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module + function get$2(name) { + return all$1()[name]; + } + /** + * Parse cookie `str`. + * + * @param {String} str + * @return {Object} + * @api private + */ - this.storage = Storage$1; // new Storage(); -======= - function parse$3(str) { -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module -======= -======= ->>>>>>> Updated npm distribution files -======= ->>>>>>> update npm module - -<<<<<<< HEAD ->>>>>>> branch for npm and latest release ->>>>>>> branch for npm and latest release - function parse$2(str) { -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= - function parse$3(str) { -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> add querystring parse to npm module -<<<<<<< HEAD ->>>>>>> add querystring parse to npm module -======= -======= -======= - function parse$2(str) { ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module -======= -======= ->>>>>>> resolve conflicts function parse$3(str) { var obj = {}; @@ -23139,45 +11162,15 @@ for (var i = 0; i < pairs.length; ++i) { pair = pairs[i].split('='); obj[decode$2(pair[0])] = decode$2(pair[1]); ->>>>>>> NPM release version 1.0.11 } - _createClass(LotameStorage, [{ - key: "setLotameSynchTime", - value: function setLotameSynchTime(value) { - this.storage.setItem(defaults$2.lotame_synch_time_key, value); - } - }, { - key: "getLotameSynchTime", - value: function getLotameSynchTime() { - return this.storage.getItem(defaults$2.lotame_synch_time_key); - } - }]); - - return LotameStorage; - }(); + return obj; + } + /** + * Encode. + */ - var lotameStorage = new LotameStorage(); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - var Lotame = /*#__PURE__*/function () { - function Lotame(config, analytics) { - var _this = this; -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> add querystring parse to npm module - function encode$2(value) { -======= - function encode$1(value) { ->>>>>>> branch for npm and latest release -======= -======= ->>>>>>> resolve conflicts function encode$2(value) { try { return encodeURIComponent(value); @@ -23188,47 +11181,20 @@ /** * Decode. */ ->>>>>>> NPM release version 1.0.11 - _classCallCheck(this, Lotame); -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - this.name = "LOTAME"; - this.analytics = analytics; - this.storage = lotameStorage; - this.bcpUrlSettingsPixel = config.bcpUrlSettingsPixel; - this.bcpUrlSettingsIframe = config.bcpUrlSettingsIframe; - this.dspUrlSettingsPixel = config.dspUrlSettingsPixel; - this.dspUrlSettingsIframe = config.dspUrlSettingsIframe; - this.mappings = {}; - config.mappings.forEach(function (mapping) { - var key = mapping.key; - var value = mapping.value; - _this.mappings[key] = value; - }); -======= -======= ->>>>>>> branch for npm and latest release -======= ->>>>>>> add querystring parse to npm module - function decode$2(value) { -======= - function decode$1(value) { ->>>>>>> branch for npm and latest release -======= -======= ->>>>>>> resolve conflicts function decode$2(value) { try { return decodeURIComponent(value); } catch (e) { debug$1('error `decode(%o)` - %o', value, e); ->>>>>>> NPM release version 1.0.11 } -======= + } + + var lib = createCommonjsModule(function (module, exports) { + /** + * Module dependencies. + */ var parse = componentUrl.parse; /** @@ -23305,80 +11271,22 @@ } // Create levels. - for (var i = parts.length - 2; i >= 0; --i) { - levels.push(parts.slice(i).join('.')); - } - - return levels; - }; - /** - * Expose cookie on domain. - */ -<<<<<<< HEAD -<<<<<<< HEAD -======= ->>>>>>> resolve conflicts - - - domain.cookie = componentCookie; - /* - * Exports. - */ - -<<<<<<< HEAD -======= - - - domain.cookie = componentCookie; - /* - * Exports. - */ - ->>>>>>> branch for npm and latest release - exports = module.exports = domain; - }); ->>>>>>> branch for npm and latest release - - _createClass(Lotame, [{ - key: "init", - value: function init() { - logger.debug("===in init Lotame==="); - -<<<<<<< HEAD - window.LOTAME_SYNCH_CALLBACK = function () {}; - } - }, { - key: "addPixel", - value: function addPixel(source, width, height) { - logger.debug("Adding pixel for :: ".concat(source)); - var image = document.createElement("img"); - image.src = source; - image.setAttribute("width", width); - image.setAttribute("height", height); - logger.debug("Image Pixel :: ".concat(image)); - document.getElementsByTagName("body")[0].appendChild(image); - } - }, { - key: "addIFrame", - value: function addIFrame(source) { - logger.debug("Adding iframe for :: ".concat(source)); - var iframe = document.createElement("iframe"); - iframe.src = source; - iframe.title = "empty"; - iframe.setAttribute("id", "LOTCCFrame"); - iframe.setAttribute("tabindex", "-1"); - iframe.setAttribute("role", "presentation"); - iframe.setAttribute("aria-hidden", "true"); - iframe.setAttribute("style", "border: 0px; width: 0px; height: 0px; display: block;"); - logger.debug("IFrame :: ".concat(iframe)); - document.getElementsByTagName("body")[0].appendChild(iframe); - } - }, { - key: "syncPixel", - value: function syncPixel(userId) { - var _this2 = this; -======= -======= + 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; }); @@ -23386,50 +11294,49 @@ * An object utility to persist values in cookies */ ->>>>>>> resolve conflicts var CookieLocal = /*#__PURE__*/function () { function CookieLocal(options) { _classCallCheck(this, CookieLocal); ->>>>>>> branch for npm and latest release - logger.debug("===== in syncPixel ======"); - logger.debug("Firing DSP Pixel URLs"); + this._options = {}; + this.options(options); + } + /** + * + * @param {*} options + */ - if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) { - var currentTime = Date.now(); - this.dspUrlSettingsPixel.forEach(function (urlSettings) { - var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { - userId: userId, - random: currentTime - }), urlSettings.dspUrlTemplate); - _this2.addPixel(dspUrl, "1", "1"); - }); - } + _createClass(CookieLocal, [{ + key: "options", + value: function options() { + var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - logger.debug("Firing DSP IFrame URLs"); + if (arguments.length === 0) return this._options; + var domain = ".".concat(lib(window.location.href)); + if (domain === ".") domain = null; // the default maxage and path - if (this.dspUrlSettingsIframe && this.dspUrlSettingsIframe.length > 0) { - var _currentTime = Date.now(); + this._options = defaults_1(_options, { + maxage: 31536000000, + path: "/", + domain: domain, + samesite: "Lax" + }); // try setting a cookie first - this.dspUrlSettingsIframe.forEach(function (urlSettings) { - var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { - userId: userId, - random: _currentTime - }), urlSettings.dspUrlTemplate); + this.set("test_rudder", true); - _this2.addIFrame(dspUrl); - }); + if (!this.get("test_rudder")) { + this._options.domain = null; } - this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel + this.remove("test_rudder"); + } + /** + * + * @param {*} key + * @param {*} value + */ -<<<<<<< HEAD - if (this.analytics.methodToCallbackMapping.syncPixel) { - this.analytics.emit("syncPixel", { - destination: this.name - }); -======= }, { key: "set", value: function set(key, value) { @@ -23439,55 +11346,8 @@ } catch (e) { logger.error(e); return false; ->>>>>>> update npm module } } -<<<<<<< HEAD - }, { -<<<<<<< HEAD - key: "compileUrl", - value: function compileUrl(map, url) { - Object.keys(map).forEach(function (key) { - if (map.hasOwnProperty(key)) { - var replaceKey = "{{".concat(key, "}}"); - var regex = new RegExp(replaceKey, "gi"); - url = url.replace(regex, map[key]); - } - }); - return url; -======= - key: "get", - value: function get(key) { - return rudderComponentCookie(key); ->>>>>>> update npm module - } - }, { - key: "identify", - value: function identify(rudderElement) { - logger.debug("in Lotame identify"); - var userId = rudderElement.message.userId; - this.syncPixel(userId); - } - }, { - key: "track", - value: function track(rudderElement) { - logger.debug("track not supported for lotame"); - } - }, { - key: "page", - value: function page(rudderElement) { - var _this3 = this; - - logger.debug("in Lotame page"); - logger.debug("Firing BCP Pixel URLs"); - - if (this.bcpUrlSettingsPixel && this.bcpUrlSettingsPixel.length > 0) { - var currentTime = Date.now(); - this.bcpUrlSettingsPixel.forEach(function (urlSettings) { - var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { - random: currentTime - }), urlSettings.bcpUrlTemplate); -======= /** * * @param {*} key @@ -23733,78 +11593,79 @@ store.enabled = !store.disabled; return store; }(); ->>>>>>> branch for npm and latest release - _this3.addPixel(bcpUrl, "1", "1"); - }); - } + /** + * An object utility to persist user and other values in localstorage + */ -<<<<<<< HEAD - logger.debug("Firing BCP IFrame URLs"); -======= var StoreLocal = /*#__PURE__*/function () { function StoreLocal(options) { _classCallCheck(this, StoreLocal); ->>>>>>> branch for npm and latest release - if (this.bcpUrlSettingsIframe && this.bcpUrlSettingsIframe.length > 0) { - var _currentTime2 = Date.now(); + this._options = {}; + this.enabled = false; + this.options(options); + } + /** + * + * @param {*} options + */ - this.bcpUrlSettingsIframe.forEach(function (urlSettings) { - var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { - random: _currentTime2 - }), urlSettings.bcpUrlTemplate); - _this3.addIFrame(bcpUrl); - }); - } + _createClass(StoreLocal, [{ + key: "options", + value: function options() { + var _options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; - if (rudderElement.message.userId && this.isPixelToBeSynched()) { - this.syncPixel(rudderElement.message.userId); - } + if (arguments.length === 0) return this._options; + defaults_1(_options, { + enabled: true + }); + this.enabled = _options.enabled && store.enabled; + this._options = _options; } - }, { - key: "isPixelToBeSynched", - value: function isPixelToBeSynched() { - var lastSynchedTime = this.storage.getLotameSynchTime(); - var currentTime = Date.now(); - - if (!lastSynchedTime) { - return true; - } + /** + * + * @param {*} key + * @param {*} value + */ - var difference = Math.floor((currentTime - lastSynchedTime) / (1000 * 3600 * 24)); - return difference >= 7; + }, { + key: "set", + value: function set(key, value) { + if (!this.enabled) return false; + return store.set(key, value); } + /** + * + * @param {*} key + */ + }, { - key: "isLoaded", - value: function isLoaded() { - logger.debug("in Lotame isLoaded"); - return true; + key: "get", + value: function get(key) { + if (!this.enabled) return null; + return store.get(key); } + /** + * + * @param {*} key + */ + }, { - key: "isReady", - value: function isReady() { - return true; + key: "remove", + value: function remove(key) { + if (!this.enabled) return false; + return store.remove(key); } }]); - return Lotame; - }(); + return StoreLocal; + }(); // Exporting only the instance - var Optimizely = /*#__PURE__*/function () { - function Optimizely(config, analytics) { - var _this = this; - _classCallCheck(this, Optimizely); + var Store = new StoreLocal({}); -<<<<<<< HEAD - this.referrerOverride = function (referrer) { - if (referrer) { - window.optimizelyEffectiveReferrer = referrer; - return referrer; - } -======= var defaults$1 = { user_storage_key: "rl_user_id", user_storage_trait: "rl_trait", @@ -23817,65 +11678,21 @@ /** * An object that handles persisting key-val from Analytics */ ->>>>>>> update npm module -<<<<<<< HEAD - return undefined; - }; -======= var Storage = /*#__PURE__*/function () { function Storage() { - _classCallCheck(this, Storage); ->>>>>>> branch for npm and latest release - - this.sendDataToRudder = function (campaignState) { - logger.debug(campaignState); - var experiment = campaignState.experiment; - var variation = campaignState.variation; - var context = { - integrations: { - All: true - } - }; - var audiences = campaignState.audiences; // Reformatting this data structure into hash map so concatenating variation ids and names is easier later - - var audiencesMap = {}; - audiences.forEach(function (audience) { - audiencesMap[audience.id] = audience.name; - }); - var audienceIds = Object.keys(audiencesMap).sort().join(); - var audienceNames = Object.values(audiencesMap).sort().join(", "); - - if (_this.sendExperimentTrack) { - var props = { - campaignName: campaignState.campaignName, - campaignId: campaignState.id, - experimentId: experiment.id, - experimentName: experiment.name, - variationName: variation.name, - variationId: variation.id, - audienceId: audienceIds, - // eg. '7527562222,7527111138' - audienceName: audienceNames, - // eg. 'Peaky Blinders, Trust Tree' - isInCampaignHoldback: campaignState.isInCampaignHoldback - }; // If this was a redirect experiment and the effective referrer is different from document.referrer, - // this value is made available. So if a customer came in via google.com/ad -> tb12.com -> redirect experiment -> Belichickgoat.com - // `experiment.referrer` would be google.com/ad here NOT `tb12.com`. - - if (experiment.referrer) { - props.referrer = experiment.referrer; - context.page = { - referrer: experiment.referrer - }; - } // For Google's nonInteraction flag + _classCallCheck(this, Storage); + + // First try setting the storage to cookie else to localstorage + Cookie.set("rudder_cookies", true); + + if (Cookie.get("rudder_cookies")) { + Cookie.remove("rudder_cookies"); + this.storage = Cookie; + return; + } // localStorage is enabled. -<<<<<<< HEAD - if (_this.sendExperimentTrackAsNonInteractive) props.nonInteraction = 1; // If customCampaignProperties is provided overide the props with it. - // If valid customCampaignProperties present it will override existing props. - // const data = window.optimizely && window.optimizely.get("data"); -======= if (Store.enabled) { this.storage = Store; } @@ -23884,24 +11701,8 @@ * Json stringify the given value * @param {*} value */ ->>>>>>> update npm module - - var data = campaignState; - - if (data && _this.customCampaignProperties.length > 0) { - for (var index = 0; index < _this.customCampaignProperties.length; index += 1) { - var rudderProp = _this.customCampaignProperties[index].from; - var optimizelyProp = _this.customCampaignProperties[index].to; - if (typeof props[optimizelyProp] !== "undefined") { - props[rudderProp] = props[optimizelyProp]; - delete props[optimizelyProp]; - } - } - } // Send to Rudder -<<<<<<< HEAD -======= _createClass(Storage, [{ key: "stringify", value: function stringify(value) { @@ -23981,16 +11782,15 @@ * * @param {*} value */ ->>>>>>> update npm module - _this.analytics.track("Experiment Viewed", props, context); + }, { + key: "setUserId", + value: function setUserId(value) { + if (typeof value !== "string") { + logger.error("[Storage] setUserId:: userId should be string"); + return; } -<<<<<<< HEAD - if (_this.sendExperimentIdentify) { - var traits = {}; - traits["Experiment: ".concat(experiment.name)] = variation.name; // Send to Rudder -======= this.storage.set(defaults$1.user_storage_key, this.encryptValue(this.stringify(value))); } /** @@ -24007,31 +11807,15 @@ * * @param {*} value */ ->>>>>>> update npm module - _this.analytics.identify(traits); + }, { + key: "setGroupId", + value: function setGroupId(value) { + if (typeof value !== "string") { + logger.error("[Storage] setGroupId:: groupId should be string"); + return; } - }; - -<<<<<<< HEAD - this.analytics = analytics; - this.sendExperimentTrack = config.sendExperimentTrack; - this.sendExperimentIdentify = config.sendExperimentIdentify; - this.sendExperimentTrackAsNonInteractive = config.sendExperimentTrackAsNonInteractive; - this.revenueOnlyOnOrderCompleted = config.revenueOnlyOnOrderCompleted; - this.trackCategorizedPages = config.trackCategorizedPages; - this.trackNamedPages = config.trackNamedPages; - this.customCampaignProperties = config.customCampaignProperties ? config.customCampaignProperties : []; - this.customExperimentProperties = config.customExperimentProperties ? config.customExperimentProperties : []; - this.name = "OPTIMIZELY"; - } - _createClass(Optimizely, [{ - key: "init", - value: function init() { - logger.debug("=== in optimizely init ==="); - this.initOptimizelyIntegration(this.referrerOverride, this.sendDataToRudder); -======= this.storage.set(defaults$1.group_storage_key, this.encryptValue(this.stringify(value))); } /** @@ -24043,405 +11827,196 @@ key: "setGroupTraits", value: function setGroupTraits(value) { this.storage.set(defaults$1.group_storage_trait, this.encryptValue(this.stringify(value))); ->>>>>>> update npm module - } - }, { - key: "initOptimizelyIntegration", - value: function initOptimizelyIntegration(referrerOverride, sendCampaignData) { - var newActiveCampaign = function newActiveCampaign(id, referrer) { - var state = window.optimizely.get && window.optimizely.get("state"); - -<<<<<<< HEAD - if (state) { - var activeCampaigns = state.getCampaignStates({ - isActive: true - }); - var campaignState = activeCampaigns[id]; - if (referrer) campaignState.experiment.referrer = referrer; - sendCampaignData(campaignState); - } - }; - - var checkReferrer = function checkReferrer() { - var state = window.optimizely.get && window.optimizely.get("state"); - - if (state) { - var referrer = state.getRedirectInfo() && state.getRedirectInfo().referrer; - - if (referrer) { - referrerOverride(referrer); - return referrer; - } - } - - return undefined; - }; - - var registerFutureActiveCampaigns = function registerFutureActiveCampaigns() { - window.optimizely = window.optimizely || []; - window.optimizely.push({ - type: "addListener", - filter: { - type: "lifecycle", - name: "campaignDecided" - }, - handler: function handler(event) { - var id = event.data.campaign.id; - newActiveCampaign(id); - } - }); - }; - - var registerCurrentlyActiveCampaigns = function registerCurrentlyActiveCampaigns() { - window.optimizely = window.optimizely || []; - var state = window.optimizely.get && window.optimizely.get("state"); -======= - this.storage.set(defaults$1.user_storage_anonymousId, this.encryptValue(this.stringify(value))); - } - /** - * - * @param {*} key - */ - - }, { - key: "getItem", - value: function getItem(key) { - return this.parse(this.decryptValue(this.storage.get(key))); - } - /** - * get the stored userId - */ - - }, { - key: "getUserId", - value: function getUserId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_key))); - } - /** - * get the stored user traits - */ - - }, { - key: "getUserTraits", - value: function getUserTraits() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_trait))); - } - /** - * get the stored userId - */ - - }, { - key: "getGroupId", - value: function getGroupId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_key))); - } - /** - * get the stored user traits - */ - - }, { - key: "getGroupTraits", - value: function getGroupTraits() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_trait))); - } - /** - * get stored anonymous id - */ - - }, { - key: "getAnonymousId", - value: function getAnonymousId() { - return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_anonymousId))); } /** * - * @param {*} key + * @param {*} value */ ->>>>>>> update npm module - - if (state) { - var referrer = checkReferrer(); - var activeCampaigns = state.getCampaignStates({ - isActive: true - }); - Object.keys(activeCampaigns).forEach(function (id) { - if (referrer) { - newActiveCampaign(id, referrer); - } else { - newActiveCampaign(id); - } - }); - } else { - window.optimizely.push({ - type: "addListener", - filter: { - type: "lifecycle", - name: "initialized" - }, - handler: function handler() { - checkReferrer(); - } - }); - } - }; - -<<<<<<< HEAD - registerCurrentlyActiveCampaigns(); - registerFutureActiveCampaigns(); -======= - }, { - key: "clear", - value: function clear() { - this.storage.remove(defaults$1.user_storage_key); - this.storage.remove(defaults$1.user_storage_trait); - this.storage.remove(defaults$1.group_storage_key); - this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); ->>>>>>> update npm module - } - }, { - key: "track", - value: function track(rudderElement) { - logger.debug("in Optimizely web track"); - var eventProperties = rudderElement.message.properties; - var event = rudderElement.message.event; - - if (eventProperties.revenue && this.revenueOnlyOnOrderCompleted) { - if (event === "Order Completed") { - eventProperties.revenue = Math.round(eventProperties.revenue * 100); - } else if (event !== "Order Completed") { - delete eventProperties.revenue; - } - } - var eventName = event.replace(/:/g, "_"); // can't have colons so replacing with underscores - - var payload = { - type: "event", - eventName: eventName, - tags: eventProperties - }; - window.optimizely.push(payload); - } }, { - key: "page", - value: function page(rudderElement) { - logger.debug("in Optimizely web page"); - var category = rudderElement.message.properties.category; - var name = rudderElement.message.name; - /* const contextOptimizely = { - integrations: { All: false, Optimizely: true }, - }; */ - // categorized pages - -<<<<<<< HEAD - if (category && this.trackCategorizedPages) { - // this.analytics.track(`Viewed ${category} page`, {}, contextOptimizely); - rudderElement.message.event = "Viewed ".concat(category, " page"); - rudderElement.message.type = "track"; - this.track(rudderElement); - } // named pages -======= - var LotameStorage = /*#__PURE__*/function () { - function LotameStorage() { - _classCallCheck(this, LotameStorage); ->>>>>>> branch for npm and latest release - - - if (name && this.trackNamedPages) { - // this.analytics.track(`Viewed ${name} page`, {}, contextOptimizely); - rudderElement.message.event = "Viewed ".concat(name, " page"); - rudderElement.message.type = "track"; - this.track(rudderElement); + key: "setAnonymousId", + value: function setAnonymousId(value) { + if (typeof value !== "string") { + logger.error("[Storage] setAnonymousId:: anonymousId should be string"); + return; } + + this.storage.set(defaults$1.user_storage_anonymousId, this.encryptValue(this.stringify(value))); } + /** + * + * @param {*} key + */ + }, { - key: "isLoaded", - value: function isLoaded() { - return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); + key: "getItem", + value: function getItem(key) { + return this.parse(this.decryptValue(this.storage.get(key))); } + /** + * get the stored userId + */ + }, { - key: "isReady", - value: function isReady() { - return !!(window.optimizely && window.optimizely.push !== Array.prototype.push); + key: "getUserId", + value: function getUserId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_key))); } - }]); - - return Optimizely; - }(); - - var Bugsnag = /*#__PURE__*/function () { - function Bugsnag(config) { - _classCallCheck(this, Bugsnag); + /** + * get the stored user traits + */ - this.releaseStage = config.releaseStage; - this.apiKey = config.apiKey; - this.name = "BUGSNAG"; - this.setIntervalHandler = undefined; - } + }, { + key: "getUserTraits", + value: function getUserTraits() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_trait))); + } + /** + * get the stored userId + */ - _createClass(Bugsnag, [{ - key: "init", - value: function init() { - logger.debug("===in init Bugsnag==="); - ScriptLoader("bugsnag-id", "https://d2wy8f7a9ursnm.cloudfront.net/v6/bugsnag.min.js"); - this.setIntervalHandler = setInterval(this.initBugsnagClient.bind(this), 1000); + }, { + key: "getGroupId", + value: function getGroupId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_key))); } + /** + * get the stored user traits + */ + }, { - key: "initBugsnagClient", - value: function initBugsnagClient() { - if (window.bugsnag !== undefined) { - window.bugsnagClient = window.bugsnag(this.apiKey); - window.bugsnagClient.releaseStage = this.releaseStage; - clearInterval(this.setIntervalHandler); - } + key: "getGroupTraits", + value: function getGroupTraits() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.group_storage_trait))); } + /** + * get stored anonymous id + */ + }, { - key: "isLoaded", - value: function isLoaded() { - logger.debug("in bugsnag isLoaded"); - return !!window.bugsnagClient; + key: "getAnonymousId", + value: function getAnonymousId() { + return this.parse(this.decryptValue(this.storage.get(defaults$1.user_storage_anonymousId))); } + /** + * + * @param {*} key + */ + }, { - key: "isReady", - value: function isReady() { - logger.debug("in bugsnag isReady"); - return !!window.bugsnagClient; + key: "removeItem", + value: function removeItem(key) { + return this.storage.remove(key); } + /** + * remove stored keys + */ + }, { - key: "identify", - value: function identify(rudderElement) { - var traits = rudderElement.message.context.traits; - var traitsFinal = { - id: rudderElement.message.userId || rudderElement.message.anonymousId, - name: traits.name, - email: traits.email - }; - window.bugsnagClient.user = traitsFinal; - window.bugsnagClient.notify(new Error("error in identify")); + key: "clear", + value: function clear() { + this.storage.remove(defaults$1.user_storage_key); + this.storage.remove(defaults$1.user_storage_trait); + this.storage.remove(defaults$1.group_storage_key); + this.storage.remove(defaults$1.group_storage_trait); // this.storage.remove(defaults.user_storage_anonymousId); } }]); - return Bugsnag; + return Storage; }(); - var preserveCamelCase = function preserveCamelCase(string) { - var isLastCharLower = false; - var isLastCharUpper = false; - var isLastLastCharUpper = false; - - for (var i = 0; i < string.length; i++) { - var character = string[i]; - - if (isLastCharLower && /(?:[A-Z\xC0-\xD6\xD8-\xDE\u0100\u0102\u0104\u0106\u0108\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0139\u013B\u013D\u013F\u0141\u0143\u0145\u0147\u014A\u014C\u014E\u0150\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u0179\u017B\u017D\u0181\u0182\u0184\u0186\u0187\u0189-\u018B\u018E-\u0191\u0193\u0194\u0196-\u0198\u019C\u019D\u019F\u01A0\u01A2\u01A4\u01A6\u01A7\u01A9\u01AC\u01AE\u01AF\u01B1-\u01B3\u01B5\u01B7\u01B8\u01BC\u01C4\u01C7\u01CA\u01CD\u01CF\u01D1\u01D3\u01D5\u01D7\u01D9\u01DB\u01DE\u01E0\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F1\u01F4\u01F6-\u01F8\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228\u022A\u022C\u022E\u0230\u0232\u023A\u023B\u023D\u023E\u0241\u0243-\u0246\u0248\u024A\u024C\u024E\u0370\u0372\u0376\u037F\u0386\u0388-\u038A\u038C\u038E\u038F\u0391-\u03A1\u03A3-\u03AB\u03CF\u03D2-\u03D4\u03D8\u03DA\u03DC\u03DE\u03E0\u03E2\u03E4\u03E6\u03E8\u03EA\u03EC\u03EE\u03F4\u03F7\u03F9\u03FA\u03FD-\u042F\u0460\u0462\u0464\u0466\u0468\u046A\u046C\u046E\u0470\u0472\u0474\u0476\u0478\u047A\u047C\u047E\u0480\u048A\u048C\u048E\u0490\u0492\u0494\u0496\u0498\u049A\u049C\u049E\u04A0\u04A2\u04A4\u04A6\u04A8\u04AA\u04AC\u04AE\u04B0\u04B2\u04B4\u04B6\u04B8\u04BA\u04BC\u04BE\u04C0\u04C1\u04C3\u04C5\u04C7\u04C9\u04CB\u04CD\u04D0\u04D2\u04D4\u04D6\u04D8\u04DA\u04DC\u04DE\u04E0\u04E2\u04E4\u04E6\u04E8\u04EA\u04EC\u04EE\u04F0\u04F2\u04F4\u04F6\u04F8\u04FA\u04FC\u04FE\u0500\u0502\u0504\u0506\u0508\u050A\u050C\u050E\u0510\u0512\u0514\u0516\u0518\u051A\u051C\u051E\u0520\u0522\u0524\u0526\u0528\u052A\u052C\u052E\u0531-\u0556\u10A0-\u10C5\u10C7\u10CD\u13A0-\u13F5\u1C90-\u1CBA\u1CBD-\u1CBF\u1E00\u1E02\u1E04\u1E06\u1E08\u1E0A\u1E0C\u1E0E\u1E10\u1E12\u1E14\u1E16\u1E18\u1E1A\u1E1C\u1E1E\u1E20\u1E22\u1E24\u1E26\u1E28\u1E2A\u1E2C\u1E2E\u1E30\u1E32\u1E34\u1E36\u1E38\u1E3A\u1E3C\u1E3E\u1E40\u1E42\u1E44\u1E46\u1E48\u1E4A\u1E4C\u1E4E\u1E50\u1E52\u1E54\u1E56\u1E58\u1E5A\u1E5C\u1E5E\u1E60\u1E62\u1E64\u1E66\u1E68\u1E6A\u1E6C\u1E6E\u1E70\u1E72\u1E74\u1E76\u1E78\u1E7A\u1E7C\u1E7E\u1E80\u1E82\u1E84\u1E86\u1E88\u1E8A\u1E8C\u1E8E\u1E90\u1E92\u1E94\u1E9E\u1EA0\u1EA2\u1EA4\u1EA6\u1EA8\u1EAA\u1EAC\u1EAE\u1EB0\u1EB2\u1EB4\u1EB6\u1EB8\u1EBA\u1EBC\u1EBE\u1EC0\u1EC2\u1EC4\u1EC6\u1EC8\u1ECA\u1ECC\u1ECE\u1ED0\u1ED2\u1ED4\u1ED6\u1ED8\u1EDA\u1EDC\u1EDE\u1EE0\u1EE2\u1EE4\u1EE6\u1EE8\u1EEA\u1EEC\u1EEE\u1EF0\u1EF2\u1EF4\u1EF6\u1EF8\u1EFA\u1EFC\u1EFE\u1F08-\u1F0F\u1F18-\u1F1D\u1F28-\u1F2F\u1F38-\u1F3F\u1F48-\u1F4D\u1F59\u1F5B\u1F5D\u1F5F\u1F68-\u1F6F\u1FB8-\u1FBB\u1FC8-\u1FCB\u1FD8-\u1FDB\u1FE8-\u1FEC\u1FF8-\u1FFB\u2102\u2107\u210B-\u210D\u2110-\u2112\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u2130-\u2133\u213E\u213F\u2145\u2183\u2C00-\u2C2E\u2C60\u2C62-\u2C64\u2C67\u2C69\u2C6B\u2C6D-\u2C70\u2C72\u2C75\u2C7E-\u2C80\u2C82\u2C84\u2C86\u2C88\u2C8A\u2C8C\u2C8E\u2C90\u2C92\u2C94\u2C96\u2C98\u2C9A\u2C9C\u2C9E\u2CA0\u2CA2\u2CA4\u2CA6\u2CA8\u2CAA\u2CAC\u2CAE\u2CB0\u2CB2\u2CB4\u2CB6\u2CB8\u2CBA\u2CBC\u2CBE\u2CC0\u2CC2\u2CC4\u2CC6\u2CC8\u2CCA\u2CCC\u2CCE\u2CD0\u2CD2\u2CD4\u2CD6\u2CD8\u2CDA\u2CDC\u2CDE\u2CE0\u2CE2\u2CEB\u2CED\u2CF2\uA640\uA642\uA644\uA646\uA648\uA64A\uA64C\uA64E\uA650\uA652\uA654\uA656\uA658\uA65A\uA65C\uA65E\uA660\uA662\uA664\uA666\uA668\uA66A\uA66C\uA680\uA682\uA684\uA686\uA688\uA68A\uA68C\uA68E\uA690\uA692\uA694\uA696\uA698\uA69A\uA722\uA724\uA726\uA728\uA72A\uA72C\uA72E\uA732\uA734\uA736\uA738\uA73A\uA73C\uA73E\uA740\uA742\uA744\uA746\uA748\uA74A\uA74C\uA74E\uA750\uA752\uA754\uA756\uA758\uA75A\uA75C\uA75E\uA760\uA762\uA764\uA766\uA768\uA76A\uA76C\uA76E\uA779\uA77B\uA77D\uA77E\uA780\uA782\uA784\uA786\uA78B\uA78D\uA790\uA792\uA796\uA798\uA79A\uA79C\uA79E\uA7A0\uA7A2\uA7A4\uA7A6\uA7A8\uA7AA-\uA7AE\uA7B0-\uA7B4\uA7B6\uA7B8\uA7BA\uA7BC\uA7BE\uA7C2\uA7C4-\uA7C7\uA7C9\uA7F5\uFF21-\uFF3A]|\uD801[\uDC00-\uDC27\uDCB0-\uDCD3]|\uD803[\uDC80-\uDCB2]|\uD806[\uDCA0-\uDCBF]|\uD81B[\uDE40-\uDE5F]|\uD835[\uDC00-\uDC19\uDC34-\uDC4D\uDC68-\uDC81\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB5\uDCD0-\uDCE9\uDD04\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD38\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD6C-\uDD85\uDDA0-\uDDB9\uDDD4-\uDDED\uDE08-\uDE21\uDE3C-\uDE55\uDE70-\uDE89\uDEA8-\uDEC0\uDEE2-\uDEFA\uDF1C-\uDF34\uDF56-\uDF6E\uDF90-\uDFA8\uDFCA]|\uD83A[\uDD00-\uDD21])/.test(character)) { - string = string.slice(0, i) + '-' + string.slice(i); - isLastCharLower = false; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = true; - i++; - } else if (isLastCharUpper && isLastLastCharUpper && /(?:[a-z\xB5\xDF-\xF6\xF8-\xFF\u0101\u0103\u0105\u0107\u0109\u010B\u010D\u010F\u0111\u0113\u0115\u0117\u0119\u011B\u011D\u011F\u0121\u0123\u0125\u0127\u0129\u012B\u012D\u012F\u0131\u0133\u0135\u0137\u0138\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u0149\u014B\u014D\u014F\u0151\u0153\u0155\u0157\u0159\u015B\u015D\u015F\u0161\u0163\u0165\u0167\u0169\u016B\u016D\u016F\u0171\u0173\u0175\u0177\u017A\u017C\u017E-\u0180\u0183\u0185\u0188\u018C\u018D\u0192\u0195\u0199-\u019B\u019E\u01A1\u01A3\u01A5\u01A8\u01AA\u01AB\u01AD\u01B0\u01B4\u01B6\u01B9\u01BA\u01BD-\u01BF\u01C6\u01C9\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DD\u01DF\u01E1\u01E3\u01E5\u01E7\u01E9\u01EB\u01ED\u01EF\u01F0\u01F3\u01F5\u01F9\u01FB\u01FD\u01FF\u0201\u0203\u0205\u0207\u0209\u020B\u020D\u020F\u0211\u0213\u0215\u0217\u0219\u021B\u021D\u021F\u0221\u0223\u0225\u0227\u0229\u022B\u022D\u022F\u0231\u0233-\u0239\u023C\u023F\u0240\u0242\u0247\u0249\u024B\u024D\u024F-\u0293\u0295-\u02AF\u0371\u0373\u0377\u037B-\u037D\u0390\u03AC-\u03CE\u03D0\u03D1\u03D5-\u03D7\u03D9\u03DB\u03DD\u03DF\u03E1\u03E3\u03E5\u03E7\u03E9\u03EB\u03ED\u03EF-\u03F3\u03F5\u03F8\u03FB\u03FC\u0430-\u045F\u0461\u0463\u0465\u0467\u0469\u046B\u046D\u046F\u0471\u0473\u0475\u0477\u0479\u047B\u047D\u047F\u0481\u048B\u048D\u048F\u0491\u0493\u0495\u0497\u0499\u049B\u049D\u049F\u04A1\u04A3\u04A5\u04A7\u04A9\u04AB\u04AD\u04AF\u04B1\u04B3\u04B5\u04B7\u04B9\u04BB\u04BD\u04BF\u04C2\u04C4\u04C6\u04C8\u04CA\u04CC\u04CE\u04CF\u04D1\u04D3\u04D5\u04D7\u04D9\u04DB\u04DD\u04DF\u04E1\u04E3\u04E5\u04E7\u04E9\u04EB\u04ED\u04EF\u04F1\u04F3\u04F5\u04F7\u04F9\u04FB\u04FD\u04FF\u0501\u0503\u0505\u0507\u0509\u050B\u050D\u050F\u0511\u0513\u0515\u0517\u0519\u051B\u051D\u051F\u0521\u0523\u0525\u0527\u0529\u052B\u052D\u052F\u0560-\u0588\u10D0-\u10FA\u10FD-\u10FF\u13F8-\u13FD\u1C80-\u1C88\u1D00-\u1D2B\u1D6B-\u1D77\u1D79-\u1D9A\u1E01\u1E03\u1E05\u1E07\u1E09\u1E0B\u1E0D\u1E0F\u1E11\u1E13\u1E15\u1E17\u1E19\u1E1B\u1E1D\u1E1F\u1E21\u1E23\u1E25\u1E27\u1E29\u1E2B\u1E2D\u1E2F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CA1\u2CA3\u2CA5\u2CA7\u2CA9\u2CAB\u2CAD\u2CAF\u2CB1\u2CB3\u2CB5\u2CB7\u2CB9\u2CBB\u2CBD\u2CBF\u2CC1\u2CC3\u2CC5\u2CC7\u2CC9\u2CCB\u2CCD\u2CCF\u2CD1\u2CD3\u2CD5\u2CD7\u2CD9\u2CDB\u2CDD\u2CDF\u2CE1\u2CE3\u2CE4\u2CEC\u2CEE\u2CF3\u2D00-\u2D25\u2D27\u2D2D\uA641\uA643\uA645\uA647\uA649\uA64B\uA64D\uA64F\uA651\uA653\uA655\uA657\uA659\uA65B\uA65D\uA65F\uA661\uA663\uA665\uA667\uA669\uA66B\uA66D\uA681\uA683\uA685\uA687\uA689\uA68B\uA68D\uA68F\uA691\uA693\uA695\uA697\uA699\uA69B\uA723\uA725\uA727\uA729\uA72B\uA72D\uA72F-\uA731\uA733\uA735\uA737\uA739\uA73B\uA73D\uA73F\uA741\uA743\uA745\uA747\uA749\uA74B\uA74D\uA74F\uA751\uA753\uA755\uA757\uA759\uA75B\uA75D\uA75F\uA761\uA763\uA765\uA767\uA769\uA76B\uA76D\uA76F\uA771-\uA778\uA77A\uA77C\uA77F\uA781\uA783\uA785\uA787\uA78C\uA78E\uA791\uA793-\uA795\uA797\uA799\uA79B\uA79D\uA79F\uA7A1\uA7A3\uA7A5\uA7A7\uA7A9\uA7AF\uA7B5\uA7B7\uA7B9\uA7BB\uA7BD\uA7BF\uA7C3\uA7C8\uA7CA\uA7F6\uA7FA\uAB30-\uAB5A\uAB60-\uAB68\uAB70-\uABBF\uFB00-\uFB06\uFB13-\uFB17\uFF41-\uFF5A]|\uD801[\uDC28-\uDC4F\uDCD8-\uDCFB]|\uD803[\uDCC0-\uDCF2]|\uD806[\uDCC0-\uDCDF]|\uD81B[\uDE60-\uDE7F]|\uD835[\uDC1A-\uDC33\uDC4E-\uDC54\uDC56-\uDC67\uDC82-\uDC9B\uDCB6-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDCCF\uDCEA-\uDD03\uDD1E-\uDD37\uDD52-\uDD6B\uDD86-\uDD9F\uDDBA-\uDDD3\uDDEE-\uDE07\uDE22-\uDE3B\uDE56-\uDE6F\uDE8A-\uDEA5\uDEC2-\uDEDA\uDEDC-\uDEE1\uDEFC-\uDF14\uDF16-\uDF1B\uDF36-\uDF4E\uDF50-\uDF55\uDF70-\uDF88\uDF8A-\uDF8F\uDFAA-\uDFC2\uDFC4-\uDFC9\uDFCB]|\uD83A[\uDD22-\uDD43])/.test(character)) { - string = string.slice(0, i - 1) + '-' + string.slice(i - 1); - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = false; - isLastCharLower = true; - } else { - isLastCharLower = character.toLocaleLowerCase() === character && character.toLocaleUpperCase() !== character; - isLastLastCharUpper = isLastCharUpper; - isLastCharUpper = character.toLocaleUpperCase() === character && character.toLocaleLowerCase() !== character; - } - } + var Storage$1 = new Storage(); -<<<<<<< HEAD - return string; + var defaults$2 = { + lotame_synch_time_key: "lt_synch_timestamp" }; -======= - var Lotame = /*#__PURE__*/function () { - function Lotame(config, analytics) { - var _this = this; ->>>>>>> branch for npm and latest release - - var camelCase = function camelCase(input, options) { - if (!(typeof input === 'string' || Array.isArray(input))) { - throw new TypeError('Expected the input to be `string | string[]`'); - } - - options = _objectSpread2(_objectSpread2({}, { - pascalCase: false - }), options); - - var postProcess = function postProcess(x) { - return options.pascalCase ? x.charAt(0).toLocaleUpperCase() + x.slice(1) : x; - }; - - if (Array.isArray(input)) { - input = input.map(function (x) { - return x.trim(); - }).filter(function (x) { - return x.length; - }).join('-'); - } else { - input = input.trim(); - } - if (input.length === 0) { - return ''; - } + var LotameStorage = /*#__PURE__*/function () { + function LotameStorage() { + _classCallCheck(this, LotameStorage); - if (input.length === 1) { - return options.pascalCase ? input.toLocaleUpperCase() : input.toLocaleLowerCase(); + this.storage = Storage$1; // new Storage(); } - var hasUpperCase = input !== input.toLocaleLowerCase(); - - if (hasUpperCase) { - input = preserveCamelCase(input); - } + _createClass(LotameStorage, [{ + key: "setLotameSynchTime", + value: function setLotameSynchTime(value) { + this.storage.setItem(defaults$2.lotame_synch_time_key, value); + } + }, { + key: "getLotameSynchTime", + value: function getLotameSynchTime() { + return this.storage.getItem(defaults$2.lotame_synch_time_key); + } + }]); - input = input.replace(/^[_.\- ]+/, '').toLocaleLowerCase().replace(/[ \x2D\._]+((?:[0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u0669\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\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u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1713\u1720-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1ABF\u1AC0\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4B\u1B50-\u1B59\u1B80-\u1BA9\u1BAC-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2189\u2150-\u2182\u2460-\u249B\u24B6-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\u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DD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD27\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEAB\uDEAC\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC00-\uDC45\uDC52-\uDC6F\uDC82-\uDCB8\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD32\uDD36-\uDD3F\uDD44-\uDD47\uDD50-\uDD72\uDD76\uDD80-\uDDBF\uDDC1-\uDDC4\uDDCE-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE34\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEE8\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D-\uDF44\uDF47\uDF48\uDF4B\uDF4C\uDF50\uDF57\uDF5D-\uDF63]|\uD805[\uDC00-\uDC41\uDC43-\uDC45\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCC1\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDBE\uDDD8-\uDDDD\uDE00-\uDE3E\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB5\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF1D-\uDF2A\uDF30-\uDF3B]|\uD806[\uDC00-\uDC38\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD35\uDD37\uDD38\uDD3B\uDD3C\uDD3F-\uDD42\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD7\uDDDA-\uDDDF\uDDE1\uDDE3\uDDE4\uDE00-\uDE32\uDE35-\uDE3E\uDE50-\uDE97\uDE9D\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC3E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD41\uDD43\uDD46\uDD47\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD8E\uDD90\uDD91\uDD93-\uDD96\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF6\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7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D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])|$)/g, function (_, p1) { - return p1.toLocaleUpperCase(); - }).replace(/[0-9]+((?:[0-9A-Z_a-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0345\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05B0-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05EF-\u05F2\u0610-\u061A\u0620-\u0657\u0659-\u0669\u066E-\u06D3\u06D5-\u06DC\u06E1-\u06E8\u06ED-\u06FC\u06FF\u0710-\u073F\u074D-\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0817\u081A-\u082C\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08C7\u08D4-\u08DF\u08E3-\u08E9\u08F0-\u093B\u093D-\u094C\u094E-\u0950\u0955-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD-\u09C4\u09C7\u09C8\u09CB\u09CC\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3E-\u0A42\u0A47\u0A48\u0A4B\u0A4C\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD-\u0AC5\u0AC7-\u0AC9\u0ACB\u0ACC\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFC\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D-\u0B44\u0B47\u0B48\u0B4B\u0B4C\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71-\u0B77\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCC\u0BD0\u0BD7\u0BE6-\u0BF2\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4C\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C78-\u0C7E\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCC\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4C\u0D4E\u0D54-\u0D63\u0D66-\u0D78\u0D7A-\u0D7F\u0D81-\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E46\u0E4D\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F71-\u0F81\u0F88-\u0F97\u0F99-\u0FBC\u1000-\u1036\u1038\u103B-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1713\u1720-\u1733\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17B3\u17B6-\u17C8\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u1938\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A61-\u1A74\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1ABF\u1AC0\u1B00-\u1B33\u1B35-\u1B43\u1B45-\u1B4B\u1B50-\u1B59\u1B80-\u1BA9\u1BAC-\u1BE5\u1BE7-\u1BF1\u1C00-\u1C36\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1DE7-\u1DF4\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2189\u2150-\u2182\u2460-\u249B\u24B6-\u24FF\u2776-\u2793\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\u9FFC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA674-\uA67B\uA67F-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7BF\uA7C2-\uA7CA\uA7F5-\uA805\uA807-\uA827\uA830-\uA835\uA840-\uA873\uA880-\uA8C3\uA8C5\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD-\uA92A\uA930-\uA952\uA960-\uA97C\uA980-\uA9B2\uA9B4-\uA9BF\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAABE\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF5\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABEA\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\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DFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF4F-\uDF87\uDF8F-\uDF9F\uDFE0\uDFE1\uDFE3\uDFF0\uDFF1]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82C[\uDC00-\uDD1E\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9E]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD47\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C\uDD30-\uDD49\uDD50-\uDD69\uDD70-\uDD89]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDD\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])|$)/g, function (m) { - return m.toLocaleUpperCase(); - }); - return postProcess(input); - }; + return LotameStorage; + }(); - var camelcase = camelCase; // TODO: Remove this for the next major release + var lotameStorage = new LotameStorage(); - var default_1 = camelCase; - camelcase["default"] = default_1; + var Lotame = /*#__PURE__*/function () { + function Lotame(config, analytics) { + var _this = this; - var Fullstory = /*#__PURE__*/function () { - function Fullstory(config) { - _classCallCheck(this, Fullstory); + _classCallCheck(this, Lotame); - this.fs_org = config.fs_org; - this.fs_debug_mode = config.fs_debug_mode; - this.name = "FULLSTORY"; + this.name = "LOTAME"; + this.analytics = analytics; + this.storage = lotameStorage; + this.bcpUrlSettingsPixel = config.bcpUrlSettingsPixel; + this.bcpUrlSettingsIframe = config.bcpUrlSettingsIframe; + this.dspUrlSettingsPixel = config.dspUrlSettingsPixel; + this.dspUrlSettingsIframe = config.dspUrlSettingsIframe; + this.mappings = {}; + config.mappings.forEach(function (mapping) { + var key = mapping.key; + var value = mapping.value; + _this.mappings[key] = value; + }); } - _createClass(Fullstory, [{ + _createClass(Lotame, [{ key: "init", value: function init() { - logger.debug("===in init FULLSTORY==="); - window._fs_debug = this.fs_debug_mode; - window._fs_host = "fullstory.com"; - window._fs_script = "edge.fullstory.com/s/fs.js"; - window._fs_org = this.fs_org; - window._fs_namespace = "FS"; + logger.debug("===in init Lotame==="); - (function (m, n, e, t, l, o, g, y) { - if (e in m) { - if (m.console && m.console.log) { - m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'); - } + window.LOTAME_SYNCH_CALLBACK = function () {}; + } + }, { + key: "addPixel", + value: function addPixel(source, width, height) { + logger.debug("Adding pixel for :: ".concat(source)); + var image = document.createElement("img"); + image.src = source; + image.setAttribute("width", width); + image.setAttribute("height", height); + logger.debug("Image Pixel :: ".concat(image)); + document.getElementsByTagName("body")[0].appendChild(image); + } + }, { + key: "addIFrame", + value: function addIFrame(source) { + logger.debug("Adding iframe for :: ".concat(source)); + var iframe = document.createElement("iframe"); + iframe.src = source; + iframe.title = "empty"; + iframe.setAttribute("id", "LOTCCFrame"); + iframe.setAttribute("tabindex", "-1"); + iframe.setAttribute("role", "presentation"); + iframe.setAttribute("aria-hidden", "true"); + iframe.setAttribute("style", "border: 0px; width: 0px; height: 0px; display: block;"); + logger.debug("IFrame :: ".concat(iframe)); + document.getElementsByTagName("body")[0].appendChild(iframe); + } + }, { + key: "syncPixel", + value: function syncPixel(userId) { + var _this2 = this; - return; - } + logger.debug("===== in syncPixel ======"); + logger.debug("Firing DSP Pixel URLs"); -<<<<<<< HEAD - g = m[e] = function (a, b, s) { - g.q ? g.q.push([a, b, s]) : g._api(a, b, s); - }; -======= if (this.dspUrlSettingsPixel && this.dspUrlSettingsPixel.length > 0) { var currentTime = Date.now(); this.dspUrlSettingsPixel.forEach(function (urlSettings) { @@ -24449,130 +12024,59 @@ userId: userId, random: currentTime }), urlSettings.dspUrlTemplate); ->>>>>>> branch for npm and latest release - g.q = []; - o = n.createElement(t); - o.async = 1; - o.crossOrigin = "anonymous"; - o.src = "https://".concat(_fs_script); - y = n.getElementsByTagName(t)[0]; - y.parentNode.insertBefore(o, y); + _this2.addPixel(dspUrl, "1", "1"); + }); + } - g.identify = function (i, v, s) { - g(l, { - uid: i - }, s); - if (v) g(l, v, s); - }; + logger.debug("Firing DSP IFrame URLs"); - g.setUserVars = function (v, s) { - g(l, v, s); - }; + if (this.dspUrlSettingsIframe && this.dspUrlSettingsIframe.length > 0) { + var _currentTime = Date.now(); -<<<<<<< HEAD - g.event = function (i, v, s) { - g("event", { - n: i, - p: v - }, s); - }; -======= this.dspUrlSettingsIframe.forEach(function (urlSettings) { var dspUrl = _this2.compileUrl(_objectSpread2(_objectSpread2({}, _this2.mappings), {}, { userId: userId, random: _currentTime }), urlSettings.dspUrlTemplate); ->>>>>>> branch for npm and latest release - - g.shutdown = function () { - g("rec", !1); - }; - - g.restart = function () { - g("rec", !0); - }; - - g.log = function (a, b) { - g("log", [a, b]); - }; - - g.consent = function (a) { - g("consent", !arguments.length || a); - }; - g.identifyAccount = function (i, v) { - o = "account"; - v = v || {}; - v.acctId = i; - g(o, v); - }; + _this2.addIFrame(dspUrl); + }); + } - g.clearUserCookie = function () {}; + this.storage.setLotameSynchTime(Date.now()); // emit on syncPixel - g._w = {}; - y = "XMLHttpRequest"; - g._w[y] = m[y]; - y = "fetch"; - g._w[y] = m[y]; - if (m[y]) m[y] = function () { - return g._w[y].apply(this, arguments); - }; - })(window, document, window._fs_namespace, "script", "user"); + if (this.analytics.methodToCallbackMapping.syncPixel) { + this.analytics.emit("syncPixel", { + destination: this.name + }); + } } }, { - key: "page", - value: function page(rudderElement) { - logger.debug("in FULLSORY page"); - var rudderMessage = rudderElement.message; - var pageName = rudderMessage.name; - - var props = _objectSpread2({ - name: pageName - }, rudderMessage.properties); - - window.FS.event("Viewed a Page", Fullstory.getFSProperties(props)); + key: "compileUrl", + value: function compileUrl(map, url) { + Object.keys(map).forEach(function (key) { + if (map.hasOwnProperty(key)) { + var replaceKey = "{{".concat(key, "}}"); + var regex = new RegExp(replaceKey, "gi"); + url = url.replace(regex, map[key]); + } + }); + return url; } }, { key: "identify", value: function identify(rudderElement) { - logger.debug("in FULLSORY identify"); + logger.debug("in Lotame identify"); var userId = rudderElement.message.userId; - var traits = rudderElement.message.context.traits; - if (!userId) userId = rudderElement.message.anonymousId; - if (Object.keys(traits).length === 0 && traits.constructor === Object) window.FS.identify(userId);else window.FS.identify(userId, Fullstory.getFSProperties(traits)); + this.syncPixel(userId); } }, { key: "track", value: function track(rudderElement) { - logger.debug("in FULLSTORY track"); - window.FS.event(rudderElement.message.event, Fullstory.getFSProperties(rudderElement.message.properties)); - } - }, { -<<<<<<< HEAD - key: "isLoaded", - value: function isLoaded() { - logger.debug("in FULLSTORY isLoaded"); - return !!window.FS; - } - }], [{ - key: "getFSProperties", - value: function getFSProperties(properties) { - var FS_properties = {}; - Object.keys(properties).map(function (key, index) { - FS_properties[key === "displayName" || key === "email" ? key : Fullstory.camelCaseField(key)] = properties[key]; - }); - return FS_properties; + logger.debug("track not supported for lotame"); } }, { - key: "camelCaseField", - value: function camelCaseField(fieldName) { - // Do not camel case across type suffixes. - var parts = fieldName.split("_"); - - if (parts.length > 1) { - var typeSuffix = parts.pop(); -======= key: "page", value: function page(rudderElement) { var _this3 = this; @@ -24600,30 +12104,42 @@ var bcpUrl = _this3.compileUrl(_objectSpread2(_objectSpread2({}, _this3.mappings), {}, { random: _currentTime2 }), urlSettings.bcpUrlTemplate); ->>>>>>> branch for npm and latest release - switch (typeSuffix) { - case "str": - case "int": - case "date": - case "real": - case "bool": - case "strs": - case "ints": - case "dates": - case "reals": - case "bools": - return "".concat(camelcase(parts.join("_")), "_").concat(typeSuffix); + _this3.addIFrame(bcpUrl); + }); + } - } - } // No type suffix found. Camel case the whole field name. + if (rudderElement.message.userId && this.isPixelToBeSynched()) { + this.syncPixel(rudderElement.message.userId); + } + } + }, { + key: "isPixelToBeSynched", + value: function isPixelToBeSynched() { + var lastSynchedTime = this.storage.getLotameSynchTime(); + var currentTime = Date.now(); + if (!lastSynchedTime) { + return true; + } - return camelcase(fieldName); + var difference = Math.floor((currentTime - lastSynchedTime) / (1000 * 3600 * 24)); + return difference >= 7; + } + }, { + key: "isLoaded", + value: function isLoaded() { + logger.debug("in Lotame isLoaded"); + return true; + } + }, { + key: "isReady", + value: function isReady() { + return true; } }]); - return Fullstory; + return Lotame; }(); var Optimizely = /*#__PURE__*/function () { @@ -25327,138 +12843,8 @@ this.build = "1.0.0"; this.name = "RudderLabs JavaScript SDK"; this.namespace = "com.rudderlabs.javascript"; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - this.version = "1.0.10"; -======= - this.version = "1.0.8"; ->>>>>>> update npm module -======= - this.version = "1.0.9"; ->>>>>>> branch for npm and latest release -======= - this.version = "1.0.10"; ->>>>>>> add querystring parse to npm module -======= - this.version = "1.0.11"; ->>>>>>> rebase with production branch -======= -======= ->>>>>>> add querystring parse to npm module - this.version = "1.0.11"; -======= - this.version = "1.0.9"; ->>>>>>> branch for npm and latest release -<<<<<<< HEAD ->>>>>>> branch for npm and latest release -======= -======= - this.version = "1.0.10"; ->>>>>>> add querystring parse to npm module ->>>>>>> add querystring parse to npm module - }; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -======= - var Optimizely = /*#__PURE__*/function () { - function Optimizely(config, analytics) { - var _this = this; - - _classCallCheck(this, Optimizely); ->>>>>>> Updated npm distribution files - -======= ->>>>>>> update npm module - ->>>>>>> update npm module -======= -======= ->>>>>>> update npm module ->>>>>>> update npm module - -======= -======= - var Optimizely = /*#__PURE__*/function () { - function Optimizely(config, analytics) { - var _this = this; - - _classCallCheck(this, Optimizely); ->>>>>>> Updated npm distribution files - ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files - this.referrerOverride = function (referrer) { - if (referrer) { - window.optimizelyEffectiveReferrer = referrer; - return referrer; - } - -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - this.name = "RudderLabs JavaScript SDK"; -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD - this.version = "1.0.10"; -======= - this.version = "1.0.8"; ->>>>>>> update npm module -======= - this.version = "1.0.9"; ->>>>>>> branch for npm and latest release -======= - this.version = "1.0.10"; ->>>>>>> add querystring parse to npm module -======= - this.version = "1.0.11"; ->>>>>>> rebase with production branch - }; // Operating System information class -======= - return undefined; - }; ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> Updated npm distribution files - return undefined; - }; -======= - this.name = "RudderLabs JavaScript SDK"; - this.version = "1.0.10"; - }; // Operating System information class ->>>>>>> update npm module -<<<<<<< HEAD ->>>>>>> update npm module -======= -======= - this.name = "RudderLabs JavaScript SDK"; - this.version = "1.0.10"; - }; // Operating System information class -======= - return undefined; - }; ->>>>>>> Updated npm distribution files ->>>>>>> Updated npm distribution files -<<<<<<< HEAD ->>>>>>> Updated npm distribution files -======= -======= ->>>>>>> update npm module -======= ->>>>>>> update npm module -======= this.version = "1.0.11"; }; ->>>>>>> resolve conflicts // Library information class var RudderLibraryInfo = function RudderLibraryInfo() { @@ -26299,185 +13685,6 @@ try { if (window.localStorage) debug$2.enable(localStorage.debug); } catch (e) {} -<<<<<<< HEAD - - var componentEmitter$1 = createCommonjsModule(function (module) { - /** - * Expose `Emitter`. - */ - - { - module.exports = Emitter; - } - - /** - * Initialize a new `Emitter`. - * - * @api public - */ - - function Emitter(obj) { - if (obj) return mixin(obj); - } - /** - * Mixin the emitter properties. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - - function mixin(obj) { - for (var key in Emitter.prototype) { - obj[key] = Emitter.prototype[key]; - } - return obj; - } - - /** - * Listen on the given `event` with `fn`. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.on = - Emitter.prototype.addEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - (this._callbacks['$' + event] = this._callbacks['$' + event] || []) - .push(fn); - return this; - }; - - /** - * Adds an `event` listener that will be invoked a single - * time then automatically removed. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.once = function(event, fn){ - function on() { - this.off(event, on); - fn.apply(this, arguments); - } - - on.fn = fn; - this.on(event, on); - return this; - }; - - /** - * Remove the given callback for `event` or all - * registered callbacks. - * - * @param {String} event - * @param {Function} fn - * @return {Emitter} - * @api public - */ - - Emitter.prototype.off = - Emitter.prototype.removeListener = - Emitter.prototype.removeAllListeners = - Emitter.prototype.removeEventListener = function(event, fn){ - this._callbacks = this._callbacks || {}; - - // all - if (0 == arguments.length) { - this._callbacks = {}; - return this; - } - - // specific event - var callbacks = this._callbacks['$' + event]; - if (!callbacks) return this; - - // remove all handlers - if (1 == arguments.length) { - delete this._callbacks['$' + event]; - return this; - } - - // remove specific handler - var cb; - for (var i = 0; i < callbacks.length; i++) { - cb = callbacks[i]; - if (cb === fn || cb.fn === fn) { - callbacks.splice(i, 1); - break; - } - } - - // Remove event specific arrays for event types that no - // one is subscribed for to avoid memory leak. - if (callbacks.length === 0) { - delete this._callbacks['$' + event]; - } - - return this; - }; - - /** - * Emit `event` with the given args. - * - * @param {String} event - * @param {Mixed} ... - * @return {Emitter} - */ - - Emitter.prototype.emit = function(event){ - this._callbacks = this._callbacks || {}; - - var args = new Array(arguments.length - 1) - , callbacks = this._callbacks['$' + event]; - - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } - - if (callbacks) { - callbacks = callbacks.slice(0); - for (var i = 0, len = callbacks.length; i < len; ++i) { - callbacks[i].apply(this, args); - } - } - - return this; - }; - - /** - * Return array of callbacks for `event`. - * - * @param {String} event - * @return {Array} - * @api public - */ - - Emitter.prototype.listeners = function(event){ - this._callbacks = this._callbacks || {}; - return this._callbacks['$' + event] || []; - }; - - /** - * Check if this emitter has `event` handlers. - * - * @param {String} event - * @return {Boolean} - * @api public - */ - - Emitter.prototype.hasListeners = function(event){ - return !! this.listeners(event).length; - }; - }); -======= ->>>>>>> branch for npm and latest release var uuid$2 = uuid_1.v4; var debug$3 = debug_1$2('localstorage-retry'); // Some browsers don't support Function.prototype.bind, so just including a simplified version here @@ -26550,13 +13757,6 @@ * Mix in event emitter */ -<<<<<<< HEAD -<<<<<<< HEAD -======= - componentEmitter$1(Queue.prototype); ->>>>>>> update npm module -======= ->>>>>>> branch for npm and latest release componentEmitter(Queue.prototype); /** @@ -26737,13 +13937,8 @@ this._processId = this._schedule.run(this._processHead, queue[0].time - now); } }; // Ack continuously to prevent other tabs from claiming our queue -<<<<<<< HEAD - -======= - ->>>>>>> branch for npm and latest release Queue.prototype._ack = function () { this._store.set(this.keys.ACK, this._schedule.now()); @@ -28381,25 +15576,6 @@ instance.registerCallbacks(false); var eventsPushedAlready = !!window.rudderanalytics && window.rudderanalytics.push == Array.prototype.push; var argumentsArray = window.rudderanalytics; -<<<<<<< HEAD - - while (argumentsArray && argumentsArray[0] && argumentsArray[0][0] !== "load") { - argumentsArray.shift(); - } - - if (argumentsArray && argumentsArray.length > 0 && argumentsArray[0][0] === "load") { - var method = argumentsArray[0][0]; - argumentsArray[0].shift(); - logger.debug("=====from init, calling method:: ", method); - instance[method].apply(instance, _toConsumableArray(argumentsArray[0])); - argumentsArray.shift(); - } // once loaded, parse querystring of the page url to send events - - - var parsedQueryObject = instance.parseQueryString(window.location.search); - pushDataToAnalyticsArray(argumentsArray, parsedQueryObject); - -======= while (argumentsArray && argumentsArray[0] && argumentsArray[0][0] !== "load") { argumentsArray.shift(); @@ -28417,7 +15593,6 @@ var parsedQueryObject = instance.parseQueryString(window.location.search); pushDataToAnalyticsArray(argumentsArray, parsedQueryObject); ->>>>>>> update npm module if (eventsPushedAlready && argumentsArray && argumentsArray.length > 0) { for (var i$1 = 0; i$1 < argumentsArray.length; i$1++) { instance.toBeProcessedArray.push(argumentsArray[i$1]);