From 423bc3519b03f190c0d054f12ce1d7526107617f Mon Sep 17 00:00:00 2001 From: sayan-mitra Date: Wed, 16 Sep 2020 11:45:18 +0530 Subject: [PATCH] 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\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; - } - } + 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-\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\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\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\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-\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\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\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\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]);