{"version":3,"sources":["../../node_modules/blueimp-md5/js/md5.js","../../node_modules/@amplitude/ua-parser-js/src/ua-parser.js","../../node_modules/remove-accents/index.js","../../node_modules/lodash/_listCacheClear.js","../../node_modules/lodash/eq.js","../../node_modules/lodash/_assocIndexOf.js","../../node_modules/lodash/_listCacheDelete.js","../../node_modules/lodash/_listCacheGet.js","../../node_modules/lodash/_listCacheHas.js","../../node_modules/lodash/_listCacheSet.js","../../node_modules/lodash/_ListCache.js","../../node_modules/lodash/_stackClear.js","../../node_modules/lodash/_stackDelete.js","../../node_modules/lodash/_stackGet.js","../../node_modules/lodash/_stackHas.js","../../node_modules/lodash/_freeGlobal.js","../../node_modules/lodash/_root.js","../../node_modules/lodash/_Symbol.js","../../node_modules/lodash/_getRawTag.js","../../node_modules/lodash/_objectToString.js","../../node_modules/lodash/_baseGetTag.js","../../node_modules/lodash/isObject.js","../../node_modules/lodash/isFunction.js","../../node_modules/lodash/_coreJsData.js","../../node_modules/lodash/_isMasked.js","../../node_modules/lodash/_toSource.js","../../node_modules/lodash/_baseIsNative.js","../../node_modules/lodash/_getValue.js","../../node_modules/lodash/_getNative.js","../../node_modules/lodash/_Map.js","../../node_modules/lodash/_nativeCreate.js","../../node_modules/lodash/_hashClear.js","../../node_modules/lodash/_hashDelete.js","../../node_modules/lodash/_hashGet.js","../../node_modules/lodash/_hashHas.js","../../node_modules/lodash/_hashSet.js","../../node_modules/lodash/_Hash.js","../../node_modules/lodash/_mapCacheClear.js","../../node_modules/lodash/_isKeyable.js","../../node_modules/lodash/_getMapData.js","../../node_modules/lodash/_mapCacheDelete.js","../../node_modules/lodash/_mapCacheGet.js","../../node_modules/lodash/_mapCacheHas.js","../../node_modules/lodash/_mapCacheSet.js","../../node_modules/lodash/_MapCache.js","../../node_modules/lodash/_stackSet.js","../../node_modules/lodash/_Stack.js","../../node_modules/lodash/_arrayEach.js","../../node_modules/lodash/_defineProperty.js","../../node_modules/lodash/_baseAssignValue.js","../../node_modules/lodash/_assignValue.js","../../node_modules/lodash/_copyObject.js","../../node_modules/lodash/_baseTimes.js","../../node_modules/lodash/isObjectLike.js","../../node_modules/lodash/_baseIsArguments.js","../../node_modules/lodash/isArguments.js","../../node_modules/lodash/isArray.js","../../node_modules/lodash/stubFalse.js","../../node_modules/lodash/isBuffer.js","../../node_modules/lodash/_isIndex.js","../../node_modules/lodash/isLength.js","../../node_modules/lodash/_baseIsTypedArray.js","../../node_modules/lodash/_baseUnary.js","../../node_modules/lodash/_nodeUtil.js","../../node_modules/lodash/isTypedArray.js","../../node_modules/lodash/_arrayLikeKeys.js","../../node_modules/lodash/_isPrototype.js","../../node_modules/lodash/_overArg.js","../../node_modules/lodash/_nativeKeys.js","../../node_modules/lodash/_baseKeys.js","../../node_modules/lodash/isArrayLike.js","../../node_modules/lodash/keys.js","../../node_modules/lodash/_baseAssign.js","../../node_modules/lodash/_nativeKeysIn.js","../../node_modules/lodash/_baseKeysIn.js","../../node_modules/lodash/keysIn.js","../../node_modules/lodash/_baseAssignIn.js","../../node_modules/lodash/_cloneBuffer.js","../../node_modules/lodash/_copyArray.js","../../node_modules/lodash/_arrayFilter.js","../../node_modules/lodash/stubArray.js","../../node_modules/lodash/_getSymbols.js","../../node_modules/lodash/_copySymbols.js","../../node_modules/lodash/_arrayPush.js","../../node_modules/lodash/_getPrototype.js","../../node_modules/lodash/_getSymbolsIn.js","../../node_modules/lodash/_copySymbolsIn.js","../../node_modules/lodash/_baseGetAllKeys.js","../../node_modules/lodash/_getAllKeys.js","../../node_modules/lodash/_getAllKeysIn.js","../../node_modules/lodash/_DataView.js","../../node_modules/lodash/_Promise.js","../../node_modules/lodash/_Set.js","../../node_modules/lodash/_WeakMap.js","../../node_modules/lodash/_getTag.js","../../node_modules/lodash/_initCloneArray.js","../../node_modules/lodash/_Uint8Array.js","../../node_modules/lodash/_cloneArrayBuffer.js","../../node_modules/lodash/_cloneDataView.js","../../node_modules/lodash/_cloneRegExp.js","../../node_modules/lodash/_cloneSymbol.js","../../node_modules/lodash/_cloneTypedArray.js","../../node_modules/lodash/_initCloneByTag.js","../../node_modules/lodash/_baseCreate.js","../../node_modules/lodash/_initCloneObject.js","../../node_modules/lodash/_baseIsMap.js","../../node_modules/lodash/isMap.js","../../node_modules/lodash/_baseIsSet.js","../../node_modules/lodash/isSet.js","../../node_modules/lodash/_baseClone.js","../../node_modules/lodash/cloneDeep.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/careers/removeJobIDfromLocalstorage.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/search-interface/_imports/career/show-saved-jobs-count-animation.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/search-interface/_imports/career/show-saved-jobs-count.js","../../node_modules/@sentry/utils/src/is.ts","../../node_modules/@sentry/utils/src/version.ts","../../node_modules/@sentry/utils/src/worldwide.ts","../../node_modules/@sentry/utils/src/debug-build.ts","../../node_modules/@sentry/utils/src/logger.ts","../../node_modules/@sentry/utils/src/object.ts","../../node_modules/@sentry/utils/src/time.ts","../../node_modules/@sentry/utils/src/misc.ts","../../node_modules/@sentry/utils/src/propagationContext.ts","../../node_modules/@sentry/core/src/carrier.ts","../../node_modules/@sentry/core/src/session.ts","../../node_modules/@sentry/core/src/utils/spanOnScope.ts","../../node_modules/@sentry/core/src/scope.ts","../../node_modules/@sentry/core/src/defaultScopes.ts","../../node_modules/@sentry/core/src/asyncContext/stackStrategy.ts","../../node_modules/@sentry/core/src/asyncContext/index.ts","../../node_modules/@sentry/core/src/currentScopes.ts","../../node_modules/@sentry/core/src/utils/prepareEvent.ts","../../node_modules/@sentry/core/src/exports.ts","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components/onetrust/cookiePolicy.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/dataLayers/utils/utils.dataLayer.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/dataLayers/careers-saved-job.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/dataLayers/careers-details-page-saved-job.common.js","../../node_modules/@amplitude/utils/src/misc.ts","../../node_modules/amplitude-js/amplitude.esm.js","../../node_modules/amplitude-js/node_modules/query-string/base.js","../../node_modules/amplitude-js/node_modules/decode-uri-component/index.js","../../node_modules/amplitude-js/node_modules/split-on-first/index.js","../../node_modules/amplitude-js/node_modules/filter-obj/index.js","../../node_modules/amplitude-js/node_modules/query-string/index.js","../../node_modules/@amplitude/analytics-connector/dist/analytics-connector.esm.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/utils/utils.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components/amplitude.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/amplitude/job-interactions.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/careers/buttons-saveJobs.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/dataLayers/content-sharing.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/_imports/utils/utils.common.js","../../src/Project/Common/Sitecore.Common.Website/assets/scripts/components_split/career-saved-jobs-details/career-saved-jobs-details.main.js"],"sourcesContent":["/*\n * JavaScript MD5\n * https://github.com/blueimp/JavaScript-MD5\n *\n * Copyright 2011, Sebastian Tschan\n * https://blueimp.net\n *\n * Licensed under the MIT license:\n * https://opensource.org/licenses/MIT\n *\n * Based on\n * A JavaScript implementation of the RSA Data Security, Inc. MD5 Message\n * Digest Algorithm, as defined in RFC 1321.\n * Version 2.2 Copyright (C) Paul Johnston 1999 - 2009\n * Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet\n * Distributed under the BSD License\n * See http://pajhome.org.uk/crypt/md5 for more info.\n */\n\n/* global define */\n\n/* eslint-disable strict */\n\n;(function ($) {\n 'use strict'\n\n /**\n * Add integers, wrapping at 2^32.\n * This uses 16-bit operations internally to work around bugs in interpreters.\n *\n * @param {number} x First integer\n * @param {number} y Second integer\n * @returns {number} Sum\n */\n function safeAdd(x, y) {\n var lsw = (x & 0xffff) + (y & 0xffff)\n var msw = (x >> 16) + (y >> 16) + (lsw >> 16)\n return (msw << 16) | (lsw & 0xffff)\n }\n\n /**\n * Bitwise rotate a 32-bit number to the left.\n *\n * @param {number} num 32-bit number\n * @param {number} cnt Rotation count\n * @returns {number} Rotated number\n */\n function bitRotateLeft(num, cnt) {\n return (num << cnt) | (num >>> (32 - cnt))\n }\n\n /**\n * Basic operation the algorithm uses.\n *\n * @param {number} q q\n * @param {number} a a\n * @param {number} b b\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\n function md5cmn(q, a, b, x, s, t) {\n return safeAdd(bitRotateLeft(safeAdd(safeAdd(a, q), safeAdd(x, t)), s), b)\n }\n /**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\n function md5ff(a, b, c, d, x, s, t) {\n return md5cmn((b & c) | (~b & d), a, b, x, s, t)\n }\n /**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\n function md5gg(a, b, c, d, x, s, t) {\n return md5cmn((b & d) | (c & ~d), a, b, x, s, t)\n }\n /**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\n function md5hh(a, b, c, d, x, s, t) {\n return md5cmn(b ^ c ^ d, a, b, x, s, t)\n }\n /**\n * Basic operation the algorithm uses.\n *\n * @param {number} a a\n * @param {number} b b\n * @param {number} c c\n * @param {number} d d\n * @param {number} x x\n * @param {number} s s\n * @param {number} t t\n * @returns {number} Result\n */\n function md5ii(a, b, c, d, x, s, t) {\n return md5cmn(c ^ (b | ~d), a, b, x, s, t)\n }\n\n /**\n * Calculate the MD5 of an array of little-endian words, and a bit length.\n *\n * @param {Array} x Array of little-endian words\n * @param {number} len Bit length\n * @returns {Array} MD5 Array\n */\n function binlMD5(x, len) {\n /* append padding */\n x[len >> 5] |= 0x80 << len % 32\n x[(((len + 64) >>> 9) << 4) + 14] = len\n\n var i\n var olda\n var oldb\n var oldc\n var oldd\n var a = 1732584193\n var b = -271733879\n var c = -1732584194\n var d = 271733878\n\n for (i = 0; i < x.length; i += 16) {\n olda = a\n oldb = b\n oldc = c\n oldd = d\n\n a = md5ff(a, b, c, d, x[i], 7, -680876936)\n d = md5ff(d, a, b, c, x[i + 1], 12, -389564586)\n c = md5ff(c, d, a, b, x[i + 2], 17, 606105819)\n b = md5ff(b, c, d, a, x[i + 3], 22, -1044525330)\n a = md5ff(a, b, c, d, x[i + 4], 7, -176418897)\n d = md5ff(d, a, b, c, x[i + 5], 12, 1200080426)\n c = md5ff(c, d, a, b, x[i + 6], 17, -1473231341)\n b = md5ff(b, c, d, a, x[i + 7], 22, -45705983)\n a = md5ff(a, b, c, d, x[i + 8], 7, 1770035416)\n d = md5ff(d, a, b, c, x[i + 9], 12, -1958414417)\n c = md5ff(c, d, a, b, x[i + 10], 17, -42063)\n b = md5ff(b, c, d, a, x[i + 11], 22, -1990404162)\n a = md5ff(a, b, c, d, x[i + 12], 7, 1804603682)\n d = md5ff(d, a, b, c, x[i + 13], 12, -40341101)\n c = md5ff(c, d, a, b, x[i + 14], 17, -1502002290)\n b = md5ff(b, c, d, a, x[i + 15], 22, 1236535329)\n\n a = md5gg(a, b, c, d, x[i + 1], 5, -165796510)\n d = md5gg(d, a, b, c, x[i + 6], 9, -1069501632)\n c = md5gg(c, d, a, b, x[i + 11], 14, 643717713)\n b = md5gg(b, c, d, a, x[i], 20, -373897302)\n a = md5gg(a, b, c, d, x[i + 5], 5, -701558691)\n d = md5gg(d, a, b, c, x[i + 10], 9, 38016083)\n c = md5gg(c, d, a, b, x[i + 15], 14, -660478335)\n b = md5gg(b, c, d, a, x[i + 4], 20, -405537848)\n a = md5gg(a, b, c, d, x[i + 9], 5, 568446438)\n d = md5gg(d, a, b, c, x[i + 14], 9, -1019803690)\n c = md5gg(c, d, a, b, x[i + 3], 14, -187363961)\n b = md5gg(b, c, d, a, x[i + 8], 20, 1163531501)\n a = md5gg(a, b, c, d, x[i + 13], 5, -1444681467)\n d = md5gg(d, a, b, c, x[i + 2], 9, -51403784)\n c = md5gg(c, d, a, b, x[i + 7], 14, 1735328473)\n b = md5gg(b, c, d, a, x[i + 12], 20, -1926607734)\n\n a = md5hh(a, b, c, d, x[i + 5], 4, -378558)\n d = md5hh(d, a, b, c, x[i + 8], 11, -2022574463)\n c = md5hh(c, d, a, b, x[i + 11], 16, 1839030562)\n b = md5hh(b, c, d, a, x[i + 14], 23, -35309556)\n a = md5hh(a, b, c, d, x[i + 1], 4, -1530992060)\n d = md5hh(d, a, b, c, x[i + 4], 11, 1272893353)\n c = md5hh(c, d, a, b, x[i + 7], 16, -155497632)\n b = md5hh(b, c, d, a, x[i + 10], 23, -1094730640)\n a = md5hh(a, b, c, d, x[i + 13], 4, 681279174)\n d = md5hh(d, a, b, c, x[i], 11, -358537222)\n c = md5hh(c, d, a, b, x[i + 3], 16, -722521979)\n b = md5hh(b, c, d, a, x[i + 6], 23, 76029189)\n a = md5hh(a, b, c, d, x[i + 9], 4, -640364487)\n d = md5hh(d, a, b, c, x[i + 12], 11, -421815835)\n c = md5hh(c, d, a, b, x[i + 15], 16, 530742520)\n b = md5hh(b, c, d, a, x[i + 2], 23, -995338651)\n\n a = md5ii(a, b, c, d, x[i], 6, -198630844)\n d = md5ii(d, a, b, c, x[i + 7], 10, 1126891415)\n c = md5ii(c, d, a, b, x[i + 14], 15, -1416354905)\n b = md5ii(b, c, d, a, x[i + 5], 21, -57434055)\n a = md5ii(a, b, c, d, x[i + 12], 6, 1700485571)\n d = md5ii(d, a, b, c, x[i + 3], 10, -1894986606)\n c = md5ii(c, d, a, b, x[i + 10], 15, -1051523)\n b = md5ii(b, c, d, a, x[i + 1], 21, -2054922799)\n a = md5ii(a, b, c, d, x[i + 8], 6, 1873313359)\n d = md5ii(d, a, b, c, x[i + 15], 10, -30611744)\n c = md5ii(c, d, a, b, x[i + 6], 15, -1560198380)\n b = md5ii(b, c, d, a, x[i + 13], 21, 1309151649)\n a = md5ii(a, b, c, d, x[i + 4], 6, -145523070)\n d = md5ii(d, a, b, c, x[i + 11], 10, -1120210379)\n c = md5ii(c, d, a, b, x[i + 2], 15, 718787259)\n b = md5ii(b, c, d, a, x[i + 9], 21, -343485551)\n\n a = safeAdd(a, olda)\n b = safeAdd(b, oldb)\n c = safeAdd(c, oldc)\n d = safeAdd(d, oldd)\n }\n return [a, b, c, d]\n }\n\n /**\n * Convert an array of little-endian words to a string\n *\n * @param {Array} input MD5 Array\n * @returns {string} MD5 string\n */\n function binl2rstr(input) {\n var i\n var output = ''\n var length32 = input.length * 32\n for (i = 0; i < length32; i += 8) {\n output += String.fromCharCode((input[i >> 5] >>> i % 32) & 0xff)\n }\n return output\n }\n\n /**\n * Convert a raw string to an array of little-endian words\n * Characters >255 have their high-byte silently ignored.\n *\n * @param {string} input Raw input string\n * @returns {Array} Array of little-endian words\n */\n function rstr2binl(input) {\n var i\n var output = []\n output[(input.length >> 2) - 1] = undefined\n for (i = 0; i < output.length; i += 1) {\n output[i] = 0\n }\n var length8 = input.length * 8\n for (i = 0; i < length8; i += 8) {\n output[i >> 5] |= (input.charCodeAt(i / 8) & 0xff) << i % 32\n }\n return output\n }\n\n /**\n * Calculate the MD5 of a raw string\n *\n * @param {string} s Input string\n * @returns {string} Raw MD5 string\n */\n function rstrMD5(s) {\n return binl2rstr(binlMD5(rstr2binl(s), s.length * 8))\n }\n\n /**\n * Calculates the HMAC-MD5 of a key and some data (raw strings)\n *\n * @param {string} key HMAC key\n * @param {string} data Raw input string\n * @returns {string} Raw MD5 string\n */\n function rstrHMACMD5(key, data) {\n var i\n var bkey = rstr2binl(key)\n var ipad = []\n var opad = []\n var hash\n ipad[15] = opad[15] = undefined\n if (bkey.length > 16) {\n bkey = binlMD5(bkey, key.length * 8)\n }\n for (i = 0; i < 16; i += 1) {\n ipad[i] = bkey[i] ^ 0x36363636\n opad[i] = bkey[i] ^ 0x5c5c5c5c\n }\n hash = binlMD5(ipad.concat(rstr2binl(data)), 512 + data.length * 8)\n return binl2rstr(binlMD5(opad.concat(hash), 512 + 128))\n }\n\n /**\n * Convert a raw string to a hex string\n *\n * @param {string} input Raw input string\n * @returns {string} Hex encoded string\n */\n function rstr2hex(input) {\n var hexTab = '0123456789abcdef'\n var output = ''\n var x\n var i\n for (i = 0; i < input.length; i += 1) {\n x = input.charCodeAt(i)\n output += hexTab.charAt((x >>> 4) & 0x0f) + hexTab.charAt(x & 0x0f)\n }\n return output\n }\n\n /**\n * Encode a string as UTF-8\n *\n * @param {string} input Input string\n * @returns {string} UTF8 string\n */\n function str2rstrUTF8(input) {\n return unescape(encodeURIComponent(input))\n }\n\n /**\n * Encodes input string as raw MD5 string\n *\n * @param {string} s Input string\n * @returns {string} Raw MD5 string\n */\n function rawMD5(s) {\n return rstrMD5(str2rstrUTF8(s))\n }\n /**\n * Encodes input string as Hex encoded string\n *\n * @param {string} s Input string\n * @returns {string} Hex encoded string\n */\n function hexMD5(s) {\n return rstr2hex(rawMD5(s))\n }\n /**\n * Calculates the raw HMAC-MD5 for the given key and data\n *\n * @param {string} k HMAC key\n * @param {string} d Input string\n * @returns {string} Raw MD5 string\n */\n function rawHMACMD5(k, d) {\n return rstrHMACMD5(str2rstrUTF8(k), str2rstrUTF8(d))\n }\n /**\n * Calculates the Hex encoded HMAC-MD5 for the given key and data\n *\n * @param {string} k HMAC key\n * @param {string} d Input string\n * @returns {string} Raw MD5 string\n */\n function hexHMACMD5(k, d) {\n return rstr2hex(rawHMACMD5(k, d))\n }\n\n /**\n * Calculates MD5 value for a given string.\n * If a key is provided, calculates the HMAC-MD5 value.\n * Returns a Hex encoded string unless the raw argument is given.\n *\n * @param {string} string Input string\n * @param {string} [key] HMAC key\n * @param {boolean} [raw] Raw output switch\n * @returns {string} MD5 output\n */\n function md5(string, key, raw) {\n if (!key) {\n if (!raw) {\n return hexMD5(string)\n }\n return rawMD5(string)\n }\n if (!raw) {\n return hexHMACMD5(key, string)\n }\n return rawHMACMD5(key, string)\n }\n\n if (typeof define === 'function' && define.amd) {\n define(function () {\n return md5\n })\n } else if (typeof module === 'object' && module.exports) {\n module.exports = md5\n } else {\n $.md5 = md5\n }\n})(this)\n","/////////////////////////////////////////////////////////////////////////////////\n/* UAParser.js v0.7.33\n Copyright © 2012-2021 Faisal Salman \n MIT License */ /*\n Detect Browser, Engine, OS, CPU, and Device type/model from User-Agent data.\n Supports browser & node.js environment.\n Demo : https://faisalman.github.io/ua-parser-js\n Source : https://github.com/faisalman/ua-parser-js */\n/////////////////////////////////////////////////////////////////////////////////\n\n(function (window, undefined) {\n \"use strict\";\n\n //////////////\n // Constants\n /////////////\n\n var LIBVERSION = \"0.7.33\",\n EMPTY = \"\",\n UNKNOWN = \"?\",\n FUNC_TYPE = \"function\",\n UNDEF_TYPE = \"undefined\",\n OBJ_TYPE = \"object\",\n STR_TYPE = \"string\",\n MAJOR = \"major\",\n MODEL = \"model\",\n NAME = \"name\",\n TYPE = \"type\",\n VENDOR = \"vendor\",\n VERSION = \"version\",\n ARCHITECTURE = \"architecture\",\n CONSOLE = \"console\",\n MOBILE = \"mobile\",\n TABLET = \"tablet\",\n SMARTTV = \"smarttv\",\n WEARABLE = \"wearable\",\n EMBEDDED = \"embedded\",\n UA_MAX_LENGTH = 350;\n\n var AMAZON = \"Amazon\",\n APPLE = \"Apple\",\n ASUS = \"ASUS\",\n BLACKBERRY = \"BlackBerry\",\n BROWSER = \"Browser\",\n CHROME = \"Chrome\",\n EDGE = \"Edge\",\n FIREFOX = \"Firefox\",\n GOOGLE = \"Google\",\n HUAWEI = \"Huawei\",\n LG = \"LG\",\n MICROSOFT = \"Microsoft\",\n MOTOROLA = \"Motorola\",\n OPERA = \"Opera\",\n SAMSUNG = \"Samsung\",\n SHARP = \"Sharp\",\n SONY = \"Sony\",\n XIAOMI = \"Xiaomi\",\n ZEBRA = \"Zebra\",\n FACEBOOK = \"Facebook\";\n\n ///////////\n // Helper\n //////////\n\n var extend = function (regexes, extensions) {\n var mergedRegexes = {};\n for (var i in regexes) {\n if (extensions[i] && extensions[i].length % 2 === 0) {\n mergedRegexes[i] = extensions[i].concat(regexes[i]);\n } else {\n mergedRegexes[i] = regexes[i];\n }\n }\n return mergedRegexes;\n },\n enumerize = function (arr) {\n var enums = {};\n for (var i = 0; i < arr.length; i++) {\n enums[arr[i].toUpperCase()] = arr[i];\n }\n return enums;\n },\n has = function (str1, str2) {\n return typeof str1 === STR_TYPE ? lowerize(str2).indexOf(lowerize(str1)) !== -1 : false;\n },\n lowerize = function (str) {\n return str.toLowerCase();\n },\n majorize = function (version) {\n return typeof version === STR_TYPE ? version.replace(/[^\\d\\.]/g, EMPTY).split(\".\")[0] : undefined;\n },\n trim = function (str, len) {\n if (typeof str === STR_TYPE) {\n str = str.replace(/^\\s\\s*/, EMPTY);\n return typeof len === UNDEF_TYPE ? str : str.substring(0, UA_MAX_LENGTH);\n }\n };\n\n ///////////////\n // Map helper\n //////////////\n\n var rgxMapper = function (ua, arrays) {\n var i = 0,\n j,\n k,\n p,\n q,\n matches,\n match;\n\n // loop through all regexes maps\n while (i < arrays.length && !matches) {\n var regex = arrays[i], // even sequence (0,2,4,..)\n props = arrays[i + 1]; // odd sequence (1,3,5,..)\n j = k = 0;\n\n // try matching uastring with regexes\n while (j < regex.length && !matches) {\n matches = regex[j++].exec(ua);\n\n if (!!matches) {\n for (p = 0; p < props.length; p++) {\n match = matches[++k];\n q = props[p];\n // check if given property is actually array\n if (typeof q === OBJ_TYPE && q.length > 0) {\n if (q.length === 2) {\n if (typeof q[1] == FUNC_TYPE) {\n // assign modified match\n this[q[0]] = q[1].call(this, match);\n } else {\n // assign given value, ignore regex match\n this[q[0]] = q[1];\n }\n } else if (q.length === 3) {\n // check whether function or regex\n if (typeof q[1] === FUNC_TYPE && !(q[1].exec && q[1].test)) {\n // call function (usually string mapper)\n this[q[0]] = match ? q[1].call(this, match, q[2]) : undefined;\n } else {\n // sanitize match using given regex\n this[q[0]] = match ? match.replace(q[1], q[2]) : undefined;\n }\n } else if (q.length === 4) {\n this[q[0]] = match ? q[3].call(this, match.replace(q[1], q[2])) : undefined;\n }\n } else {\n this[q] = match ? match : undefined;\n }\n }\n }\n }\n i += 2;\n }\n },\n strMapper = function (str, map) {\n for (var i in map) {\n // check if current value is array\n if (typeof map[i] === OBJ_TYPE && map[i].length > 0) {\n for (var j = 0; j < map[i].length; j++) {\n if (has(map[i][j], str)) {\n return i === UNKNOWN ? undefined : i;\n }\n }\n } else if (has(map[i], str)) {\n return i === UNKNOWN ? undefined : i;\n }\n }\n return str;\n };\n\n ///////////////\n // String map\n //////////////\n\n // Safari < 3.0\n var oldSafariMap = {\n \"1.0\": \"/8\",\n 1.2: \"/1\",\n 1.3: \"/3\",\n \"2.0\": \"/412\",\n \"2.0.2\": \"/416\",\n \"2.0.3\": \"/417\",\n \"2.0.4\": \"/419\",\n \"?\": \"/\"\n },\n windowsVersionMap = {\n ME: \"4.90\",\n \"NT 3.11\": \"NT3.51\",\n \"NT 4.0\": \"NT4.0\",\n 2000: \"NT 5.0\",\n XP: [\"NT 5.1\", \"NT 5.2\"],\n Vista: \"NT 6.0\",\n 7: \"NT 6.1\",\n 8: \"NT 6.2\",\n 8.1: \"NT 6.3\",\n 10: [\"NT 6.4\", \"NT 10.0\"],\n RT: \"ARM\"\n };\n\n //////////////\n // Regex map\n /////////////\n\n var regexes = {\n browser: [\n [\n /\\b(?:crmo|crios)\\/([\\w\\.]+)/i // Chrome for Android/iOS\n ],\n [VERSION, [NAME, \"Chrome\"]],\n [\n /edg(?:e|ios|a)?\\/([\\w\\.]+)/i // Microsoft Edge\n ],\n [VERSION, [NAME, \"Edge\"]],\n [\n // Presto based\n /(opera mini)\\/([-\\w\\.]+)/i, // Opera Mini\n /(opera [mobiletab]{3,6})\\b.+version\\/([-\\w\\.]+)/i, // Opera Mobi/Tablet\n /(opera)(?:.+version\\/|[\\/ ]+)([\\w\\.]+)/i // Opera\n ],\n [NAME, VERSION],\n [\n /opios[\\/ ]+([\\w\\.]+)/i // Opera mini on iphone >= 8.0\n ],\n [VERSION, [NAME, OPERA + \" Mini\"]],\n [\n /\\bopr\\/([\\w\\.]+)/i // Opera Webkit\n ],\n [VERSION, [NAME, OPERA]],\n [\n // Mixed\n /(kindle)\\/([\\w\\.]+)/i, // Kindle\n /(lunascape|maxthon|netfront|jasmine|blazer)[\\/ ]?([\\w\\.]*)/i, // Lunascape/Maxthon/Netfront/Jasmine/Blazer\n // Trident based\n /(avant |iemobile|slim)(?:browser)?[\\/ ]?([\\w\\.]*)/i, // Avant/IEMobile/SlimBrowser\n /(ba?idubrowser)[\\/ ]?([\\w\\.]+)/i, // Baidu Browser\n /(?:ms|\\()(ie) ([\\w\\.]+)/i, // Internet Explorer\n\n // Webkit/KHTML based // Flock/RockMelt/Midori/Epiphany/Silk/Skyfire/Bolt/Iron/Iridium/PhantomJS/Bowser/QupZilla/Falkon\n /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\\/([-\\w\\.]+)/i,\n // Rekonq/Puffin/Brave/Whale/QQBrowserLite/QQ, aka ShouQ\n /(weibo)__([\\d\\.]+)/i // Weibo\n ],\n [NAME, VERSION],\n [\n /(?:\\buc? ?browser|(?:juc.+)ucweb)[\\/ ]?([\\w\\.]+)/i // UCBrowser\n ],\n [VERSION, [NAME, \"UC\" + BROWSER]],\n [\n /microm.+\\bqbcore\\/([\\w\\.]+)/i, // WeChat Desktop for Windows Built-in Browser\n /\\bqbcore\\/([\\w\\.]+).+microm/i\n ],\n [VERSION, [NAME, \"WeChat(Win) Desktop\"]],\n [\n /micromessenger\\/([\\w\\.]+)/i // WeChat\n ],\n [VERSION, [NAME, \"WeChat\"]],\n [\n /konqueror\\/([\\w\\.]+)/i // Konqueror\n ],\n [VERSION, [NAME, \"Konqueror\"]],\n [\n /trident.+rv[: ]([\\w\\.]{1,9})\\b.+like gecko/i // IE11\n ],\n [VERSION, [NAME, \"IE\"]],\n [\n /yabrowser\\/([\\w\\.]+)/i // Yandex\n ],\n [VERSION, [NAME, \"Yandex\"]],\n [\n /(avast|avg)\\/([\\w\\.]+)/i // Avast/AVG Secure Browser\n ],\n [[NAME, /(.+)/, \"$1 Secure \" + BROWSER], VERSION],\n [\n /\\bfocus\\/([\\w\\.]+)/i // Firefox Focus\n ],\n [VERSION, [NAME, FIREFOX + \" Focus\"]],\n [\n /\\bopt\\/([\\w\\.]+)/i // Opera Touch\n ],\n [VERSION, [NAME, OPERA + \" Touch\"]],\n [\n /coc_coc\\w+\\/([\\w\\.]+)/i // Coc Coc Browser\n ],\n [VERSION, [NAME, \"Coc Coc\"]],\n [\n /dolfin\\/([\\w\\.]+)/i // Dolphin\n ],\n [VERSION, [NAME, \"Dolphin\"]],\n [\n /coast\\/([\\w\\.]+)/i // Opera Coast\n ],\n [VERSION, [NAME, OPERA + \" Coast\"]],\n [\n /miuibrowser\\/([\\w\\.]+)/i // MIUI Browser\n ],\n [VERSION, [NAME, \"MIUI \" + BROWSER]],\n [\n /fxios\\/([-\\w\\.]+)/i // Firefox for iOS\n ],\n [VERSION, [NAME, FIREFOX]],\n [\n /\\bqihu|(qi?ho?o?|360)browser/i // 360\n ],\n [[NAME, \"360 \" + BROWSER]],\n [/(oculus|samsung|sailfish|huawei)browser\\/([\\w\\.]+)/i],\n [[NAME, /(.+)/, \"$1 \" + BROWSER], VERSION],\n [\n // Oculus/Samsung/Sailfish/Huawei Browser\n /(comodo_dragon)\\/([\\w\\.]+)/i // Comodo Dragon\n ],\n [[NAME, /_/g, \" \"], VERSION],\n [\n /(electron)\\/([\\w\\.]+) safari/i, // Electron-based App\n /(tesla)(?: qtcarbrowser|\\/(20\\d\\d\\.[-\\w\\.]+))/i, // Tesla\n /m?(qqbrowser|baiduboxapp|2345Explorer)[\\/ ]?([\\w\\.]+)/i // QQBrowser/Baidu App/2345 Browser\n ],\n [NAME, VERSION],\n [\n /(metasr)[\\/ ]?([\\w\\.]+)/i, // SouGouBrowser\n /(lbbrowser)/i, // LieBao Browser\n /\\[(linkedin)app\\]/i // LinkedIn App for iOS & Android\n ],\n [NAME],\n [\n // WebView\n /((?:fban\\/fbios|fb_iab\\/fb4a)(?!.+fbav)|;fbav\\/([\\w\\.]+);)/i // Facebook App for iOS & Android\n ],\n [[NAME, FACEBOOK], VERSION],\n [\n /safari (line)\\/([\\w\\.]+)/i, // Line App for iOS\n /\\b(line)\\/([\\w\\.]+)\\/iab/i, // Line App for Android\n /(chromium|instagram)[\\/ ]([-\\w\\.]+)/i // Chromium/Instagram\n ],\n [NAME, VERSION],\n [\n /\\bgsa\\/([\\w\\.]+) .*safari\\//i // Google Search Appliance on iOS\n ],\n [VERSION, [NAME, \"GSA\"]],\n [\n /headlesschrome(?:\\/([\\w\\.]+)| )/i // Chrome Headless\n ],\n [VERSION, [NAME, CHROME + \" Headless\"]],\n [\n / wv\\).+(chrome)\\/([\\w\\.]+)/i // Chrome WebView\n ],\n [[NAME, CHROME + \" WebView\"], VERSION],\n [\n /droid.+ version\\/([\\w\\.]+)\\b.+(?:mobile safari|safari)/i // Android Browser\n ],\n [VERSION, [NAME, \"Android \" + BROWSER]],\n [\n /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\\/v?([\\w\\.]+)/i // Chrome/OmniWeb/Arora/Tizen/Nokia\n ],\n [NAME, VERSION],\n [\n /version\\/([\\w\\.\\,]+) .*mobile\\/\\w+ (safari)/i // Mobile Safari\n ],\n [VERSION, [NAME, \"Mobile Safari\"]],\n [\n /version\\/([\\w(\\.|\\,)]+) .*(mobile ?safari|safari)/i // Safari & Safari Mobile\n ],\n [VERSION, NAME],\n [\n /webkit.+?(mobile ?safari|safari)(\\/[\\w\\.]+)/i // Safari < 3.0\n ],\n [NAME, [VERSION, strMapper, oldSafariMap]],\n [/(webkit|khtml)\\/([\\w\\.]+)/i],\n [NAME, VERSION],\n [\n // Gecko based\n /(navigator|netscape\\d?)\\/([-\\w\\.]+)/i // Netscape\n ],\n [[NAME, \"Netscape\"], VERSION],\n [\n /mobile vr; rv:([\\w\\.]+)\\).+firefox/i // Firefox Reality\n ],\n [VERSION, [NAME, FIREFOX + \" Reality\"]],\n [\n /ekiohf.+(flow)\\/([\\w\\.]+)/i, // Flow\n /(swiftfox)/i, // Swiftfox\n /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\\/ ]?([\\w\\.\\+]+)/i,\n // IceDragon/Iceweasel/Camino/Chimera/Fennec/Maemo/Minimo/Conkeror/Klar\n /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\\/([-\\w\\.]+)$/i,\n // Firefox/SeaMonkey/K-Meleon/IceCat/IceApe/Firebird/Phoenix\n /(firefox)\\/([\\w\\.]+)/i, // Other Firefox-based\n /(mozilla)\\/([\\w\\.]+) .+rv\\:.+gecko\\/\\d+/i, // Mozilla\n\n // Other\n /(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\\. ]?browser)[-\\/ ]?v?([\\w\\.]+)/i,\n // Polaris/Lynx/Dillo/iCab/Doris/Amaya/w3m/NetSurf/Sleipnir/Obigo/Mosaic/Go/ICE/UP.Browser\n /(links) \\(([\\w\\.]+)/i // Links\n ],\n [NAME, VERSION],\n [\n /(cobalt)\\/([\\w\\.]+)/i // Cobalt\n ],\n [NAME, [VERSION, /master.|lts./, \"\"]]\n ],\n\n cpu: [\n [\n /(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\\)]/i // AMD64 (x64)\n ],\n [[ARCHITECTURE, \"amd64\"]],\n [\n /(ia32(?=;))/i // IA32 (quicktime)\n ],\n [[ARCHITECTURE, lowerize]],\n [\n /((?:i[346]|x)86)[;\\)]/i // IA32 (x86)\n ],\n [[ARCHITECTURE, \"ia32\"]],\n [\n /\\b(aarch64|arm(v?8e?l?|_?64))\\b/i // ARM64\n ],\n [[ARCHITECTURE, \"arm64\"]],\n [\n /\\b(arm(?:v[67])?ht?n?[fl]p?)\\b/i // ARMHF\n ],\n [[ARCHITECTURE, \"armhf\"]],\n [\n // PocketPC mistakenly identified as PowerPC\n /windows (ce|mobile); ppc;/i\n ],\n [[ARCHITECTURE, \"arm\"]],\n [\n /((?:ppc|powerpc)(?:64)?)(?: mac|;|\\))/i // PowerPC\n ],\n [[ARCHITECTURE, /ower/, EMPTY, lowerize]],\n [\n /(sun4\\w)[;\\)]/i // SPARC\n ],\n [[ARCHITECTURE, \"sparc\"]],\n [\n /((?:avr32|ia64(?=;))|68k(?=\\))|\\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\\b|pa-risc)/i\n // IA64, 68K, ARM/64, AVR/32, IRIX/64, MIPS/64, SPARC/64, PA-RISC\n ],\n [[ARCHITECTURE, lowerize]]\n ],\n\n device: [\n [\n //////////////////////////\n // MOBILES & TABLETS\n // Ordered by popularity\n /////////////////////////\n\n // Samsung\n /\\b(sch-i[89]0\\d|shw-m380s|sm-[ptx]\\w{2,4}|gt-[pn]\\d{2,4}|sgh-t8[56]9|nexus 10)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, TABLET]],\n [\n /\\b((?:s[cgp]h|gt|sm)-\\w+|galaxy nexus)/i,\n /samsung[- ]([-\\w]+)/i,\n /sec-(sgh\\w+)/i\n ],\n [MODEL, [VENDOR, SAMSUNG], [TYPE, MOBILE]],\n [\n // Apple\n /((ipod|iphone)\\d+,\\d+)/i // iPod/iPhone model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /(ipad\\d+,\\d+)/i // iPad model\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [\n /\\((ip(?:hone|od)[\\w ]*);/i // iPod/iPhone\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, MOBILE]],\n [\n /\\((ipad);[-\\w\\),; ]+apple/i, // iPad\n /applecoremedia\\/[\\w\\.]+ \\((ipad)/i,\n /\\b(ipad)\\d\\d?,\\d\\d?[;\\]].+ios/i\n ],\n [MODEL, [VENDOR, APPLE], [TYPE, TABLET]],\n [/(macintosh);/i],\n [MODEL, [VENDOR, APPLE]],\n [\n // Huawei\n /\\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\\d{2})\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, TABLET]],\n [\n /(?:huawei|honor)([-\\w ]+)[;\\)]/i,\n /\\b(nexus 6p|\\w{2,4}e?-[atu]?[ln][\\dx][012359c][adn]?)\\b(?!.+d\\/s)/i\n ],\n [MODEL, [VENDOR, HUAWEI], [TYPE, MOBILE]],\n [\n // Xiaomi\n /\\b(poco[\\w ]+)(?: bui|\\))/i, // Xiaomi POCO\n /\\b; (\\w+) build\\/hm\\1/i, // Xiaomi Hongmi 'numeric' models\n /\\b(hm[-_ ]?note?[_ ]?(?:\\d\\w)?) bui/i, // Xiaomi Hongmi\n /\\b(redmi[\\-_ ]?(?:note|k)?[\\w_ ]+)(?: bui|\\))/i, // Xiaomi Redmi\n /\\b(mi[-_ ]?(?:a\\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\\d?\\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\\))/i // Xiaomi Mi\n ],\n [\n [MODEL, /_/g, \" \"],\n [VENDOR, XIAOMI],\n [TYPE, MOBILE]\n ],\n [\n /\\b(mi[-_ ]?(?:pad)(?:[\\w_ ]+))(?: bui|\\))/i // Mi Pad tablets\n ],\n [\n [MODEL, /_/g, \" \"],\n [VENDOR, XIAOMI],\n [TYPE, TABLET]\n ],\n [\n // OPPO\n /; (\\w+) bui.+ oppo/i,\n /\\b(cph[12]\\d{3}|p(?:af|c[al]|d\\w|e[ar])[mt]\\d0|x9007|a101op)\\b/i\n ],\n [MODEL, [VENDOR, \"OPPO\"], [TYPE, MOBILE]],\n [\n // Vivo\n /vivo (\\w+)(?: bui|\\))/i,\n /\\b(v[12]\\d{3}\\w?[at])(?: bui|;)/i\n ],\n [MODEL, [VENDOR, \"Vivo\"], [TYPE, MOBILE]],\n [\n // Realme\n /\\b(rmx[12]\\d{3})(?: bui|;|\\))/i\n ],\n [MODEL, [VENDOR, \"Realme\"], [TYPE, MOBILE]],\n [\n // Motorola\n /\\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\\b[\\w ]+build\\//i,\n /\\bmot(?:orola)?[- ](\\w*)/i,\n /((?:moto[\\w\\(\\) ]+|xt\\d{3,4}|nexus 6)(?= bui|\\)))/i\n ],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, MOBILE]],\n [/\\b(mz60\\d|xoom[2 ]{0,2}) build\\//i],\n [MODEL, [VENDOR, MOTOROLA], [TYPE, TABLET]],\n [\n // LG\n /((?=lg)?[vl]k\\-?\\d{3}) bui| 3\\.[-\\w; ]{10}lg?-([06cv9]{3,4})/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, TABLET]],\n [\n /(lm(?:-?f100[nv]?|-[\\w\\.]+)(?= bui|\\))|nexus [45])/i,\n /\\blg[-e;\\/ ]+((?!browser|netcast|android tv)\\w+)/i,\n /\\blg-?([\\d\\w]+) bui/i\n ],\n [MODEL, [VENDOR, LG], [TYPE, MOBILE]],\n [\n // Lenovo\n /(ideatab[-\\w ]+)/i,\n /lenovo ?(s[56]000[-\\w]+|tab(?:[\\w ]+)|yt[-\\d\\w]{6}|tb[-\\d\\w]{6})/i\n ],\n [MODEL, [VENDOR, \"Lenovo\"], [TYPE, TABLET]],\n [\n // Nokia\n /(?:maemo|nokia).*(n900|lumia \\d+)/i,\n /nokia[-_ ]?([-\\w\\.]*)/i\n ],\n [\n [MODEL, /_/g, \" \"],\n [VENDOR, \"Nokia\"],\n [TYPE, MOBILE]\n ],\n [\n // Google\n /(pixel c)\\b/i // Google Pixel C\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, TABLET]],\n [\n /droid.+; (pixel[\\daxl ]{0,6})(?: bui|\\))/i // Google Pixel\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, MOBILE]],\n [\n // Sony\n /droid.+ (a?\\d[0-2]{2}so|[c-g]\\d{4}|so[-gl]\\w+|xq-a\\w[4-7][12])(?= bui|\\).+chrome\\/(?![1-6]{0,1}\\d\\.))/i\n ],\n [MODEL, [VENDOR, SONY], [TYPE, MOBILE]],\n [/sony tablet [ps]/i, /\\b(?:sony)?sgp\\w+(?: bui|\\))/i],\n [\n [MODEL, \"Xperia Tablet\"],\n [VENDOR, SONY],\n [TYPE, TABLET]\n ],\n [\n // OnePlus\n / (kb2005|in20[12]5|be20[12][59])\\b/i,\n /(?:one)?(?:plus)? (a\\d0\\d\\d)(?: b|\\))/i\n ],\n [MODEL, [VENDOR, \"OnePlus\"], [TYPE, MOBILE]],\n [\n // Amazon\n /(alexa)webm/i,\n /(kf[a-z]{2}wi)( bui|\\))/i, // Kindle Fire without Silk\n /(kf[a-z]+)( bui|\\)).+silk\\//i // Kindle Fire HD\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, TABLET]],\n [\n /((?:sd|kf)[0349hijorstuw]+)( bui|\\)).+silk\\//i // Fire Phone\n ],\n [\n [MODEL, /(.+)/g, \"Fire Phone $1\"],\n [VENDOR, AMAZON],\n [TYPE, MOBILE]\n ],\n [\n // BlackBerry\n /(playbook);[-\\w\\),; ]+(rim)/i // BlackBerry PlayBook\n ],\n [MODEL, VENDOR, [TYPE, TABLET]],\n [\n /\\b((?:bb[a-f]|st[hv])100-\\d)/i,\n /\\(bb10; (\\w+)/i // BlackBerry 10\n ],\n [MODEL, [VENDOR, BLACKBERRY], [TYPE, MOBILE]],\n [\n // Asus\n /(?:\\b|asus_)(transfo[prime ]{4,10} \\w+|eeepc|slider \\w+|nexus 7|padfone|p00[cj])/i\n ],\n [MODEL, [VENDOR, ASUS], [TYPE, TABLET]],\n [/ (z[bes]6[027][012][km][ls]|zenfone \\d\\w?)\\b/i],\n [MODEL, [VENDOR, ASUS], [TYPE, MOBILE]],\n [\n // HTC\n /(nexus 9)/i // HTC Nexus 9\n ],\n [MODEL, [VENDOR, \"HTC\"], [TYPE, TABLET]],\n [\n /(htc)[-;_ ]{1,2}([\\w ]+(?=\\)| bui)|\\w+)/i, // HTC\n\n // ZTE\n /(zte)[- ]([\\w ]+?)(?: bui|\\/|\\))/i,\n /(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\\w]*)/i // Alcatel/GeeksPhone/Nexian/Panasonic/Sony\n ],\n [VENDOR, [MODEL, /_/g, \" \"], [TYPE, MOBILE]],\n [\n // Acer\n /droid.+; ([ab][1-7]-?[0178a]\\d\\d?)/i\n ],\n [MODEL, [VENDOR, \"Acer\"], [TYPE, TABLET]],\n [\n // Meizu\n /droid.+; (m[1-5] note) bui/i,\n /\\bmz-([-\\w]{2,})/i\n ],\n [MODEL, [VENDOR, \"Meizu\"], [TYPE, MOBILE]],\n [\n // Sharp\n /\\b(sh-?[altvz]?\\d\\d[a-ekm]?)/i\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, MOBILE]],\n [\n // MIXED\n /(blackberry|benq|palm(?=\\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\\w]*)/i,\n // BlackBerry/BenQ/Palm/Sony-Ericsson/Acer/Asus/Dell/Meizu/Motorola/Polytron\n /(hp) ([\\w ]+\\w)/i, // HP iPAQ\n /(asus)-?(\\w+)/i, // Asus\n /(microsoft); (lumia[\\w ]+)/i, // Microsoft Lumia\n /(lenovo)[-_ ]?([-\\w]+)/i, // Lenovo\n /(jolla)/i, // Jolla\n /(oppo) ?([\\w ]+) bui/i // OPPO\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(archos) (gamepad2?)/i, // Archos\n /(hp).+(touchpad(?!.+tablet)|tablet)/i, // HP TouchPad\n /(kindle)\\/([\\w\\.]+)/i, // Kindle\n /(nook)[\\w ]+build\\/(\\w+)/i, // Nook\n /(dell) (strea[kpr\\d ]*[\\dko])/i, // Dell Streak\n /(le[- ]+pan)[- ]+(\\w{1,9}) bui/i, // Le Pan Tablets\n /(trinity)[- ]*(t\\d{3}) bui/i, // Trinity Tablets\n /(gigaset)[- ]+(q\\w{1,9}) bui/i, // Gigaset Tablets\n /(vodafone) ([\\w ]+)(?:\\)| bui)/i // Vodafone\n ],\n [VENDOR, MODEL, [TYPE, TABLET]],\n [\n /(surface duo)/i // Surface Duo\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, TABLET]],\n [\n /droid [\\d\\.]+; (fp\\du?)(?: b|\\))/i // Fairphone\n ],\n [MODEL, [VENDOR, \"Fairphone\"], [TYPE, MOBILE]],\n [\n /(u304aa)/i // AT&T\n ],\n [MODEL, [VENDOR, \"AT&T\"], [TYPE, MOBILE]],\n [\n /\\bsie-(\\w*)/i // Siemens\n ],\n [MODEL, [VENDOR, \"Siemens\"], [TYPE, MOBILE]],\n [\n /\\b(rct\\w+) b/i // RCA Tablets\n ],\n [MODEL, [VENDOR, \"RCA\"], [TYPE, TABLET]],\n [\n /\\b(venue[\\d ]{2,7}) b/i // Dell Venue Tablets\n ],\n [MODEL, [VENDOR, \"Dell\"], [TYPE, TABLET]],\n [\n /\\b(q(?:mv|ta)\\w+) b/i // Verizon Tablet\n ],\n [MODEL, [VENDOR, \"Verizon\"], [TYPE, TABLET]],\n [\n /\\b(?:barnes[& ]+noble |bn[rt])([\\w\\+ ]*) b/i // Barnes & Noble Tablet\n ],\n [MODEL, [VENDOR, \"Barnes & Noble\"], [TYPE, TABLET]],\n [/\\b(tm\\d{3}\\w+) b/i],\n [MODEL, [VENDOR, \"NuVision\"], [TYPE, TABLET]],\n [\n /\\b(k88) b/i // ZTE K Series Tablet\n ],\n [MODEL, [VENDOR, \"ZTE\"], [TYPE, TABLET]],\n [\n /\\b(nx\\d{3}j) b/i // ZTE Nubia\n ],\n [MODEL, [VENDOR, \"ZTE\"], [TYPE, MOBILE]],\n [\n /\\b(gen\\d{3}) b.+49h/i // Swiss GEN Mobile\n ],\n [MODEL, [VENDOR, \"Swiss\"], [TYPE, MOBILE]],\n [\n /\\b(zur\\d{3}) b/i // Swiss ZUR Tablet\n ],\n [MODEL, [VENDOR, \"Swiss\"], [TYPE, TABLET]],\n [\n /\\b((zeki)?tb.*\\b) b/i // Zeki Tablets\n ],\n [MODEL, [VENDOR, \"Zeki\"], [TYPE, TABLET]],\n [\n /\\b([yr]\\d{2}) b/i,\n /\\b(dragon[- ]+touch |dt)(\\w{5}) b/i // Dragon Touch Tablet\n ],\n [[VENDOR, \"Dragon Touch\"], MODEL, [TYPE, TABLET]],\n [\n /\\b(ns-?\\w{0,9}) b/i // Insignia Tablets\n ],\n [MODEL, [VENDOR, \"Insignia\"], [TYPE, TABLET]],\n [\n /\\b((nxa|next)-?\\w{0,9}) b/i // NextBook Tablets\n ],\n [MODEL, [VENDOR, \"NextBook\"], [TYPE, TABLET]],\n [\n /\\b(xtreme\\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i // Voice Xtreme Phones\n ],\n [[VENDOR, \"Voice\"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(lvtel\\-)?(v1[12]) b/i // LvTel Phones\n ],\n [[VENDOR, \"LvTel\"], MODEL, [TYPE, MOBILE]],\n [\n /\\b(ph-1) /i // Essential PH-1\n ],\n [MODEL, [VENDOR, \"Essential\"], [TYPE, MOBILE]],\n [\n /\\b(v(100md|700na|7011|917g).*\\b) b/i // Envizen Tablets\n ],\n [MODEL, [VENDOR, \"Envizen\"], [TYPE, TABLET]],\n [\n /\\b(trio[-\\w\\. ]+) b/i // MachSpeed Tablets\n ],\n [MODEL, [VENDOR, \"MachSpeed\"], [TYPE, TABLET]],\n [\n /\\btu_(1491) b/i // Rotor Tablets\n ],\n [MODEL, [VENDOR, \"Rotor\"], [TYPE, TABLET]],\n [\n /(shield[\\w ]+) b/i // Nvidia Shield Tablets\n ],\n [MODEL, [VENDOR, \"Nvidia\"], [TYPE, TABLET]],\n [\n /(sprint) (\\w+)/i // Sprint Phones\n ],\n [VENDOR, MODEL, [TYPE, MOBILE]],\n [\n /(kin\\.[onetw]{3})/i // Microsoft Kin\n ],\n [\n [MODEL, /\\./g, \" \"],\n [VENDOR, MICROSOFT],\n [TYPE, MOBILE]\n ],\n [\n /droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\\)/i // Zebra\n ],\n [MODEL, [VENDOR, ZEBRA], [TYPE, TABLET]],\n [/droid.+; (ec30|ps20|tc[2-8]\\d[kx])\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, MOBILE]],\n [\n ///////////////////\n // CONSOLES\n ///////////////////\n\n /(ouya)/i, // Ouya\n /(nintendo) ([wids3utch]+)/i // Nintendo\n ],\n [VENDOR, MODEL, [TYPE, CONSOLE]],\n [\n /droid.+; (shield) bui/i // Nvidia\n ],\n [MODEL, [VENDOR, \"Nvidia\"], [TYPE, CONSOLE]],\n [\n /(playstation [345portablevi]+)/i // Playstation\n ],\n [MODEL, [VENDOR, SONY], [TYPE, CONSOLE]],\n [\n /\\b(xbox(?: one)?(?!; xbox))[\\); ]/i // Microsoft Xbox\n ],\n [MODEL, [VENDOR, MICROSOFT], [TYPE, CONSOLE]],\n [\n ///////////////////\n // SMARTTVS\n ///////////////////\n\n /smart-tv.+(samsung)/i // Samsung\n ],\n [VENDOR, [TYPE, SMARTTV]],\n [/hbbtv.+maple;(\\d+)/i],\n [\n [MODEL, /^/, \"SmartTV\"],\n [VENDOR, SAMSUNG],\n [TYPE, SMARTTV]\n ],\n [\n /(nux; netcast.+smarttv|lg (netcast\\.tv-201\\d|android tv))/i // LG SmartTV\n ],\n [\n [VENDOR, LG],\n [TYPE, SMARTTV]\n ],\n [\n /(apple) ?tv/i // Apple TV\n ],\n [VENDOR, [MODEL, APPLE + \" TV\"], [TYPE, SMARTTV]],\n [\n /crkey/i // Google Chromecast\n ],\n [\n [MODEL, CHROME + \"cast\"],\n [VENDOR, GOOGLE],\n [TYPE, SMARTTV]\n ],\n [\n /droid.+aft(\\w)( bui|\\))/i // Fire TV\n ],\n [MODEL, [VENDOR, AMAZON], [TYPE, SMARTTV]],\n [\n /\\(dtv[\\);].+(aquos)/i,\n /(aquos-tv[\\w ]+)\\)/i // Sharp\n ],\n [MODEL, [VENDOR, SHARP], [TYPE, SMARTTV]],\n [\n /(bravia[\\w ]+)( bui|\\))/i // Sony\n ],\n [MODEL, [VENDOR, SONY], [TYPE, SMARTTV]],\n [\n /(mitv-\\w{5}) bui/i // Xiaomi\n ],\n [MODEL, [VENDOR, XIAOMI], [TYPE, SMARTTV]],\n [\n /\\b(roku)[\\dx]*[\\)\\/]((?:dvp-)?[\\d\\.]*)/i, // Roku\n /hbbtv\\/\\d+\\.\\d+\\.\\d+ +\\([\\w ]*; *(\\w[^;]*);([^;]*)/i // HbbTV devices\n ],\n [\n [VENDOR, trim],\n [MODEL, trim],\n [TYPE, SMARTTV]\n ],\n [\n /\\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\\b/i // SmartTV from Unidentified Vendors\n ],\n [[TYPE, SMARTTV]],\n [\n ///////////////////\n // WEARABLES\n ///////////////////\n\n /((pebble))app/i // Pebble\n ],\n [VENDOR, MODEL, [TYPE, WEARABLE]],\n [\n /droid.+; (glass) \\d/i // Google Glass\n ],\n [MODEL, [VENDOR, GOOGLE], [TYPE, WEARABLE]],\n [/droid.+; (wt63?0{2,3})\\)/i],\n [MODEL, [VENDOR, ZEBRA], [TYPE, WEARABLE]],\n [\n /(quest( 2)?)/i // Oculus Quest\n ],\n [MODEL, [VENDOR, FACEBOOK], [TYPE, WEARABLE]],\n [\n ///////////////////\n // EMBEDDED\n ///////////////////\n\n /(tesla)(?: qtcarbrowser|\\/[-\\w\\.]+)/i // Tesla\n ],\n [VENDOR, [TYPE, EMBEDDED]],\n [\n ////////////////////\n // MIXED (GENERIC)\n ///////////////////\n\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+? mobile safari/i // Android Phones from Unidentified Vendors\n ],\n [MODEL, [TYPE, MOBILE]],\n [\n /droid .+?; ([^;]+?)(?: bui|\\) applew).+?(?! mobile) safari/i // Android Tablets from Unidentified Vendors\n ],\n [MODEL, [TYPE, TABLET]],\n [\n /\\b((tablet|tab)[;\\/]|focus\\/\\d(?!.+mobile))/i // Unidentifiable Tablet\n ],\n [[TYPE, TABLET]],\n [\n /(phone|mobile(?:[;\\/]| [ \\w\\/\\.]*safari)|pda(?=.+windows ce))/i // Unidentifiable Mobile\n ],\n [[TYPE, MOBILE]],\n [\n /(android[-\\w\\. ]{0,9});.+buil/i // Generic Android Device\n ],\n [MODEL, [VENDOR, \"Generic\"]]\n ],\n\n engine: [\n [\n /windows.+ edge\\/([\\w\\.]+)/i // EdgeHTML\n ],\n [VERSION, [NAME, EDGE + \"HTML\"]],\n [\n /webkit\\/537\\.36.+chrome\\/(?!27)([\\w\\.]+)/i // Blink\n ],\n [VERSION, [NAME, \"Blink\"]],\n [\n /(presto)\\/([\\w\\.]+)/i, // Presto\n /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\\/([\\w\\.]+)/i, // WebKit/Trident/NetFront/NetSurf/Amaya/Lynx/w3m/Goanna\n /ekioh(flow)\\/([\\w\\.]+)/i, // Flow\n /(khtml|tasman|links)[\\/ ]\\(?([\\w\\.]+)/i, // KHTML/Tasman/Links\n /(icab)[\\/ ]([23]\\.[\\d\\.]+)/i // iCab\n ],\n [NAME, VERSION],\n [\n /rv\\:([\\w\\.]{1,9})\\b.+(gecko)/i // Gecko\n ],\n [VERSION, NAME]\n ],\n\n os: [\n [\n // Windows\n /microsoft (windows) (vista|xp)/i // Windows (iTunes)\n ],\n [NAME, VERSION],\n [\n /(windows) nt 6\\.2; (arm)/i, // Windows RT\n /(windows (?:phone(?: os)?|mobile))[\\/ ]?([\\d\\.\\w ]*)/i, // Windows Phone\n /(windows)[\\/ ]?([ntce\\d\\. ]+\\w)(?!.+xbox)/i\n ],\n [NAME, [VERSION, strMapper, windowsVersionMap]],\n [/(win(?=3|9|n)|win 9x )([nt\\d\\.]+)/i],\n [\n [NAME, \"Windows\"],\n [VERSION, strMapper, windowsVersionMap]\n ],\n [\n // iOS/macOS\n /ip[honead]{2,4}\\b(?:.*os ([\\w]+) like mac|; opera)/i, // iOS\n /cfnetwork\\/.+darwin/i\n ],\n [\n [VERSION, /_/g, \".\"],\n [NAME, \"iOS\"]\n ],\n [\n /(mac os x) ?([\\w\\. ]*)/i,\n /(macintosh|mac_powerpc\\b)(?!.+haiku)/i // Mac OS\n ],\n [\n [NAME, \"Mac OS\"],\n [VERSION, /_/g, \".\"]\n ],\n [\n // Mobile OSes\n /droid ([\\w\\.]+)\\b.+(android[- ]x86|harmonyos)/i // Android-x86/HarmonyOS\n ],\n [VERSION, NAME],\n [\n // Android/WebOS/QNX/Bada/RIM/Maemo/MeeGo/Sailfish OS\n /(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\\/ ]?([\\w\\.]*)/i,\n /(blackberry)\\w*\\/([\\w\\.]*)/i, // Blackberry\n /(tizen|kaios)[\\/ ]([\\w\\.]+)/i, // Tizen/KaiOS\n /\\((series40);/i // Series 40\n ],\n [NAME, VERSION],\n [\n /\\(bb(10);/i // BlackBerry 10\n ],\n [VERSION, [NAME, BLACKBERRY]],\n [\n /(?:symbian ?os|symbos|s60(?=;)|series60)[-\\/ ]?([\\w\\.]*)/i // Symbian\n ],\n [VERSION, [NAME, \"Symbian\"]],\n [\n /mozilla\\/[\\d\\.]+ \\((?:mobile|tablet|tv|mobile; [\\w ]+); rv:.+ gecko\\/([\\w\\.]+)/i // Firefox OS\n ],\n [VERSION, [NAME, FIREFOX + \" OS\"]],\n [\n /web0s;.+rt(tv)/i,\n /\\b(?:hp)?wos(?:browser)?\\/([\\w\\.]+)/i // WebOS\n ],\n [VERSION, [NAME, \"webOS\"]],\n [\n // Google Chromecast\n /crkey\\/([\\d\\.]+)/i // Google Chromecast\n ],\n [VERSION, [NAME, CHROME + \"cast\"]],\n [\n /(cros) [\\w]+ ([\\w\\.]+\\w)/i // Chromium OS\n ],\n [[NAME, \"Chromium OS\"], VERSION],\n [\n // Console\n /(nintendo|playstation) ([wids345portablevuch]+)/i, // Nintendo/Playstation\n /(xbox); +xbox ([^\\);]+)/i, // Microsoft Xbox (360, One, X, S, Series X, Series S)\n\n // Other\n /\\b(joli|palm)\\b ?(?:os)?\\/?([\\w\\.]*)/i, // Joli/Palm\n /(mint)[\\/\\(\\) ]?(\\w*)/i, // Mint\n /(mageia|vectorlinux)[; ]/i, // Mageia/VectorLinux\n /([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\\/ ]?(?!chrom|package)([-\\w\\.]*)/i,\n // Ubuntu/Debian/SUSE/Gentoo/Arch/Slackware/Fedora/Mandriva/CentOS/PCLinuxOS/RedHat/Zenwalk/Linpus/Raspbian/Plan9/Minix/RISCOS/Contiki/Deepin/Manjaro/elementary/Sabayon/Linspire\n /(hurd|linux) ?([\\w\\.]*)/i, // Hurd/Linux\n /(gnu) ?([\\w\\.]*)/i, // GNU\n /\\b([-frentopcghs]{0,5}bsd|dragonfly)[\\/ ]?(?!amd|[ix346]{1,2}86)([\\w\\.]*)/i, // FreeBSD/NetBSD/OpenBSD/PC-BSD/GhostBSD/DragonFly\n /(haiku) (\\w+)/i // Haiku\n ],\n [NAME, VERSION],\n [\n /(sunos) ?([\\w\\.\\d]*)/i // Solaris\n ],\n [[NAME, \"Solaris\"], VERSION],\n [\n /((?:open)?solaris)[-\\/ ]?([\\w\\.]*)/i, // Solaris\n /(aix) ((\\d)(?=\\.|\\)| )[\\w\\.])*/i, // AIX\n /\\b(beos|os\\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i, // BeOS/OS2/AmigaOS/MorphOS/OpenVMS/Fuchsia/HP-UX\n /(unix) ?([\\w\\.]*)/i // UNIX\n ],\n [NAME, VERSION]\n ]\n };\n\n /////////////////\n // Constructor\n ////////////////\n\n var UAParser = function (ua, extensions) {\n if (typeof ua === OBJ_TYPE) {\n extensions = ua;\n ua = undefined;\n }\n\n if (!(this instanceof UAParser)) {\n return new UAParser(ua, extensions).getResult();\n }\n\n var _ua =\n ua ||\n (typeof window !== UNDEF_TYPE &&\n window.navigator &&\n window.navigator.userAgent ? window.navigator.userAgent : EMPTY);\n var _rgxmap = extensions ? extend(regexes, extensions) : regexes;\n\n this.getBrowser = function () {\n var _browser = {};\n _browser[NAME] = undefined;\n _browser[VERSION] = undefined;\n rgxMapper.call(_browser, _ua, _rgxmap.browser);\n _browser.major = majorize(_browser.version);\n return _browser;\n };\n this.getCPU = function () {\n var _cpu = {};\n _cpu[ARCHITECTURE] = undefined;\n rgxMapper.call(_cpu, _ua, _rgxmap.cpu);\n return _cpu;\n };\n this.getDevice = function () {\n var _device = {};\n _device[VENDOR] = undefined;\n _device[MODEL] = undefined;\n _device[TYPE] = undefined;\n rgxMapper.call(_device, _ua, _rgxmap.device);\n return _device;\n };\n this.getEngine = function () {\n var _engine = {};\n _engine[NAME] = undefined;\n _engine[VERSION] = undefined;\n rgxMapper.call(_engine, _ua, _rgxmap.engine);\n return _engine;\n };\n this.getOS = function () {\n var _os = {};\n _os[NAME] = undefined;\n _os[VERSION] = undefined;\n rgxMapper.call(_os, _ua, _rgxmap.os);\n return _os;\n };\n this.getResult = function () {\n return {\n ua: this.getUA(),\n browser: this.getBrowser(),\n engine: this.getEngine(),\n os: this.getOS(),\n device: this.getDevice(),\n cpu: this.getCPU()\n };\n };\n this.getUA = function () {\n return _ua;\n };\n this.setUA = function (ua) {\n _ua =\n typeof ua === STR_TYPE && ua.length > UA_MAX_LENGTH ? trim(ua, UA_MAX_LENGTH) : ua;\n return this;\n };\n this.setUA(_ua);\n return this;\n };\n\n UAParser.VERSION = LIBVERSION;\n UAParser.BROWSER = enumerize([NAME, VERSION, MAJOR]);\n UAParser.CPU = enumerize([ARCHITECTURE]);\n UAParser.DEVICE = enumerize([\n MODEL,\n VENDOR,\n TYPE,\n CONSOLE,\n MOBILE,\n SMARTTV,\n TABLET,\n WEARABLE,\n EMBEDDED\n ]);\n UAParser.ENGINE = UAParser.OS = enumerize([NAME, VERSION]);\n\n ///////////\n // Export\n //////////\n\n // check js environment\n if (typeof exports !== UNDEF_TYPE) {\n // nodejs env\n if (typeof module !== UNDEF_TYPE && module.exports) {\n exports = module.exports = UAParser;\n }\n exports.UAParser = UAParser;\n } else {\n // requirejs env (optional)\n if (typeof define === FUNC_TYPE && define.amd) {\n define(function () {\n return UAParser;\n });\n } else if (typeof window !== UNDEF_TYPE) {\n // browser env\n window.UAParser = UAParser;\n }\n }\n\n // jQuery/Zepto specific (optional)\n // Note:\n // In AMD env the global scope should be kept clean, but jQuery is an exception.\n // jQuery always exports to global scope, unless jQuery.noConflict(true) is used,\n // and we should catch that.\n var $ = typeof window !== UNDEF_TYPE && (window.jQuery || window.Zepto);\n if ($ && !$.ua) {\n var parser = new UAParser();\n $.ua = parser.getResult();\n $.ua.get = function () {\n return parser.getUA();\n };\n $.ua.set = function (ua) {\n parser.setUA(ua);\n var result = parser.getResult();\n for (var prop in result) {\n $.ua[prop] = result[prop];\n }\n };\n }\n})(typeof window === \"object\" ? window : this);\n","var characterMap = {\r\n\t\"À\": \"A\",\r\n\t\"Á\": \"A\",\r\n\t\"Â\": \"A\",\r\n\t\"Ã\": \"A\",\r\n\t\"Ä\": \"A\",\r\n\t\"Å\": \"A\",\r\n\t\"Ấ\": \"A\",\r\n\t\"Ắ\": \"A\",\r\n\t\"Ẳ\": \"A\",\r\n\t\"Ẵ\": \"A\",\r\n\t\"Ặ\": \"A\",\r\n\t\"Æ\": \"AE\",\r\n\t\"Ầ\": \"A\",\r\n\t\"Ằ\": \"A\",\r\n\t\"Ȃ\": \"A\",\r\n\t\"Ç\": \"C\",\r\n\t\"Ḉ\": \"C\",\r\n\t\"È\": \"E\",\r\n\t\"É\": \"E\",\r\n\t\"Ê\": \"E\",\r\n\t\"Ë\": \"E\",\r\n\t\"Ế\": \"E\",\r\n\t\"Ḗ\": \"E\",\r\n\t\"Ề\": \"E\",\r\n\t\"Ḕ\": \"E\",\r\n\t\"Ḝ\": \"E\",\r\n\t\"Ȇ\": \"E\",\r\n\t\"Ì\": \"I\",\r\n\t\"Í\": \"I\",\r\n\t\"Î\": \"I\",\r\n\t\"Ï\": \"I\",\r\n\t\"Ḯ\": \"I\",\r\n\t\"Ȋ\": \"I\",\r\n\t\"Ð\": \"D\",\r\n\t\"Ñ\": \"N\",\r\n\t\"Ò\": \"O\",\r\n\t\"Ó\": \"O\",\r\n\t\"Ô\": \"O\",\r\n\t\"Õ\": \"O\",\r\n\t\"Ö\": \"O\",\r\n\t\"Ø\": \"O\",\r\n\t\"Ố\": \"O\",\r\n\t\"Ṍ\": \"O\",\r\n\t\"Ṓ\": \"O\",\r\n\t\"Ȏ\": \"O\",\r\n\t\"Ù\": \"U\",\r\n\t\"Ú\": \"U\",\r\n\t\"Û\": \"U\",\r\n\t\"Ü\": \"U\",\r\n\t\"Ý\": \"Y\",\r\n\t\"à\": \"a\",\r\n\t\"á\": \"a\",\r\n\t\"â\": \"a\",\r\n\t\"ã\": \"a\",\r\n\t\"ä\": \"a\",\r\n\t\"å\": \"a\",\r\n\t\"ấ\": \"a\",\r\n\t\"ắ\": \"a\",\r\n\t\"ẳ\": \"a\",\r\n\t\"ẵ\": \"a\",\r\n\t\"ặ\": \"a\",\r\n\t\"æ\": \"ae\",\r\n\t\"ầ\": \"a\",\r\n\t\"ằ\": \"a\",\r\n\t\"ȃ\": \"a\",\r\n\t\"ç\": \"c\",\r\n\t\"ḉ\": \"c\",\r\n\t\"è\": \"e\",\r\n\t\"é\": \"e\",\r\n\t\"ê\": \"e\",\r\n\t\"ë\": \"e\",\r\n\t\"ế\": \"e\",\r\n\t\"ḗ\": \"e\",\r\n\t\"ề\": \"e\",\r\n\t\"ḕ\": \"e\",\r\n\t\"ḝ\": \"e\",\r\n\t\"ȇ\": \"e\",\r\n\t\"ì\": \"i\",\r\n\t\"í\": \"i\",\r\n\t\"î\": \"i\",\r\n\t\"ï\": \"i\",\r\n\t\"ḯ\": \"i\",\r\n\t\"ȋ\": \"i\",\r\n\t\"ð\": \"d\",\r\n\t\"ñ\": \"n\",\r\n\t\"ò\": \"o\",\r\n\t\"ó\": \"o\",\r\n\t\"ô\": \"o\",\r\n\t\"õ\": \"o\",\r\n\t\"ö\": \"o\",\r\n\t\"ø\": \"o\",\r\n\t\"ố\": \"o\",\r\n\t\"ṍ\": \"o\",\r\n\t\"ṓ\": \"o\",\r\n\t\"ȏ\": \"o\",\r\n\t\"ù\": \"u\",\r\n\t\"ú\": \"u\",\r\n\t\"û\": \"u\",\r\n\t\"ü\": \"u\",\r\n\t\"ý\": \"y\",\r\n\t\"ÿ\": \"y\",\r\n\t\"Ā\": \"A\",\r\n\t\"ā\": \"a\",\r\n\t\"Ă\": \"A\",\r\n\t\"ă\": \"a\",\r\n\t\"Ą\": \"A\",\r\n\t\"ą\": \"a\",\r\n\t\"Ć\": \"C\",\r\n\t\"ć\": \"c\",\r\n\t\"Ĉ\": \"C\",\r\n\t\"ĉ\": \"c\",\r\n\t\"Ċ\": \"C\",\r\n\t\"ċ\": \"c\",\r\n\t\"Č\": \"C\",\r\n\t\"č\": \"c\",\r\n\t\"C̆\": \"C\",\r\n\t\"c̆\": \"c\",\r\n\t\"Ď\": \"D\",\r\n\t\"ď\": \"d\",\r\n\t\"Đ\": \"D\",\r\n\t\"đ\": \"d\",\r\n\t\"Ē\": \"E\",\r\n\t\"ē\": \"e\",\r\n\t\"Ĕ\": \"E\",\r\n\t\"ĕ\": \"e\",\r\n\t\"Ė\": \"E\",\r\n\t\"ė\": \"e\",\r\n\t\"Ę\": \"E\",\r\n\t\"ę\": \"e\",\r\n\t\"Ě\": \"E\",\r\n\t\"ě\": \"e\",\r\n\t\"Ĝ\": \"G\",\r\n\t\"Ǵ\": \"G\",\r\n\t\"ĝ\": \"g\",\r\n\t\"ǵ\": \"g\",\r\n\t\"Ğ\": \"G\",\r\n\t\"ğ\": \"g\",\r\n\t\"Ġ\": \"G\",\r\n\t\"ġ\": \"g\",\r\n\t\"Ģ\": \"G\",\r\n\t\"ģ\": \"g\",\r\n\t\"Ĥ\": \"H\",\r\n\t\"ĥ\": \"h\",\r\n\t\"Ħ\": \"H\",\r\n\t\"ħ\": \"h\",\r\n\t\"Ḫ\": \"H\",\r\n\t\"ḫ\": \"h\",\r\n\t\"Ĩ\": \"I\",\r\n\t\"ĩ\": \"i\",\r\n\t\"Ī\": \"I\",\r\n\t\"ī\": \"i\",\r\n\t\"Ĭ\": \"I\",\r\n\t\"ĭ\": \"i\",\r\n\t\"Į\": \"I\",\r\n\t\"į\": \"i\",\r\n\t\"İ\": \"I\",\r\n\t\"ı\": \"i\",\r\n\t\"IJ\": \"IJ\",\r\n\t\"ij\": \"ij\",\r\n\t\"Ĵ\": \"J\",\r\n\t\"ĵ\": \"j\",\r\n\t\"Ķ\": \"K\",\r\n\t\"ķ\": \"k\",\r\n\t\"Ḱ\": \"K\",\r\n\t\"ḱ\": \"k\",\r\n\t\"K̆\": \"K\",\r\n\t\"k̆\": \"k\",\r\n\t\"Ĺ\": \"L\",\r\n\t\"ĺ\": \"l\",\r\n\t\"Ļ\": \"L\",\r\n\t\"ļ\": \"l\",\r\n\t\"Ľ\": \"L\",\r\n\t\"ľ\": \"l\",\r\n\t\"Ŀ\": \"L\",\r\n\t\"ŀ\": \"l\",\r\n\t\"Ł\": \"l\",\r\n\t\"ł\": \"l\",\r\n\t\"Ḿ\": \"M\",\r\n\t\"ḿ\": \"m\",\r\n\t\"M̆\": \"M\",\r\n\t\"m̆\": \"m\",\r\n\t\"Ń\": \"N\",\r\n\t\"ń\": \"n\",\r\n\t\"Ņ\": \"N\",\r\n\t\"ņ\": \"n\",\r\n\t\"Ň\": \"N\",\r\n\t\"ň\": \"n\",\r\n\t\"ʼn\": \"n\",\r\n\t\"N̆\": \"N\",\r\n\t\"n̆\": \"n\",\r\n\t\"Ō\": \"O\",\r\n\t\"ō\": \"o\",\r\n\t\"Ŏ\": \"O\",\r\n\t\"ŏ\": \"o\",\r\n\t\"Ő\": \"O\",\r\n\t\"ő\": \"o\",\r\n\t\"Œ\": \"OE\",\r\n\t\"œ\": \"oe\",\r\n\t\"P̆\": \"P\",\r\n\t\"p̆\": \"p\",\r\n\t\"Ŕ\": \"R\",\r\n\t\"ŕ\": \"r\",\r\n\t\"Ŗ\": \"R\",\r\n\t\"ŗ\": \"r\",\r\n\t\"Ř\": \"R\",\r\n\t\"ř\": \"r\",\r\n\t\"R̆\": \"R\",\r\n\t\"r̆\": \"r\",\r\n\t\"Ȓ\": \"R\",\r\n\t\"ȓ\": \"r\",\r\n\t\"Ś\": \"S\",\r\n\t\"ś\": \"s\",\r\n\t\"Ŝ\": \"S\",\r\n\t\"ŝ\": \"s\",\r\n\t\"Ş\": \"S\",\r\n\t\"Ș\": \"S\",\r\n\t\"ș\": \"s\",\r\n\t\"ş\": \"s\",\r\n\t\"Š\": \"S\",\r\n\t\"š\": \"s\",\r\n\t\"Ţ\": \"T\",\r\n\t\"ţ\": \"t\",\r\n\t\"ț\": \"t\",\r\n\t\"Ț\": \"T\",\r\n\t\"Ť\": \"T\",\r\n\t\"ť\": \"t\",\r\n\t\"Ŧ\": \"T\",\r\n\t\"ŧ\": \"t\",\r\n\t\"T̆\": \"T\",\r\n\t\"t̆\": \"t\",\r\n\t\"Ũ\": \"U\",\r\n\t\"ũ\": \"u\",\r\n\t\"Ū\": \"U\",\r\n\t\"ū\": \"u\",\r\n\t\"Ŭ\": \"U\",\r\n\t\"ŭ\": \"u\",\r\n\t\"Ů\": \"U\",\r\n\t\"ů\": \"u\",\r\n\t\"Ű\": \"U\",\r\n\t\"ű\": \"u\",\r\n\t\"Ų\": \"U\",\r\n\t\"ų\": \"u\",\r\n\t\"Ȗ\": \"U\",\r\n\t\"ȗ\": \"u\",\r\n\t\"V̆\": \"V\",\r\n\t\"v̆\": \"v\",\r\n\t\"Ŵ\": \"W\",\r\n\t\"ŵ\": \"w\",\r\n\t\"Ẃ\": \"W\",\r\n\t\"ẃ\": \"w\",\r\n\t\"X̆\": \"X\",\r\n\t\"x̆\": \"x\",\r\n\t\"Ŷ\": \"Y\",\r\n\t\"ŷ\": \"y\",\r\n\t\"Ÿ\": \"Y\",\r\n\t\"Y̆\": \"Y\",\r\n\t\"y̆\": \"y\",\r\n\t\"Ź\": \"Z\",\r\n\t\"ź\": \"z\",\r\n\t\"Ż\": \"Z\",\r\n\t\"ż\": \"z\",\r\n\t\"Ž\": \"Z\",\r\n\t\"ž\": \"z\",\r\n\t\"ſ\": \"s\",\r\n\t\"ƒ\": \"f\",\r\n\t\"Ơ\": \"O\",\r\n\t\"ơ\": \"o\",\r\n\t\"Ư\": \"U\",\r\n\t\"ư\": \"u\",\r\n\t\"Ǎ\": \"A\",\r\n\t\"ǎ\": \"a\",\r\n\t\"Ǐ\": \"I\",\r\n\t\"ǐ\": \"i\",\r\n\t\"Ǒ\": \"O\",\r\n\t\"ǒ\": \"o\",\r\n\t\"Ǔ\": \"U\",\r\n\t\"ǔ\": \"u\",\r\n\t\"Ǖ\": \"U\",\r\n\t\"ǖ\": \"u\",\r\n\t\"Ǘ\": \"U\",\r\n\t\"ǘ\": \"u\",\r\n\t\"Ǚ\": \"U\",\r\n\t\"ǚ\": \"u\",\r\n\t\"Ǜ\": \"U\",\r\n\t\"ǜ\": \"u\",\r\n\t\"Ứ\": \"U\",\r\n\t\"ứ\": \"u\",\r\n\t\"Ṹ\": \"U\",\r\n\t\"ṹ\": \"u\",\r\n\t\"Ǻ\": \"A\",\r\n\t\"ǻ\": \"a\",\r\n\t\"Ǽ\": \"AE\",\r\n\t\"ǽ\": \"ae\",\r\n\t\"Ǿ\": \"O\",\r\n\t\"ǿ\": \"o\",\r\n\t\"Þ\": \"TH\",\r\n\t\"þ\": \"th\",\r\n\t\"Ṕ\": \"P\",\r\n\t\"ṕ\": \"p\",\r\n\t\"Ṥ\": \"S\",\r\n\t\"ṥ\": \"s\",\r\n\t\"X́\": \"X\",\r\n\t\"x́\": \"x\",\r\n\t\"Ѓ\": \"Г\",\r\n\t\"ѓ\": \"г\",\r\n\t\"Ќ\": \"К\",\r\n\t\"ќ\": \"к\",\r\n\t\"A̋\": \"A\",\r\n\t\"a̋\": \"a\",\r\n\t\"E̋\": \"E\",\r\n\t\"e̋\": \"e\",\r\n\t\"I̋\": \"I\",\r\n\t\"i̋\": \"i\",\r\n\t\"Ǹ\": \"N\",\r\n\t\"ǹ\": \"n\",\r\n\t\"Ồ\": \"O\",\r\n\t\"ồ\": \"o\",\r\n\t\"Ṑ\": \"O\",\r\n\t\"ṑ\": \"o\",\r\n\t\"Ừ\": \"U\",\r\n\t\"ừ\": \"u\",\r\n\t\"Ẁ\": \"W\",\r\n\t\"ẁ\": \"w\",\r\n\t\"Ỳ\": \"Y\",\r\n\t\"ỳ\": \"y\",\r\n\t\"Ȁ\": \"A\",\r\n\t\"ȁ\": \"a\",\r\n\t\"Ȅ\": \"E\",\r\n\t\"ȅ\": \"e\",\r\n\t\"Ȉ\": \"I\",\r\n\t\"ȉ\": \"i\",\r\n\t\"Ȍ\": \"O\",\r\n\t\"ȍ\": \"o\",\r\n\t\"Ȑ\": \"R\",\r\n\t\"ȑ\": \"r\",\r\n\t\"Ȕ\": \"U\",\r\n\t\"ȕ\": \"u\",\r\n\t\"B̌\": \"B\",\r\n\t\"b̌\": \"b\",\r\n\t\"Č̣\": \"C\",\r\n\t\"č̣\": \"c\",\r\n\t\"Ê̌\": \"E\",\r\n\t\"ê̌\": \"e\",\r\n\t\"F̌\": \"F\",\r\n\t\"f̌\": \"f\",\r\n\t\"Ǧ\": \"G\",\r\n\t\"ǧ\": \"g\",\r\n\t\"Ȟ\": \"H\",\r\n\t\"ȟ\": \"h\",\r\n\t\"J̌\": \"J\",\r\n\t\"ǰ\": \"j\",\r\n\t\"Ǩ\": \"K\",\r\n\t\"ǩ\": \"k\",\r\n\t\"M̌\": \"M\",\r\n\t\"m̌\": \"m\",\r\n\t\"P̌\": \"P\",\r\n\t\"p̌\": \"p\",\r\n\t\"Q̌\": \"Q\",\r\n\t\"q̌\": \"q\",\r\n\t\"Ř̩\": \"R\",\r\n\t\"ř̩\": \"r\",\r\n\t\"Ṧ\": \"S\",\r\n\t\"ṧ\": \"s\",\r\n\t\"V̌\": \"V\",\r\n\t\"v̌\": \"v\",\r\n\t\"W̌\": \"W\",\r\n\t\"w̌\": \"w\",\r\n\t\"X̌\": \"X\",\r\n\t\"x̌\": \"x\",\r\n\t\"Y̌\": \"Y\",\r\n\t\"y̌\": \"y\",\r\n\t\"A̧\": \"A\",\r\n\t\"a̧\": \"a\",\r\n\t\"B̧\": \"B\",\r\n\t\"b̧\": \"b\",\r\n\t\"Ḑ\": \"D\",\r\n\t\"ḑ\": \"d\",\r\n\t\"Ȩ\": \"E\",\r\n\t\"ȩ\": \"e\",\r\n\t\"Ɛ̧\": \"E\",\r\n\t\"ɛ̧\": \"e\",\r\n\t\"Ḩ\": \"H\",\r\n\t\"ḩ\": \"h\",\r\n\t\"I̧\": \"I\",\r\n\t\"i̧\": \"i\",\r\n\t\"Ɨ̧\": \"I\",\r\n\t\"ɨ̧\": \"i\",\r\n\t\"M̧\": \"M\",\r\n\t\"m̧\": \"m\",\r\n\t\"O̧\": \"O\",\r\n\t\"o̧\": \"o\",\r\n\t\"Q̧\": \"Q\",\r\n\t\"q̧\": \"q\",\r\n\t\"U̧\": \"U\",\r\n\t\"u̧\": \"u\",\r\n\t\"X̧\": \"X\",\r\n\t\"x̧\": \"x\",\r\n\t\"Z̧\": \"Z\",\r\n\t\"z̧\": \"z\",\r\n};\r\n\r\nvar chars = Object.keys(characterMap).join('|');\r\nvar allAccents = new RegExp(chars, 'g');\r\nvar firstAccent = new RegExp(chars, '');\r\n\r\nvar removeAccents = function(string) {\t\r\n\treturn string.replace(allAccents, function(match) {\r\n\t\treturn characterMap[match];\r\n\t});\r\n};\r\n\r\nvar hasAccents = function(string) {\r\n\treturn !!string.match(firstAccent);\r\n};\r\n\r\nmodule.exports = removeAccents;\r\nmodule.exports.has = hasAccents;\r\nmodule.exports.remove = removeAccents;\r\n","/**\n * Removes all key-value entries from the list cache.\n *\n * @private\n * @name clear\n * @memberOf ListCache\n */\nfunction listCacheClear() {\n this.__data__ = [];\n this.size = 0;\n}\n\nmodule.exports = listCacheClear;\n","/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\nmodule.exports = eq;\n","var eq = require('./eq');\n\n/**\n * Gets the index at which the `key` is found in `array` of key-value pairs.\n *\n * @private\n * @param {Array} array The array to inspect.\n * @param {*} key The key to search for.\n * @returns {number} Returns the index of the matched value, else `-1`.\n */\nfunction assocIndexOf(array, key) {\n var length = array.length;\n while (length--) {\n if (eq(array[length][0], key)) {\n return length;\n }\n }\n return -1;\n}\n\nmodule.exports = assocIndexOf;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/** Used for built-in method references. */\nvar arrayProto = Array.prototype;\n\n/** Built-in value references. */\nvar splice = arrayProto.splice;\n\n/**\n * Removes `key` and its value from the list cache.\n *\n * @private\n * @name delete\n * @memberOf ListCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction listCacheDelete(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n return false;\n }\n var lastIndex = data.length - 1;\n if (index == lastIndex) {\n data.pop();\n } else {\n splice.call(data, index, 1);\n }\n --this.size;\n return true;\n}\n\nmodule.exports = listCacheDelete;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Gets the list cache value for `key`.\n *\n * @private\n * @name get\n * @memberOf ListCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction listCacheGet(key) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n return index < 0 ? undefined : data[index][1];\n}\n\nmodule.exports = listCacheGet;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Checks if a list cache value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf ListCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction listCacheHas(key) {\n return assocIndexOf(this.__data__, key) > -1;\n}\n\nmodule.exports = listCacheHas;\n","var assocIndexOf = require('./_assocIndexOf');\n\n/**\n * Sets the list cache `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf ListCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the list cache instance.\n */\nfunction listCacheSet(key, value) {\n var data = this.__data__,\n index = assocIndexOf(data, key);\n\n if (index < 0) {\n ++this.size;\n data.push([key, value]);\n } else {\n data[index][1] = value;\n }\n return this;\n}\n\nmodule.exports = listCacheSet;\n","var listCacheClear = require('./_listCacheClear'),\n listCacheDelete = require('./_listCacheDelete'),\n listCacheGet = require('./_listCacheGet'),\n listCacheHas = require('./_listCacheHas'),\n listCacheSet = require('./_listCacheSet');\n\n/**\n * Creates an list cache object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction ListCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `ListCache`.\nListCache.prototype.clear = listCacheClear;\nListCache.prototype['delete'] = listCacheDelete;\nListCache.prototype.get = listCacheGet;\nListCache.prototype.has = listCacheHas;\nListCache.prototype.set = listCacheSet;\n\nmodule.exports = ListCache;\n","var ListCache = require('./_ListCache');\n\n/**\n * Removes all key-value entries from the stack.\n *\n * @private\n * @name clear\n * @memberOf Stack\n */\nfunction stackClear() {\n this.__data__ = new ListCache;\n this.size = 0;\n}\n\nmodule.exports = stackClear;\n","/**\n * Removes `key` and its value from the stack.\n *\n * @private\n * @name delete\n * @memberOf Stack\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction stackDelete(key) {\n var data = this.__data__,\n result = data['delete'](key);\n\n this.size = data.size;\n return result;\n}\n\nmodule.exports = stackDelete;\n","/**\n * Gets the stack value for `key`.\n *\n * @private\n * @name get\n * @memberOf Stack\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction stackGet(key) {\n return this.__data__.get(key);\n}\n\nmodule.exports = stackGet;\n","/**\n * Checks if a stack value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Stack\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction stackHas(key) {\n return this.__data__.has(key);\n}\n\nmodule.exports = stackHas;\n","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nmodule.exports = freeGlobal;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nmodule.exports = root;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nmodule.exports = Symbol;\n","var Symbol = require('./_Symbol');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nmodule.exports = getRawTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nmodule.exports = objectToString;\n","var Symbol = require('./_Symbol'),\n getRawTag = require('./_getRawTag'),\n objectToString = require('./_objectToString');\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nmodule.exports = baseGetTag;\n","/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return value != null && (type == 'object' || type == 'function');\n}\n\nmodule.exports = isObject;\n","var baseGetTag = require('./_baseGetTag'),\n isObject = require('./isObject');\n\n/** `Object#toString` result references. */\nvar asyncTag = '[object AsyncFunction]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n proxyTag = '[object Proxy]';\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n if (!isObject(value)) {\n return false;\n }\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 9 which returns 'object' for typed arrays and other constructors.\n var tag = baseGetTag(value);\n return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;\n}\n\nmodule.exports = isFunction;\n","var root = require('./_root');\n\n/** Used to detect overreaching core-js shims. */\nvar coreJsData = root['__core-js_shared__'];\n\nmodule.exports = coreJsData;\n","var coreJsData = require('./_coreJsData');\n\n/** Used to detect methods masquerading as native. */\nvar maskSrcKey = (function() {\n var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');\n return uid ? ('Symbol(src)_1.' + uid) : '';\n}());\n\n/**\n * Checks if `func` has its source masked.\n *\n * @private\n * @param {Function} func The function to check.\n * @returns {boolean} Returns `true` if `func` is masked, else `false`.\n */\nfunction isMasked(func) {\n return !!maskSrcKey && (maskSrcKey in func);\n}\n\nmodule.exports = isMasked;\n","/** Used for built-in method references. */\nvar funcProto = Function.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/**\n * Converts `func` to its source code.\n *\n * @private\n * @param {Function} func The function to convert.\n * @returns {string} Returns the source code.\n */\nfunction toSource(func) {\n if (func != null) {\n try {\n return funcToString.call(func);\n } catch (e) {}\n try {\n return (func + '');\n } catch (e) {}\n }\n return '';\n}\n\nmodule.exports = toSource;\n","var isFunction = require('./isFunction'),\n isMasked = require('./_isMasked'),\n isObject = require('./isObject'),\n toSource = require('./_toSource');\n\n/**\n * Used to match `RegExp`\n * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).\n */\nvar reRegExpChar = /[\\\\^$.*+?()[\\]{}|]/g;\n\n/** Used to detect host constructors (Safari). */\nvar reIsHostCtor = /^\\[object .+?Constructor\\]$/;\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to detect if a method is native. */\nvar reIsNative = RegExp('^' +\n funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\\\$&')\n .replace(/hasOwnProperty|(function).*?(?=\\\\\\()| for .+?(?=\\\\\\])/g, '$1.*?') + '$'\n);\n\n/**\n * The base implementation of `_.isNative` without bad shim checks.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a native function,\n * else `false`.\n */\nfunction baseIsNative(value) {\n if (!isObject(value) || isMasked(value)) {\n return false;\n }\n var pattern = isFunction(value) ? reIsNative : reIsHostCtor;\n return pattern.test(toSource(value));\n}\n\nmodule.exports = baseIsNative;\n","/**\n * Gets the value at `key` of `object`.\n *\n * @private\n * @param {Object} [object] The object to query.\n * @param {string} key The key of the property to get.\n * @returns {*} Returns the property value.\n */\nfunction getValue(object, key) {\n return object == null ? undefined : object[key];\n}\n\nmodule.exports = getValue;\n","var baseIsNative = require('./_baseIsNative'),\n getValue = require('./_getValue');\n\n/**\n * Gets the native function at `key` of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {string} key The key of the method to get.\n * @returns {*} Returns the function if it's native, else `undefined`.\n */\nfunction getNative(object, key) {\n var value = getValue(object, key);\n return baseIsNative(value) ? value : undefined;\n}\n\nmodule.exports = getNative;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Map = getNative(root, 'Map');\n\nmodule.exports = Map;\n","var getNative = require('./_getNative');\n\n/* Built-in method references that are verified to be native. */\nvar nativeCreate = getNative(Object, 'create');\n\nmodule.exports = nativeCreate;\n","var nativeCreate = require('./_nativeCreate');\n\n/**\n * Removes all key-value entries from the hash.\n *\n * @private\n * @name clear\n * @memberOf Hash\n */\nfunction hashClear() {\n this.__data__ = nativeCreate ? nativeCreate(null) : {};\n this.size = 0;\n}\n\nmodule.exports = hashClear;\n","/**\n * Removes `key` and its value from the hash.\n *\n * @private\n * @name delete\n * @memberOf Hash\n * @param {Object} hash The hash to modify.\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction hashDelete(key) {\n var result = this.has(key) && delete this.__data__[key];\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = hashDelete;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Gets the hash value for `key`.\n *\n * @private\n * @name get\n * @memberOf Hash\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction hashGet(key) {\n var data = this.__data__;\n if (nativeCreate) {\n var result = data[key];\n return result === HASH_UNDEFINED ? undefined : result;\n }\n return hasOwnProperty.call(data, key) ? data[key] : undefined;\n}\n\nmodule.exports = hashGet;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Checks if a hash value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf Hash\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction hashHas(key) {\n var data = this.__data__;\n return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key);\n}\n\nmodule.exports = hashHas;\n","var nativeCreate = require('./_nativeCreate');\n\n/** Used to stand-in for `undefined` hash values. */\nvar HASH_UNDEFINED = '__lodash_hash_undefined__';\n\n/**\n * Sets the hash `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Hash\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the hash instance.\n */\nfunction hashSet(key, value) {\n var data = this.__data__;\n this.size += this.has(key) ? 0 : 1;\n data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value;\n return this;\n}\n\nmodule.exports = hashSet;\n","var hashClear = require('./_hashClear'),\n hashDelete = require('./_hashDelete'),\n hashGet = require('./_hashGet'),\n hashHas = require('./_hashHas'),\n hashSet = require('./_hashSet');\n\n/**\n * Creates a hash object.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Hash(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `Hash`.\nHash.prototype.clear = hashClear;\nHash.prototype['delete'] = hashDelete;\nHash.prototype.get = hashGet;\nHash.prototype.has = hashHas;\nHash.prototype.set = hashSet;\n\nmodule.exports = Hash;\n","var Hash = require('./_Hash'),\n ListCache = require('./_ListCache'),\n Map = require('./_Map');\n\n/**\n * Removes all key-value entries from the map.\n *\n * @private\n * @name clear\n * @memberOf MapCache\n */\nfunction mapCacheClear() {\n this.size = 0;\n this.__data__ = {\n 'hash': new Hash,\n 'map': new (Map || ListCache),\n 'string': new Hash\n };\n}\n\nmodule.exports = mapCacheClear;\n","/**\n * Checks if `value` is suitable for use as unique object key.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is suitable, else `false`.\n */\nfunction isKeyable(value) {\n var type = typeof value;\n return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')\n ? (value !== '__proto__')\n : (value === null);\n}\n\nmodule.exports = isKeyable;\n","var isKeyable = require('./_isKeyable');\n\n/**\n * Gets the data for `map`.\n *\n * @private\n * @param {Object} map The map to query.\n * @param {string} key The reference key.\n * @returns {*} Returns the map data.\n */\nfunction getMapData(map, key) {\n var data = map.__data__;\n return isKeyable(key)\n ? data[typeof key == 'string' ? 'string' : 'hash']\n : data.map;\n}\n\nmodule.exports = getMapData;\n","var getMapData = require('./_getMapData');\n\n/**\n * Removes `key` and its value from the map.\n *\n * @private\n * @name delete\n * @memberOf MapCache\n * @param {string} key The key of the value to remove.\n * @returns {boolean} Returns `true` if the entry was removed, else `false`.\n */\nfunction mapCacheDelete(key) {\n var result = getMapData(this, key)['delete'](key);\n this.size -= result ? 1 : 0;\n return result;\n}\n\nmodule.exports = mapCacheDelete;\n","var getMapData = require('./_getMapData');\n\n/**\n * Gets the map value for `key`.\n *\n * @private\n * @name get\n * @memberOf MapCache\n * @param {string} key The key of the value to get.\n * @returns {*} Returns the entry value.\n */\nfunction mapCacheGet(key) {\n return getMapData(this, key).get(key);\n}\n\nmodule.exports = mapCacheGet;\n","var getMapData = require('./_getMapData');\n\n/**\n * Checks if a map value for `key` exists.\n *\n * @private\n * @name has\n * @memberOf MapCache\n * @param {string} key The key of the entry to check.\n * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.\n */\nfunction mapCacheHas(key) {\n return getMapData(this, key).has(key);\n}\n\nmodule.exports = mapCacheHas;\n","var getMapData = require('./_getMapData');\n\n/**\n * Sets the map `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf MapCache\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the map cache instance.\n */\nfunction mapCacheSet(key, value) {\n var data = getMapData(this, key),\n size = data.size;\n\n data.set(key, value);\n this.size += data.size == size ? 0 : 1;\n return this;\n}\n\nmodule.exports = mapCacheSet;\n","var mapCacheClear = require('./_mapCacheClear'),\n mapCacheDelete = require('./_mapCacheDelete'),\n mapCacheGet = require('./_mapCacheGet'),\n mapCacheHas = require('./_mapCacheHas'),\n mapCacheSet = require('./_mapCacheSet');\n\n/**\n * Creates a map cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction MapCache(entries) {\n var index = -1,\n length = entries == null ? 0 : entries.length;\n\n this.clear();\n while (++index < length) {\n var entry = entries[index];\n this.set(entry[0], entry[1]);\n }\n}\n\n// Add methods to `MapCache`.\nMapCache.prototype.clear = mapCacheClear;\nMapCache.prototype['delete'] = mapCacheDelete;\nMapCache.prototype.get = mapCacheGet;\nMapCache.prototype.has = mapCacheHas;\nMapCache.prototype.set = mapCacheSet;\n\nmodule.exports = MapCache;\n","var ListCache = require('./_ListCache'),\n Map = require('./_Map'),\n MapCache = require('./_MapCache');\n\n/** Used as the size to enable large array optimizations. */\nvar LARGE_ARRAY_SIZE = 200;\n\n/**\n * Sets the stack `key` to `value`.\n *\n * @private\n * @name set\n * @memberOf Stack\n * @param {string} key The key of the value to set.\n * @param {*} value The value to set.\n * @returns {Object} Returns the stack cache instance.\n */\nfunction stackSet(key, value) {\n var data = this.__data__;\n if (data instanceof ListCache) {\n var pairs = data.__data__;\n if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {\n pairs.push([key, value]);\n this.size = ++data.size;\n return this;\n }\n data = this.__data__ = new MapCache(pairs);\n }\n data.set(key, value);\n this.size = data.size;\n return this;\n}\n\nmodule.exports = stackSet;\n","var ListCache = require('./_ListCache'),\n stackClear = require('./_stackClear'),\n stackDelete = require('./_stackDelete'),\n stackGet = require('./_stackGet'),\n stackHas = require('./_stackHas'),\n stackSet = require('./_stackSet');\n\n/**\n * Creates a stack cache object to store key-value pairs.\n *\n * @private\n * @constructor\n * @param {Array} [entries] The key-value pairs to cache.\n */\nfunction Stack(entries) {\n var data = this.__data__ = new ListCache(entries);\n this.size = data.size;\n}\n\n// Add methods to `Stack`.\nStack.prototype.clear = stackClear;\nStack.prototype['delete'] = stackDelete;\nStack.prototype.get = stackGet;\nStack.prototype.has = stackHas;\nStack.prototype.set = stackSet;\n\nmodule.exports = Stack;\n","/**\n * A specialized version of `_.forEach` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns `array`.\n */\nfunction arrayEach(array, iteratee) {\n var index = -1,\n length = array == null ? 0 : array.length;\n\n while (++index < length) {\n if (iteratee(array[index], index, array) === false) {\n break;\n }\n }\n return array;\n}\n\nmodule.exports = arrayEach;\n","var getNative = require('./_getNative');\n\nvar defineProperty = (function() {\n try {\n var func = getNative(Object, 'defineProperty');\n func({}, '', {});\n return func;\n } catch (e) {}\n}());\n\nmodule.exports = defineProperty;\n","var defineProperty = require('./_defineProperty');\n\n/**\n * The base implementation of `assignValue` and `assignMergeValue` without\n * value checks.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction baseAssignValue(object, key, value) {\n if (key == '__proto__' && defineProperty) {\n defineProperty(object, key, {\n 'configurable': true,\n 'enumerable': true,\n 'value': value,\n 'writable': true\n });\n } else {\n object[key] = value;\n }\n}\n\nmodule.exports = baseAssignValue;\n","var baseAssignValue = require('./_baseAssignValue'),\n eq = require('./eq');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n baseAssignValue(object, key, value);\n }\n}\n\nmodule.exports = assignValue;\n","var assignValue = require('./_assignValue'),\n baseAssignValue = require('./_baseAssignValue');\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n var isNew = !object;\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n if (newValue === undefined) {\n newValue = source[key];\n }\n if (isNew) {\n baseAssignValue(object, key, newValue);\n } else {\n assignValue(object, key, newValue);\n }\n }\n return object;\n}\n\nmodule.exports = copyObject;\n","/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\nmodule.exports = baseTimes;\n","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nmodule.exports = isObjectLike;\n","var baseGetTag = require('./_baseGetTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]';\n\n/**\n * The base implementation of `_.isArguments`.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n */\nfunction baseIsArguments(value) {\n return isObjectLike(value) && baseGetTag(value) == argsTag;\n}\n\nmodule.exports = baseIsArguments;\n","var baseIsArguments = require('./_baseIsArguments'),\n isObjectLike = require('./isObjectLike');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nvar isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {\n return isObjectLike(value) && hasOwnProperty.call(value, 'callee') &&\n !propertyIsEnumerable.call(value, 'callee');\n};\n\nmodule.exports = isArguments;\n","/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\nmodule.exports = isArray;\n","/**\n * This method returns `false`.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {boolean} Returns `false`.\n * @example\n *\n * _.times(2, _.stubFalse);\n * // => [false, false]\n */\nfunction stubFalse() {\n return false;\n}\n\nmodule.exports = stubFalse;\n","var root = require('./_root'),\n stubFalse = require('./stubFalse');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;\n\n/**\n * Checks if `value` is a buffer.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a buffer, else `false`.\n * @example\n *\n * _.isBuffer(new Buffer(2));\n * // => true\n *\n * _.isBuffer(new Uint8Array(2));\n * // => false\n */\nvar isBuffer = nativeIsBuffer || stubFalse;\n\nmodule.exports = isBuffer;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n var type = typeof value;\n length = length == null ? MAX_SAFE_INTEGER : length;\n\n return !!length &&\n (type == 'number' ||\n (type != 'symbol' && reIsUint.test(value))) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\nmodule.exports = isIndex;\n","/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\nmodule.exports = isLength;\n","var baseGetTag = require('./_baseGetTag'),\n isLength = require('./isLength'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values of typed arrays. */\nvar typedArrayTags = {};\ntypedArrayTags[float32Tag] = typedArrayTags[float64Tag] =\ntypedArrayTags[int8Tag] = typedArrayTags[int16Tag] =\ntypedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =\ntypedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =\ntypedArrayTags[uint32Tag] = true;\ntypedArrayTags[argsTag] = typedArrayTags[arrayTag] =\ntypedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =\ntypedArrayTags[dataViewTag] = typedArrayTags[dateTag] =\ntypedArrayTags[errorTag] = typedArrayTags[funcTag] =\ntypedArrayTags[mapTag] = typedArrayTags[numberTag] =\ntypedArrayTags[objectTag] = typedArrayTags[regexpTag] =\ntypedArrayTags[setTag] = typedArrayTags[stringTag] =\ntypedArrayTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.isTypedArray` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n */\nfunction baseIsTypedArray(value) {\n return isObjectLike(value) &&\n isLength(value.length) && !!typedArrayTags[baseGetTag(value)];\n}\n\nmodule.exports = baseIsTypedArray;\n","/**\n * The base implementation of `_.unary` without support for storing metadata.\n *\n * @private\n * @param {Function} func The function to cap arguments for.\n * @returns {Function} Returns the new capped function.\n */\nfunction baseUnary(func) {\n return function(value) {\n return func(value);\n };\n}\n\nmodule.exports = baseUnary;\n","var freeGlobal = require('./_freeGlobal');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Detect free variable `process` from Node.js. */\nvar freeProcess = moduleExports && freeGlobal.process;\n\n/** Used to access faster Node.js helpers. */\nvar nodeUtil = (function() {\n try {\n // Use `util.types` for Node.js 10+.\n var types = freeModule && freeModule.require && freeModule.require('util').types;\n\n if (types) {\n return types;\n }\n\n // Legacy `process.binding('util')` for Node.js < 10.\n return freeProcess && freeProcess.binding && freeProcess.binding('util');\n } catch (e) {}\n}());\n\nmodule.exports = nodeUtil;\n","var baseIsTypedArray = require('./_baseIsTypedArray'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;\n\n/**\n * Checks if `value` is classified as a typed array.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a typed array, else `false`.\n * @example\n *\n * _.isTypedArray(new Uint8Array);\n * // => true\n *\n * _.isTypedArray([]);\n * // => false\n */\nvar isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;\n\nmodule.exports = isTypedArray;\n","var baseTimes = require('./_baseTimes'),\n isArguments = require('./isArguments'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isIndex = require('./_isIndex'),\n isTypedArray = require('./isTypedArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n var isArr = isArray(value),\n isArg = !isArr && isArguments(value),\n isBuff = !isArr && !isArg && isBuffer(value),\n isType = !isArr && !isArg && !isBuff && isTypedArray(value),\n skipIndexes = isArr || isArg || isBuff || isType,\n result = skipIndexes ? baseTimes(value.length, String) : [],\n length = result.length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (\n // Safari 9 has enumerable `arguments.length` in strict mode.\n key == 'length' ||\n // Node.js 0.10 has enumerable non-index properties on buffers.\n (isBuff && (key == 'offset' || key == 'parent')) ||\n // PhantomJS 2 has enumerable non-index properties on typed arrays.\n (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||\n // Skip index properties.\n isIndex(key, length)\n ))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = arrayLikeKeys;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\nmodule.exports = isPrototype;\n","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nmodule.exports = overArg;\n","var overArg = require('./_overArg');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeKeys = overArg(Object.keys, Object);\n\nmodule.exports = nativeKeys;\n","var isPrototype = require('./_isPrototype'),\n nativeKeys = require('./_nativeKeys');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keys` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeys(object) {\n if (!isPrototype(object)) {\n return nativeKeys(object);\n }\n var result = [];\n for (var key in Object(object)) {\n if (hasOwnProperty.call(object, key) && key != 'constructor') {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeys;\n","var isFunction = require('./isFunction'),\n isLength = require('./isLength');\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\nmodule.exports = isArrayLike;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeys = require('./_baseKeys'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects. See the\n * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * for more details.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keys(new Foo);\n * // => ['a', 'b'] (iteration order is not guaranteed)\n *\n * _.keys('hi');\n * // => ['0', '1']\n */\nfunction keys(object) {\n return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);\n}\n\nmodule.exports = keys;\n","var copyObject = require('./_copyObject'),\n keys = require('./keys');\n\n/**\n * The base implementation of `_.assign` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssign(object, source) {\n return object && copyObject(source, keys(source), object);\n}\n\nmodule.exports = baseAssign;\n","/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = nativeKeysIn;\n","var isObject = require('./isObject'),\n isPrototype = require('./_isPrototype'),\n nativeKeysIn = require('./_nativeKeysIn');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\nmodule.exports = baseKeysIn;\n","var arrayLikeKeys = require('./_arrayLikeKeys'),\n baseKeysIn = require('./_baseKeysIn'),\n isArrayLike = require('./isArrayLike');\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = keysIn;\n","var copyObject = require('./_copyObject'),\n keysIn = require('./keysIn');\n\n/**\n * The base implementation of `_.assignIn` without support for multiple sources\n * or `customizer` functions.\n *\n * @private\n * @param {Object} object The destination object.\n * @param {Object} source The source object.\n * @returns {Object} Returns `object`.\n */\nfunction baseAssignIn(object, source) {\n return object && copyObject(source, keysIn(source), object);\n}\n\nmodule.exports = baseAssignIn;\n","var root = require('./_root');\n\n/** Detect free variable `exports`. */\nvar freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;\n\n/** Detect free variable `module`. */\nvar freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;\n\n/** Detect the popular CommonJS extension `module.exports`. */\nvar moduleExports = freeModule && freeModule.exports === freeExports;\n\n/** Built-in value references. */\nvar Buffer = moduleExports ? root.Buffer : undefined,\n allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;\n\n/**\n * Creates a clone of `buffer`.\n *\n * @private\n * @param {Buffer} buffer The buffer to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Buffer} Returns the cloned buffer.\n */\nfunction cloneBuffer(buffer, isDeep) {\n if (isDeep) {\n return buffer.slice();\n }\n var length = buffer.length,\n result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);\n\n buffer.copy(result);\n return result;\n}\n\nmodule.exports = cloneBuffer;\n","/**\n * Copies the values of `source` to `array`.\n *\n * @private\n * @param {Array} source The array to copy values from.\n * @param {Array} [array=[]] The array to copy values to.\n * @returns {Array} Returns `array`.\n */\nfunction copyArray(source, array) {\n var index = -1,\n length = source.length;\n\n array || (array = Array(length));\n while (++index < length) {\n array[index] = source[index];\n }\n return array;\n}\n\nmodule.exports = copyArray;\n","/**\n * A specialized version of `_.filter` for arrays without support for\n * iteratee shorthands.\n *\n * @private\n * @param {Array} [array] The array to iterate over.\n * @param {Function} predicate The function invoked per iteration.\n * @returns {Array} Returns the new filtered array.\n */\nfunction arrayFilter(array, predicate) {\n var index = -1,\n length = array == null ? 0 : array.length,\n resIndex = 0,\n result = [];\n\n while (++index < length) {\n var value = array[index];\n if (predicate(value, index, array)) {\n result[resIndex++] = value;\n }\n }\n return result;\n}\n\nmodule.exports = arrayFilter;\n","/**\n * This method returns a new empty array.\n *\n * @static\n * @memberOf _\n * @since 4.13.0\n * @category Util\n * @returns {Array} Returns the new empty array.\n * @example\n *\n * var arrays = _.times(2, _.stubArray);\n *\n * console.log(arrays);\n * // => [[], []]\n *\n * console.log(arrays[0] === arrays[1]);\n * // => false\n */\nfunction stubArray() {\n return [];\n}\n\nmodule.exports = stubArray;\n","var arrayFilter = require('./_arrayFilter'),\n stubArray = require('./stubArray');\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbols = !nativeGetSymbols ? stubArray : function(object) {\n if (object == null) {\n return [];\n }\n object = Object(object);\n return arrayFilter(nativeGetSymbols(object), function(symbol) {\n return propertyIsEnumerable.call(object, symbol);\n });\n};\n\nmodule.exports = getSymbols;\n","var copyObject = require('./_copyObject'),\n getSymbols = require('./_getSymbols');\n\n/**\n * Copies own symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbols(source, object) {\n return copyObject(source, getSymbols(source), object);\n}\n\nmodule.exports = copySymbols;\n","/**\n * Appends the elements of `values` to `array`.\n *\n * @private\n * @param {Array} array The array to modify.\n * @param {Array} values The values to append.\n * @returns {Array} Returns `array`.\n */\nfunction arrayPush(array, values) {\n var index = -1,\n length = values.length,\n offset = array.length;\n\n while (++index < length) {\n array[offset + index] = values[index];\n }\n return array;\n}\n\nmodule.exports = arrayPush;\n","var overArg = require('./_overArg');\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nmodule.exports = getPrototype;\n","var arrayPush = require('./_arrayPush'),\n getPrototype = require('./_getPrototype'),\n getSymbols = require('./_getSymbols'),\n stubArray = require('./stubArray');\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeGetSymbols = Object.getOwnPropertySymbols;\n\n/**\n * Creates an array of the own and inherited enumerable symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of symbols.\n */\nvar getSymbolsIn = !nativeGetSymbols ? stubArray : function(object) {\n var result = [];\n while (object) {\n arrayPush(result, getSymbols(object));\n object = getPrototype(object);\n }\n return result;\n};\n\nmodule.exports = getSymbolsIn;\n","var copyObject = require('./_copyObject'),\n getSymbolsIn = require('./_getSymbolsIn');\n\n/**\n * Copies own and inherited symbols of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy symbols from.\n * @param {Object} [object={}] The object to copy symbols to.\n * @returns {Object} Returns `object`.\n */\nfunction copySymbolsIn(source, object) {\n return copyObject(source, getSymbolsIn(source), object);\n}\n\nmodule.exports = copySymbolsIn;\n","var arrayPush = require('./_arrayPush'),\n isArray = require('./isArray');\n\n/**\n * The base implementation of `getAllKeys` and `getAllKeysIn` which uses\n * `keysFunc` and `symbolsFunc` to get the enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @param {Function} keysFunc The function to get the keys of `object`.\n * @param {Function} symbolsFunc The function to get the symbols of `object`.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction baseGetAllKeys(object, keysFunc, symbolsFunc) {\n var result = keysFunc(object);\n return isArray(object) ? result : arrayPush(result, symbolsFunc(object));\n}\n\nmodule.exports = baseGetAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbols = require('./_getSymbols'),\n keys = require('./keys');\n\n/**\n * Creates an array of own enumerable property names and symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeys(object) {\n return baseGetAllKeys(object, keys, getSymbols);\n}\n\nmodule.exports = getAllKeys;\n","var baseGetAllKeys = require('./_baseGetAllKeys'),\n getSymbolsIn = require('./_getSymbolsIn'),\n keysIn = require('./keysIn');\n\n/**\n * Creates an array of own and inherited enumerable property names and\n * symbols of `object`.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names and symbols.\n */\nfunction getAllKeysIn(object) {\n return baseGetAllKeys(object, keysIn, getSymbolsIn);\n}\n\nmodule.exports = getAllKeysIn;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar DataView = getNative(root, 'DataView');\n\nmodule.exports = DataView;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Promise = getNative(root, 'Promise');\n\nmodule.exports = Promise;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar Set = getNative(root, 'Set');\n\nmodule.exports = Set;\n","var getNative = require('./_getNative'),\n root = require('./_root');\n\n/* Built-in method references that are verified to be native. */\nvar WeakMap = getNative(root, 'WeakMap');\n\nmodule.exports = WeakMap;\n","var DataView = require('./_DataView'),\n Map = require('./_Map'),\n Promise = require('./_Promise'),\n Set = require('./_Set'),\n WeakMap = require('./_WeakMap'),\n baseGetTag = require('./_baseGetTag'),\n toSource = require('./_toSource');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]',\n objectTag = '[object Object]',\n promiseTag = '[object Promise]',\n setTag = '[object Set]',\n weakMapTag = '[object WeakMap]';\n\nvar dataViewTag = '[object DataView]';\n\n/** Used to detect maps, sets, and weakmaps. */\nvar dataViewCtorString = toSource(DataView),\n mapCtorString = toSource(Map),\n promiseCtorString = toSource(Promise),\n setCtorString = toSource(Set),\n weakMapCtorString = toSource(WeakMap);\n\n/**\n * Gets the `toStringTag` of `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nvar getTag = baseGetTag;\n\n// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.\nif ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||\n (Map && getTag(new Map) != mapTag) ||\n (Promise && getTag(Promise.resolve()) != promiseTag) ||\n (Set && getTag(new Set) != setTag) ||\n (WeakMap && getTag(new WeakMap) != weakMapTag)) {\n getTag = function(value) {\n var result = baseGetTag(value),\n Ctor = result == objectTag ? value.constructor : undefined,\n ctorString = Ctor ? toSource(Ctor) : '';\n\n if (ctorString) {\n switch (ctorString) {\n case dataViewCtorString: return dataViewTag;\n case mapCtorString: return mapTag;\n case promiseCtorString: return promiseTag;\n case setCtorString: return setTag;\n case weakMapCtorString: return weakMapTag;\n }\n }\n return result;\n };\n}\n\nmodule.exports = getTag;\n","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Initializes an array clone.\n *\n * @private\n * @param {Array} array The array to clone.\n * @returns {Array} Returns the initialized clone.\n */\nfunction initCloneArray(array) {\n var length = array.length,\n result = new array.constructor(length);\n\n // Add properties assigned by `RegExp#exec`.\n if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) {\n result.index = array.index;\n result.input = array.input;\n }\n return result;\n}\n\nmodule.exports = initCloneArray;\n","var root = require('./_root');\n\n/** Built-in value references. */\nvar Uint8Array = root.Uint8Array;\n\nmodule.exports = Uint8Array;\n","var Uint8Array = require('./_Uint8Array');\n\n/**\n * Creates a clone of `arrayBuffer`.\n *\n * @private\n * @param {ArrayBuffer} arrayBuffer The array buffer to clone.\n * @returns {ArrayBuffer} Returns the cloned array buffer.\n */\nfunction cloneArrayBuffer(arrayBuffer) {\n var result = new arrayBuffer.constructor(arrayBuffer.byteLength);\n new Uint8Array(result).set(new Uint8Array(arrayBuffer));\n return result;\n}\n\nmodule.exports = cloneArrayBuffer;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `dataView`.\n *\n * @private\n * @param {Object} dataView The data view to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned data view.\n */\nfunction cloneDataView(dataView, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer;\n return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength);\n}\n\nmodule.exports = cloneDataView;\n","/** Used to match `RegExp` flags from their coerced string values. */\nvar reFlags = /\\w*$/;\n\n/**\n * Creates a clone of `regexp`.\n *\n * @private\n * @param {Object} regexp The regexp to clone.\n * @returns {Object} Returns the cloned regexp.\n */\nfunction cloneRegExp(regexp) {\n var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));\n result.lastIndex = regexp.lastIndex;\n return result;\n}\n\nmodule.exports = cloneRegExp;\n","var Symbol = require('./_Symbol');\n\n/** Used to convert symbols to primitives and strings. */\nvar symbolProto = Symbol ? Symbol.prototype : undefined,\n symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;\n\n/**\n * Creates a clone of the `symbol` object.\n *\n * @private\n * @param {Object} symbol The symbol object to clone.\n * @returns {Object} Returns the cloned symbol object.\n */\nfunction cloneSymbol(symbol) {\n return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};\n}\n\nmodule.exports = cloneSymbol;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer');\n\n/**\n * Creates a clone of `typedArray`.\n *\n * @private\n * @param {Object} typedArray The typed array to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the cloned typed array.\n */\nfunction cloneTypedArray(typedArray, isDeep) {\n var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;\n return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);\n}\n\nmodule.exports = cloneTypedArray;\n","var cloneArrayBuffer = require('./_cloneArrayBuffer'),\n cloneDataView = require('./_cloneDataView'),\n cloneRegExp = require('./_cloneRegExp'),\n cloneSymbol = require('./_cloneSymbol'),\n cloneTypedArray = require('./_cloneTypedArray');\n\n/** `Object#toString` result references. */\nvar boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/**\n * Initializes an object clone based on its `toStringTag`.\n *\n * **Note:** This function only supports cloning values with tags of\n * `Boolean`, `Date`, `Error`, `Map`, `Number`, `RegExp`, `Set`, or `String`.\n *\n * @private\n * @param {Object} object The object to clone.\n * @param {string} tag The `toStringTag` of the object to clone.\n * @param {boolean} [isDeep] Specify a deep clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneByTag(object, tag, isDeep) {\n var Ctor = object.constructor;\n switch (tag) {\n case arrayBufferTag:\n return cloneArrayBuffer(object);\n\n case boolTag:\n case dateTag:\n return new Ctor(+object);\n\n case dataViewTag:\n return cloneDataView(object, isDeep);\n\n case float32Tag: case float64Tag:\n case int8Tag: case int16Tag: case int32Tag:\n case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag:\n return cloneTypedArray(object, isDeep);\n\n case mapTag:\n return new Ctor;\n\n case numberTag:\n case stringTag:\n return new Ctor(object);\n\n case regexpTag:\n return cloneRegExp(object);\n\n case setTag:\n return new Ctor;\n\n case symbolTag:\n return cloneSymbol(object);\n }\n}\n\nmodule.exports = initCloneByTag;\n","var isObject = require('./isObject');\n\n/** Built-in value references. */\nvar objectCreate = Object.create;\n\n/**\n * The base implementation of `_.create` without support for assigning\n * properties to the created object.\n *\n * @private\n * @param {Object} proto The object to inherit from.\n * @returns {Object} Returns the new object.\n */\nvar baseCreate = (function() {\n function object() {}\n return function(proto) {\n if (!isObject(proto)) {\n return {};\n }\n if (objectCreate) {\n return objectCreate(proto);\n }\n object.prototype = proto;\n var result = new object;\n object.prototype = undefined;\n return result;\n };\n}());\n\nmodule.exports = baseCreate;\n","var baseCreate = require('./_baseCreate'),\n getPrototype = require('./_getPrototype'),\n isPrototype = require('./_isPrototype');\n\n/**\n * Initializes an object clone.\n *\n * @private\n * @param {Object} object The object to clone.\n * @returns {Object} Returns the initialized clone.\n */\nfunction initCloneObject(object) {\n return (typeof object.constructor == 'function' && !isPrototype(object))\n ? baseCreate(getPrototype(object))\n : {};\n}\n\nmodule.exports = initCloneObject;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar mapTag = '[object Map]';\n\n/**\n * The base implementation of `_.isMap` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n */\nfunction baseIsMap(value) {\n return isObjectLike(value) && getTag(value) == mapTag;\n}\n\nmodule.exports = baseIsMap;\n","var baseIsMap = require('./_baseIsMap'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsMap = nodeUtil && nodeUtil.isMap;\n\n/**\n * Checks if `value` is classified as a `Map` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a map, else `false`.\n * @example\n *\n * _.isMap(new Map);\n * // => true\n *\n * _.isMap(new WeakMap);\n * // => false\n */\nvar isMap = nodeIsMap ? baseUnary(nodeIsMap) : baseIsMap;\n\nmodule.exports = isMap;\n","var getTag = require('./_getTag'),\n isObjectLike = require('./isObjectLike');\n\n/** `Object#toString` result references. */\nvar setTag = '[object Set]';\n\n/**\n * The base implementation of `_.isSet` without Node.js optimizations.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n */\nfunction baseIsSet(value) {\n return isObjectLike(value) && getTag(value) == setTag;\n}\n\nmodule.exports = baseIsSet;\n","var baseIsSet = require('./_baseIsSet'),\n baseUnary = require('./_baseUnary'),\n nodeUtil = require('./_nodeUtil');\n\n/* Node.js helper references. */\nvar nodeIsSet = nodeUtil && nodeUtil.isSet;\n\n/**\n * Checks if `value` is classified as a `Set` object.\n *\n * @static\n * @memberOf _\n * @since 4.3.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a set, else `false`.\n * @example\n *\n * _.isSet(new Set);\n * // => true\n *\n * _.isSet(new WeakSet);\n * // => false\n */\nvar isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;\n\nmodule.exports = isSet;\n","var Stack = require('./_Stack'),\n arrayEach = require('./_arrayEach'),\n assignValue = require('./_assignValue'),\n baseAssign = require('./_baseAssign'),\n baseAssignIn = require('./_baseAssignIn'),\n cloneBuffer = require('./_cloneBuffer'),\n copyArray = require('./_copyArray'),\n copySymbols = require('./_copySymbols'),\n copySymbolsIn = require('./_copySymbolsIn'),\n getAllKeys = require('./_getAllKeys'),\n getAllKeysIn = require('./_getAllKeysIn'),\n getTag = require('./_getTag'),\n initCloneArray = require('./_initCloneArray'),\n initCloneByTag = require('./_initCloneByTag'),\n initCloneObject = require('./_initCloneObject'),\n isArray = require('./isArray'),\n isBuffer = require('./isBuffer'),\n isMap = require('./isMap'),\n isObject = require('./isObject'),\n isSet = require('./isSet'),\n keys = require('./keys'),\n keysIn = require('./keysIn');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_FLAT_FLAG = 2,\n CLONE_SYMBOLS_FLAG = 4;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n arrayTag = '[object Array]',\n boolTag = '[object Boolean]',\n dateTag = '[object Date]',\n errorTag = '[object Error]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]',\n mapTag = '[object Map]',\n numberTag = '[object Number]',\n objectTag = '[object Object]',\n regexpTag = '[object RegExp]',\n setTag = '[object Set]',\n stringTag = '[object String]',\n symbolTag = '[object Symbol]',\n weakMapTag = '[object WeakMap]';\n\nvar arrayBufferTag = '[object ArrayBuffer]',\n dataViewTag = '[object DataView]',\n float32Tag = '[object Float32Array]',\n float64Tag = '[object Float64Array]',\n int8Tag = '[object Int8Array]',\n int16Tag = '[object Int16Array]',\n int32Tag = '[object Int32Array]',\n uint8Tag = '[object Uint8Array]',\n uint8ClampedTag = '[object Uint8ClampedArray]',\n uint16Tag = '[object Uint16Array]',\n uint32Tag = '[object Uint32Array]';\n\n/** Used to identify `toStringTag` values supported by `_.clone`. */\nvar cloneableTags = {};\ncloneableTags[argsTag] = cloneableTags[arrayTag] =\ncloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] =\ncloneableTags[boolTag] = cloneableTags[dateTag] =\ncloneableTags[float32Tag] = cloneableTags[float64Tag] =\ncloneableTags[int8Tag] = cloneableTags[int16Tag] =\ncloneableTags[int32Tag] = cloneableTags[mapTag] =\ncloneableTags[numberTag] = cloneableTags[objectTag] =\ncloneableTags[regexpTag] = cloneableTags[setTag] =\ncloneableTags[stringTag] = cloneableTags[symbolTag] =\ncloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] =\ncloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true;\ncloneableTags[errorTag] = cloneableTags[funcTag] =\ncloneableTags[weakMapTag] = false;\n\n/**\n * The base implementation of `_.clone` and `_.cloneDeep` which tracks\n * traversed objects.\n *\n * @private\n * @param {*} value The value to clone.\n * @param {boolean} bitmask The bitmask flags.\n * 1 - Deep clone\n * 2 - Flatten inherited properties\n * 4 - Clone symbols\n * @param {Function} [customizer] The function to customize cloning.\n * @param {string} [key] The key of `value`.\n * @param {Object} [object] The parent object of `value`.\n * @param {Object} [stack] Tracks traversed objects and their clone counterparts.\n * @returns {*} Returns the cloned value.\n */\nfunction baseClone(value, bitmask, customizer, key, object, stack) {\n var result,\n isDeep = bitmask & CLONE_DEEP_FLAG,\n isFlat = bitmask & CLONE_FLAT_FLAG,\n isFull = bitmask & CLONE_SYMBOLS_FLAG;\n\n if (customizer) {\n result = object ? customizer(value, key, object, stack) : customizer(value);\n }\n if (result !== undefined) {\n return result;\n }\n if (!isObject(value)) {\n return value;\n }\n var isArr = isArray(value);\n if (isArr) {\n result = initCloneArray(value);\n if (!isDeep) {\n return copyArray(value, result);\n }\n } else {\n var tag = getTag(value),\n isFunc = tag == funcTag || tag == genTag;\n\n if (isBuffer(value)) {\n return cloneBuffer(value, isDeep);\n }\n if (tag == objectTag || tag == argsTag || (isFunc && !object)) {\n result = (isFlat || isFunc) ? {} : initCloneObject(value);\n if (!isDeep) {\n return isFlat\n ? copySymbolsIn(value, baseAssignIn(result, value))\n : copySymbols(value, baseAssign(result, value));\n }\n } else {\n if (!cloneableTags[tag]) {\n return object ? value : {};\n }\n result = initCloneByTag(value, tag, isDeep);\n }\n }\n // Check for circular references and return its corresponding clone.\n stack || (stack = new Stack);\n var stacked = stack.get(value);\n if (stacked) {\n return stacked;\n }\n stack.set(value, result);\n\n if (isSet(value)) {\n value.forEach(function(subValue) {\n result.add(baseClone(subValue, bitmask, customizer, subValue, value, stack));\n });\n } else if (isMap(value)) {\n value.forEach(function(subValue, key) {\n result.set(key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n }\n\n var keysFunc = isFull\n ? (isFlat ? getAllKeysIn : getAllKeys)\n : (isFlat ? keysIn : keys);\n\n var props = isArr ? undefined : keysFunc(value);\n arrayEach(props || value, function(subValue, key) {\n if (props) {\n key = subValue;\n subValue = value[key];\n }\n // Recursively populate clone (susceptible to call stack limits).\n assignValue(result, key, baseClone(subValue, bitmask, customizer, key, value, stack));\n });\n return result;\n}\n\nmodule.exports = baseClone;\n","var baseClone = require('./_baseClone');\n\n/** Used to compose bitmasks for cloning. */\nvar CLONE_DEEP_FLAG = 1,\n CLONE_SYMBOLS_FLAG = 4;\n\n/**\n * This method is like `_.clone` except that it recursively clones `value`.\n *\n * @static\n * @memberOf _\n * @since 1.0.0\n * @category Lang\n * @param {*} value The value to recursively clone.\n * @returns {*} Returns the deep cloned value.\n * @see _.clone\n * @example\n *\n * var objects = [{ 'a': 1 }, { 'b': 2 }];\n *\n * var deep = _.cloneDeep(objects);\n * console.log(deep[0] === objects[0]);\n * // => false\n */\nfunction cloneDeep(value) {\n return baseClone(value, CLONE_DEEP_FLAG | CLONE_SYMBOLS_FLAG);\n}\n\nmodule.exports = cloneDeep;\n","const removeJobIDfromLocalstorageCommon = (jobID) => {\n\tlet jobsIDfromLocalstorage = JSON.parse(localStorage.getItem(`careerSavedJobsID_${lang}`));\n\t\tjobsIDfromLocalstorage = jobsIDfromLocalstorage.filter(id => id !== jobID);\n\n\tlocalStorage.setItem(`careerSavedJobsID_${lang}`, JSON.stringify(jobsIDfromLocalstorage));\n};\n\nexport default removeJobIDfromLocalstorageCommon;","const showSavedJobsCountAnimation = (config = {}) => {\n\tconst complete = config.complete || null;\n\tconst opacity = config.show ? 1 : 0;\n\tconst savedItems = document.querySelector('.saved-jobs-items');\n\n\tif (savedItems) {\n Velocity(\n savedItems,\n {\n opacity: opacity,\n },\n {\n duration: 150,\n complete: complete,\n }\n );\n }\n};\n\nexport default showSavedJobsCountAnimation;","import showSavedJobsCountAnimation from \"./show-saved-jobs-count-animation\";\n\nconst showSavedJobsCount = (config = {}) => {\n\tconst onload = config.onload || false;\n\tconst savedJobsLocalstorage = localStorage.getItem(`careerSavedJobsID_${lang}`);\n\tconst savedJobsCount = savedJobsLocalstorage ? JSON.parse(savedJobsLocalstorage).length : 0;\n\tconst saveJobsCountHtml = `
${savedJobsCount}
`;\n\tconst saveJobsElement = '[data-nav-element-type=\"saved-jobs-link\"]';\n\tconst mainNavItem = document.querySelector(`${saveJobsElement} a`);\n\n\tif(savedJobsCount === 0 && !onload) {\n\t\tif(mainNavItem) {\n\t\t\tmainNavItem.classList.remove('saved-jobs-items-added');\n\t\t}\n\n\t\tshowSavedJobsCountAnimation({\n\t\t\tshow: false,\n\t\t\tcomplete: () => {\n\t\t\t\tif(mainNavItem) {\n\t\t\t\t\tmainNavItem.removeChild(document.querySelector(`${saveJobsElement} a .saved-jobs-items`));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\tif(mainNavItem && savedJobsCount >= 1) {\n\t\tconst savedJobsTotalItems = document.querySelector('.saved-jobs-items');\n\n\t\tif(onload) {\n\t\t\tif(!savedJobsTotalItems) {\n\t\t\t\tmainNavItem.innerHTML = `${mainNavItem.innerHTML} ${saveJobsCountHtml}`;\n\t\t\t\tmainNavItem.classList.add('saved-jobs-items-added');\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif(savedJobsTotalItems) {\n\t\t\tsavedJobsTotalItems.innerHTML = savedJobsCount;\n\t\t} else {\n\t\t\tmainNavItem.innerHTML = `${mainNavItem.innerHTML} ${saveJobsCountHtml}`;\n\t\t\tmainNavItem.classList.add('saved-jobs-items-added');\n\n\t\t\tconst savedJobsTotalItems = document.querySelector('.saved-jobs-items');\n\n\t\t\tsavedJobsTotalItems.innerHTML = savedJobsCount;\n\t\t}\n\t}\n\n\n};\n\nexport default showSavedJobsCount;","/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { ParameterizedString, PolymorphicEvent, Primitive } from '@sentry/types';\n\n// eslint-disable-next-line @typescript-eslint/unbound-method\nconst objectToString = Object.prototype.toString;\n\n/**\n * Checks whether given value's type is one of a few Error or Error-like\n * {@link isError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isError(wat: unknown): wat is Error {\n switch (objectToString.call(wat)) {\n case '[object Error]':\n case '[object Exception]':\n case '[object DOMException]':\n case '[object WebAssembly.Exception]':\n return true;\n default:\n return isInstanceOf(wat, Error);\n }\n}\n/**\n * Checks whether given value is an instance of the given built-in class.\n *\n * @param wat The value to be checked\n * @param className\n * @returns A boolean representing the result.\n */\nfunction isBuiltin(wat: unknown, className: string): boolean {\n return objectToString.call(wat) === `[object ${className}]`;\n}\n\n/**\n * Checks whether given value's type is ErrorEvent\n * {@link isErrorEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isErrorEvent(wat: unknown): boolean {\n return isBuiltin(wat, 'ErrorEvent');\n}\n\n/**\n * Checks whether given value's type is DOMError\n * {@link isDOMError}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMError(wat: unknown): boolean {\n return isBuiltin(wat, 'DOMError');\n}\n\n/**\n * Checks whether given value's type is DOMException\n * {@link isDOMException}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isDOMException(wat: unknown): boolean {\n return isBuiltin(wat, 'DOMException');\n}\n\n/**\n * Checks whether given value's type is a string\n * {@link isString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isString(wat: unknown): wat is string {\n return isBuiltin(wat, 'String');\n}\n\n/**\n * Checks whether given string is parameterized\n * {@link isParameterizedString}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isParameterizedString(wat: unknown): wat is ParameterizedString {\n return (\n typeof wat === 'object' &&\n wat !== null &&\n '__sentry_template_string__' in wat &&\n '__sentry_template_values__' in wat\n );\n}\n\n/**\n * Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)\n * {@link isPrimitive}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPrimitive(wat: unknown): wat is Primitive {\n return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');\n}\n\n/**\n * Checks whether given value's type is an object literal, or a class instance.\n * {@link isPlainObject}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isPlainObject(wat: unknown): wat is Record {\n return isBuiltin(wat, 'Object');\n}\n\n/**\n * Checks whether given value's type is an Event instance\n * {@link isEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isEvent(wat: unknown): wat is PolymorphicEvent {\n return typeof Event !== 'undefined' && isInstanceOf(wat, Event);\n}\n\n/**\n * Checks whether given value's type is an Element instance\n * {@link isElement}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isElement(wat: unknown): boolean {\n return typeof Element !== 'undefined' && isInstanceOf(wat, Element);\n}\n\n/**\n * Checks whether given value's type is an regexp\n * {@link isRegExp}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isRegExp(wat: unknown): wat is RegExp {\n return isBuiltin(wat, 'RegExp');\n}\n\n/**\n * Checks whether given value has a then function.\n * @param wat A value to be checked.\n */\nexport function isThenable(wat: any): wat is PromiseLike {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n return Boolean(wat && wat.then && typeof wat.then === 'function');\n}\n\n/**\n * Checks whether given value's type is a SyntheticEvent\n * {@link isSyntheticEvent}.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isSyntheticEvent(wat: unknown): boolean {\n return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;\n}\n\n/**\n * Checks whether given value's type is an instance of provided constructor.\n * {@link isInstanceOf}.\n *\n * @param wat A value to be checked.\n * @param base A constructor to be used in a check.\n * @returns A boolean representing the result.\n */\nexport function isInstanceOf(wat: any, base: any): boolean {\n try {\n return wat instanceof base;\n } catch (_e) {\n return false;\n }\n}\n\ninterface VueViewModel {\n // Vue3\n __isVue?: boolean;\n // Vue2\n _isVue?: boolean;\n}\n/**\n * Checks whether given value's type is a Vue ViewModel.\n *\n * @param wat A value to be checked.\n * @returns A boolean representing the result.\n */\nexport function isVueViewModel(wat: unknown): boolean {\n // Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.\n return !!(typeof wat === 'object' && wat !== null && ((wat as VueViewModel).__isVue || (wat as VueViewModel)._isVue));\n}\n","// This is a magic string replaced by rollup\ndeclare const __SENTRY_SDK_VERSION__: string;\n\nexport const SDK_VERSION = typeof __SENTRY_SDK_VERSION__ === 'string' ? __SENTRY_SDK_VERSION__ : '0.0.0-unknown.0';\n","/**\n * NOTE: In order to avoid circular dependencies, if you add a function to this module and it needs to print something,\n * you must either a) use `console.log` rather than the logger, or b) put your function elsewhere.\n *\n * Note: This file was originally called `global.ts`, but was changed to unblock users which might be doing\n * string replaces with bundlers like Vite for `global` (would break imports that rely on importing from utils/src/global).\n *\n * Why worldwide?\n *\n * Why not?\n */\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport type { Client, MetricsAggregator, Scope } from '@sentry/types';\n\nimport type { SdkSource } from './env';\nimport type { logger } from './logger';\nimport { SDK_VERSION } from './version';\n\ninterface SentryCarrier {\n acs?: any;\n stack?: any;\n\n globalScope?: Scope;\n defaultIsolationScope?: Scope;\n defaultCurrentScope?: Scope;\n globalMetricsAggregators?: WeakMap | undefined;\n logger?: typeof logger;\n\n /** Overwrites TextEncoder used in `@sentry/utils`, need for `react-native@0.73` and older */\n encodePolyfill?: (input: string) => Uint8Array;\n /** Overwrites TextDecoder used in `@sentry/utils`, need for `react-native@0.73` and older */\n decodePolyfill?: (input: Uint8Array) => string;\n}\n\n// TODO(v9): Clean up or remove this type\ntype BackwardsCompatibleSentryCarrier = SentryCarrier & {\n // pre-v7 hub (replaced by .stack)\n hub: any;\n integrations?: any[];\n logger: any;\n extensions?: {\n /** Extension methods for the hub, which are bound to the current Hub instance */\n // eslint-disable-next-line @typescript-eslint/ban-types\n [key: string]: Function;\n };\n};\n\n/** Internal global with common properties and Sentry extensions */\nexport type InternalGlobal = {\n navigator?: { userAgent?: string };\n console: Console;\n PerformanceObserver?: any;\n Sentry?: any;\n onerror?: {\n (event: object | string, source?: string, lineno?: number, colno?: number, error?: Error): any;\n __SENTRY_INSTRUMENTED__?: true;\n __SENTRY_LOADER__?: true;\n };\n onunhandledrejection?: {\n (event: unknown): boolean;\n __SENTRY_INSTRUMENTED__?: true;\n __SENTRY_LOADER__?: true;\n };\n SENTRY_ENVIRONMENT?: string;\n SENTRY_DSN?: string;\n SENTRY_RELEASE?: {\n id?: string;\n };\n SENTRY_SDK_SOURCE?: SdkSource;\n /**\n * Debug IDs are indirectly injected by Sentry CLI or bundler plugins to directly reference a particular source map\n * for resolving of a source file. The injected code will place an entry into the record for each loaded bundle/JS\n * file.\n */\n _sentryDebugIds?: Record;\n __SENTRY__: Record, SentryCarrier> & {\n version?: string;\n } & BackwardsCompatibleSentryCarrier;\n /**\n * Raw module metadata that is injected by bundler plugins.\n *\n * Keys are `error.stack` strings, values are the metadata.\n */\n _sentryModuleMetadata?: Record;\n _sentryEsmLoaderHookRegistered?: boolean;\n};\n\n/** Get's the global object for the current JavaScript runtime */\nexport const GLOBAL_OBJ = globalThis as unknown as InternalGlobal;\n\n/**\n * Returns a global singleton contained in the global `__SENTRY__[]` object.\n *\n * If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory\n * function and added to the `__SENTRY__` object.\n *\n * @param name name of the global singleton on __SENTRY__\n * @param creator creator Factory function to create the singleton if it doesn't already exist on `__SENTRY__`\n * @param obj (Optional) The global object on which to look for `__SENTRY__`, if not `GLOBAL_OBJ`'s return value\n * @returns the singleton\n */\nexport function getGlobalSingleton(name: keyof SentryCarrier, creator: () => T, obj?: unknown): T {\n const gbl = (obj || GLOBAL_OBJ) as InternalGlobal;\n const __SENTRY__ = (gbl.__SENTRY__ = gbl.__SENTRY__ || {});\n const versionedCarrier = (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n return versionedCarrier[name] || (versionedCarrier[name] = creator());\n}\n","declare const __DEBUG_BUILD__: boolean;\n\n/**\n * This serves as a build time flag that will be true by default, but false in non-debug builds or if users replace `__SENTRY_DEBUG__` in their generated code.\n *\n * ATTENTION: This constant must never cross package boundaries (i.e. be exported) to guarantee that it can be used for tree shaking.\n */\nexport const DEBUG_BUILD = __DEBUG_BUILD__;\n","import type { ConsoleLevel } from '@sentry/types';\n\nimport { DEBUG_BUILD } from './debug-build';\nimport { GLOBAL_OBJ, getGlobalSingleton } from './worldwide';\n\n/** Prefix for logging strings */\nconst PREFIX = 'Sentry Logger ';\n\nexport const CONSOLE_LEVELS: readonly ConsoleLevel[] = [\n 'debug',\n 'info',\n 'warn',\n 'error',\n 'log',\n 'assert',\n 'trace',\n] as const;\n\ntype LoggerMethod = (...args: unknown[]) => void;\ntype LoggerConsoleMethods = Record;\n\n/** This may be mutated by the console instrumentation. */\nexport const originalConsoleMethods: {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n [key in ConsoleLevel]?: (...args: any[]) => void;\n} = {};\n\n/** JSDoc */\ninterface Logger extends LoggerConsoleMethods {\n disable(): void;\n enable(): void;\n isEnabled(): boolean;\n}\n\n/**\n * Temporarily disable sentry console instrumentations.\n *\n * @param callback The function to run against the original `console` messages\n * @returns The results of the callback\n */\nexport function consoleSandbox(callback: () => T): T {\n if (!('console' in GLOBAL_OBJ)) {\n return callback();\n }\n\n const console = GLOBAL_OBJ.console as Console;\n const wrappedFuncs: Partial = {};\n\n const wrappedLevels = Object.keys(originalConsoleMethods) as ConsoleLevel[];\n\n // Restore all wrapped console methods\n wrappedLevels.forEach(level => {\n const originalConsoleMethod = originalConsoleMethods[level] as LoggerMethod;\n wrappedFuncs[level] = console[level] as LoggerMethod | undefined;\n console[level] = originalConsoleMethod;\n });\n\n try {\n return callback();\n } finally {\n // Revert restoration to wrapped state\n wrappedLevels.forEach(level => {\n console[level] = wrappedFuncs[level] as LoggerMethod;\n });\n }\n}\n\nfunction makeLogger(): Logger {\n let enabled = false;\n const logger: Partial = {\n enable: () => {\n enabled = true;\n },\n disable: () => {\n enabled = false;\n },\n isEnabled: () => enabled,\n };\n\n if (DEBUG_BUILD) {\n CONSOLE_LEVELS.forEach(name => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n logger[name] = (...args: any[]) => {\n if (enabled) {\n consoleSandbox(() => {\n GLOBAL_OBJ.console[name](`${PREFIX}[${name}]:`, ...args);\n });\n }\n };\n });\n } else {\n CONSOLE_LEVELS.forEach(name => {\n logger[name] = () => undefined;\n });\n }\n\n return logger as Logger;\n}\n\n/**\n * This is a logger singleton which either logs things or no-ops if logging is not enabled.\n * The logger is a singleton on the carrier, to ensure that a consistent logger is used throughout the SDK.\n */\nexport const logger = getGlobalSingleton('logger', makeLogger);\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { WrappedFunction } from '@sentry/types';\n\nimport { htmlTreeAsString } from './browser';\nimport { DEBUG_BUILD } from './debug-build';\nimport { isElement, isError, isEvent, isInstanceOf, isPlainObject, isPrimitive } from './is';\nimport { logger } from './logger';\nimport { truncate } from './string';\n\n/**\n * Replace a method in an object with a wrapped version of itself.\n *\n * @param source An object that contains a method to be wrapped.\n * @param name The name of the method to be wrapped.\n * @param replacementFactory A higher-order function that takes the original version of the given method and returns a\n * wrapped version. Note: The function returned by `replacementFactory` needs to be a non-arrow function, in order to\n * preserve the correct value of `this`, and the original method must be called using `origMethod.call(this, )` or `origMethod.apply(this, [])` (rather than being called directly), again to preserve `this`.\n * @returns void\n */\nexport function fill(source: { [key: string]: any }, name: string, replacementFactory: (...args: any[]) => any): void {\n if (!(name in source)) {\n return;\n }\n\n const original = source[name] as () => any;\n const wrapped = replacementFactory(original) as WrappedFunction;\n\n // Make sure it's a function first, as we need to attach an empty prototype for `defineProperties` to work\n // otherwise it'll throw \"TypeError: Object.defineProperties called on non-object\"\n if (typeof wrapped === 'function') {\n markFunctionWrapped(wrapped, original);\n }\n\n source[name] = wrapped;\n}\n\n/**\n * Defines a non-enumerable property on the given object.\n *\n * @param obj The object on which to set the property\n * @param name The name of the property to be set\n * @param value The value to which to set the property\n */\nexport function addNonEnumerableProperty(obj: object, name: string, value: unknown): void {\n try {\n Object.defineProperty(obj, name, {\n // enumerable: false, // the default, so we can save on bundle size by not explicitly setting it\n value: value,\n writable: true,\n configurable: true,\n });\n } catch (o_O) {\n DEBUG_BUILD && logger.log(`Failed to add non-enumerable property \"${name}\" to object`, obj);\n }\n}\n\n/**\n * Remembers the original function on the wrapped function and\n * patches up the prototype.\n *\n * @param wrapped the wrapper function\n * @param original the original function that gets wrapped\n */\nexport function markFunctionWrapped(wrapped: WrappedFunction, original: WrappedFunction): void {\n try {\n const proto = original.prototype || {};\n wrapped.prototype = original.prototype = proto;\n addNonEnumerableProperty(wrapped, '__sentry_original__', original);\n } catch (o_O) {} // eslint-disable-line no-empty\n}\n\n/**\n * This extracts the original function if available. See\n * `markFunctionWrapped` for more information.\n *\n * @param func the function to unwrap\n * @returns the unwrapped version of the function if available.\n */\nexport function getOriginalFunction(func: WrappedFunction): WrappedFunction | undefined {\n return func.__sentry_original__;\n}\n\n/**\n * Encodes given object into url-friendly format\n *\n * @param object An object that contains serializable values\n * @returns string Encoded\n */\nexport function urlEncode(object: { [key: string]: any }): string {\n return Object.keys(object)\n .map(key => `${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`)\n .join('&');\n}\n\n/**\n * Transforms any `Error` or `Event` into a plain object with all of their enumerable properties, and some of their\n * non-enumerable properties attached.\n *\n * @param value Initial source that we have to transform in order for it to be usable by the serializer\n * @returns An Event or Error turned into an object - or the value argument itself, when value is neither an Event nor\n * an Error.\n */\nexport function convertToPlainObject(\n value: V,\n):\n | {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n }\n | {\n [ownProps: string]: unknown;\n message: string;\n name: string;\n stack?: string;\n }\n | V {\n if (isError(value)) {\n return {\n message: value.message,\n name: value.name,\n stack: value.stack,\n ...getOwnProperties(value),\n };\n } else if (isEvent(value)) {\n const newObj: {\n [ownProps: string]: unknown;\n type: string;\n target: string;\n currentTarget: string;\n detail?: unknown;\n } = {\n type: value.type,\n target: serializeEventTarget(value.target),\n currentTarget: serializeEventTarget(value.currentTarget),\n ...getOwnProperties(value),\n };\n\n if (typeof CustomEvent !== 'undefined' && isInstanceOf(value, CustomEvent)) {\n newObj.detail = value.detail;\n }\n\n return newObj;\n } else {\n return value;\n }\n}\n\n/** Creates a string representation of the target of an `Event` object */\nfunction serializeEventTarget(target: unknown): string {\n try {\n return isElement(target) ? htmlTreeAsString(target) : Object.prototype.toString.call(target);\n } catch (_oO) {\n return '';\n }\n}\n\n/** Filters out all but an object's own properties */\nfunction getOwnProperties(obj: unknown): { [key: string]: unknown } {\n if (typeof obj === 'object' && obj !== null) {\n const extractedProps: { [key: string]: unknown } = {};\n for (const property in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, property)) {\n extractedProps[property] = (obj as Record)[property];\n }\n }\n return extractedProps;\n } else {\n return {};\n }\n}\n\n/**\n * Given any captured exception, extract its keys and create a sorted\n * and truncated list that will be used inside the event message.\n * eg. `Non-error exception captured with keys: foo, bar, baz`\n */\nexport function extractExceptionKeysForMessage(exception: Record, maxLength: number = 40): string {\n const keys = Object.keys(convertToPlainObject(exception));\n keys.sort();\n\n const firstKey = keys[0];\n\n if (!firstKey) {\n return '[object has no keys]';\n }\n\n if (firstKey.length >= maxLength) {\n return truncate(firstKey, maxLength);\n }\n\n for (let includedKeys = keys.length; includedKeys > 0; includedKeys--) {\n const serialized = keys.slice(0, includedKeys).join(', ');\n if (serialized.length > maxLength) {\n continue;\n }\n if (includedKeys === keys.length) {\n return serialized;\n }\n return truncate(serialized, maxLength);\n }\n\n return '';\n}\n\n/**\n * Given any object, return a new object having removed all fields whose value was `undefined`.\n * Works recursively on objects and arrays.\n *\n * Attention: This function keeps circular references in the returned object.\n */\nexport function dropUndefinedKeys(inputValue: T): T {\n // This map keeps track of what already visited nodes map to.\n // Our Set - based memoBuilder doesn't work here because we want to the output object to have the same circular\n // references as the input object.\n const memoizationMap = new Map();\n\n // This function just proxies `_dropUndefinedKeys` to keep the `memoBuilder` out of this function's API\n return _dropUndefinedKeys(inputValue, memoizationMap);\n}\n\nfunction _dropUndefinedKeys(inputValue: T, memoizationMap: Map): T {\n if (isPojo(inputValue)) {\n // If this node has already been visited due to a circular reference, return the object it was mapped to in the new object\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal as T;\n }\n\n const returnValue: { [key: string]: any } = {};\n // Store the mapping of this value in case we visit it again, in case of circular data\n memoizationMap.set(inputValue, returnValue);\n\n for (const key of Object.getOwnPropertyNames(inputValue)) {\n if (typeof inputValue[key] !== 'undefined') {\n returnValue[key] = _dropUndefinedKeys(inputValue[key], memoizationMap);\n }\n }\n\n return returnValue as T;\n }\n\n if (Array.isArray(inputValue)) {\n // If this node has already been visited due to a circular reference, return the array it was mapped to in the new object\n const memoVal = memoizationMap.get(inputValue);\n if (memoVal !== undefined) {\n return memoVal as T;\n }\n\n const returnValue: unknown[] = [];\n // Store the mapping of this value in case we visit it again, in case of circular data\n memoizationMap.set(inputValue, returnValue);\n\n inputValue.forEach((item: unknown) => {\n returnValue.push(_dropUndefinedKeys(item, memoizationMap));\n });\n\n return returnValue as unknown as T;\n }\n\n return inputValue;\n}\n\nfunction isPojo(input: unknown): input is Record {\n if (!isPlainObject(input)) {\n return false;\n }\n\n try {\n const name = (Object.getPrototypeOf(input) as { constructor: { name: string } }).constructor.name;\n return !name || name === 'Object';\n } catch {\n return true;\n }\n}\n\n/**\n * Ensure that something is an object.\n *\n * Turns `undefined` and `null` into `String`s and all other primitives into instances of their respective wrapper\n * classes (String, Boolean, Number, etc.). Acts as the identity function on non-primitives.\n *\n * @param wat The subject of the objectification\n * @returns A version of `wat` which can safely be used with `Object` class methods\n */\nexport function objectify(wat: unknown): typeof Object {\n let objectified;\n switch (true) {\n case wat === undefined || wat === null:\n objectified = new String(wat);\n break;\n\n // Though symbols and bigints do have wrapper classes (`Symbol` and `BigInt`, respectively), for whatever reason\n // those classes don't have constructors which can be used with the `new` keyword. We therefore need to cast each as\n // an object in order to wrap it.\n case typeof wat === 'symbol' || typeof wat === 'bigint':\n objectified = Object(wat);\n break;\n\n // this will catch the remaining primitives: `String`, `Number`, and `Boolean`\n case isPrimitive(wat):\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n objectified = new (wat as any).constructor(wat);\n break;\n\n // by process of elimination, at this point we know that `wat` must already be an object\n default:\n objectified = wat;\n break;\n }\n return objectified;\n}\n","import { GLOBAL_OBJ } from './worldwide';\n\nconst ONE_SECOND_IN_MS = 1000;\n\n/**\n * A partial definition of the [Performance Web API]{@link https://developer.mozilla.org/en-US/docs/Web/API/Performance}\n * for accessing a high-resolution monotonic clock.\n */\ninterface Performance {\n /**\n * The millisecond timestamp at which measurement began, measured in Unix time.\n */\n timeOrigin: number;\n /**\n * Returns the current millisecond timestamp, where 0 represents the start of measurement.\n */\n now(): number;\n}\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using the Date API.\n *\n * TODO(v8): Return type should be rounded.\n */\nexport function dateTimestampInSeconds(): number {\n return Date.now() / ONE_SECOND_IN_MS;\n}\n\n/**\n * Returns a wrapper around the native Performance API browser implementation, or undefined for browsers that do not\n * support the API.\n *\n * Wrapping the native API works around differences in behavior from different browsers.\n */\nfunction createUnixTimestampInSecondsFunc(): () => number {\n const { performance } = GLOBAL_OBJ as typeof GLOBAL_OBJ & { performance?: Performance };\n if (!performance || !performance.now) {\n return dateTimestampInSeconds;\n }\n\n // Some browser and environments don't have a timeOrigin, so we fallback to\n // using Date.now() to compute the starting time.\n const approxStartingTimeOrigin = Date.now() - performance.now();\n const timeOrigin = performance.timeOrigin == undefined ? approxStartingTimeOrigin : performance.timeOrigin;\n\n // performance.now() is a monotonic clock, which means it starts at 0 when the process begins. To get the current\n // wall clock time (actual UNIX timestamp), we need to add the starting time origin and the current time elapsed.\n //\n // TODO: This does not account for the case where the monotonic clock that powers performance.now() drifts from the\n // wall clock time, which causes the returned timestamp to be inaccurate. We should investigate how to detect and\n // correct for this.\n // See: https://github.com/getsentry/sentry-javascript/issues/2590\n // See: https://github.com/mdn/content/issues/4713\n // See: https://dev.to/noamr/when-a-millisecond-is-not-a-millisecond-3h6\n return () => {\n return (timeOrigin + performance.now()) / ONE_SECOND_IN_MS;\n };\n}\n\n/**\n * Returns a timestamp in seconds since the UNIX epoch using either the Performance or Date APIs, depending on the\n * availability of the Performance API.\n *\n * BUG: Note that because of how browsers implement the Performance API, the clock might stop when the computer is\n * asleep. This creates a skew between `dateTimestampInSeconds` and `timestampInSeconds`. The\n * skew can grow to arbitrary amounts like days, weeks or months.\n * See https://github.com/getsentry/sentry-javascript/issues/2590.\n */\nexport const timestampInSeconds = createUnixTimestampInSecondsFunc();\n\n/**\n * Internal helper to store what is the source of browserPerformanceTimeOrigin below. For debugging only.\n */\nexport let _browserPerformanceTimeOriginMode: string;\n\n/**\n * The number of milliseconds since the UNIX epoch. This value is only usable in a browser, and only when the\n * performance API is available.\n */\nexport const browserPerformanceTimeOrigin = ((): number | undefined => {\n // Unfortunately browsers may report an inaccurate time origin data, through either performance.timeOrigin or\n // performance.timing.navigationStart, which results in poor results in performance data. We only treat time origin\n // data as reliable if they are within a reasonable threshold of the current time.\n\n const { performance } = GLOBAL_OBJ as typeof GLOBAL_OBJ & Window;\n if (!performance || !performance.now) {\n _browserPerformanceTimeOriginMode = 'none';\n return undefined;\n }\n\n const threshold = 3600 * 1000;\n const performanceNow = performance.now();\n const dateNow = Date.now();\n\n // if timeOrigin isn't available set delta to threshold so it isn't used\n const timeOriginDelta = performance.timeOrigin\n ? Math.abs(performance.timeOrigin + performanceNow - dateNow)\n : threshold;\n const timeOriginIsReliable = timeOriginDelta < threshold;\n\n // While performance.timing.navigationStart is deprecated in favor of performance.timeOrigin, performance.timeOrigin\n // is not as widely supported. Namely, performance.timeOrigin is undefined in Safari as of writing.\n // Also as of writing, performance.timing is not available in Web Workers in mainstream browsers, so it is not always\n // a valid fallback. In the absence of an initial time provided by the browser, fallback to the current time from the\n // Date API.\n // eslint-disable-next-line deprecation/deprecation\n const navigationStart = performance.timing && performance.timing.navigationStart;\n const hasNavigationStart = typeof navigationStart === 'number';\n // if navigationStart isn't available set delta to threshold so it isn't used\n const navigationStartDelta = hasNavigationStart ? Math.abs(navigationStart + performanceNow - dateNow) : threshold;\n const navigationStartIsReliable = navigationStartDelta < threshold;\n\n if (timeOriginIsReliable || navigationStartIsReliable) {\n // Use the more reliable time origin\n if (timeOriginDelta <= navigationStartDelta) {\n _browserPerformanceTimeOriginMode = 'timeOrigin';\n return performance.timeOrigin;\n } else {\n _browserPerformanceTimeOriginMode = 'navigationStart';\n return navigationStart;\n }\n }\n\n // Either both timeOrigin and navigationStart are skewed or neither is available, fallback to Date.\n _browserPerformanceTimeOriginMode = 'dateNow';\n return dateNow;\n})();\n","/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Event, Exception, Mechanism, StackFrame } from '@sentry/types';\n\nimport { addNonEnumerableProperty } from './object';\nimport { snipLine } from './string';\nimport { GLOBAL_OBJ } from './worldwide';\n\ninterface CryptoInternal {\n getRandomValues(array: Uint8Array): Uint8Array;\n randomUUID?(): string;\n}\n\n/** An interface for common properties on global */\ninterface CryptoGlobal {\n msCrypto?: CryptoInternal;\n crypto?: CryptoInternal;\n}\n\n/**\n * UUID4 generator\n *\n * @returns string Generated UUID4.\n */\nexport function uuid4(): string {\n const gbl = GLOBAL_OBJ as typeof GLOBAL_OBJ & CryptoGlobal;\n const crypto = gbl.crypto || gbl.msCrypto;\n\n let getRandomByte = (): number => Math.random() * 16;\n try {\n if (crypto && crypto.randomUUID) {\n return crypto.randomUUID().replace(/-/g, '');\n }\n if (crypto && crypto.getRandomValues) {\n getRandomByte = () => {\n // crypto.getRandomValues might return undefined instead of the typed array\n // in old Chromium versions (e.g. 23.0.1235.0 (151422))\n // However, `typedArray` is still filled in-place.\n // @see https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues#typedarray\n const typedArray = new Uint8Array(1);\n crypto.getRandomValues(typedArray);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return typedArray[0]!;\n };\n }\n } catch (_) {\n // some runtimes can crash invoking crypto\n // https://github.com/getsentry/sentry-javascript/issues/8935\n }\n\n // http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/2117523#2117523\n // Concatenating the following numbers as strings results in '10000000100040008000100000000000'\n return (([1e7] as unknown as string) + 1e3 + 4e3 + 8e3 + 1e11).replace(/[018]/g, c =>\n // eslint-disable-next-line no-bitwise\n ((c as unknown as number) ^ ((getRandomByte() & 15) >> ((c as unknown as number) / 4))).toString(16),\n );\n}\n\nfunction getFirstException(event: Event): Exception | undefined {\n return event.exception && event.exception.values ? event.exception.values[0] : undefined;\n}\n\n/**\n * Extracts either message or type+value from an event that can be used for user-facing logs\n * @returns event's description\n */\nexport function getEventDescription(event: Event): string {\n const { message, event_id: eventId } = event;\n if (message) {\n return message;\n }\n\n const firstException = getFirstException(event);\n if (firstException) {\n if (firstException.type && firstException.value) {\n return `${firstException.type}: ${firstException.value}`;\n }\n return firstException.type || firstException.value || eventId || '';\n }\n return eventId || '';\n}\n\n/**\n * Adds exception values, type and value to an synthetic Exception.\n * @param event The event to modify.\n * @param value Value of the exception.\n * @param type Type of the exception.\n * @hidden\n */\nexport function addExceptionTypeValue(event: Event, value?: string, type?: string): void {\n const exception = (event.exception = event.exception || {});\n const values = (exception.values = exception.values || []);\n const firstException = (values[0] = values[0] || {});\n if (!firstException.value) {\n firstException.value = value || '';\n }\n if (!firstException.type) {\n firstException.type = type || 'Error';\n }\n}\n\n/**\n * Adds exception mechanism data to a given event. Uses defaults if the second parameter is not passed.\n *\n * @param event The event to modify.\n * @param newMechanism Mechanism data to add to the event.\n * @hidden\n */\nexport function addExceptionMechanism(event: Event, newMechanism?: Partial): void {\n const firstException = getFirstException(event);\n if (!firstException) {\n return;\n }\n\n const defaultMechanism = { type: 'generic', handled: true };\n const currentMechanism = firstException.mechanism;\n firstException.mechanism = { ...defaultMechanism, ...currentMechanism, ...newMechanism };\n\n if (newMechanism && 'data' in newMechanism) {\n const mergedData = { ...(currentMechanism && currentMechanism.data), ...newMechanism.data };\n firstException.mechanism.data = mergedData;\n }\n}\n\n// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\nconst SEMVER_REGEXP =\n /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$/;\n\n/**\n * Represents Semantic Versioning object\n */\ninterface SemVer {\n major?: number;\n minor?: number;\n patch?: number;\n prerelease?: string;\n buildmetadata?: string;\n}\n\nfunction _parseInt(input: string | undefined): number {\n return parseInt(input || '', 10);\n}\n\n/**\n * Parses input into a SemVer interface\n * @param input string representation of a semver version\n */\nexport function parseSemver(input: string): SemVer {\n const match = input.match(SEMVER_REGEXP) || [];\n const major = _parseInt(match[1]);\n const minor = _parseInt(match[2]);\n const patch = _parseInt(match[3]);\n return {\n buildmetadata: match[5],\n major: isNaN(major) ? undefined : major,\n minor: isNaN(minor) ? undefined : minor,\n patch: isNaN(patch) ? undefined : patch,\n prerelease: match[4],\n };\n}\n\n/**\n * This function adds context (pre/post/line) lines to the provided frame\n *\n * @param lines string[] containing all lines\n * @param frame StackFrame that will be mutated\n * @param linesOfContext number of context lines we want to add pre/post\n */\nexport function addContextToFrame(lines: string[], frame: StackFrame, linesOfContext: number = 5): void {\n // When there is no line number in the frame, attaching context is nonsensical and will even break grouping\n if (frame.lineno === undefined) {\n return;\n }\n\n const maxLines = lines.length;\n const sourceLine = Math.max(Math.min(maxLines - 1, frame.lineno - 1), 0);\n\n frame.pre_context = lines\n .slice(Math.max(0, sourceLine - linesOfContext), sourceLine)\n .map((line: string) => snipLine(line, 0));\n\n // We guard here to ensure this is not larger than the existing number of lines\n const lineIndex = Math.min(maxLines - 1, sourceLine);\n\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n frame.context_line = snipLine(lines[lineIndex]!, frame.colno || 0);\n\n frame.post_context = lines\n .slice(Math.min(sourceLine + 1, maxLines), sourceLine + 1 + linesOfContext)\n .map((line: string) => snipLine(line, 0));\n}\n\n/**\n * Checks whether or not we've already captured the given exception (note: not an identical exception - the very object\n * in question), and marks it captured if not.\n *\n * This is useful because it's possible for an error to get captured by more than one mechanism. After we intercept and\n * record an error, we rethrow it (assuming we've intercepted it before it's reached the top-level global handlers), so\n * that we don't interfere with whatever effects the error might have had were the SDK not there. At that point, because\n * the error has been rethrown, it's possible for it to bubble up to some other code we've instrumented. If it's not\n * caught after that, it will bubble all the way up to the global handlers (which of course we also instrument). This\n * function helps us ensure that even if we encounter the same error more than once, we only record it the first time we\n * see it.\n *\n * Note: It will ignore primitives (always return `false` and not mark them as seen), as properties can't be set on\n * them. {@link: Object.objectify} can be used on exceptions to convert any that are primitives into their equivalent\n * object wrapper forms so that this check will always work. However, because we need to flag the exact object which\n * will get rethrown, and because that rethrowing happens outside of the event processing pipeline, the objectification\n * must be done before the exception captured.\n *\n * @param A thrown exception to check or flag as having been seen\n * @returns `true` if the exception has already been captured, `false` if not (with the side effect of marking it seen)\n */\nexport function checkOrSetAlreadyCaught(exception: unknown): boolean {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (exception && (exception as any).__sentry_captured__) {\n return true;\n }\n\n try {\n // set it this way rather than by assignment so that it's not ennumerable and therefore isn't recorded by the\n // `ExtraErrorData` integration\n addNonEnumerableProperty(exception as { [key: string]: unknown }, '__sentry_captured__', true);\n } catch (err) {\n // `exception` is a primitive, so we can't mark it seen\n }\n\n return false;\n}\n\n/**\n * Checks whether the given input is already an array, and if it isn't, wraps it in one.\n *\n * @param maybeArray Input to turn into an array, if necessary\n * @returns The input, if already an array, or an array with the input as the only element, if not\n */\nexport function arrayify(maybeArray: T | T[]): T[] {\n return Array.isArray(maybeArray) ? maybeArray : [maybeArray];\n}\n","import type { PropagationContext } from '@sentry/types';\nimport { uuid4 } from './misc';\n\n/**\n * Returns a new minimal propagation context\n */\nexport function generatePropagationContext(): PropagationContext {\n return {\n traceId: uuid4(),\n spanId: uuid4().substring(16),\n };\n}\n","import type { Client, Integration, MetricsAggregator, Scope } from '@sentry/types';\nimport { GLOBAL_OBJ, SDK_VERSION } from '@sentry/utils';\nimport type { AsyncContextStack } from './asyncContext/stackStrategy';\nimport type { AsyncContextStrategy } from './asyncContext/types';\n\n/**\n * An object that contains globally accessible properties and maintains a scope stack.\n * @hidden\n */\nexport interface Carrier {\n __SENTRY__?: VersionedCarrier;\n}\n\ntype VersionedCarrier = {\n version?: string;\n} & Record, SentryCarrier>;\n\ninterface SentryCarrier {\n acs?: AsyncContextStrategy;\n stack?: AsyncContextStack;\n\n globalScope?: Scope;\n defaultIsolationScope?: Scope;\n defaultCurrentScope?: Scope;\n globalMetricsAggregators?: WeakMap | undefined;\n\n // TODO(v9): Remove these properties - they are no longer used and were left over in v8\n integrations?: Integration[];\n extensions?: {\n // eslint-disable-next-line @typescript-eslint/ban-types\n [key: string]: Function;\n };\n}\n\n/**\n * Returns the global shim registry.\n *\n * FIXME: This function is problematic, because despite always returning a valid Carrier,\n * it has an optional `__SENTRY__` property, which then in turn requires us to always perform an unnecessary check\n * at the call-site. We always access the carrier through this function, so we can guarantee that `__SENTRY__` is there.\n **/\nexport function getMainCarrier(): Carrier {\n // This ensures a Sentry carrier exists\n getSentryCarrier(GLOBAL_OBJ);\n return GLOBAL_OBJ;\n}\n\n/** Will either get the existing sentry carrier, or create a new one. */\nexport function getSentryCarrier(carrier: Carrier): SentryCarrier {\n const __SENTRY__ = (carrier.__SENTRY__ = carrier.__SENTRY__ || {});\n\n // For now: First SDK that sets the .version property wins\n __SENTRY__.version = __SENTRY__.version || SDK_VERSION;\n\n // Intentionally populating and returning the version of \"this\" SDK instance\n // rather than what's set in .version so that \"this\" SDK always gets its carrier\n return (__SENTRY__[SDK_VERSION] = __SENTRY__[SDK_VERSION] || {});\n}\n","import type { SerializedSession, Session, SessionContext, SessionStatus } from '@sentry/types';\nimport { dropUndefinedKeys, timestampInSeconds, uuid4 } from '@sentry/utils';\n/**\n * Creates a new `Session` object by setting certain default parameters. If optional @param context\n * is passed, the passed properties are applied to the session object.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns a new `Session` object\n */\nexport function makeSession(context?: Omit): Session {\n // Both timestamp and started are in seconds since the UNIX epoch.\n const startingTime = timestampInSeconds();\n\n const session: Session = {\n sid: uuid4(),\n init: true,\n timestamp: startingTime,\n started: startingTime,\n duration: 0,\n status: 'ok',\n errors: 0,\n ignoreDuration: false,\n toJSON: () => sessionToJSON(session),\n };\n\n if (context) {\n updateSession(session, context);\n }\n\n return session;\n}\n\n/**\n * Updates a session object with the properties passed in the context.\n *\n * Note that this function mutates the passed object and returns void.\n * (Had to do this instead of returning a new and updated session because closing and sending a session\n * makes an update to the session after it was passed to the sending logic.\n * @see BaseClient.captureSession )\n *\n * @param session the `Session` to update\n * @param context the `SessionContext` holding the properties that should be updated in @param session\n */\n// eslint-disable-next-line complexity\nexport function updateSession(session: Session, context: SessionContext = {}): void {\n if (context.user) {\n if (!session.ipAddress && context.user.ip_address) {\n session.ipAddress = context.user.ip_address;\n }\n\n if (!session.did && !context.did) {\n session.did = context.user.id || context.user.email || context.user.username;\n }\n }\n\n session.timestamp = context.timestamp || timestampInSeconds();\n\n if (context.abnormal_mechanism) {\n session.abnormal_mechanism = context.abnormal_mechanism;\n }\n\n if (context.ignoreDuration) {\n session.ignoreDuration = context.ignoreDuration;\n }\n if (context.sid) {\n // Good enough uuid validation. — Kamil\n session.sid = context.sid.length === 32 ? context.sid : uuid4();\n }\n if (context.init !== undefined) {\n session.init = context.init;\n }\n if (!session.did && context.did) {\n session.did = `${context.did}`;\n }\n if (typeof context.started === 'number') {\n session.started = context.started;\n }\n if (session.ignoreDuration) {\n session.duration = undefined;\n } else if (typeof context.duration === 'number') {\n session.duration = context.duration;\n } else {\n const duration = session.timestamp - session.started;\n session.duration = duration >= 0 ? duration : 0;\n }\n if (context.release) {\n session.release = context.release;\n }\n if (context.environment) {\n session.environment = context.environment;\n }\n if (!session.ipAddress && context.ipAddress) {\n session.ipAddress = context.ipAddress;\n }\n if (!session.userAgent && context.userAgent) {\n session.userAgent = context.userAgent;\n }\n if (typeof context.errors === 'number') {\n session.errors = context.errors;\n }\n if (context.status) {\n session.status = context.status;\n }\n}\n\n/**\n * Closes a session by setting its status and updating the session object with it.\n * Internally calls `updateSession` to update the passed session object.\n *\n * Note that this function mutates the passed session (@see updateSession for explanation).\n *\n * @param session the `Session` object to be closed\n * @param status the `SessionStatus` with which the session was closed. If you don't pass a status,\n * this function will keep the previously set status, unless it was `'ok'` in which case\n * it is changed to `'exited'`.\n */\nexport function closeSession(session: Session, status?: Exclude): void {\n let context = {};\n if (status) {\n context = { status };\n } else if (session.status === 'ok') {\n context = { status: 'exited' };\n }\n\n updateSession(session, context);\n}\n\n/**\n * Serializes a passed session object to a JSON object with a slightly different structure.\n * This is necessary because the Sentry backend requires a slightly different schema of a session\n * than the one the JS SDKs use internally.\n *\n * @param session the session to be converted\n *\n * @returns a JSON object of the passed session\n */\nfunction sessionToJSON(session: Session): SerializedSession {\n return dropUndefinedKeys({\n sid: `${session.sid}`,\n init: session.init,\n // Make sure that sec is converted to ms for date constructor\n started: new Date(session.started * 1000).toISOString(),\n timestamp: new Date(session.timestamp * 1000).toISOString(),\n status: session.status,\n errors: session.errors,\n did: typeof session.did === 'number' || typeof session.did === 'string' ? `${session.did}` : undefined,\n duration: session.duration,\n abnormal_mechanism: session.abnormal_mechanism,\n attrs: {\n release: session.release,\n environment: session.environment,\n ip_address: session.ipAddress,\n user_agent: session.userAgent,\n },\n });\n}\n","import type { Scope, Span } from '@sentry/types';\nimport { addNonEnumerableProperty } from '@sentry/utils';\n\nconst SCOPE_SPAN_FIELD = '_sentrySpan';\n\ntype ScopeWithMaybeSpan = Scope & {\n [SCOPE_SPAN_FIELD]?: Span;\n};\n\n/**\n * Set the active span for a given scope.\n * NOTE: This should NOT be used directly, but is only used internally by the trace methods.\n */\nexport function _setSpanForScope(scope: Scope, span: Span | undefined): void {\n if (span) {\n addNonEnumerableProperty(scope as ScopeWithMaybeSpan, SCOPE_SPAN_FIELD, span);\n } else {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete (scope as ScopeWithMaybeSpan)[SCOPE_SPAN_FIELD];\n }\n}\n\n/**\n * Get the active span for a given scope.\n * NOTE: This should NOT be used directly, but is only used internally by the trace methods.\n */\nexport function _getSpanForScope(scope: ScopeWithMaybeSpan): Span | undefined {\n return scope[SCOPE_SPAN_FIELD];\n}\n","/* eslint-disable max-lines */\nimport type {\n Attachment,\n Breadcrumb,\n CaptureContext,\n Client,\n Context,\n Contexts,\n Event,\n EventHint,\n EventProcessor,\n Extra,\n Extras,\n Primitive,\n PropagationContext,\n RequestSession,\n Scope as ScopeInterface,\n ScopeContext,\n ScopeData,\n Session,\n SeverityLevel,\n User,\n} from '@sentry/types';\nimport { dateTimestampInSeconds, generatePropagationContext, isPlainObject, logger, uuid4 } from '@sentry/utils';\n\nimport { updateSession } from './session';\nimport { _getSpanForScope, _setSpanForScope } from './utils/spanOnScope';\n\n/**\n * Default value for maximum number of breadcrumbs added to an event.\n */\nconst DEFAULT_MAX_BREADCRUMBS = 100;\n\n/**\n * Holds additional event information.\n */\nclass ScopeClass implements ScopeInterface {\n /** Flag if notifying is happening. */\n protected _notifyingListeners: boolean;\n\n /** Callback for client to receive scope changes. */\n protected _scopeListeners: Array<(scope: Scope) => void>;\n\n /** Callback list that will be called during event processing. */\n protected _eventProcessors: EventProcessor[];\n\n /** Array of breadcrumbs. */\n protected _breadcrumbs: Breadcrumb[];\n\n /** User */\n protected _user: User;\n\n /** Tags */\n protected _tags: { [key: string]: Primitive };\n\n /** Extra */\n protected _extra: Extras;\n\n /** Contexts */\n protected _contexts: Contexts;\n\n /** Attachments */\n protected _attachments: Attachment[];\n\n /** Propagation Context for distributed tracing */\n protected _propagationContext: PropagationContext;\n\n /**\n * A place to stash data which is needed at some point in the SDK's event processing pipeline but which shouldn't get\n * sent to Sentry\n */\n protected _sdkProcessingMetadata: { [key: string]: unknown };\n\n /** Fingerprint */\n protected _fingerprint?: string[];\n\n /** Severity */\n protected _level?: SeverityLevel;\n\n /**\n * Transaction Name\n *\n * IMPORTANT: The transaction name on the scope has nothing to do with root spans/transaction objects.\n * It's purpose is to assign a transaction to the scope that's added to non-transaction events.\n */\n protected _transactionName?: string;\n\n /** Session */\n protected _session?: Session;\n\n /** Request Mode Session Status */\n protected _requestSession?: RequestSession;\n\n /** The client on this scope */\n protected _client?: Client;\n\n /** Contains the last event id of a captured event. */\n protected _lastEventId?: string;\n\n // NOTE: Any field which gets added here should get added not only to the constructor but also to the `clone` method.\n\n public constructor() {\n this._notifyingListeners = false;\n this._scopeListeners = [];\n this._eventProcessors = [];\n this._breadcrumbs = [];\n this._attachments = [];\n this._user = {};\n this._tags = {};\n this._extra = {};\n this._contexts = {};\n this._sdkProcessingMetadata = {};\n this._propagationContext = generatePropagationContext();\n }\n\n /**\n * @inheritDoc\n */\n public clone(): ScopeClass {\n const newScope = new ScopeClass();\n newScope._breadcrumbs = [...this._breadcrumbs];\n newScope._tags = { ...this._tags };\n newScope._extra = { ...this._extra };\n newScope._contexts = { ...this._contexts };\n newScope._user = this._user;\n newScope._level = this._level;\n newScope._session = this._session;\n newScope._transactionName = this._transactionName;\n newScope._fingerprint = this._fingerprint;\n newScope._eventProcessors = [...this._eventProcessors];\n newScope._requestSession = this._requestSession;\n newScope._attachments = [...this._attachments];\n newScope._sdkProcessingMetadata = { ...this._sdkProcessingMetadata };\n newScope._propagationContext = { ...this._propagationContext };\n newScope._client = this._client;\n newScope._lastEventId = this._lastEventId;\n\n _setSpanForScope(newScope, _getSpanForScope(this));\n\n return newScope;\n }\n\n /**\n * @inheritDoc\n */\n public setClient(client: Client | undefined): void {\n this._client = client;\n }\n\n /**\n * @inheritDoc\n */\n public setLastEventId(lastEventId: string | undefined): void {\n this._lastEventId = lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public getClient(): C | undefined {\n return this._client as C | undefined;\n }\n\n /**\n * @inheritDoc\n */\n public lastEventId(): string | undefined {\n return this._lastEventId;\n }\n\n /**\n * @inheritDoc\n */\n public addScopeListener(callback: (scope: Scope) => void): void {\n this._scopeListeners.push(callback);\n }\n\n /**\n * @inheritDoc\n */\n public addEventProcessor(callback: EventProcessor): this {\n this._eventProcessors.push(callback);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setUser(user: User | null): this {\n // If null is passed we want to unset everything, but still define keys,\n // so that later down in the pipeline any existing values are cleared.\n this._user = user || {\n email: undefined,\n id: undefined,\n ip_address: undefined,\n username: undefined,\n };\n\n if (this._session) {\n updateSession(this._session, { user });\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getUser(): User | undefined {\n return this._user;\n }\n\n /**\n * @inheritDoc\n */\n public getRequestSession(): RequestSession | undefined {\n return this._requestSession;\n }\n\n /**\n * @inheritDoc\n */\n public setRequestSession(requestSession?: RequestSession): this {\n this._requestSession = requestSession;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTags(tags: { [key: string]: Primitive }): this {\n this._tags = {\n ...this._tags,\n ...tags,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTag(key: string, value: Primitive): this {\n this._tags = { ...this._tags, [key]: value };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setExtras(extras: Extras): this {\n this._extra = {\n ...this._extra,\n ...extras,\n };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setExtra(key: string, extra: Extra): this {\n this._extra = { ...this._extra, [key]: extra };\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setFingerprint(fingerprint: string[]): this {\n this._fingerprint = fingerprint;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setLevel(level: SeverityLevel): this {\n this._level = level;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setTransactionName(name?: string): this {\n this._transactionName = name;\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setContext(key: string, context: Context | null): this {\n if (context === null) {\n // eslint-disable-next-line @typescript-eslint/no-dynamic-delete\n delete this._contexts[key];\n } else {\n this._contexts[key] = context;\n }\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setSession(session?: Session): this {\n if (!session) {\n delete this._session;\n } else {\n this._session = session;\n }\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getSession(): Session | undefined {\n return this._session;\n }\n\n /**\n * @inheritDoc\n */\n public update(captureContext?: CaptureContext): this {\n if (!captureContext) {\n return this;\n }\n\n const scopeToMerge = typeof captureContext === 'function' ? captureContext(this) : captureContext;\n\n const [scopeInstance, requestSession] =\n scopeToMerge instanceof Scope\n ? [scopeToMerge.getScopeData(), scopeToMerge.getRequestSession()]\n : isPlainObject(scopeToMerge)\n ? [captureContext as ScopeContext, (captureContext as ScopeContext).requestSession]\n : [];\n\n const { tags, extra, user, contexts, level, fingerprint = [], propagationContext } = scopeInstance || {};\n\n this._tags = { ...this._tags, ...tags };\n this._extra = { ...this._extra, ...extra };\n this._contexts = { ...this._contexts, ...contexts };\n\n if (user && Object.keys(user).length) {\n this._user = user;\n }\n\n if (level) {\n this._level = level;\n }\n\n if (fingerprint.length) {\n this._fingerprint = fingerprint;\n }\n\n if (propagationContext) {\n this._propagationContext = propagationContext;\n }\n\n if (requestSession) {\n this._requestSession = requestSession;\n }\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clear(): this {\n // client is not cleared here on purpose!\n this._breadcrumbs = [];\n this._tags = {};\n this._extra = {};\n this._user = {};\n this._contexts = {};\n this._level = undefined;\n this._transactionName = undefined;\n this._fingerprint = undefined;\n this._requestSession = undefined;\n this._session = undefined;\n _setSpanForScope(this, undefined);\n this._attachments = [];\n this._propagationContext = generatePropagationContext();\n\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public addBreadcrumb(breadcrumb: Breadcrumb, maxBreadcrumbs?: number): this {\n const maxCrumbs = typeof maxBreadcrumbs === 'number' ? maxBreadcrumbs : DEFAULT_MAX_BREADCRUMBS;\n\n // No data has been changed, so don't notify scope listeners\n if (maxCrumbs <= 0) {\n return this;\n }\n\n const mergedBreadcrumb = {\n timestamp: dateTimestampInSeconds(),\n ...breadcrumb,\n };\n\n const breadcrumbs = this._breadcrumbs;\n breadcrumbs.push(mergedBreadcrumb);\n this._breadcrumbs = breadcrumbs.length > maxCrumbs ? breadcrumbs.slice(-maxCrumbs) : breadcrumbs;\n\n this._notifyScopeListeners();\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getLastBreadcrumb(): Breadcrumb | undefined {\n return this._breadcrumbs[this._breadcrumbs.length - 1];\n }\n\n /**\n * @inheritDoc\n */\n public clearBreadcrumbs(): this {\n this._breadcrumbs = [];\n this._notifyScopeListeners();\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public addAttachment(attachment: Attachment): this {\n this._attachments.push(attachment);\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public clearAttachments(): this {\n this._attachments = [];\n return this;\n }\n\n /** @inheritDoc */\n public getScopeData(): ScopeData {\n return {\n breadcrumbs: this._breadcrumbs,\n attachments: this._attachments,\n contexts: this._contexts,\n tags: this._tags,\n extra: this._extra,\n user: this._user,\n level: this._level,\n fingerprint: this._fingerprint || [],\n eventProcessors: this._eventProcessors,\n propagationContext: this._propagationContext,\n sdkProcessingMetadata: this._sdkProcessingMetadata,\n transactionName: this._transactionName,\n span: _getSpanForScope(this),\n };\n }\n\n /**\n * @inheritDoc\n */\n public setSDKProcessingMetadata(newData: { [key: string]: unknown }): this {\n this._sdkProcessingMetadata = { ...this._sdkProcessingMetadata, ...newData };\n\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public setPropagationContext(context: PropagationContext): this {\n this._propagationContext = context;\n return this;\n }\n\n /**\n * @inheritDoc\n */\n public getPropagationContext(): PropagationContext {\n return this._propagationContext;\n }\n\n /**\n * @inheritDoc\n */\n public captureException(exception: unknown, hint?: EventHint): string {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture exception!');\n return eventId;\n }\n\n const syntheticException = new Error('Sentry syntheticException');\n\n this._client.captureException(\n exception,\n {\n originalException: exception,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureMessage(message: string, level?: SeverityLevel, hint?: EventHint): string {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture message!');\n return eventId;\n }\n\n const syntheticException = new Error(message);\n\n this._client.captureMessage(\n message,\n level,\n {\n originalException: message,\n syntheticException,\n ...hint,\n event_id: eventId,\n },\n this,\n );\n\n return eventId;\n }\n\n /**\n * @inheritDoc\n */\n public captureEvent(event: Event, hint?: EventHint): string {\n const eventId = hint && hint.event_id ? hint.event_id : uuid4();\n\n if (!this._client) {\n logger.warn('No client configured on scope - will not capture event!');\n return eventId;\n }\n\n this._client.captureEvent(event, { ...hint, event_id: eventId }, this);\n\n return eventId;\n }\n\n /**\n * This will be called on every set call.\n */\n protected _notifyScopeListeners(): void {\n // We need this check for this._notifyingListeners to be able to work on scope during updates\n // If this check is not here we'll produce endless recursion when something is done with the scope\n // during the callback.\n if (!this._notifyingListeners) {\n this._notifyingListeners = true;\n this._scopeListeners.forEach(callback => {\n callback(this);\n });\n this._notifyingListeners = false;\n }\n }\n}\n\n// NOTE: By exporting this here as const & type, instead of doing `export class`,\n// We can get the correct class when importing from `@sentry/core`, but the original type (from `@sentry/types`)\n// This is helpful for interop, e.g. when doing `import type { Scope } from '@sentry/node';` (which re-exports this)\n\n/**\n * Holds additional event information.\n */\nexport const Scope = ScopeClass;\n\n/**\n * Holds additional event information.\n */\nexport type Scope = ScopeInterface;\n","import type { Scope } from '@sentry/types';\nimport { getGlobalSingleton } from '@sentry/utils';\nimport { Scope as ScopeClass } from './scope';\n\n/** Get the default current scope. */\nexport function getDefaultCurrentScope(): Scope {\n return getGlobalSingleton('defaultCurrentScope', () => new ScopeClass());\n}\n\n/** Get the default isolation scope. */\nexport function getDefaultIsolationScope(): Scope {\n return getGlobalSingleton('defaultIsolationScope', () => new ScopeClass());\n}\n","import type { Client, Scope as ScopeInterface } from '@sentry/types';\nimport { isThenable } from '@sentry/utils';\nimport { getDefaultCurrentScope, getDefaultIsolationScope } from '../defaultScopes';\nimport { Scope } from '../scope';\n\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport type { AsyncContextStrategy } from './types';\n\ninterface Layer {\n client?: Client;\n scope: ScopeInterface;\n}\n\n/**\n * This is an object that holds a stack of scopes.\n */\nexport class AsyncContextStack {\n private readonly _stack: [Layer, ...Layer[]];\n private _isolationScope: ScopeInterface;\n\n public constructor(scope?: ScopeInterface, isolationScope?: ScopeInterface) {\n let assignedScope;\n if (!scope) {\n assignedScope = new Scope();\n } else {\n assignedScope = scope;\n }\n\n let assignedIsolationScope;\n if (!isolationScope) {\n assignedIsolationScope = new Scope();\n } else {\n assignedIsolationScope = isolationScope;\n }\n\n // scope stack for domains or the process\n this._stack = [{ scope: assignedScope }];\n this._isolationScope = assignedIsolationScope;\n }\n\n /**\n * Fork a scope for the stack.\n */\n public withScope(callback: (scope: ScopeInterface) => T): T {\n const scope = this._pushScope();\n\n let maybePromiseResult: T;\n try {\n maybePromiseResult = callback(scope);\n } catch (e) {\n this._popScope();\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n // @ts-expect-error - isThenable returns the wrong type\n return maybePromiseResult.then(\n res => {\n this._popScope();\n return res;\n },\n e => {\n this._popScope();\n throw e;\n },\n );\n }\n\n this._popScope();\n return maybePromiseResult;\n }\n\n /**\n * Get the client of the stack.\n */\n public getClient(): C | undefined {\n return this.getStackTop().client as C;\n }\n\n /**\n * Returns the scope of the top stack.\n */\n public getScope(): ScopeInterface {\n return this.getStackTop().scope;\n }\n\n /**\n * Get the isolation scope for the stack.\n */\n public getIsolationScope(): ScopeInterface {\n return this._isolationScope;\n }\n\n /**\n * Returns the topmost scope layer in the order domain > local > process.\n */\n public getStackTop(): Layer {\n return this._stack[this._stack.length - 1] as Layer;\n }\n\n /**\n * Push a scope to the stack.\n */\n private _pushScope(): ScopeInterface {\n // We want to clone the content of prev scope\n const scope = this.getScope().clone();\n this._stack.push({\n client: this.getClient(),\n scope,\n });\n return scope;\n }\n\n /**\n * Pop a scope from the stack.\n */\n private _popScope(): boolean {\n if (this._stack.length <= 1) return false;\n return !!this._stack.pop();\n }\n}\n\n/**\n * Get the global async context stack.\n * This will be removed during the v8 cycle and is only here to make migration easier.\n */\nfunction getAsyncContextStack(): AsyncContextStack {\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n\n return (sentry.stack = sentry.stack || new AsyncContextStack(getDefaultCurrentScope(), getDefaultIsolationScope()));\n}\n\nfunction withScope(callback: (scope: ScopeInterface) => T): T {\n return getAsyncContextStack().withScope(callback);\n}\n\nfunction withSetScope(scope: ScopeInterface, callback: (scope: ScopeInterface) => T): T {\n const stack = getAsyncContextStack() as AsyncContextStack;\n return stack.withScope(() => {\n stack.getStackTop().scope = scope;\n return callback(scope);\n });\n}\n\nfunction withIsolationScope(callback: (isolationScope: ScopeInterface) => T): T {\n return getAsyncContextStack().withScope(() => {\n return callback(getAsyncContextStack().getIsolationScope());\n });\n}\n\n/**\n * Get the stack-based async context strategy.\n */\nexport function getStackAsyncContextStrategy(): AsyncContextStrategy {\n return {\n withIsolationScope,\n withScope,\n withSetScope,\n withSetIsolationScope: (_isolationScope: ScopeInterface, callback: (isolationScope: ScopeInterface) => T) => {\n return withIsolationScope(callback);\n },\n getCurrentScope: () => getAsyncContextStack().getScope(),\n getIsolationScope: () => getAsyncContextStack().getIsolationScope(),\n };\n}\n","import type { Carrier } from './../carrier';\nimport { getMainCarrier, getSentryCarrier } from './../carrier';\nimport { getStackAsyncContextStrategy } from './stackStrategy';\nimport type { AsyncContextStrategy } from './types';\n\n/**\n * @private Private API with no semver guarantees!\n *\n * Sets the global async context strategy\n */\nexport function setAsyncContextStrategy(strategy: AsyncContextStrategy | undefined): void {\n // Get main carrier (global for every environment)\n const registry = getMainCarrier();\n const sentry = getSentryCarrier(registry);\n sentry.acs = strategy;\n}\n\n/**\n * Get the current async context strategy.\n * If none has been setup, the default will be used.\n */\nexport function getAsyncContextStrategy(carrier: Carrier): AsyncContextStrategy {\n const sentry = getSentryCarrier(carrier);\n\n if (sentry.acs) {\n return sentry.acs;\n }\n\n // Otherwise, use the default one (stack)\n return getStackAsyncContextStrategy();\n}\n","import type { Scope } from '@sentry/types';\nimport type { Client } from '@sentry/types';\nimport { getGlobalSingleton } from '@sentry/utils';\nimport { getAsyncContextStrategy } from './asyncContext';\nimport { getMainCarrier } from './carrier';\nimport { Scope as ScopeClass } from './scope';\n\n/**\n * Get the currently active scope.\n */\nexport function getCurrentScope(): Scope {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n return acs.getCurrentScope();\n}\n\n/**\n * Get the currently active isolation scope.\n * The isolation scope is active for the current execution context.\n */\nexport function getIsolationScope(): Scope {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n return acs.getIsolationScope();\n}\n\n/**\n * Get the global scope.\n * This scope is applied to _all_ events.\n */\nexport function getGlobalScope(): Scope {\n return getGlobalSingleton('globalScope', () => new ScopeClass());\n}\n\n/**\n * Creates a new scope with and executes the given operation within.\n * The scope is automatically removed once the operation\n * finishes or throws.\n */\nexport function withScope(callback: (scope: Scope) => T): T;\n/**\n * Set the given scope as the active scope in the callback.\n */\nexport function withScope(scope: Scope | undefined, callback: (scope: Scope) => T): T;\n/**\n * Either creates a new active scope, or sets the given scope as active scope in the given callback.\n */\nexport function withScope(\n ...rest: [callback: (scope: Scope) => T] | [scope: Scope | undefined, callback: (scope: Scope) => T]\n): T {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [scope, callback] = rest;\n\n if (!scope) {\n return acs.withScope(callback);\n }\n\n return acs.withSetScope(scope, callback);\n }\n\n return acs.withScope(rest[0]);\n}\n\n/**\n * Attempts to fork the current isolation scope and the current scope based on the current async context strategy. If no\n * async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the\n * case, for example, in the browser).\n *\n * Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.\n *\n * This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in \"normal\"\n * applications directly because it comes with pitfalls. Use at your own risk!\n */\nexport function withIsolationScope(callback: (isolationScope: Scope) => T): T;\n/**\n * Set the provided isolation scope as active in the given callback. If no\n * async context strategy is set, the isolation scope and the current scope will not be forked (this is currently the\n * case, for example, in the browser).\n *\n * Usage of this function in environments without async context strategy is discouraged and may lead to unexpected behaviour.\n *\n * This function is intended for Sentry SDK and SDK integration development. It is not recommended to be used in \"normal\"\n * applications directly because it comes with pitfalls. Use at your own risk!\n *\n * If you pass in `undefined` as a scope, it will fork a new isolation scope, the same as if no scope is passed.\n */\nexport function withIsolationScope(isolationScope: Scope | undefined, callback: (isolationScope: Scope) => T): T;\n/**\n * Either creates a new active isolation scope, or sets the given isolation scope as active scope in the given callback.\n */\nexport function withIsolationScope(\n ...rest:\n | [callback: (isolationScope: Scope) => T]\n | [isolationScope: Scope | undefined, callback: (isolationScope: Scope) => T]\n): T {\n const carrier = getMainCarrier();\n const acs = getAsyncContextStrategy(carrier);\n\n // If a scope is defined, we want to make this the active scope instead of the default one\n if (rest.length === 2) {\n const [isolationScope, callback] = rest;\n\n if (!isolationScope) {\n return acs.withIsolationScope(callback);\n }\n\n return acs.withSetIsolationScope(isolationScope, callback);\n }\n\n return acs.withIsolationScope(rest[0]);\n}\n\n/**\n * Get the currently active client.\n */\nexport function getClient(): C | undefined {\n return getCurrentScope().getClient();\n}\n","import type {\n CaptureContext,\n Client,\n ClientOptions,\n Event,\n EventHint,\n Scope as ScopeInterface,\n ScopeContext,\n StackParser,\n} from '@sentry/types';\nimport {\n addExceptionMechanism,\n dateTimestampInSeconds,\n getFilenameToDebugIdMap,\n normalize,\n truncate,\n uuid4,\n} from '@sentry/utils';\n\nimport { DEFAULT_ENVIRONMENT } from '../constants';\nimport { getGlobalScope } from '../currentScopes';\nimport { notifyEventProcessors } from '../eventProcessors';\nimport { Scope } from '../scope';\nimport { applyScopeDataToEvent, mergeScopeData } from './applyScopeDataToEvent';\n\n/**\n * This type makes sure that we get either a CaptureContext, OR an EventHint.\n * It does not allow mixing them, which could lead to unexpected outcomes, e.g. this is disallowed:\n * { user: { id: '123' }, mechanism: { handled: false } }\n */\nexport type ExclusiveEventHintOrCaptureContext =\n | (CaptureContext & Partial<{ [key in keyof EventHint]: never }>)\n | (EventHint & Partial<{ [key in keyof ScopeContext]: never }>);\n\n/**\n * Adds common information to events.\n *\n * The information includes release and environment from `options`,\n * breadcrumbs and context (extra, tags and user) from the scope.\n *\n * Information that is already present in the event is never overwritten. For\n * nested objects, such as the context, keys are merged.\n *\n * @param event The original event.\n * @param hint May contain additional information about the original exception.\n * @param scope A scope containing event metadata.\n * @returns A new event with more information.\n * @hidden\n */\nexport function prepareEvent(\n options: ClientOptions,\n event: Event,\n hint: EventHint,\n scope?: ScopeInterface,\n client?: Client,\n isolationScope?: ScopeInterface,\n): PromiseLike {\n const { normalizeDepth = 3, normalizeMaxBreadth = 1_000 } = options;\n const prepared: Event = {\n ...event,\n event_id: event.event_id || hint.event_id || uuid4(),\n timestamp: event.timestamp || dateTimestampInSeconds(),\n };\n const integrations = hint.integrations || options.integrations.map(i => i.name);\n\n applyClientOptions(prepared, options);\n applyIntegrationsMetadata(prepared, integrations);\n\n if (client) {\n client.emit('applyFrameMetadata', event);\n }\n\n // Only put debug IDs onto frames for error events.\n if (event.type === undefined) {\n applyDebugIds(prepared, options.stackParser);\n }\n\n // If we have scope given to us, use it as the base for further modifications.\n // This allows us to prevent unnecessary copying of data if `captureContext` is not provided.\n const finalScope = getFinalScope(scope, hint.captureContext);\n\n if (hint.mechanism) {\n addExceptionMechanism(prepared, hint.mechanism);\n }\n\n const clientEventProcessors = client ? client.getEventProcessors() : [];\n\n // This should be the last thing called, since we want that\n // {@link Scope.addEventProcessor} gets the finished prepared event.\n // Merge scope data together\n const data = getGlobalScope().getScopeData();\n\n if (isolationScope) {\n const isolationData = isolationScope.getScopeData();\n mergeScopeData(data, isolationData);\n }\n\n if (finalScope) {\n const finalScopeData = finalScope.getScopeData();\n mergeScopeData(data, finalScopeData);\n }\n\n const attachments = [...(hint.attachments || []), ...data.attachments];\n if (attachments.length) {\n hint.attachments = attachments;\n }\n\n applyScopeDataToEvent(prepared, data);\n\n const eventProcessors = [\n ...clientEventProcessors,\n // Run scope event processors _after_ all other processors\n ...data.eventProcessors,\n ];\n\n const result = notifyEventProcessors(eventProcessors, prepared, hint);\n\n return result.then(evt => {\n if (evt) {\n // We apply the debug_meta field only after all event processors have ran, so that if any event processors modified\n // file names (e.g.the RewriteFrames integration) the filename -> debug ID relationship isn't destroyed.\n // This should not cause any PII issues, since we're only moving data that is already on the event and not adding\n // any new data\n applyDebugMeta(evt);\n }\n\n if (typeof normalizeDepth === 'number' && normalizeDepth > 0) {\n return normalizeEvent(evt, normalizeDepth, normalizeMaxBreadth);\n }\n return evt;\n });\n}\n\n/**\n * Enhances event using the client configuration.\n * It takes care of all \"static\" values like environment, release and `dist`,\n * as well as truncating overly long values.\n * @param event event instance to be enhanced\n */\nfunction applyClientOptions(event: Event, options: ClientOptions): void {\n const { environment, release, dist, maxValueLength = 250 } = options;\n\n if (!('environment' in event)) {\n event.environment = 'environment' in options ? environment : DEFAULT_ENVIRONMENT;\n }\n\n if (event.release === undefined && release !== undefined) {\n event.release = release;\n }\n\n if (event.dist === undefined && dist !== undefined) {\n event.dist = dist;\n }\n\n if (event.message) {\n event.message = truncate(event.message, maxValueLength);\n }\n\n const exception = event.exception && event.exception.values && event.exception.values[0];\n if (exception && exception.value) {\n exception.value = truncate(exception.value, maxValueLength);\n }\n\n const request = event.request;\n if (request && request.url) {\n request.url = truncate(request.url, maxValueLength);\n }\n}\n\n/**\n * Puts debug IDs into the stack frames of an error event.\n */\nexport function applyDebugIds(event: Event, stackParser: StackParser): void {\n // Build a map of filename -> debug_id\n const filenameDebugIdMap = getFilenameToDebugIdMap(stackParser);\n\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event!.exception!.values!.forEach(exception => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n exception.stacktrace!.frames!.forEach(frame => {\n if (frame.filename) {\n frame.debug_id = filenameDebugIdMap[frame.filename];\n }\n });\n });\n } catch (e) {\n // To save bundle size we're just try catching here instead of checking for the existence of all the different objects.\n }\n}\n\n/**\n * Moves debug IDs from the stack frames of an error event into the debug_meta field.\n */\nexport function applyDebugMeta(event: Event): void {\n // Extract debug IDs and filenames from the stack frames on the event.\n const filenameDebugIdMap: Record = {};\n try {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n event.exception!.values!.forEach(exception => {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n exception.stacktrace!.frames!.forEach(frame => {\n if (frame.debug_id) {\n if (frame.abs_path) {\n filenameDebugIdMap[frame.abs_path] = frame.debug_id;\n } else if (frame.filename) {\n filenameDebugIdMap[frame.filename] = frame.debug_id;\n }\n delete frame.debug_id;\n }\n });\n });\n } catch (e) {\n // To save bundle size we're just try catching here instead of checking for the existence of all the different objects.\n }\n\n if (Object.keys(filenameDebugIdMap).length === 0) {\n return;\n }\n\n // Fill debug_meta information\n event.debug_meta = event.debug_meta || {};\n event.debug_meta.images = event.debug_meta.images || [];\n const images = event.debug_meta.images;\n Object.entries(filenameDebugIdMap).forEach(([filename, debug_id]) => {\n images.push({\n type: 'sourcemap',\n code_file: filename,\n debug_id,\n });\n });\n}\n\n/**\n * This function adds all used integrations to the SDK info in the event.\n * @param event The event that will be filled with all integrations.\n */\nfunction applyIntegrationsMetadata(event: Event, integrationNames: string[]): void {\n if (integrationNames.length > 0) {\n event.sdk = event.sdk || {};\n event.sdk.integrations = [...(event.sdk.integrations || []), ...integrationNames];\n }\n}\n\n/**\n * Applies `normalize` function on necessary `Event` attributes to make them safe for serialization.\n * Normalized keys:\n * - `breadcrumbs.data`\n * - `user`\n * - `contexts`\n * - `extra`\n * @param event Event\n * @returns Normalized event\n */\nfunction normalizeEvent(event: Event | null, depth: number, maxBreadth: number): Event | null {\n if (!event) {\n return null;\n }\n\n const normalized: Event = {\n ...event,\n ...(event.breadcrumbs && {\n breadcrumbs: event.breadcrumbs.map(b => ({\n ...b,\n ...(b.data && {\n data: normalize(b.data, depth, maxBreadth),\n }),\n })),\n }),\n ...(event.user && {\n user: normalize(event.user, depth, maxBreadth),\n }),\n ...(event.contexts && {\n contexts: normalize(event.contexts, depth, maxBreadth),\n }),\n ...(event.extra && {\n extra: normalize(event.extra, depth, maxBreadth),\n }),\n };\n\n // event.contexts.trace stores information about a Transaction. Similarly,\n // event.spans[] stores information about child Spans. Given that a\n // Transaction is conceptually a Span, normalization should apply to both\n // Transactions and Spans consistently.\n // For now the decision is to skip normalization of Transactions and Spans,\n // so this block overwrites the normalized event to add back the original\n // Transaction information prior to normalization.\n if (event.contexts && event.contexts.trace && normalized.contexts) {\n normalized.contexts.trace = event.contexts.trace;\n\n // event.contexts.trace.data may contain circular/dangerous data so we need to normalize it\n if (event.contexts.trace.data) {\n normalized.contexts.trace.data = normalize(event.contexts.trace.data, depth, maxBreadth);\n }\n }\n\n // event.spans[].data may contain circular/dangerous data so we need to normalize it\n if (event.spans) {\n normalized.spans = event.spans.map(span => {\n return {\n ...span,\n ...(span.data && {\n data: normalize(span.data, depth, maxBreadth),\n }),\n };\n });\n }\n\n return normalized;\n}\n\nfunction getFinalScope(\n scope: ScopeInterface | undefined,\n captureContext: CaptureContext | undefined,\n): ScopeInterface | undefined {\n if (!captureContext) {\n return scope;\n }\n\n const finalScope = scope ? scope.clone() : new Scope();\n finalScope.update(captureContext);\n return finalScope;\n}\n\n/**\n * Parse either an `EventHint` directly, or convert a `CaptureContext` to an `EventHint`.\n * This is used to allow to update method signatures that used to accept a `CaptureContext` but should now accept an `EventHint`.\n */\nexport function parseEventHintOrCaptureContext(\n hint: ExclusiveEventHintOrCaptureContext | undefined,\n): EventHint | undefined {\n if (!hint) {\n return undefined;\n }\n\n // If you pass a Scope or `() => Scope` as CaptureContext, we just return this as captureContext\n if (hintIsScopeOrFunction(hint)) {\n return { captureContext: hint };\n }\n\n if (hintIsScopeContext(hint)) {\n return {\n captureContext: hint,\n };\n }\n\n return hint;\n}\n\nfunction hintIsScopeOrFunction(\n hint: CaptureContext | EventHint,\n): hint is ScopeInterface | ((scope: ScopeInterface) => ScopeInterface) {\n return hint instanceof Scope || typeof hint === 'function';\n}\n\ntype ScopeContextProperty = keyof ScopeContext;\nconst captureContextKeys: readonly ScopeContextProperty[] = [\n 'user',\n 'level',\n 'extra',\n 'contexts',\n 'tags',\n 'fingerprint',\n 'requestSession',\n 'propagationContext',\n] as const;\n\nfunction hintIsScopeContext(hint: Partial | EventHint): hint is Partial {\n return Object.keys(hint).some(key => captureContextKeys.includes(key as ScopeContextProperty));\n}\n","import type {\n CaptureContext,\n CheckIn,\n Event,\n EventHint,\n EventProcessor,\n Extra,\n Extras,\n FinishedCheckIn,\n MonitorConfig,\n Primitive,\n Session,\n SessionContext,\n SeverityLevel,\n User,\n} from '@sentry/types';\nimport { GLOBAL_OBJ, isThenable, logger, timestampInSeconds, uuid4 } from '@sentry/utils';\n\nimport { DEFAULT_ENVIRONMENT } from './constants';\nimport { getClient, getCurrentScope, getIsolationScope, withIsolationScope } from './currentScopes';\nimport { DEBUG_BUILD } from './debug-build';\nimport { closeSession, makeSession, updateSession } from './session';\nimport type { ExclusiveEventHintOrCaptureContext } from './utils/prepareEvent';\nimport { parseEventHintOrCaptureContext } from './utils/prepareEvent';\n\n/**\n * Captures an exception event and sends it to Sentry.\n *\n * @param exception The exception to capture.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured Sentry event.\n */\nexport function captureException(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n exception: any,\n hint?: ExclusiveEventHintOrCaptureContext,\n): string {\n return getCurrentScope().captureException(exception, parseEventHintOrCaptureContext(hint));\n}\n\n/**\n * Captures a message event and sends it to Sentry.\n *\n * @param message The message to send to Sentry.\n * @param captureContext Define the level of the message or pass in additional data to attach to the message.\n * @returns the id of the captured message.\n */\nexport function captureMessage(message: string, captureContext?: CaptureContext | SeverityLevel): string {\n // This is necessary to provide explicit scopes upgrade, without changing the original\n // arity of the `captureMessage(message, level)` method.\n const level = typeof captureContext === 'string' ? captureContext : undefined;\n const context = typeof captureContext !== 'string' ? { captureContext } : undefined;\n return getCurrentScope().captureMessage(message, level, context);\n}\n\n/**\n * Captures a manually created event and sends it to Sentry.\n *\n * @param event The event to send to Sentry.\n * @param hint Optional additional data to attach to the Sentry event.\n * @returns the id of the captured event.\n */\nexport function captureEvent(event: Event, hint?: EventHint): string {\n return getCurrentScope().captureEvent(event, hint);\n}\n\n/**\n * Sets context data with the given name.\n * @param name of the context\n * @param context Any kind of data. This data will be normalized.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function setContext(name: string, context: { [key: string]: any } | null): void {\n getIsolationScope().setContext(name, context);\n}\n\n/**\n * Set an object that will be merged sent as extra data with the event.\n * @param extras Extras object to merge into current context.\n */\nexport function setExtras(extras: Extras): void {\n getIsolationScope().setExtras(extras);\n}\n\n/**\n * Set key:value that will be sent as extra data with the event.\n * @param key String of extra\n * @param extra Any kind of data. This data will be normalized.\n */\nexport function setExtra(key: string, extra: Extra): void {\n getIsolationScope().setExtra(key, extra);\n}\n\n/**\n * Set an object that will be merged sent as tags data with the event.\n * @param tags Tags context object to merge into current context.\n */\nexport function setTags(tags: { [key: string]: Primitive }): void {\n getIsolationScope().setTags(tags);\n}\n\n/**\n * Set key:value that will be sent as tags data with the event.\n *\n * Can also be used to unset a tag, by passing `undefined`.\n *\n * @param key String key of tag\n * @param value Value of tag\n */\nexport function setTag(key: string, value: Primitive): void {\n getIsolationScope().setTag(key, value);\n}\n\n/**\n * Updates user context information for future events.\n *\n * @param user User context object to be set in the current context. Pass `null` to unset the user.\n */\nexport function setUser(user: User | null): void {\n getIsolationScope().setUser(user);\n}\n\n/**\n * The last error event id of the isolation scope.\n *\n * Warning: This function really returns the last recorded error event id on the current\n * isolation scope. If you call this function after handling a certain error and another error\n * is captured in between, the last one is returned instead of the one you might expect.\n * Also, ids of events that were never sent to Sentry (for example because\n * they were dropped in `beforeSend`) could be returned.\n *\n * @returns The last event id of the isolation scope.\n */\nexport function lastEventId(): string | undefined {\n return getIsolationScope().lastEventId();\n}\n\n/**\n * Create a cron monitor check in and send it to Sentry.\n *\n * @param checkIn An object that describes a check in.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function captureCheckIn(checkIn: CheckIn, upsertMonitorConfig?: MonitorConfig): string {\n const scope = getCurrentScope();\n const client = getClient();\n if (!client) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. No client defined.');\n } else if (!client.captureCheckIn) {\n DEBUG_BUILD && logger.warn('Cannot capture check-in. Client does not support sending check-ins.');\n } else {\n return client.captureCheckIn(checkIn, upsertMonitorConfig, scope);\n }\n\n return uuid4();\n}\n\n/**\n * Wraps a callback with a cron monitor check in. The check in will be sent to Sentry when the callback finishes.\n *\n * @param monitorSlug The distinct slug of the monitor.\n * @param upsertMonitorConfig An optional object that describes a monitor config. Use this if you want\n * to create a monitor automatically when sending a check in.\n */\nexport function withMonitor(\n monitorSlug: CheckIn['monitorSlug'],\n callback: () => T,\n upsertMonitorConfig?: MonitorConfig,\n): T {\n const checkInId = captureCheckIn({ monitorSlug, status: 'in_progress' }, upsertMonitorConfig);\n const now = timestampInSeconds();\n\n function finishCheckIn(status: FinishedCheckIn['status']): void {\n captureCheckIn({ monitorSlug, status, checkInId, duration: timestampInSeconds() - now });\n }\n\n return withIsolationScope(() => {\n let maybePromiseResult: T;\n try {\n maybePromiseResult = callback();\n } catch (e) {\n finishCheckIn('error');\n throw e;\n }\n\n if (isThenable(maybePromiseResult)) {\n Promise.resolve(maybePromiseResult).then(\n () => {\n finishCheckIn('ok');\n },\n e => {\n finishCheckIn('error');\n throw e;\n },\n );\n } else {\n finishCheckIn('ok');\n }\n\n return maybePromiseResult;\n });\n}\n\n/**\n * Call `flush()` on the current client, if there is one. See {@link Client.flush}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue. Omitting this parameter will cause\n * the client to wait until all events are sent before resolving the promise.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function flush(timeout?: number): Promise {\n const client = getClient();\n if (client) {\n return client.flush(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Call `close()` on the current client, if there is one. See {@link Client.close}.\n *\n * @param timeout Maximum time in ms the client should wait to flush its event queue before shutting down. Omitting this\n * parameter will cause the client to wait until all events are sent before disabling itself.\n * @returns A promise which resolves to `true` if the queue successfully drains before the timeout, or `false` if it\n * doesn't (or if there's no client defined).\n */\nexport async function close(timeout?: number): Promise {\n const client = getClient();\n if (client) {\n return client.close(timeout);\n }\n DEBUG_BUILD && logger.warn('Cannot flush events and disable SDK. No client defined.');\n return Promise.resolve(false);\n}\n\n/**\n * Returns true if Sentry has been properly initialized.\n */\nexport function isInitialized(): boolean {\n return !!getClient();\n}\n\n/** If the SDK is initialized & enabled. */\nexport function isEnabled(): boolean {\n const client = getClient();\n return !!client && client.getOptions().enabled !== false && !!client.getTransport();\n}\n\n/**\n * Add an event processor.\n * This will be added to the current isolation scope, ensuring any event that is processed in the current execution\n * context will have the processor applied.\n */\nexport function addEventProcessor(callback: EventProcessor): void {\n getIsolationScope().addEventProcessor(callback);\n}\n\n/**\n * Start a session on the current isolation scope.\n *\n * @param context (optional) additional properties to be applied to the returned session object\n *\n * @returns the new active session\n */\nexport function startSession(context?: SessionContext): Session {\n const client = getClient();\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const { release, environment = DEFAULT_ENVIRONMENT } = (client && client.getOptions()) || {};\n\n // Will fetch userAgent if called from browser sdk\n const { userAgent } = GLOBAL_OBJ.navigator || {};\n\n const session = makeSession({\n release,\n environment,\n user: currentScope.getUser() || isolationScope.getUser(),\n ...(userAgent && { userAgent }),\n ...context,\n });\n\n // End existing session if there's one\n const currentSession = isolationScope.getSession();\n if (currentSession && currentSession.status === 'ok') {\n updateSession(currentSession, { status: 'exited' });\n }\n\n endSession();\n\n // Afterwards we set the new session on the scope\n isolationScope.setSession(session);\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession(session);\n\n return session;\n}\n\n/**\n * End the session on the current isolation scope.\n */\nexport function endSession(): void {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session) {\n closeSession(session);\n }\n _sendSessionUpdate();\n\n // the session is over; take it off of the scope\n isolationScope.setSession();\n\n // TODO (v8): Remove this and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n currentScope.setSession();\n}\n\n/**\n * Sends the current Session on the scope\n */\nfunction _sendSessionUpdate(): void {\n const isolationScope = getIsolationScope();\n const currentScope = getCurrentScope();\n const client = getClient();\n // TODO (v8): Remove currentScope and only use the isolation scope(?).\n // For v7 though, we can't \"soft-break\" people using getCurrentHub().getScope().setSession()\n const session = currentScope.getSession() || isolationScope.getSession();\n if (session && client) {\n client.captureSession(session);\n }\n}\n\n/**\n * Sends the current session on the scope to Sentry\n *\n * @param end If set the session will be marked as exited and removed from the scope.\n * Defaults to `false`.\n */\nexport function captureSession(end: boolean = false): void {\n // both send the update and pull the session from the scope\n if (end) {\n endSession();\n return;\n }\n\n // only send the update\n _sendSessionUpdate();\n}\n","import * as Sentry from \"@sentry/browser\";\n\n/*\n* Run custom function based on cookie categorization if the user has accepted the cookie policy\n */\nconst ifCookieCategorizationCallback = (config = {}) => {\n const OnetrustActiveGroups = config.OnetrustActiveGroups || '';\n const cookies = config.cookies || [];\n\n for(let cookie of cookies) {\n if(OnetrustActiveGroups === ',C0001,' && cookie.refusedCookieCallback) {\n cookie.refusedCookieCallback();\n\n return;\n }\n\n if(OnetrustActiveGroups.indexOf(cookie.categorieID) > -1 && cookie.acceptedCookieCallback) {\n if(cookie.hasBeenInit === false) {\n cookie.acceptedCookieCallback();\n cookie.hasBeenInit = true;\n }\n } else if(OnetrustActiveGroups.indexOf(`${cookie.categorieID}`) <= -1 && cookie.refusedCookieCallback) {\n if(cookie.hasBeenInit === false) {\n cookie.refusedCookieCallback();\n cookie.hasBeenInit = true;\n }\n }\n }\n};\n\n/*\n* Append a div element and add a data-attribute that contain OneTrust categories\n* The observer use this DIV to watch changes on the categories\n*
\n*/\nconst OTGroupsObserverDiv = (groups) => {\n const OTGroups = document.createElement('div');\n\n OTGroups.classList.add('hiddendiv');\n OTGroups.classList.add('common');\n OTGroups.id = 'OnetrustActiveGroups';\n OTGroups.dataset.otgroups = groups;\n\n document.body.appendChild(OTGroups);\n};\n\n/*\n* Function called by the OneTrust script to update the accepted categories\n */\nwindow.OptanonWrapper = function OptanonWrapper() {\n const categories = OnetrustActiveGroups.split(',');\n let classOnBody = document.body.className ? document.body.className.split(' ') : '';\n\n if(classOnBody) {\n classOnBody = classOnBody.filter(el => !el.includes('ot-')).join(\" \");\n }\n\n if(!document.getElementById('OnetrustActiveGroups')) {\n OTGroupsObserverDiv(OnetrustActiveGroups);\n }\n\n document.getElementById('OnetrustActiveGroups').dataset['otgroups'] = OnetrustActiveGroups;\n\n document.body.setAttribute('class', classOnBody);\n\n for(let categorie of categories) {\n if(categorie) {\n document.body.classList.add(`ot-${categorie}`);\n }\n }\n};\n\n/*\n* Create an array of cookie categorization based on Onetrust scan and init function related on this category\n* Add an observer to watch the accepted categories\n* https://coveo.my.onetrust.com/cookies/categorizations?tab=Categories\n* acceptedCookieCallback: Init function when the user accepted the cookies\n* refusedCookieCallback: Init function if the user refused the cookies\n */\nconst acceptedCookiePolicy = (config = {}) => {\n const ifStrictlyNecessaryCookies = config.ifStrictlyNecessaryCookies || null;\n const ifPerformanceCookies = config.ifPerformanceCookies || null;\n const ifFunctionalCookies = config.ifFunctionalCookies || null;\n const ifTargetingCookies = config.ifTargetingCookies || null;\n const ifSocialMediaCookies = config.ifSocialMediaCookies || null;\n\n const ifNoPerformanceCookies = config.ifNoPerformanceCookies || null;\n const ifNoFunctionalCookies = config.ifNoFunctionalCookies || null;\n const ifNoTargetingCookies = config.ifNoTargetingCookies || null;\n const ifNoSocialMediaCookies = config.ifNoSocialMediaCookies || null;\n\n let observer = null;\n const cookieCategorization = [\n {\n categorieID: 'C0002',\n acceptedCookieCallback: ifPerformanceCookies,\n refusedCookieCallback: ifNoPerformanceCookies,\n hasBeenInit: false\n },\n {\n categorieID: 'C0003',\n acceptedCookieCallback: ifFunctionalCookies,\n refusedCookieCallback: ifNoFunctionalCookies,\n hasBeenInit: false\n },\n {\n categorieID: 'C0004',\n acceptedCookieCallback: ifTargetingCookies,\n refusedCookieCallback: ifNoTargetingCookies,\n hasBeenInit: false\n },\n {\n categorieID: 'C0005',\n acceptedCookieCallback: ifSocialMediaCookies,\n refusedCookieCallback: ifNoSocialMediaCookies,\n hasBeenInit: false\n }\n ];\n\n const initFunctionWhenDataChange = (mutations) => {\n for (let mutation of mutations) {\n if (mutation.type === 'attributes') {\n if(OnetrustActiveGroups === ',C0001,') {\n if(ifStrictlyNecessaryCookies) {\n ifStrictlyNecessaryCookies();\n }\n } else {\n ifCookieCategorizationCallback({\n OnetrustActiveGroups,\n cookies: cookieCategorization\n });\n }\n\n break;\n }\n }\n };\n\n const watchOnetrustActiveGroups = setInterval(() => {\n if(typeof OptanonWrapper !== \"undefined\" && document.getElementById('OnetrustActiveGroups')) {\n const OTElement = document.getElementById('OnetrustActiveGroups');\n\n observer = new MutationObserver(initFunctionWhenDataChange);\n observer.observe(OTElement, { attributes: true });\n\n ifCookieCategorizationCallback({\n OnetrustActiveGroups,\n cookies: cookieCategorization\n });\n\n clearInterval(watchOnetrustActiveGroups);\n }\n }, 250);\n\n /*\n * Disabled the cookie policy function if onetrust script is not loaded for unknow reason.\n * The script response time is ~55ms\n * OnetrustActiveGroups variable is set after the https://cdn.cookielaw.org/scripttemplates/otSDKStub.js was initialized\n */\n setTimeout(() => {\n if(typeof OnetrustActiveGroups === 'undefined') {\n window.OnetrustActiveGroups = ',C0001,C0003,C0002,C0004,C0005,';\n\n OptanonWrapper();\n ifCookieCategorizationCallback({\n OnetrustActiveGroups,\n cookies: cookieCategorization\n });\n\n clearInterval(watchOnetrustActiveGroups);\n\n // Enable Sentry if Onetrust fail\n console.warn('OneTrust cookie policy script failed to load');\n Sentry.captureException('OneTrust cookie policy script failed to load');\n }\n }, 3000);\n};\n\n\nexport default acceptedCookiePolicy;","import acceptedCookiePolicy from \"../../../../components/onetrust/cookiePolicy\";\n\nconst ifCanPushDatalayer = (config = {}) => {\n\tconst then = config.then || null;\n\n\tacceptedCookiePolicy({\n\t\tifTargetingCookies: () => {\n\t\t\tif (typeof dataLayer !== 'undefined') {\n\t\t\t\tthen();\n\t\t\t}\n\t\t}\n\t});\n};\n\nconst urlIncludes = (segment) => {\n\treturn window.location.href.includes(segment);\n};\n\nconst pageTypeIncludes = (string) => {\n\tconst dataPage = document.querySelector(`html[data-page*=${string}]`);\n\tconst page = dataPage ? dataPage.dataset.page : '';\n\n\treturn page.includes(string);\n};\n\nexport {\n\tifCanPushDatalayer,\n\turlIncludes,\n\tpageTypeIncludes\n};\n","import {ifCanPushDatalayer} from './utils/utils.dataLayer.common';\n\nconst dataLayerCareerSavedJobs = (event) => {\n\tifCanPushDatalayer({\n\t\tthen: () => {\n\n const jobListingContainer = event.target.closest('div.coveo-list-layout.CoveoResult');\n\n if (jobListingContainer) {\n const jobListingTitle = jobListingContainer.querySelector('h5.title').innerText;\n const jobListingDepartment = jobListingContainer.querySelector('span.coveo-main-badge.career').innerText;\n const savedJobIconDiv = jobListingContainer.querySelector('div.saved-jobs-icon');\n\n if (savedJobIconDiv.classList.contains('is-saved')) {\n dataLayer.push({\n 'event': 'saved_job_listing',\n 'job_listing': jobListingTitle,\n 'departement': jobListingDepartment\n });\n } else {\n dataLayer.push({\n 'event': 'unsaved_job_listing',\n 'job_listing': jobListingTitle,\n 'departement': jobListingDepartment\n });\n }\n }\n\t\t}\n\t});\n};\n\nexport default dataLayerCareerSavedJobs;","import {ifCanPushDatalayer} from './utils/utils.dataLayer.common';\n\nconst dataLayersCareer = () => {\n\tconst jobListingTitle = document.querySelector('.hero-job-detail .heading');\n\tconst jobListingDepartment = document.querySelector('.hero-job-detail .department');\n\n\tif (jobListingTitle && jobListingDepartment) {\n\t\tconst savedJob = () => {\n\t\t\tifCanPushDatalayer({\n\t\t\t\tthen: () => {\n\t\t\t\t\tdataLayer.push({\n\t\t\t\t\t\t'event': 'saved_job_listing',\n\t\t\t\t\t\t'job_listing': jobListingTitle.innerText,\n\t\t\t\t\t\t'departement': jobListingDepartment.innerText\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst unsavedJob = () => {\n\t\t\tifCanPushDatalayer({\n\t\t\t\tthen: () => {\n\t\t\t\t\tdataLayer.push({\n\t\t\t\t\t\t'event': 'unsaved_job_listing',\n\t\t\t\t\t\t'job_listing': jobListingTitle.innerText,\n\t\t\t\t\t\t'departement': jobListingDepartment.innerText\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\treturn {\n\t\t\tsavedJob,\n\t\t\tunsavedJob\n\t\t};\n\t}\n};\n\nexport default dataLayersCareer;\n","/**\n * Checks whether we're in a Node.js environment\n *\n * @returns Answer to given question\n */\nexport function isNodeEnv(): boolean {\n return typeof process === 'object' && process?.versions?.node !== undefined;\n}\n\n/**\n * Checks whether we're in a browser environment\n *\n * @returns Answer to given question\n */\nexport function isBrowserEnv(): boolean {\n return typeof window === 'object' && window?.document !== undefined;\n}\n\nconst fallbackGlobalObject = {};\n\n/**\n * Safely get global scope object\n *\n * @returns Global scope object\n */\nexport const getGlobalObject = (): any => {\n if (isNodeEnv()) {\n return global;\n } else if (typeof window !== 'undefined') {\n return window;\n } else if (typeof self !== 'undefined') {\n return self;\n } else {\n return fallbackGlobalObject;\n }\n};\n\nexport const getGlobalAmplitudeNamespace = (): any => {\n const global = getGlobalObject();\n if (global.__AMPLITUDE__ === undefined) {\n global.__AMPLITUDE__ = {};\n }\n\n return global.__AMPLITUDE__;\n};\n\n/**\n * A promise-based way to sleep for x millseconds, then queue ourselves back to the\n * JS event loop.\n *\n * @param milliseconds The number of milliseconds to wait for\n */\nexport const asyncSleep = async (milliseconds: number): Promise => {\n return await new Promise(resolve => setTimeout(resolve, milliseconds));\n};\n\n/**\n * Fixes browser edge case where Prototype.js injects Array.prototype.toJSON and breaks the built-in JSON.stringify()\n *\n * @returns true if Array.prototype.toJSON was deleted, false if not\n */\nexport const prototypeJsFix = (): boolean => {\n // Augment and cast built-ins to represent Prototype.js injection\n interface Window {\n Prototype?: Record;\n }\n interface ArrayConstructor {\n prototype?: { toJSON?: Function };\n }\n if (isBrowserEnv()) {\n const augmentedWindow = window as Window;\n const augmentedArray = Array as ArrayConstructor;\n if (augmentedWindow.Prototype !== undefined && augmentedArray.prototype?.toJSON !== undefined) {\n delete augmentedArray.prototype.toJSON;\n return true;\n }\n }\n return false;\n};\n","import { isBrowserEnv, prototypeJsFix } from '@amplitude/utils';\nimport md5 from 'blueimp-md5';\nimport queryString from 'query-string';\nimport UAParser from '@amplitude/ua-parser-js';\nimport { AnalyticsConnector } from '@amplitude/analytics-connector';\n\nfunction ownKeys(object, enumerableOnly) {\n var keys = Object.keys(object);\n if (Object.getOwnPropertySymbols) {\n var symbols = Object.getOwnPropertySymbols(object);\n enumerableOnly && (symbols = symbols.filter(function (sym) {\n return Object.getOwnPropertyDescriptor(object, sym).enumerable;\n })), keys.push.apply(keys, symbols);\n }\n return keys;\n}\nfunction _objectSpread2(target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = null != arguments[i] ? arguments[i] : {};\n i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {\n _defineProperty(target, key, source[key]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));\n });\n }\n return target;\n}\nfunction _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n}\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\nfunction _defineProperty(obj, key, value) {\n key = _toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nfunction _toConsumableArray(arr) {\n return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();\n}\nfunction _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return _arrayLikeToArray(arr);\n}\nfunction _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];\n return arr2;\n}\nfunction _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _createForOfIteratorHelper(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (!it) {\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n var F = function () {};\n return {\n s: F,\n n: function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n },\n e: function (e) {\n throw e;\n },\n f: F\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n }\n var normalCompletion = true,\n didErr = false,\n err;\n return {\n s: function () {\n it = it.call(o);\n },\n n: function () {\n var step = it.next();\n normalCompletion = step.done;\n return step;\n },\n e: function (e) {\n didErr = true;\n err = e;\n },\n f: function () {\n try {\n if (!normalCompletion && it.return != null) it.return();\n } finally {\n if (didErr) throw err;\n }\n }\n };\n}\nfunction _toPrimitive(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n}\n\nvar Constants = {\n DEFAULT_INSTANCE: '$default_instance',\n API_VERSION: 2,\n MAX_STRING_LENGTH: 4096,\n MAX_PROPERTY_KEYS: 1000,\n IDENTIFY_EVENT: '$identify',\n GROUP_IDENTIFY_EVENT: '$groupidentify',\n EVENT_LOG_URL: 'api.amplitude.com',\n EVENT_LOG_EU_URL: 'api.eu.amplitude.com',\n DYNAMIC_CONFIG_URL: 'regionconfig.amplitude.com',\n DYNAMIC_CONFIG_EU_URL: 'regionconfig.eu.amplitude.com',\n // localStorageKeys\n LAST_EVENT_ID: 'amplitude_lastEventId',\n LAST_EVENT_TIME: 'amplitude_lastEventTime',\n LAST_IDENTIFY_ID: 'amplitude_lastIdentifyId',\n LAST_SEQUENCE_NUMBER: 'amplitude_lastSequenceNumber',\n SESSION_ID: 'amplitude_sessionId',\n // Used in cookie as well\n DEVICE_ID: 'amplitude_deviceId',\n OPT_OUT: 'amplitude_optOut',\n USER_ID: 'amplitude_userId',\n // indexes of properties in cookie v2 storage format\n DEVICE_ID_INDEX: 0,\n USER_ID_INDEX: 1,\n OPT_OUT_INDEX: 2,\n SESSION_ID_INDEX: 3,\n LAST_EVENT_TIME_INDEX: 4,\n EVENT_ID_INDEX: 5,\n IDENTIFY_ID_INDEX: 6,\n SEQUENCE_NUMBER_INDEX: 7,\n COOKIE_TEST_PREFIX: 'amp_cookie_test',\n COOKIE_PREFIX: 'amp',\n // Storage options\n STORAGE_DEFAULT: '',\n STORAGE_COOKIES: 'cookies',\n STORAGE_NONE: 'none',\n STORAGE_LOCAL: 'localStorage',\n STORAGE_SESSION: 'sessionStorage',\n // revenue keys\n REVENUE_EVENT: 'revenue_amount',\n REVENUE_PRODUCT_ID: '$productId',\n REVENUE_QUANTITY: '$quantity',\n REVENUE_PRICE: '$price',\n REVENUE_REVENUE_TYPE: '$revenueType',\n AMP_DEVICE_ID_PARAM: 'amp_device_id',\n // url param\n AMP_REFERRER_PARAM: 'amp_referrer',\n // url param for overwriting the document.refer\n\n REFERRER: 'referrer',\n REFERRING_DOMAIN: 'referring_domain',\n // UTM Params\n UTM_SOURCE: 'utm_source',\n UTM_MEDIUM: 'utm_medium',\n UTM_CAMPAIGN: 'utm_campaign',\n UTM_TERM: 'utm_term',\n UTM_CONTENT: 'utm_content',\n ATTRIBUTION_EVENT: '[Amplitude] Attribution Captured',\n TRANSPORT_HTTP: 'http',\n TRANSPORT_BEACON: 'beacon'\n};\n\n/*\n * UTF-8 encoder/decoder\n * http://www.webtoolkit.info/\n */\nvar UTF8 = {\n encode: function encode(s) {\n var utftext = '';\n for (var n = 0; n < s.length; n++) {\n var c = s.charCodeAt(n);\n if (c < 128) {\n utftext += String.fromCharCode(c);\n } else if (c > 127 && c < 2048) {\n utftext += String.fromCharCode(c >> 6 | 192);\n utftext += String.fromCharCode(c & 63 | 128);\n } else {\n utftext += String.fromCharCode(c >> 12 | 224);\n utftext += String.fromCharCode(c >> 6 & 63 | 128);\n utftext += String.fromCharCode(c & 63 | 128);\n }\n }\n return utftext;\n },\n decode: function decode(utftext) {\n var s = '';\n var i = 0;\n var c = 0,\n c1 = 0,\n c2 = 0;\n while (i < utftext.length) {\n c = utftext.charCodeAt(i);\n if (c < 128) {\n s += String.fromCharCode(c);\n i++;\n } else if (c > 191 && c < 224) {\n c1 = utftext.charCodeAt(i + 1);\n s += String.fromCharCode((c & 31) << 6 | c1 & 63);\n i += 2;\n } else {\n c1 = utftext.charCodeAt(i + 1);\n c2 = utftext.charCodeAt(i + 2);\n s += String.fromCharCode((c & 15) << 12 | (c1 & 63) << 6 | c2 & 63);\n i += 3;\n }\n }\n return s;\n }\n};\n\n/* global globalThis */\nvar GlobalScope = function () {\n if (typeof globalThis !== 'undefined') {\n return globalThis;\n }\n if (typeof window !== 'undefined') {\n return window;\n }\n if (typeof self !== 'undefined') {\n return self;\n }\n if (typeof global !== 'undefined') {\n return global;\n }\n}();\n\n/*\n * Base64 encoder/decoder\n * http://www.webtoolkit.info/\n */\nvar Base64 = {\n _keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',\n encode: function encode(input) {\n try {\n if (GlobalScope.btoa && GlobalScope.atob) {\n return GlobalScope.btoa(unescape(encodeURIComponent(input)));\n }\n } catch (e) {\n //log(e);\n }\n return Base64._encode(input);\n },\n _encode: function _encode(input) {\n var output = '';\n var chr1, chr2, chr3, enc1, enc2, enc3, enc4;\n var i = 0;\n input = UTF8.encode(input);\n while (i < input.length) {\n chr1 = input.charCodeAt(i++);\n chr2 = input.charCodeAt(i++);\n chr3 = input.charCodeAt(i++);\n enc1 = chr1 >> 2;\n enc2 = (chr1 & 3) << 4 | chr2 >> 4;\n enc3 = (chr2 & 15) << 2 | chr3 >> 6;\n enc4 = chr3 & 63;\n if (isNaN(chr2)) {\n enc3 = enc4 = 64;\n } else if (isNaN(chr3)) {\n enc4 = 64;\n }\n output = output + Base64._keyStr.charAt(enc1) + Base64._keyStr.charAt(enc2) + Base64._keyStr.charAt(enc3) + Base64._keyStr.charAt(enc4);\n }\n return output;\n },\n decode: function decode(input) {\n try {\n if (GlobalScope.btoa && GlobalScope.atob) {\n return decodeURIComponent(escape(GlobalScope.atob(input)));\n }\n } catch (e) {\n //log(e);\n }\n return Base64._decode(input);\n },\n _decode: function _decode(input) {\n var output = '';\n var chr1, chr2, chr3;\n var enc1, enc2, enc3, enc4;\n var i = 0;\n input = input.replace(/[^A-Za-z0-9+/=]/g, '');\n while (i < input.length) {\n enc1 = Base64._keyStr.indexOf(input.charAt(i++));\n enc2 = Base64._keyStr.indexOf(input.charAt(i++));\n enc3 = Base64._keyStr.indexOf(input.charAt(i++));\n enc4 = Base64._keyStr.indexOf(input.charAt(i++));\n chr1 = enc1 << 2 | enc2 >> 4;\n chr2 = (enc2 & 15) << 4 | enc3 >> 2;\n chr3 = (enc3 & 3) << 6 | enc4;\n output = output + String.fromCharCode(chr1);\n if (enc3 !== 64) {\n output = output + String.fromCharCode(chr2);\n }\n if (enc4 !== 64) {\n output = output + String.fromCharCode(chr3);\n }\n }\n output = UTF8.decode(output);\n return output;\n }\n};\n\n/**\n * toString ref.\n * @private\n */\n\nvar toString = Object.prototype.toString;\n\n/**\n * Return the type of `val`.\n * @private\n * @param {Mixed} val\n * @return {String}\n * @api public\n */\n\nfunction type (val) {\n switch (toString.call(val)) {\n case '[object Date]':\n return 'date';\n case '[object RegExp]':\n return 'regexp';\n case '[object Arguments]':\n return 'arguments';\n case '[object Array]':\n return 'array';\n case '[object Error]':\n return 'error';\n }\n if (val === null) {\n return 'null';\n }\n if (val === undefined) {\n return 'undefined';\n }\n if (val !== val) {\n return 'nan';\n }\n if (val && val.nodeType === 1) {\n return 'element';\n }\n if (typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function' && Buffer.isBuffer(val)) {\n return 'buffer';\n }\n val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val);\n return _typeof(val);\n}\n\nvar logLevels = {\n DISABLE: 0,\n ERROR: 1,\n WARN: 2,\n INFO: 3\n};\nvar logLevel = logLevels.WARN;\nvar setLogLevel = function setLogLevel(logLevelName) {\n if (Object.prototype.hasOwnProperty.call(logLevels, logLevelName)) {\n logLevel = logLevels[logLevelName];\n }\n};\nvar getLogLevel = function getLogLevel() {\n return logLevel;\n};\nvar log = {\n error: function error(s) {\n if (logLevel >= logLevels.ERROR) {\n _log(s);\n }\n },\n warn: function warn(s) {\n if (logLevel >= logLevels.WARN) {\n _log(s);\n }\n },\n info: function info(s) {\n if (logLevel >= logLevels.INFO) {\n _log(s);\n }\n }\n};\nvar _log = function _log(s) {\n try {\n console.log('[Amplitude] ' + s);\n } catch (e) {\n // console logging not available\n }\n};\nvar isEmptyString = function isEmptyString(str) {\n return !str || str.length === 0;\n};\nvar sessionStorageEnabled = function sessionStorageEnabled() {\n try {\n if (GlobalScope.sessionStorage) {\n return true;\n }\n } catch (e) {\n // sessionStorage disabled\n }\n return false;\n};\n\n// truncate string values in event and user properties so that request size does not get too large\nvar truncate = function truncate(value) {\n if (type(value) === 'array') {\n for (var i = 0; i < value.length; i++) {\n value[i] = truncate(value[i]);\n }\n } else if (type(value) === 'object') {\n for (var key in value) {\n if (key in value) {\n value[key] = truncate(value[key]);\n }\n }\n } else {\n value = _truncateValue(value);\n }\n return value;\n};\nvar _truncateValue = function _truncateValue(value) {\n if (type(value) === 'string') {\n return value.length > Constants.MAX_STRING_LENGTH ? value.substring(0, Constants.MAX_STRING_LENGTH) : value;\n }\n return value;\n};\nvar validateInput = function validateInput(input, name, expectedType) {\n if (type(input) !== expectedType) {\n log.error('Invalid ' + name + ' input type. Expected ' + expectedType + ' but received ' + type(input));\n return false;\n }\n return true;\n};\nvar validateDeviceId = function validateDeviceId(deviceId) {\n if (!validateInput(deviceId, 'deviceId', 'string')) {\n return false;\n }\n if (deviceId.indexOf('.') >= 0) {\n log.error(\"Device IDs may not contain '.' characters. Value will be ignored: \\\"\".concat(deviceId, \"\\\"\"));\n return false;\n }\n return true;\n};\nvar validateTransport = function validateTransport(transport) {\n if (!validateInput(transport, 'transport', 'string')) {\n return false;\n }\n if (transport !== Constants.TRANSPORT_HTTP && transport !== Constants.TRANSPORT_BEACON) {\n log.error(\"transport value must be one of '\".concat(Constants.TRANSPORT_BEACON, \"' or '\").concat(Constants.TRANSPORT_HTTP, \"'\"));\n return false;\n }\n if (transport !== Constants.TRANSPORT_HTTP && typeof navigator !== 'undefined' && !navigator.sendBeacon) {\n log.error(\"browser does not support sendBeacon, so transport must be HTTP\");\n return false;\n }\n return true;\n};\n\n// do some basic sanitization and type checking, also catch property dicts with more than 1000 key/value pairs\nvar validateProperties = function validateProperties(properties) {\n var propsType = type(properties);\n if (propsType !== 'object') {\n log.error('Error: invalid properties format. Expecting Javascript object, received ' + propsType + ', ignoring');\n return {};\n }\n if (Object.keys(properties).length > Constants.MAX_PROPERTY_KEYS) {\n log.error('Error: too many properties (more than 1000), ignoring');\n return {};\n }\n var copy = {}; // create a copy with all of the valid properties\n for (var property in properties) {\n if (!Object.prototype.hasOwnProperty.call(properties, property)) {\n continue;\n }\n\n // validate key\n var key = property;\n var keyType = type(key);\n if (keyType !== 'string') {\n key = String(key);\n log.warn('WARNING: Non-string property key, received type ' + keyType + ', coercing to string \"' + key + '\"');\n }\n\n // validate value\n var value = validatePropertyValue(key, properties[property]);\n if (value === null) {\n continue;\n }\n copy[key] = value;\n }\n return copy;\n};\nvar invalidValueTypes = ['nan', 'function', 'arguments', 'regexp', 'element'];\nvar validatePropertyValue = function validatePropertyValue(key, value) {\n var valueType = type(value);\n if (invalidValueTypes.indexOf(valueType) !== -1) {\n log.warn('WARNING: Property key \"' + key + '\" with invalid value type ' + valueType + ', ignoring');\n value = null;\n } else if (valueType === 'undefined') {\n value = null;\n } else if (valueType === 'error') {\n value = String(value);\n log.warn('WARNING: Property key \"' + key + '\" with value type error, coercing to ' + value);\n } else if (valueType === 'array') {\n // check for nested arrays or objects\n var arrayCopy = [];\n for (var i = 0; i < value.length; i++) {\n var element = value[i];\n var elemType = type(element);\n if (elemType === 'array') {\n log.warn('WARNING: Cannot have ' + elemType + ' nested in an array property value, skipping');\n continue;\n } else if (elemType === 'object') {\n arrayCopy.push(validateProperties(element));\n } else {\n arrayCopy.push(validatePropertyValue(key, element));\n }\n }\n value = arrayCopy;\n } else if (valueType === 'object') {\n value = validateProperties(value);\n }\n return value;\n};\nvar validateGroups = function validateGroups(groups) {\n var groupsType = type(groups);\n if (groupsType !== 'object') {\n log.error('Error: invalid groups format. Expecting Javascript object, received ' + groupsType + ', ignoring');\n return {};\n }\n var copy = {}; // create a copy with all of the valid properties\n for (var group in groups) {\n if (!Object.prototype.hasOwnProperty.call(groups, group)) {\n continue;\n }\n\n // validate key\n var key = group;\n var keyType = type(key);\n if (keyType !== 'string') {\n key = String(key);\n log.warn('WARNING: Non-string groupType, received type ' + keyType + ', coercing to string \"' + key + '\"');\n }\n\n // validate value\n var value = validateGroupName(key, groups[group]);\n if (value === null) {\n continue;\n }\n copy[key] = value;\n }\n return copy;\n};\nvar validateGroupName = function validateGroupName(key, groupName) {\n var groupNameType = type(groupName);\n if (groupNameType === 'string') {\n return groupName;\n }\n if (groupNameType === 'date' || groupNameType === 'number' || groupNameType === 'boolean') {\n groupName = String(groupName);\n log.warn('WARNING: Non-string groupName, received type ' + groupNameType + ', coercing to string \"' + groupName + '\"');\n return groupName;\n }\n if (groupNameType === 'array') {\n // check for nested arrays or objects\n var arrayCopy = [];\n for (var i = 0; i < groupName.length; i++) {\n var element = groupName[i];\n var elemType = type(element);\n if (elemType === 'array' || elemType === 'object') {\n log.warn('WARNING: Skipping nested ' + elemType + ' in array groupName');\n continue;\n } else if (elemType === 'string') {\n arrayCopy.push(element);\n } else if (elemType === 'date' || elemType === 'number' || elemType === 'boolean') {\n element = String(element);\n log.warn('WARNING: Non-string groupName, received type ' + elemType + ', coercing to string \"' + element + '\"');\n arrayCopy.push(element);\n }\n }\n return arrayCopy;\n }\n log.warn('WARNING: Non-string groupName, received type ' + groupNameType + '. Please use strings or array of strings for groupName');\n};\n\n// parses the value of a url param (for example ?gclid=1234&...)\nvar getQueryParam = function getQueryParam(name, query) {\n name = name.replace(/[[]/, '\\\\[').replace(/[\\]]/, '\\\\]');\n var regex = new RegExp('[\\\\?&]' + name + '=([^&#]*)');\n var results = regex.exec(query);\n return results === null ? undefined : decodeURIComponent(results[1].replace(/\\+/g, ' '));\n};\nvar isWebWorkerEnvironment = function isWebWorkerEnvironment() {\n return typeof WorkerGlobalScope !== 'undefined';\n};\nvar validateSessionId = function validateSessionId(sessionId) {\n if (validateInput(sessionId, 'sessionId', 'number') && new Date(sessionId).getTime() > 0) {\n return true;\n }\n log.error(\"sessionId value must in milliseconds since epoch (Unix Timestamp)\");\n return false;\n};\nvar getLocation = function getLocation() {\n return GlobalScope.location;\n};\nvar getHost = function getHost(url) {\n var defaultHostname = GlobalScope.location ? GlobalScope.location.hostname : '';\n if (url) {\n if (typeof document !== 'undefined') {\n var a = document.createElement('a');\n a.href = url;\n return a.hostname || defaultHostname;\n }\n if (typeof URL === 'function') {\n var u = new URL(url);\n return u.hostname || defaultHostname;\n }\n }\n return defaultHostname;\n};\nvar utils = {\n setLogLevel: setLogLevel,\n getLogLevel: getLogLevel,\n logLevels: logLevels,\n log: log,\n isEmptyString: isEmptyString,\n isWebWorkerEnvironment: isWebWorkerEnvironment,\n getQueryParam: getQueryParam,\n sessionStorageEnabled: sessionStorageEnabled,\n truncate: truncate,\n validateGroups: validateGroups,\n validateInput: validateInput,\n validateProperties: validateProperties,\n validateDeviceId: validateDeviceId,\n validateTransport: validateTransport,\n validateSessionId: validateSessionId,\n getLocation: getLocation,\n getHost: getHost\n};\n\nvar get$1 = function get(name) {\n try {\n var ca = document.cookie.split(';');\n var value = null;\n for (var i = 0; i < ca.length; i++) {\n var c = ca[i];\n while (c.charAt(0) === ' ') {\n c = c.substring(1, c.length);\n }\n if (c.indexOf(name) === 0) {\n value = c.substring(name.length, c.length);\n break;\n }\n }\n return value;\n } catch (e) {\n return null;\n }\n};\nvar getAll = function getAll(name) {\n try {\n var cookieArray = document.cookie.split(';').map(function (c) {\n return c.trimStart();\n });\n var values = [];\n var _iterator = _createForOfIteratorHelper(cookieArray),\n _step;\n try {\n for (_iterator.s(); !(_step = _iterator.n()).done;) {\n var cookie = _step.value;\n while (cookie.charAt(0) === ' ') {\n cookie = cookie.substring(1);\n }\n if (cookie.indexOf(name) === 0) {\n values.push(cookie.substring(name.length));\n }\n }\n } catch (err) {\n _iterator.e(err);\n } finally {\n _iterator.f();\n }\n return values;\n } catch (e) {\n return [];\n }\n};\nvar set$1 = function set(name, value, opts) {\n var expires = value !== null ? opts.expirationDays : -1;\n if (expires) {\n var date = new Date();\n date.setTime(date.getTime() + expires * 24 * 60 * 60 * 1000);\n expires = date;\n }\n var str = name + '=' + value;\n if (expires) {\n str += '; expires=' + expires.toUTCString();\n }\n str += '; path=/';\n if (opts.domain) {\n str += '; domain=' + opts.domain;\n }\n if (opts.secure) {\n str += '; Secure';\n }\n if (opts.sameSite) {\n str += '; SameSite=' + opts.sameSite;\n }\n document.cookie = str;\n};\nvar getLastEventTime = function getLastEventTime() {\n var cookie = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n var strValue = cookie.split('.')[Constants.LAST_EVENT_TIME_INDEX];\n var parsedValue;\n if (strValue) {\n parsedValue = parseInt(strValue, 32);\n }\n if (parsedValue) {\n return parsedValue;\n } else {\n utils.log.warn(\"unable to parse malformed cookie: \".concat(cookie));\n return 0;\n }\n};\nvar sortByEventTime = function sortByEventTime(cookies) {\n return _toConsumableArray(cookies).sort(function (c1, c2) {\n var t1 = getLastEventTime(c1);\n var t2 = getLastEventTime(c2);\n // sort c1 first if its last event time is more recent\n // i.e its event time integer is larger that c2's\n return t2 - t1;\n });\n};\n\n// test that cookies are enabled - navigator.cookiesEnabled yields false positives in IE, need to test directly\nvar areCookiesEnabled = function areCookiesEnabled() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var cookieName = Constants.COOKIE_TEST_PREFIX;\n if (typeof document === 'undefined') {\n return false;\n }\n var _areCookiesEnabled = false;\n try {\n var uid = String(Date.now());\n set$1(cookieName, uid, opts);\n utils.log.info(\"Testing if cookies available\");\n _areCookiesEnabled = get$1(cookieName + '=') === uid;\n } catch (e) {\n utils.log.warn(\"Error thrown when checking for cookies. Reason: \\\"\".concat(e, \"\\\"\"));\n } finally {\n utils.log.info(\"Cleaning up cookies availability test\");\n set$1(cookieName, null, opts);\n }\n return _areCookiesEnabled;\n};\nvar baseCookie = {\n set: set$1,\n get: get$1,\n getAll: getAll,\n getLastEventTime: getLastEventTime,\n sortByEventTime: sortByEventTime,\n areCookiesEnabled: areCookiesEnabled\n};\n\n// A URL safe variation on the the list of Base64 characters\nvar base64Chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\nvar base64Id = function base64Id() {\n var str = '';\n for (var i = 0; i < 22; ++i) {\n str += base64Chars.charAt(Math.floor(Math.random() * 64));\n }\n return str;\n};\n\n// Utility that finds top level domain to write to\nvar topDomain = function topDomain(url) {\n var host = utils.getHost(url);\n var parts = host.split('.');\n var levels = [];\n var cname = '_tldtest_' + base64Id();\n if (utils.isWebWorkerEnvironment()) return '';\n for (var i = parts.length - 2; i >= 0; --i) {\n levels.push(parts.slice(i).join('.'));\n }\n for (var _i = 0; _i < levels.length; ++_i) {\n var domain = levels[_i];\n var opts = {\n domain: '.' + domain\n };\n baseCookie.set(cname, 1, opts);\n if (baseCookie.get(cname)) {\n baseCookie.set(cname, null, opts);\n return domain;\n }\n }\n return '';\n};\n\n/*\n * Cookie data\n */\nvar _options = {\n expirationDays: undefined,\n domain: undefined\n};\nvar reset = function reset() {\n _options = {\n expirationDays: undefined,\n domain: undefined\n };\n};\nvar options = function options(opts) {\n if (arguments.length === 0) {\n return _options;\n }\n opts = opts || {};\n _options.expirationDays = opts.expirationDays;\n _options.secure = opts.secure;\n _options.sameSite = opts.sameSite;\n var domain = !utils.isEmptyString(opts.domain) ? opts.domain : '.' + topDomain(utils.getLocation().href);\n var token = Math.random();\n _options.domain = domain;\n set('amplitude_test', token);\n var stored = get('amplitude_test');\n if (!stored || stored !== token) {\n domain = null;\n }\n remove('amplitude_test');\n _options.domain = domain;\n return _options;\n};\nvar _domainSpecific = function _domainSpecific(name) {\n // differentiate between cookies on different domains\n var suffix = '';\n if (_options.domain) {\n suffix = _options.domain.charAt(0) === '.' ? _options.domain.substring(1) : _options.domain;\n }\n return name + suffix;\n};\nvar get = function get(name) {\n var nameEq = _domainSpecific(name) + '=';\n var value = baseCookie.get(nameEq);\n try {\n if (value) {\n return JSON.parse(Base64.decode(value));\n }\n } catch (e) {\n return null;\n }\n return null;\n};\nvar set = function set(name, value) {\n try {\n baseCookie.set(_domainSpecific(name), Base64.encode(JSON.stringify(value)), _options);\n return true;\n } catch (e) {\n return false;\n }\n};\nvar setRaw = function setRaw(name, value) {\n try {\n baseCookie.set(_domainSpecific(name), value, _options);\n return true;\n } catch (e) {\n return false;\n }\n};\nvar getRaw = function getRaw(name) {\n var nameEq = _domainSpecific(name) + '=';\n return baseCookie.get(nameEq);\n};\nvar remove = function remove(name) {\n try {\n baseCookie.set(_domainSpecific(name), null, _options);\n return true;\n } catch (e) {\n return false;\n }\n};\nvar Cookie = {\n reset: reset,\n options: options,\n get: get,\n set: set,\n remove: remove,\n setRaw: setRaw,\n getRaw: getRaw\n};\n\nvar WorkerStorage = /*#__PURE__*/function () {\n function WorkerStorage() {\n _classCallCheck(this, WorkerStorage);\n this.map = new Map();\n this.length = 0;\n }\n _createClass(WorkerStorage, [{\n key: \"key\",\n value: function key(index) {\n var keys = Array.from(this.map.keys());\n var key = keys[index];\n return this.map.get(key);\n }\n }, {\n key: \"getItem\",\n value: function getItem(key) {\n return this.map.get(key);\n }\n }, {\n key: \"setItem\",\n value: function setItem(key, value) {\n if (!this.map.has(key)) {\n this.length += 1;\n }\n this.map.set(key, value);\n }\n }, {\n key: \"removeItem\",\n value: function removeItem(key) {\n if (this.map.has(key)) {\n this.length -= 1;\n this.map[\"delete\"](key);\n }\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.map.clear();\n this.length = 0;\n }\n }]);\n return WorkerStorage;\n}();\n\n/*\n * Implement localStorage to support Firefox 2-3 and IE 5-7\n */\nvar localStorage;\n{\n // test that Window.localStorage is available and works\n var windowLocalStorageAvailable = function windowLocalStorageAvailable() {\n var uid = new Date();\n var result;\n try {\n GlobalScope.localStorage.setItem(uid, uid);\n result = GlobalScope.localStorage.getItem(uid) === String(uid);\n GlobalScope.localStorage.removeItem(uid);\n return result;\n } catch (e) {\n // localStorage not available\n }\n return false;\n };\n if (windowLocalStorageAvailable()) {\n localStorage = GlobalScope.localStorage;\n } else if (typeof GlobalScope !== 'undefined' && GlobalScope.globalStorage) {\n // Firefox 2-3 use globalStorage\n // See https://developer.mozilla.org/en/dom/storage#globalStorage\n try {\n localStorage = GlobalScope.globalStorage[GlobalScope.location.hostname];\n } catch (e) {\n // Something bad happened...\n }\n } else if (typeof document !== 'undefined') {\n // IE 5-7 use userData\n // See http://msdn.microsoft.com/en-us/library/ms531424(v=vs.85).aspx\n var div = document.createElement('div'),\n attrKey = 'localStorage';\n div.style.display = 'none';\n document.getElementsByTagName('head')[0].appendChild(div);\n if (div.addBehavior) {\n div.addBehavior('#default#userdata');\n localStorage = {\n length: 0,\n setItem: function setItem(k, v) {\n div.load(attrKey);\n if (!div.getAttribute(k)) {\n this.length++;\n }\n div.setAttribute(k, v);\n div.save(attrKey);\n },\n getItem: function getItem(k) {\n div.load(attrKey);\n return div.getAttribute(k);\n },\n removeItem: function removeItem(k) {\n div.load(attrKey);\n if (div.getAttribute(k)) {\n this.length--;\n }\n div.removeAttribute(k);\n div.save(attrKey);\n },\n clear: function clear() {\n div.load(attrKey);\n var i = 0;\n var attr;\n while (attr = div.XMLDocument.documentElement.attributes[i++]) {\n div.removeAttribute(attr.name);\n }\n div.save(attrKey);\n this.length = 0;\n },\n key: function key(k) {\n div.load(attrKey);\n return div.XMLDocument.documentElement.attributes[k];\n }\n };\n div.load(attrKey);\n localStorage.length = div.XMLDocument.documentElement.attributes.length;\n }\n } else if (utils.isWebWorkerEnvironment()) {\n // Web worker\n localStorage = new WorkerStorage();\n }\n if (!localStorage) {\n /* eslint-disable no-unused-vars */\n localStorage = {\n length: 0,\n setItem: function setItem(k, v) {},\n getItem: function getItem(k) {},\n removeItem: function removeItem(k) {},\n clear: function clear() {},\n key: function key(k) {}\n };\n /* eslint-enable no-unused-vars */\n }\n}\n\nvar localStorage$1 = localStorage;\n\n/*\n * Abstraction layer for cookie storage.\n * Uses cookie if available, otherwise fallback to localstorage.\n */\nvar cookieStorage = function cookieStorage() {\n this.storage = null;\n};\ncookieStorage.prototype.getStorage = function (disableCookies) {\n if (this.storage !== null) {\n return this.storage;\n }\n if (!disableCookies && baseCookie.areCookiesEnabled()) {\n this.storage = Cookie;\n } else {\n // if cookies disabled, fallback to localstorage\n // note: localstorage does not persist across subdomains\n var keyPrefix = 'amp_cookiestore_';\n this.storage = {\n _options: {\n expirationDays: undefined,\n domain: undefined,\n secure: false\n },\n reset: function reset() {\n this._options = {\n expirationDays: undefined,\n domain: undefined,\n secure: false\n };\n },\n options: function options(opts) {\n if (arguments.length === 0) {\n return this._options;\n }\n opts = opts || {};\n this._options.expirationDays = opts.expirationDays || this._options.expirationDays;\n // localStorage is specific to subdomains\n this._options.domain = opts.domain || this._options.domain || GlobalScope && GlobalScope.location && GlobalScope.location.hostname;\n return this._options.secure = opts.secure || false;\n },\n get: function get(name) {\n try {\n return JSON.parse(localStorage$1.getItem(keyPrefix + name));\n } catch (e) {} /* eslint-disable-line no-empty */\n return null;\n },\n set: function set(name, value) {\n try {\n localStorage$1.setItem(keyPrefix + name, JSON.stringify(value));\n return true;\n } catch (e) {} /* eslint-disable-line no-empty */\n return false;\n },\n remove: function remove(name) {\n try {\n localStorage$1.removeItem(keyPrefix + name);\n } catch (e) {\n return false;\n }\n }\n };\n }\n return this.storage;\n};\n\nvar _storageOptionExists;\nvar storageOptionExists = (_storageOptionExists = {}, _defineProperty(_storageOptionExists, Constants.STORAGE_COOKIES, true), _defineProperty(_storageOptionExists, Constants.STORAGE_NONE, true), _defineProperty(_storageOptionExists, Constants.STORAGE_LOCAL, true), _defineProperty(_storageOptionExists, Constants.STORAGE_SESSION, true), _storageOptionExists);\n\n/**\n * MetadataStorage involves SDK data persistance\n * storage priority: cookies -> localStorage -> in memory\n * This priority can be overriden by setting the storage options.\n * if in localStorage, unable track users between subdomains\n * if in memory, then memory can't be shared between different tabs\n */\nvar MetadataStorage = /*#__PURE__*/function () {\n function MetadataStorage(_ref) {\n var storageKey = _ref.storageKey,\n disableCookies = _ref.disableCookies,\n domain = _ref.domain,\n secure = _ref.secure,\n sameSite = _ref.sameSite,\n expirationDays = _ref.expirationDays,\n storage = _ref.storage;\n _classCallCheck(this, MetadataStorage);\n this.storageKey = storageKey;\n this.domain = domain;\n this.secure = secure;\n this.sameSite = sameSite;\n this.expirationDays = expirationDays;\n this.cookieDomain = '';\n var loc = utils.getLocation() ? utils.getLocation().href : undefined;\n var writableTopDomain = !disableCookies ? topDomain(loc) : '';\n this.cookieDomain = domain || (writableTopDomain ? '.' + writableTopDomain : null);\n if (storageOptionExists[storage]) {\n this.storage = storage;\n } else {\n var disableCookieStorage = disableCookies || !baseCookie.areCookiesEnabled({\n domain: this.cookieDomain,\n secure: this.secure,\n sameSite: this.sameSite,\n expirationDays: this.expirationDays\n });\n if (disableCookieStorage) {\n this.storage = Constants.STORAGE_LOCAL;\n } else {\n this.storage = Constants.STORAGE_COOKIES;\n }\n }\n }\n _createClass(MetadataStorage, [{\n key: \"getCookieStorageKey\",\n value: function getCookieStorageKey() {\n if (!this.domain) {\n return this.storageKey;\n }\n var suffix = this.domain.charAt(0) === '.' ? this.domain.substring(1) : this.domain;\n return \"\".concat(this.storageKey).concat(suffix ? \"_\".concat(suffix) : '');\n }\n\n /*\n * Data is saved as delimited values rather than JSO to minimize cookie space\n * Should not change order of the items\n */\n }, {\n key: \"save\",\n value: function save(_ref2) {\n var deviceId = _ref2.deviceId,\n userId = _ref2.userId,\n optOut = _ref2.optOut,\n sessionId = _ref2.sessionId,\n lastEventTime = _ref2.lastEventTime,\n eventId = _ref2.eventId,\n identifyId = _ref2.identifyId,\n sequenceNumber = _ref2.sequenceNumber;\n if (this.storage === Constants.STORAGE_NONE) {\n return;\n }\n var value = [deviceId, Base64.encode(userId || ''),\n // used to convert not unicode to alphanumeric since cookies only use alphanumeric\n optOut ? '1' : '', sessionId ? sessionId.toString(32) : '0',\n // generated when instantiated, timestamp (but re-uses session id in cookie if not expired) @TODO clients may want custom session id\n lastEventTime ? lastEventTime.toString(32) : '0',\n // last time an event was set\n eventId ? eventId.toString(32) : '0', identifyId ? identifyId.toString(32) : '0', sequenceNumber ? sequenceNumber.toString(32) : '0'].join('.');\n switch (this.storage) {\n case Constants.STORAGE_SESSION:\n if (GlobalScope.sessionStorage) {\n GlobalScope.sessionStorage.setItem(this.storageKey, value);\n }\n break;\n case Constants.STORAGE_LOCAL:\n localStorage$1.setItem(this.storageKey, value);\n break;\n case Constants.STORAGE_COOKIES:\n this.saveCookie(value);\n break;\n }\n }\n }, {\n key: \"saveCookie\",\n value: function saveCookie(value) {\n baseCookie.set(this.getCookieStorageKey(), value, {\n domain: this.cookieDomain,\n secure: this.secure,\n sameSite: this.sameSite,\n expirationDays: this.expirationDays\n });\n }\n }, {\n key: \"load\",\n value: function load() {\n var _this = this;\n var str;\n if (this.storage === Constants.STORAGE_COOKIES) {\n var cookieKey = this.getCookieStorageKey() + '=';\n var allCookies = baseCookie.getAll(cookieKey);\n if (allCookies.length === 0 || allCookies.length === 1) {\n str = allCookies[0];\n } else {\n // dedup cookies by deleting them all and restoring\n // the one with the most recent event time\n var latestCookie = baseCookie.sortByEventTime(allCookies)[0];\n allCookies.forEach(function () {\n return baseCookie.set(_this.getCookieStorageKey(), null, {});\n });\n this.saveCookie(latestCookie);\n str = baseCookie.get(cookieKey);\n }\n }\n if (!str) {\n str = localStorage$1.getItem(this.storageKey);\n }\n if (!str) {\n try {\n str = GlobalScope.sessionStorage && GlobalScope.sessionStorage.getItem(this.storageKey);\n } catch (e) {\n utils.log.info(\"window.sessionStorage unavailable. Reason: \\\"\".concat(e, \"\\\"\"));\n }\n }\n if (!str) {\n return null;\n }\n var values = str.split('.');\n var userId = null;\n if (values[Constants.USER_ID_INDEX]) {\n try {\n userId = Base64.decode(values[Constants.USER_ID_INDEX]);\n } catch (e) {\n userId = null;\n }\n }\n return {\n deviceId: values[Constants.DEVICE_ID_INDEX],\n userId: userId,\n optOut: values[Constants.OPT_OUT_INDEX] === '1',\n sessionId: parseInt(values[Constants.SESSION_ID_INDEX], 32),\n lastEventTime: parseInt(values[Constants.LAST_EVENT_TIME_INDEX], 32),\n eventId: parseInt(values[Constants.EVENT_ID_INDEX], 32),\n identifyId: parseInt(values[Constants.IDENTIFY_ID_INDEX], 32),\n sequenceNumber: parseInt(values[Constants.SEQUENCE_NUMBER_INDEX], 32)\n };\n }\n\n /**\n * Clears any saved metadata storage\n * @constructor AmplitudeClient\n * @public\n * @return {boolean} True if metadata was cleared, false if none existed\n */\n }, {\n key: \"clear\",\n value: function clear() {\n var str;\n if (this.storage === Constants.STORAGE_COOKIES) {\n str = baseCookie.get(this.getCookieStorageKey() + '=');\n baseCookie.set(this.getCookieStorageKey(), null, {\n domain: this.cookieDomain,\n secure: this.secure,\n sameSite: this.sameSite,\n expirationDays: 0\n });\n }\n if (!str) {\n str = localStorage$1.getItem(this.storageKey);\n localStorage$1.clear();\n }\n if (!str) {\n try {\n str = GlobalScope.sessionStorage && GlobalScope.sessionStorage.getItem(this.storageKey);\n GlobalScope.sessionStorage.clear();\n } catch (e) {\n utils.log.info(\"window.sessionStorage unavailable. Reason: \\\"\".concat(e, \"\\\"\"));\n }\n }\n return !!str;\n }\n }]);\n return MetadataStorage;\n}();\n\nvar getUtmData = function getUtmData(rawCookie, query) {\n // Translate the utmz cookie format into url query string format.\n var cookie = rawCookie ? '?' + rawCookie.split('.').slice(-1)[0].replace(/\\|/g, '&') : '';\n var fetchParam = function fetchParam(queryName, query, cookieName, cookie) {\n return utils.getQueryParam(queryName, query) || utils.getQueryParam(cookieName, cookie);\n };\n var utmSource = fetchParam(Constants.UTM_SOURCE, query, 'utmcsr', cookie);\n var utmMedium = fetchParam(Constants.UTM_MEDIUM, query, 'utmcmd', cookie);\n var utmCampaign = fetchParam(Constants.UTM_CAMPAIGN, query, 'utmccn', cookie);\n var utmTerm = fetchParam(Constants.UTM_TERM, query, 'utmctr', cookie);\n var utmContent = fetchParam(Constants.UTM_CONTENT, query, 'utmcct', cookie);\n var utmData = {};\n var addIfNotNull = function addIfNotNull(key, value) {\n if (!utils.isEmptyString(value)) {\n utmData[key] = value;\n }\n };\n addIfNotNull(Constants.UTM_SOURCE, utmSource);\n addIfNotNull(Constants.UTM_MEDIUM, utmMedium);\n addIfNotNull(Constants.UTM_CAMPAIGN, utmCampaign);\n addIfNotNull(Constants.UTM_TERM, utmTerm);\n addIfNotNull(Constants.UTM_CONTENT, utmContent);\n return utmData;\n};\n\n/*\n * Wrapper for a user properties JSON object that supports operations.\n * Note: if a user property is used in multiple operations on the same Identify object,\n * only the first operation will be saved, and the rest will be ignored.\n */\n\nvar AMP_OP_ADD = '$add';\nvar AMP_OP_APPEND = '$append';\nvar AMP_OP_CLEAR_ALL = '$clearAll';\nvar AMP_OP_PREPEND = '$prepend';\nvar AMP_OP_SET = '$set';\nvar AMP_OP_SET_ONCE = '$setOnce';\nvar AMP_OP_UNSET = '$unset';\nvar AMP_OP_PREINSERT = '$preInsert';\nvar AMP_OP_POSTINSERT = '$postInsert';\nvar AMP_OP_REMOVE = '$remove';\n\n/**\n * Identify API - instance constructor. Identify objects are a wrapper for user property operations.\n * Each method adds a user property operation to the Identify object, and returns the same Identify object,\n * allowing you to chain multiple method calls together.\n * Note: if the same user property is used in multiple operations on a single Identify object,\n * only the first operation on that property will be saved, and the rest will be ignored.\n * @constructor Identify\n * @public\n * @example var identify = new amplitude.Identify();\n */\nvar Identify = function Identify() {\n this.userPropertiesOperations = {};\n this.properties = []; // keep track of keys that have been added\n};\n\n/**\n * Increment a user property by a given value (can also be negative to decrement).\n * If the user property does not have a value set yet, it will be initialized to 0 before being incremented.\n * @public\n * @param {string} property - The user property key.\n * @param {number|string} value - The amount by which to increment the user property. Allows numbers as strings (ex: '123').\n * @return {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n * @example var identify = new amplitude.Identify().add('karma', 1).add('friends', 1);\n * amplitude.identify(identify); // send the Identify call\n */\nIdentify.prototype.add = function (property, value) {\n if (type(value) === 'number' || type(value) === 'string') {\n this._addOperation(AMP_OP_ADD, property, value);\n } else {\n utils.log.error('Unsupported type for value: ' + type(value) + ', expecting number or string');\n }\n return this;\n};\n\n/**\n * Append a value or values to a user property.\n * If the user property does not have a value set yet,\n * it will be initialized to an empty list before the new values are appended.\n * If the user property has an existing value and it is not a list,\n * the existing value will be converted into a list with the new values appended.\n * @public\n * @param {string} property - The user property key.\n * @param {number|string|list|object} value - A value or values to append.\n * Values can be numbers, strings, lists, or object (key:value dict will be flattened).\n * @return {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n * @example var identify = new amplitude.Identify().append('ab-tests', 'new-user-tests');\n * identify.append('some_list', [1, 2, 3, 4, 'values']);\n * amplitude.identify(identify); // send the Identify call\n */\nIdentify.prototype.append = function (property, value) {\n this._addOperation(AMP_OP_APPEND, property, value);\n return this;\n};\n\n/**\n * Clear all user properties for the current user.\n * SDK user should instead call amplitude.clearUserProperties() instead of using this.\n * $clearAll needs to be sent on its own Identify object. If there are already other operations, then don't add $clearAll.\n * If $clearAll already in an Identify object, don't allow other operations to be added.\n * @private\n */\nIdentify.prototype.clearAll = function () {\n if (Object.keys(this.userPropertiesOperations).length > 0) {\n if (!Object.prototype.hasOwnProperty.call(this.userPropertiesOperations, AMP_OP_CLEAR_ALL)) {\n utils.log.error('Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll');\n }\n return this;\n }\n this.userPropertiesOperations[AMP_OP_CLEAR_ALL] = '-';\n return this;\n};\n\n/**\n * Prepend a value or values to a user property.\n * Prepend means inserting the value or values at the front of a list.\n * If the user property does not have a value set yet,\n * it will be initialized to an empty list before the new values are prepended.\n * If the user property has an existing value and it is not a list,\n * the existing value will be converted into a list with the new values prepended.\n * @public\n * @param {string} property - The user property key.\n * @param {number|string|list|object} value - A value or values to prepend.\n * Values can be numbers, strings, lists, or object (key:value dict will be flattened).\n * @return {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n * @example var identify = new amplitude.Identify().prepend('ab-tests', 'new-user-tests');\n * identify.prepend('some_list', [1, 2, 3, 4, 'values']);\n * amplitude.identify(identify); // send the Identify call\n */\nIdentify.prototype.prepend = function (property, value) {\n this._addOperation(AMP_OP_PREPEND, property, value);\n return this;\n};\n\n/**\n * Sets the value of a given user property. If a value already exists, it will be overwriten with the new value.\n * @public\n * @param {string} property - The user property key.\n * @param {number|string|list|boolean|object} value - A value or values to set.\n * Values can be numbers, strings, lists, or object (key:value dict will be flattened).\n * @return {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n * @example var identify = new amplitude.Identify().set('user_type', 'beta');\n * identify.set('name', {'first': 'John', 'last': 'Doe'}); // dict is flattened and becomes name.first: John, name.last: Doe\n * amplitude.identify(identify); // send the Identify call\n */\nIdentify.prototype.set = function (property, value) {\n this._addOperation(AMP_OP_SET, property, value);\n return this;\n};\n\n/**\n * Sets the value of a given user property only once. Subsequent setOnce operations on that user property will be ignored;\n * however, that user property can still be modified through any of the other operations.\n * Useful for capturing properties such as 'initial_signup_date', 'initial_referrer', etc.\n * @public\n * @param {string} property - The user property key.\n * @param {number|string|list|boolean|object} value - A value or values to set once.\n * Values can be numbers, strings, lists, or object (key:value dict will be flattened).\n * @return {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n * @example var identify = new amplitude.Identify().setOnce('sign_up_date', '2016-04-01');\n * amplitude.identify(identify); // send the Identify call\n */\nIdentify.prototype.setOnce = function (property, value) {\n this._addOperation(AMP_OP_SET_ONCE, property, value);\n return this;\n};\n\n/**\n * Unset and remove a user property. This user property will no longer show up in a user's profile.\n * @public\n * @param {string} property - The user property key.\n * @return {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n * @example var identify = new amplitude.Identify().unset('user_type').unset('age');\n * amplitude.identify(identify); // send the Identify call\n */\nIdentify.prototype.unset = function (property) {\n this._addOperation(AMP_OP_UNSET, property, '-');\n return this;\n};\n\n/**\n * Preinsert a value or values to a user property, if it does not exist in the user property already.\n * Preinsert means inserting the value or values to the beginning of the specified user property.\n * If the item already exists in the user property, it will be a no-op.\n * @public\n * @param {string} property - The user property key.\n * @param {number|string|list|object} value - A value or values to insert.\n * @returns {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n */\nIdentify.prototype.preInsert = function (property, value) {\n this._addOperation(AMP_OP_PREINSERT, property, value);\n return this;\n};\n\n/**\n * Postinsert a value or values to a user property, if it does not exist in the user property already.\n * Postinsert means inserting the value or values to the beginning of the specified user property.\n * If the item already exists in the user property, it will be a no-op.\n * @param {string} property - The user property key.\n * @param {number|string|list|object} value - A value or values to insert.\n * @returns {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n */\nIdentify.prototype.postInsert = function (property, value) {\n this._addOperation(AMP_OP_POSTINSERT, property, value);\n return this;\n};\n\n/**\n * Remove a value or values to a user property, if it does exist in the user property.\n * If the item does not exist in the user property, it will be a no-op.\n * @param {string} property - The user property key.\n * @param {number|string|list|object} value - A value or values to remove.\n * @returns {Identify} Returns the same Identify object, allowing you to chain multiple method calls together.\n */\nIdentify.prototype.remove = function (property, value) {\n this._addOperation(AMP_OP_REMOVE, property, value);\n return this;\n};\n\n/**\n * Helper function that adds operation to the Identify's object\n * Handle's filtering of duplicate user property keys, and filtering for clearAll.\n * @private\n */\nIdentify.prototype._addOperation = function (operation, property, value) {\n // check that the identify doesn't already contain a clearAll\n if (Object.prototype.hasOwnProperty.call(this.userPropertiesOperations, AMP_OP_CLEAR_ALL)) {\n utils.log.error('This identify already contains a $clearAll operation, skipping operation ' + operation);\n return;\n }\n\n // check that property wasn't already used in this Identify\n if (this.properties.indexOf(property) !== -1) {\n utils.log.error('User property \"' + property + '\" already used in this identify, skipping operation ' + operation);\n return;\n }\n if (!Object.prototype.hasOwnProperty.call(this.userPropertiesOperations, operation)) {\n this.userPropertiesOperations[operation] = {};\n }\n this.userPropertiesOperations[operation][property] = value;\n this.properties.push(property);\n};\n\n/*\n * Simple AJAX request object\n */\nvar Request = function Request(url, data, headers) {\n this.url = url;\n this.data = data || {};\n this.headers = headers;\n};\nvar CORS_HEADER = 'Cross-Origin-Resource-Policy';\nfunction setHeaders(xhr, headers) {\n for (var header in headers) {\n if (header === CORS_HEADER && !headers[header]) {\n continue;\n }\n xhr.setRequestHeader(header, headers[header]);\n }\n}\nRequest.prototype.send = function (callback) {\n var isIE = GlobalScope.XDomainRequest ? true : false;\n if (isIE) {\n var xdr = new GlobalScope.XDomainRequest();\n xdr.open('POST', this.url, true);\n xdr.onload = function () {\n callback(200, xdr.responseText);\n };\n xdr.onerror = function () {\n // status code not available from xdr, try string matching on responseText\n if (xdr.responseText === 'Request Entity Too Large') {\n callback(413, xdr.responseText);\n } else {\n callback(500, xdr.responseText);\n }\n };\n xdr.ontimeout = function () {};\n xdr.onprogress = function () {};\n xdr.send(queryString.stringify(this.data));\n } else if (typeof XMLHttpRequest !== 'undefined') {\n var xhr = new XMLHttpRequest();\n xhr.open('POST', this.url, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4) {\n callback(xhr.status, xhr.responseText);\n }\n };\n setHeaders(xhr, this.headers);\n xhr.send(queryString.stringify(this.data));\n } else {\n var responseStatus = undefined;\n fetch(this.url, {\n method: 'POST',\n headers: this.headers,\n body: queryString.stringify(this.data)\n }).then(function (response) {\n responseStatus = response.status;\n return response.text();\n }).then(function (responseText) {\n callback(responseStatus, responseText);\n });\n }\n //log('sent request to ' + this.url + ' with data ' + decodeURIComponent(queryString(this.data)));\n};\n\n/**\n * Revenue API - instance constructor. Wrapper for logging Revenue data. Revenue objects get passed to amplitude.logRevenueV2 to send to Amplitude servers.\n * Each method updates a revenue property in the Revenue object, and returns the same Revenue object,\n * allowing you to chain multiple method calls together.\n *\n * Note: price is a required field to log revenue events.\n * If quantity is not specified then defaults to 1.\n * @constructor Revenue\n * @public\n * @example var revenue = new amplitude.Revenue();\n */\nvar Revenue = function Revenue() {\n // required fields\n this._price = null;\n\n // optional fields\n this._productId = null;\n this._quantity = 1;\n this._revenueType = null;\n this._properties = null;\n};\n\n/**\n * Set a value for the product identifer.\n * @public\n * @param {string} productId - The value for the product identifier. Empty and invalid strings are ignored.\n * @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.\n * @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);\n * amplitude.logRevenueV2(revenue);\n */\nRevenue.prototype.setProductId = function setProductId(productId) {\n if (type(productId) !== 'string') {\n utils.log.error('Unsupported type for productId: ' + type(productId) + ', expecting string');\n } else if (utils.isEmptyString(productId)) {\n utils.log.error('Invalid empty productId');\n } else {\n this._productId = productId;\n }\n return this;\n};\n\n/**\n * Set a value for the quantity. Note revenue amount is calculated as price * quantity.\n * @public\n * @param {number} quantity - Integer value for the quantity. If not set, quantity defaults to 1.\n * @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.\n * @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setQuantity(5);\n * amplitude.logRevenueV2(revenue);\n */\nRevenue.prototype.setQuantity = function setQuantity(quantity) {\n if (type(quantity) !== 'number') {\n utils.log.error('Unsupported type for quantity: ' + type(quantity) + ', expecting number');\n } else {\n this._quantity = parseInt(quantity);\n }\n return this;\n};\n\n/**\n * Set a value for the price. This field is required for all revenue being logged.\n *\n * Note: revenue amount is calculated as price * quantity.\n * @public\n * @param {number} price - Double value for the quantity.\n * @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.\n * @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);\n * amplitude.logRevenueV2(revenue);\n */\nRevenue.prototype.setPrice = function setPrice(price) {\n if (type(price) !== 'number') {\n utils.log.error('Unsupported type for price: ' + type(price) + ', expecting number');\n } else {\n this._price = price;\n }\n return this;\n};\n\n/**\n * Set a value for the revenueType (for example purchase, cost, tax, refund, etc).\n * @public\n * @param {string} revenueType - RevenueType to designate.\n * @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.\n * @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setRevenueType('purchase');\n * amplitude.logRevenueV2(revenue);\n */\nRevenue.prototype.setRevenueType = function setRevenueType(revenueType) {\n if (type(revenueType) !== 'string') {\n utils.log.error('Unsupported type for revenueType: ' + type(revenueType) + ', expecting string');\n } else {\n this._revenueType = revenueType;\n }\n return this;\n};\n\n/**\n * Set event properties for the revenue event.\n * @public\n * @param {object} eventProperties - Revenue event properties to set.\n * @return {Revenue} Returns the same Revenue object, allowing you to chain multiple method calls together.\n * @example var event_properties = {'city': 'San Francisco'};\n * var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99).setEventProperties(event_properties);\n * amplitude.logRevenueV2(revenue);\n */\nRevenue.prototype.setEventProperties = function setEventProperties(eventProperties) {\n if (type(eventProperties) !== 'object') {\n utils.log.error('Unsupported type for eventProperties: ' + type(eventProperties) + ', expecting object');\n } else {\n this._properties = utils.validateProperties(eventProperties);\n }\n return this;\n};\n\n/**\n * @private\n */\nRevenue.prototype._isValidRevenue = function _isValidRevenue() {\n if (type(this._price) !== 'number') {\n utils.log.error('Invalid revenue, need to set price field');\n return false;\n }\n return true;\n};\n\n/**\n * @private\n */\nRevenue.prototype._toJSONObject = function _toJSONObject() {\n var obj = type(this._properties) === 'object' ? this._properties : {};\n if (this._productId !== null) {\n obj[Constants.REVENUE_PRODUCT_ID] = this._productId;\n }\n if (this._quantity !== null) {\n obj[Constants.REVENUE_QUANTITY] = this._quantity;\n }\n if (this._price !== null) {\n obj[Constants.REVENUE_PRICE] = this._price;\n }\n if (this._revenueType !== null) {\n obj[Constants.REVENUE_REVENUE_TYPE] = this._revenueType;\n }\n return obj;\n};\n\n/**\n * Source: [jed's gist]{@link https://gist.github.com/982883}.\n * Returns a random v4 UUID of the form xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx,\n * where each x is replaced with a random hexadecimal digit from 0 to f, and\n * y is replaced with a random hexadecimal digit from 8 to b.\n * Used to generate UUIDs for deviceIds.\n * @private\n */\nvar uuid = function uuid(a) {\n return a // if the placeholder was passed, return\n ?\n // a random number from 0 to 15\n (a ^\n // unless b is 8,\n Math.random() *\n // in which case\n 16 >>\n // a random number from\n a / 4\n // 8 to 11\n ).toString(16) // in hexadecimal\n :\n // or otherwise a concatenated string:\n ([1e7] +\n // 10000000 +\n -1e3 +\n // -1000 +\n -4e3 +\n // -4000 +\n -8e3 +\n // -80000000 +\n -1e11\n // -100000000000,\n ).replace(\n // replacing\n /[018]/g,\n // zeroes, ones, and eights with\n uuid // random hex digits\n );\n};\n\nvar getLanguage = function getLanguage() {\n return typeof navigator !== 'undefined' && (navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage) || '';\n};\nvar language = {\n getLanguage: getLanguage\n};\n\n/**\n * AmplitudeServerZone is for Data Residency and handling server zone related properties.\n * The server zones now are US and EU.\n *\n * For usage like sending data to Amplitude's EU servers, you need to configure the serverZone during nitializing.\n */\nvar AmplitudeServerZone = {\n US: 'US',\n EU: 'EU'\n};\nvar getEventLogApi = function getEventLogApi(serverZone) {\n var eventLogUrl = Constants.EVENT_LOG_URL;\n switch (serverZone) {\n case AmplitudeServerZone.EU:\n eventLogUrl = Constants.EVENT_LOG_EU_URL;\n break;\n case AmplitudeServerZone.US:\n eventLogUrl = Constants.EVENT_LOG_URL;\n break;\n }\n return eventLogUrl;\n};\nvar getDynamicConfigApi = function getDynamicConfigApi(serverZone) {\n var dynamicConfigUrl = Constants.DYNAMIC_CONFIG_URL;\n switch (serverZone) {\n case AmplitudeServerZone.EU:\n dynamicConfigUrl = Constants.DYNAMIC_CONFIG_EU_URL;\n break;\n case AmplitudeServerZone.US:\n dynamicConfigUrl = Constants.DYNAMIC_CONFIG_URL;\n break;\n }\n return dynamicConfigUrl;\n};\n\nvar version = \"8.21.9\";\n\n/**\n * Options used when initializing Amplitude\n * @typedef {Object} Options\n * @property {string} [apiEndpoint=`api.amplitude.com`] - Endpoint to send amplitude event requests to.\n * @property {boolean} [batchEvents=`false`] - If `true`, then events are batched together and uploaded only when the number of unsent events is greater than or equal to eventUploadThreshold or after eventUploadPeriodMillis milliseconds have passed since the first unsent event was logged.\n * @property {number} [cookieExpiration=`365`] - The number of days after which the Amplitude cookie will expire. 12 months is for GDPR compliance.\n * @property {string} [cookieName=`amplitude_id`] - *DEPRECATED*\n * @property {string} [sameSiteCookie='None'] - Sets the SameSite flag on the amplitude cookie. Decides cookie privacy policy.\n * @property {boolean} [cookieForceUpgrade=`false`] - Forces pre-v6.0.0 instances to adopt post-v6.0.0 compat cookie formats.\n * @property {boolean} [deferInitialization=`null`] - If `true`, disables the core functionality of the sdk, including saving a cookie and all logging, until explicitly enabled. To enable tracking, please call `amplitude.getInstance().enableTracking()` *Note: This will not affect users who already have an amplitude cookie. The decision to track events is determined by whether or not a user has an amplitude analytics cookie. If the `cookieExpiration is manually defined to be a short lifespan, you may need to run `amplitude.getInstance().enableTracking()` upon the cookie expiring or upon logging in.*\n * @property {boolean} [disableCookies=`false`] - Disable Ampllitude cookies altogether.\n * @property {string} [deviceId=A randomly generated UUID.] - The custom Device ID to set. *Note: This is not recommended unless you know what you are doing (e.g. you have your own system for tracking user devices).*\n * @property {boolean} [deviceIdFromUrlParam=`false`] - If `true`, then the SDK will parse Device ID values from the URL parameter amp_device_id if available. Device IDs defined in the configuration options during init will take priority over Device IDs from URL parameters.\n * @property {string} [domain=The top domain of the current page's URL. ('https://amplitude.com')] - Set a custom domain for the Amplitude cookie. To include subdomains, add a preceding period, eg: `.amplitude.com`.\n * @property {number} [eventUploadPeriodMillis=`30000` (30 sec)] - Amount of time in milliseconds that the SDK waits before uploading events if batchEvents is true.\n * @property {number} [eventUploadThreshold=`30`] - Minimum number of events to batch together per request if batchEvents is true.\n * @property {boolean} [forceHttps=`true`] - If `true`, the events will always be uploaded to HTTPS endpoint. Otherwise, it will use the embedding site's protocol.\n * @property {boolean} [includeFbclid=`false`] - If `true`, captures the fbclid URL parameter as well as the user's initial_fbclid via a setOnce operation.\n * @property {boolean} [includeGclid=`false`] - If `true`, captures the gclid URL parameter as well as the user's initial_gclid via a setOnce operation.\n * @property {boolean} [includeReferrer=`false`] - If `true`, captures the referrer and referring_domain for each session, as well as the user's initial_referrer and initial_referring_domain via a setOnce operation.\n * @property {boolean} [includeUtm=`false`] - If `true`, finds UTM parameters in the query string or the _utmz cookie, parses, and includes them as user properties on all events uploaded. This also captures initial UTM parameters for each session via a setOnce operation.\n * @property {Object} [ingestionMetadata] Ingestion metadata\n * @property {string} [ingestionMetadata.sourceName] source name in ingestion metadata, e.g. \"ampli\"\n * @property {string} [ingestionMetadata.sourceVersion] source version in ingestion metadata, e.g. \"1.0.0\"\n * @property {string} [language=The language determined by the browser] - Custom language to set.\n * @property {Object} [library=`{ name: 'amplitude-js', version: packageJsonVersion }`] - Values for the library version\n * @property {string} [logLevel=`WARN`] - Level of logs to be printed in the developer console. Valid values are 'DISABLE', 'ERROR', 'WARN', 'INFO'. To learn more about the different options, see below.\n * @property {boolean} [logAttributionCapturedEvent=`false`] - If `true`, the SDK will log an Amplitude event anytime new attribution values are captured from the user. **Note: These events count towards your event volume.** Event name being logged: [Amplitude] Attribution Captured. Event Properties that can be logged: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, `utm_content`, `referrer`, `referring_domain`, `gclid`, `fbclid`. For UTM properties to be logged, `includeUtm` must be set to `true`. For the `referrer` and `referring_domain` properties to be logged, `includeReferrer` must be set to `true`. For the `gclid` property to be logged, `includeGclid` must be set to `true`. For the `fbclid` property to be logged, `includeFbclid` must be set to `true`.\n * @property {boolean} [optOut=`false`] - Whether or not to disable tracking for the current user.\n * @property {function} [onError=`() => {}`] - Function to call on error.\n * @property {function} [onExitPage=`() => {}`] - Function called when the user exits the browser. Useful logging on page exit.\n * @property {Object} [plan] Tracking plan properties\n * @property {string} [plan.branch] The tracking plan branch name e.g. \"main\"\n * @property {string} [plan.source] The tracking plan source e.g. \"web\"\n * @property {string} [plan.version] The tracking plan version e.g. \"1\", \"15\"\n * @property {string} [plan.versionId] The tracking plan version Id e.g. \"9ec23ba0-275f-468f-80d1-66b88bff9529\"\n * @property {string} [platform=`Web`] - Platform device is running on. Defaults to `Web` (browser, including mobile browsers).\n * @property {number} [savedMaxCount=`1000`] - Maximum number of events to save in localStorage. If more events are logged while offline, then old events are removed.\n * @property {boolean} [saveEvents=`true`] - If `true`, saves events to localStorage and removes them upon successful upload. *Note: Without saving events, events may be lost if the user navigates to another page before the events are uploaded.*\n * @property {boolean} [saveParamsReferrerOncePerSession=`true`] - If `true`, then includeGclid, includeFbclid, includeReferrer, and includeUtm will only track their respective properties once per session. New values that come in during the middle of the user's session will be ignored. Set to false to always capture new values.\n * @property {boolean} [secureCookie=`false`] - If `true`, the amplitude cookie will be set with the Secure flag.\n * @property {number} [sessionTimeout=`30*60*1000` (30 min)] - The time between logged events before a new session starts in milliseconds.\n * @property {string[]} [storage=`''`] - Sets storage strategy. Options are 'cookies', 'localStorage', 'sessionStorage', or `none`. Will override `disableCookies` option\n * @property {Object} [trackingOptions=`{ city: true, country: true, carrier: true, device_manufacturer: true, device_model: true, dma: true, ip_address: true, language: true, os_name: true, os_version: true, platform: true, region: true, version_name: true}`] - Type of data associated with a user.\n * @property {string} [transport=`http`] - Network transport mechanism used to send events. Options are 'http' and 'beacon'.\n * @property {boolean} [unsetParamsReferrerOnNewSession=`false`] - If `false`, the existing `referrer` and `utm_parameter` values will be carried through each new session. If set to `true`, the `referrer` and `utm_parameter` user properties, which include `referrer`, `utm_source`, `utm_medium`, `utm_campaign`, `utm_term`, and `utm_content`, will be set to `null` upon instantiating a new session. Note: This only works if `includeReferrer` or `includeUtm` is set to `true`.\n * @property {string} [unsentKey=`amplitude_unsent`] - localStorage key that stores unsent events.\n * @property {string} [unsentIdentifyKey=`amplitude_unsent_identify`] - localStorage key that stores unsent identifies.\n * @property {number} [uploadBatchSize=`100`] - The maximum number of events to send to the server per request.\n * @property {Object} [headers=`{ 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }`] - Headers attached to an event(s) upload network request. Custom header properties are merged with this object.\n * @property {string} [serverZone] - For server zone related configuration, used for server api endpoint and dynamic configuration.\n * @property {boolean} [useDynamicConfig] - Enable dynamic configuration to find best server url for user.\n * @property {boolean} [serverZoneBasedApi] - To update api endpoint with serverZone change or not. For data residency, recommend to enable it unless using own proxy server.\n * @property {number} [sessionId=`null`] - The custom Session ID for the current session. *Note: This is not recommended unless you know what you are doing because the Session ID of a session is utilized for all session metrics in Amplitude.\n * @property {string} [partnerId=`null`] - The partner id value\n */\nvar DEFAULT_OPTIONS = {\n apiEndpoint: Constants.EVENT_LOG_URL,\n batchEvents: false,\n cookieExpiration: 365,\n // 12 months is for GDPR compliance\n cookieName: 'amplitude_id',\n // this is a deprecated option\n sameSiteCookie: 'Lax',\n // cookie privacy policy\n cookieForceUpgrade: false,\n deferInitialization: false,\n disableCookies: false,\n // this is a deprecated option\n deviceIdFromUrlParam: false,\n domain: '',\n eventUploadPeriodMillis: 30 * 1000,\n // 30s\n eventUploadThreshold: 30,\n forceHttps: true,\n includeFbclid: false,\n includeGclid: false,\n includeReferrer: false,\n includeUtm: false,\n ingestionMetadata: {\n sourceName: '',\n sourceVersion: ''\n },\n language: language.getLanguage(),\n library: {\n name: 'amplitude-js',\n version: version\n },\n logLevel: 'WARN',\n logAttributionCapturedEvent: false,\n optOut: false,\n onError: function onError() {},\n onExitPage: function onExitPage() {},\n onNewSessionStart: function onNewSessionStart() {},\n plan: {\n branch: '',\n source: '',\n version: '',\n versionId: ''\n },\n platform: 'Web',\n savedMaxCount: 1000,\n saveEvents: true,\n saveParamsReferrerOncePerSession: true,\n secureCookie: false,\n sessionTimeout: 30 * 60 * 1000,\n storage: Constants.STORAGE_DEFAULT,\n trackingOptions: {\n city: true,\n country: true,\n carrier: true,\n device_manufacturer: true,\n device_model: true,\n dma: true,\n ip_address: true,\n language: true,\n os_name: true,\n os_version: true,\n platform: true,\n region: true,\n version_name: true\n },\n transport: Constants.TRANSPORT_HTTP,\n unsetParamsReferrerOnNewSession: false,\n unsentKey: 'amplitude_unsent',\n unsentIdentifyKey: 'amplitude_unsent_identify',\n uploadBatchSize: 100,\n headers: {\n 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',\n 'Cross-Origin-Resource-Policy': 'cross-origin'\n },\n serverZone: AmplitudeServerZone.US,\n useDynamicConfig: false,\n serverZoneBasedApi: false,\n sessionId: null,\n partnerId: ''\n};\n\n/**\n * Dynamic Configuration\n * Find the best server url automatically based on app users' geo location.\n */\nvar ConfigManager = /*#__PURE__*/function () {\n function ConfigManager() {\n _classCallCheck(this, ConfigManager);\n if (!ConfigManager.instance) {\n this.ingestionEndpoint = Constants.EVENT_LOG_URL;\n ConfigManager.instance = this;\n }\n return ConfigManager.instance;\n }\n _createClass(ConfigManager, [{\n key: \"refresh\",\n value: function refresh(serverZone, forceHttps, callback) {\n var protocol = 'https';\n if (!forceHttps && 'https:' !== GlobalScope.location.protocol) {\n protocol = 'http';\n }\n var dynamicConfigUrl = protocol + '://' + getDynamicConfigApi(serverZone);\n var self = this;\n var isIE = GlobalScope.XDomainRequest ? true : false;\n if (isIE) {\n var xdr = new GlobalScope.XDomainRequest();\n xdr.open('GET', dynamicConfigUrl, true);\n xdr.onload = function () {\n var response = JSON.parse(xdr.responseText);\n self.ingestionEndpoint = response['ingestionEndpoint'];\n if (callback) {\n callback();\n }\n };\n xdr.onerror = function () {};\n xdr.ontimeout = function () {};\n xdr.onprogress = function () {};\n xdr.send();\n } else {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', dynamicConfigUrl, true);\n xhr.onreadystatechange = function () {\n if (xhr.readyState === 4 && xhr.status === 200) {\n var response = JSON.parse(xhr.responseText);\n self.ingestionEndpoint = response['ingestionEndpoint'];\n if (callback) {\n callback();\n }\n }\n };\n xhr.send();\n }\n }\n }]);\n return ConfigManager;\n}();\nvar instance$1 = new ConfigManager();\n\n/**\n * AmplitudeClient SDK API - instance constructor.\n * The Amplitude class handles creation of client instances, all you need to do is call amplitude.getInstance()\n * @constructor AmplitudeClient\n * @public\n * @example var amplitudeClient = new AmplitudeClient();\n */\nvar AmplitudeClient = function AmplitudeClient(instanceName) {\n if (!isBrowserEnv() && !utils.isWebWorkerEnvironment()) {\n utils.log.warn('amplitude-js will not work in a non-browser environment. If you are planning to add Amplitude to a node environment, please use @amplitude/node');\n }\n this._instanceName = utils.isEmptyString(instanceName) ? Constants.DEFAULT_INSTANCE : instanceName.toLowerCase();\n this._unsentEvents = [];\n this._unsentIdentifys = [];\n this.options = _objectSpread2(_objectSpread2({}, DEFAULT_OPTIONS), {}, {\n headers: _objectSpread2({}, DEFAULT_OPTIONS.headers),\n ingestionMetadata: _objectSpread2({}, DEFAULT_OPTIONS.ingestionMetadata),\n library: _objectSpread2({}, DEFAULT_OPTIONS.library),\n plan: _objectSpread2({}, DEFAULT_OPTIONS.plan),\n trackingOptions: _objectSpread2({}, DEFAULT_OPTIONS.trackingOptions)\n });\n this._q = []; // queue for proxied functions before script load\n this._sending = false;\n this._updateScheduled = false;\n this._onInitCallbacks = [];\n this._onNewSessionStartCallbacks = [];\n\n // event meta data\n this._eventId = 0;\n this._identifyId = 0;\n this._lastEventTime = null;\n this._newSession = false;\n // sequence used for by frontend for prioritizing event send retries\n this._sequenceNumber = 0;\n this._sessionId = null;\n this._isInitialized = false;\n\n // used to integrate with experiment SDK (client-side exposure tracking & real-time user properties)\n this._connector = null;\n this._userAgent = typeof navigator !== 'undefined' && navigator && navigator.userAgent || null;\n this._ua = new UAParser(this._userAgent).getResult();\n};\nAmplitudeClient.prototype.Identify = Identify;\nAmplitudeClient.prototype.Revenue = Revenue;\n\n/**\n * Initializes the Amplitude Javascript SDK with your apiKey and any optional configurations.\n * This is required before any other methods can be called.\n * @public\n * @param {string} apiKey - The API key for your app.\n * @param {string} opt_userId - (optional) An identifier for this user.\n * @param {object} opt_config - (optional) Configuration options.\n * See [options.js](https://amplitude.github.io/Amplitude-JavaScript/Options) for a list of options and default values.\n * @param {function} opt_callback - (optional) Provide a callback function to run after initialization is complete.\n * @example amplitudeClient.init('API_KEY', 'USER_ID', {includeReferrer: true, includeUtm: true}, function() { alert('init complete'); });\n */\nAmplitudeClient.prototype.init = function init(apiKey, opt_userId, opt_config, opt_callback) {\n var _this = this;\n if (type(apiKey) !== 'string' || utils.isEmptyString(apiKey)) {\n utils.log.error('Invalid apiKey. Please re-initialize with a valid apiKey');\n return;\n }\n try {\n // used to integrate with experiment SDK (client-side exposure tracking & real-time user properties)\n this._connector = AnalyticsConnector.getInstance(this._instanceName);\n _parseConfig(this.options, opt_config);\n if ((isBrowserEnv() || utils.isWebWorkerEnvironment()) && GlobalScope.Prototype !== undefined && Array.prototype.toJSON) {\n prototypeJsFix();\n utils.log.warn('Prototype.js injected Array.prototype.toJSON. Deleting Array.prototype.toJSON to prevent double-stringify');\n }\n if (this.options.cookieName !== DEFAULT_OPTIONS.cookieName) {\n utils.log.warn('The cookieName option is deprecated. We will be ignoring it for newer cookies');\n }\n if (this.options.serverZoneBasedApi) {\n this.options.apiEndpoint = getEventLogApi(this.options.serverZone);\n }\n this._refreshDynamicConfig();\n this.options.apiKey = apiKey;\n this._storageSuffix = '_' + apiKey + (this._instanceName === Constants.DEFAULT_INSTANCE ? '' : '_' + this._instanceName);\n this._storageSuffixV5 = apiKey.slice(0, 6);\n this._oldCookiename = this.options.cookieName + this._storageSuffix;\n this._unsentKey = this.options.unsentKey + this._storageSuffix;\n this._unsentIdentifyKey = this.options.unsentIdentifyKey + this._storageSuffix;\n this._cookieName = Constants.COOKIE_PREFIX + '_' + this._storageSuffixV5;\n this.cookieStorage = new cookieStorage().getStorage(this.options.disableCookies);\n this.cookieStorage.options({\n expirationDays: this.options.cookieExpiration,\n domain: this.options.domain,\n secure: this.options.secureCookie,\n sameSite: this.options.sameSiteCookie\n });\n this._metadataStorage = new MetadataStorage({\n storageKey: this._cookieName,\n disableCookies: this.options.disableCookies,\n expirationDays: this.options.cookieExpiration,\n domain: this.options.domain,\n secure: this.options.secureCookie,\n sameSite: this.options.sameSiteCookie,\n storage: this.options.storage\n });\n var hasOldCookie = !!this.cookieStorage.get(this._oldCookiename);\n var hasNewCookie = !!this._metadataStorage.load();\n this._useOldCookie = !hasNewCookie && hasOldCookie && !this.options.cookieForceUpgrade;\n var hasCookie = hasNewCookie || hasOldCookie;\n if (this.options.deferInitialization && !hasCookie) {\n this._deferInitialization(apiKey, opt_userId, opt_config, opt_callback);\n return;\n }\n this.options.domain = this.cookieStorage.options().domain;\n if (type(this.options.logLevel) === 'string') {\n utils.setLogLevel(this.options.logLevel);\n }\n var trackingOptions = _generateApiPropertiesTrackingConfig(this);\n this._apiPropertiesTrackingOptions = Object.keys(trackingOptions).length > 0 ? {\n tracking_options: trackingOptions\n } : {};\n if (this.options.cookieForceUpgrade && hasOldCookie) {\n if (!hasNewCookie) {\n _upgradeCookieData(this);\n }\n this.cookieStorage.remove(this._oldCookiename);\n }\n _loadCookieData(this);\n this._pendingReadStorage = true;\n var initFromStorage = function initFromStorage(storedDeviceId) {\n if (opt_config && opt_config.deviceId && !utils.validateDeviceId(opt_config.deviceId)) {\n utils.log.error(\"Invalid device ID rejected. Randomly generated UUID will be used instead of \\\"\".concat(opt_config.deviceId, \"\\\"\"));\n delete opt_config.deviceId;\n }\n _this.options.deviceId = _this._getInitialDeviceId(opt_config && opt_config.deviceId, storedDeviceId);\n _this.options.userId = type(opt_userId) === 'string' && !utils.isEmptyString(opt_userId) && opt_userId || type(opt_userId) === 'number' && opt_userId.toString() || _this.options.userId || null;\n var now = new Date().getTime();\n var startNewSession = !_this._sessionId || !_this._lastEventTime || now - _this._lastEventTime > _this.options.sessionTimeout || _this.options.sessionId;\n if (startNewSession) {\n if (_this.options.unsetParamsReferrerOnNewSession) {\n _this._unsetUTMParams();\n }\n _this._newSession = true;\n _this._sessionId = _this.options.sessionId || now;\n // reset this.options.sessionId to avoid re-usage\n // use instance.getSessionId() to get session id\n _this.options.sessionId = undefined;\n\n // only capture UTM params and referrer if new session\n if (_this.options.saveParamsReferrerOncePerSession) {\n _this._trackParamsAndReferrer();\n }\n }\n if (!_this.options.saveParamsReferrerOncePerSession) {\n _this._trackParamsAndReferrer();\n }\n\n // load unsent events and identifies before any attempt to log new ones\n if (_this.options.saveEvents) {\n _validateUnsentEventQueue(_this._unsentEvents);\n _validateUnsentEventQueue(_this._unsentIdentifys);\n }\n _this._lastEventTime = now;\n _saveCookieData(_this);\n _this._pendingReadStorage = false;\n _this._sendEventsIfReady(); // try sending unsent events\n\n for (var i = 0; i < _this._onInitCallbacks.length; i++) {\n _this._onInitCallbacks[i](_this);\n }\n _this._onInitCallbacks = [];\n _this._isInitialized = true;\n if (startNewSession) {\n _this._runNewSessionStartCallbacks();\n }\n };\n if (this.options.saveEvents) {\n this._unsentEvents = this._loadSavedUnsentEvents(this.options.unsentKey).map(function (event) {\n return {\n event: event\n };\n }).concat(this._unsentEvents);\n this._unsentIdentifys = this._loadSavedUnsentEvents(this.options.unsentIdentifyKey).map(function (event) {\n return {\n event: event\n };\n }).concat(this._unsentIdentifys);\n }\n if (opt_config && opt_config.onNewSessionStart) {\n this.onNewSessionStart(this.options.onNewSessionStart);\n }\n initFromStorage();\n this.runQueuedFunctions();\n if (type(opt_callback) === 'function') {\n opt_callback(this);\n }\n var onExitPage = this.options.onExitPage;\n if (type(onExitPage) === 'function' && GlobalScope.addEventListener) {\n if (!this.pageHandlersAdded) {\n this.pageHandlersAdded = true;\n var handleVisibilityChange = function handleVisibilityChange() {\n var prevTransport = _this.options.transport;\n _this.setTransport(Constants.TRANSPORT_BEACON);\n onExitPage();\n _this.setTransport(prevTransport);\n };\n\n // Monitoring just page exits because that is the most requested feature for now\n // \"If you're specifically trying to detect page unload events, the pagehide event is the best option.\"\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event\n GlobalScope.addEventListener('pagehide', function () {\n handleVisibilityChange();\n }, false);\n }\n }\n\n // Sets an event receiver to receive and forward exposure events from the experiment SDK.\n this._connector.eventBridge.setEventReceiver(function (event) {\n _this._logEvent(event.eventType, event.eventProperties, event.userProperties);\n });\n\n // Set the user ID and device ID in the core identity store to enable fetching variants.\n var editor = this._connector.identityStore.editIdentity();\n if (this.options.deviceId) {\n editor.setDeviceId(this.options.deviceId);\n }\n if (this.options.userId) {\n editor.setUserId(this.options.userId);\n }\n editor.commit();\n } catch (err) {\n utils.log.error(err);\n if (opt_config && type(opt_config.onError) === 'function') {\n opt_config.onError(err);\n }\n }\n};\nAmplitudeClient.prototype._runNewSessionStartCallbacks = function () {\n for (var i = 0; i < this._onNewSessionStartCallbacks.length; i++) {\n this._onNewSessionStartCallbacks[i](this);\n }\n};\nAmplitudeClient.prototype.deleteLowerLevelDomainCookies = function () {\n var host = utils.getHost();\n var cookieHost = this.options.domain && this.options.domain[0] === '.' ? this.options.domain.slice(1) : this.options.domain;\n if (!cookieHost || !utils.isWebWorkerEnvironment()) {\n return;\n }\n if (host !== cookieHost) {\n if (new RegExp(cookieHost + '$').test(host)) {\n var hostParts = host.split('.');\n var cookieHostParts = cookieHost.split('.');\n for (var i = hostParts.length; i > cookieHostParts.length; --i) {\n var deleteDomain = hostParts.slice(hostParts.length - i).join('.');\n baseCookie.set(this._cookieName, null, {\n domain: '.' + deleteDomain\n });\n }\n baseCookie.set(this._cookieName, null, {});\n }\n }\n};\nAmplitudeClient.prototype._getInitialDeviceId = function (configDeviceId, storedDeviceId) {\n if (configDeviceId) {\n return configDeviceId;\n }\n if (this.options.deviceIdFromUrlParam) {\n var deviceIdFromUrlParam = this._getDeviceIdFromUrlParam(this._getUrlParams());\n if (deviceIdFromUrlParam) {\n return deviceIdFromUrlParam;\n }\n }\n if (this.options.deviceId) {\n return this.options.deviceId;\n }\n if (storedDeviceId) {\n return storedDeviceId;\n }\n return base64Id();\n};\n\n// validate properties for unsent events\nvar _validateUnsentEventQueue = function _validateUnsentEventQueue(queue) {\n for (var i = 0; i < queue.length; i++) {\n var userProperties = queue[i].event.user_properties;\n var eventProperties = queue[i].event.event_properties;\n var groups = queue[i].event.groups;\n queue[i].event.user_properties = utils.validateProperties(userProperties);\n queue[i].event.event_properties = utils.validateProperties(eventProperties);\n queue[i].event.groups = utils.validateGroups(groups);\n }\n};\n\n/**\n * @private\n */\nAmplitudeClient.prototype._trackParamsAndReferrer = function _trackParamsAndReferrer() {\n var utmProperties;\n var referrerProperties;\n var gclidProperties;\n var fbclidProperties;\n if (this.options.includeUtm) {\n utmProperties = this._initUtmData();\n }\n if (this.options.includeReferrer) {\n referrerProperties = this._saveReferrer(this._getReferrer());\n }\n if (this.options.includeGclid) {\n gclidProperties = this._saveGclid(this._getUrlParams());\n }\n if (this.options.includeFbclid) {\n fbclidProperties = this._saveFbclid(this._getUrlParams());\n }\n if (this.options.logAttributionCapturedEvent) {\n var attributionProperties = _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({}, utmProperties), referrerProperties), gclidProperties), fbclidProperties);\n if (Object.keys(attributionProperties).length > 0) {\n this.logEvent(Constants.ATTRIBUTION_EVENT, attributionProperties);\n }\n }\n};\n\n/**\n * Parse and validate user specified config values and overwrite existing option value\n * DEFAULT_OPTIONS provides list of all config keys that are modifiable, as well as expected types for values\n * @private\n */\nvar _parseConfig = function _parseConfig(options, config) {\n if (type(config) !== 'object') {\n return;\n }\n\n // Add exception in headers\n var freeFormObjectKeys = new Set(['headers']);\n var zeroAllowedKeys = new Set(['eventUploadPeriodMillis']);\n\n // validates config value is defined, is the correct type, and some additional value sanity checks\n var parseValidateAndLoad = function parseValidateAndLoad(key) {\n if (!Object.prototype.hasOwnProperty.call(options, key)) {\n return; // skip bogus config values\n }\n\n var inputValue = config[key];\n var expectedType = type(options[key]);\n if (key === 'transport' && !utils.validateTransport(inputValue)) {\n return;\n } else if (key === 'sessionId' && inputValue !== null) {\n options[key] = utils.validateSessionId(inputValue) ? inputValue : null;\n return;\n } else if (!utils.validateInput(inputValue, key + ' option', expectedType)) {\n return;\n }\n if (expectedType === 'boolean') {\n options[key] = !!inputValue;\n } else if (expectedType === 'string' && !utils.isEmptyString(inputValue) || expectedType === 'number' && (inputValue > 0 || inputValue === 0 && zeroAllowedKeys.has(key)) || expectedType === 'function') {\n options[key] = inputValue;\n } else if (expectedType === 'object') {\n _parseConfig(options[key], inputValue);\n }\n };\n for (var key in config) {\n if (freeFormObjectKeys.has(key)) {\n options[key] = _objectSpread2(_objectSpread2({}, options[key]), config[key]);\n } else if (Object.prototype.hasOwnProperty.call(config, key)) {\n parseValidateAndLoad(key);\n }\n }\n};\n\n/**\n * Run functions queued up by proxy loading snippet\n * @private\n */\nAmplitudeClient.prototype.runQueuedFunctions = function () {\n var queue = this._q;\n this._q = [];\n for (var i = 0; i < queue.length; i++) {\n var fn = this[queue[i][0]];\n if (type(fn) === 'function') {\n fn.apply(this, queue[i].slice(1));\n }\n }\n};\n\n/**\n * Check that the apiKey is set before calling a function. Logs a warning message if not set.\n * @private\n */\nAmplitudeClient.prototype._apiKeySet = function _apiKeySet(methodName) {\n if (utils.isEmptyString(this.options.apiKey)) {\n utils.log.error('Invalid apiKey. Please set a valid apiKey with init() before calling ' + methodName);\n return false;\n }\n return true;\n};\n\n/**\n * Load saved events from localStorage. JSON deserializes event array. Handles case where string is corrupted.\n * @private\n */\nAmplitudeClient.prototype._loadSavedUnsentEvents = function _loadSavedUnsentEvents(unsentKey) {\n var savedUnsentEventsString = this._getFromStorage(localStorage$1, unsentKey);\n var unsentEvents = this._parseSavedUnsentEventsString(savedUnsentEventsString, unsentKey);\n this._setInStorage(localStorage$1, unsentKey, JSON.stringify(unsentEvents));\n return unsentEvents;\n};\n\n/**\n * Load saved events from localStorage. JSON deserializes event array. Handles case where string is corrupted.\n * @private\n */\nAmplitudeClient.prototype._parseSavedUnsentEventsString = function _parseSavedUnsentEventsString(savedUnsentEventsString, unsentKey) {\n if (utils.isEmptyString(savedUnsentEventsString)) {\n return []; // new app, does not have any saved events\n }\n\n if (type(savedUnsentEventsString) === 'string') {\n try {\n var events = JSON.parse(savedUnsentEventsString);\n if (type(events) === 'array') {\n // handle case where JSON dumping of unsent events is corrupted\n return events;\n }\n } catch (e) {} /* eslint-disable-line no-empty */\n }\n\n utils.log.error('Unable to load ' + unsentKey + ' events. Restart with a new empty queue.');\n return [];\n};\n\n/**\n * Returns true if a new session was created during initialization, otherwise false.\n * @public\n * @return {boolean} Whether a new session was created during initialization.\n */\nAmplitudeClient.prototype.isNewSession = function isNewSession() {\n return this._newSession;\n};\n\n/**\n * Add callbacks to call after init. Useful for users who load Amplitude through a snippet.\n * @public\n */\nAmplitudeClient.prototype.onInit = function onInit(callback) {\n if (this._isInitialized) {\n callback(this);\n } else {\n this._onInitCallbacks.push(callback);\n }\n};\n\n/**\n * Add callbacks to call after new session start.\n * @public\n */\nAmplitudeClient.prototype.onNewSessionStart = function onNewSessionStart(callback) {\n this._onNewSessionStartCallbacks.push(callback);\n};\n\n/**\n * Returns the id of the current session.\n * @public\n * @return {number} Id of the current session.\n */\nAmplitudeClient.prototype.getSessionId = function getSessionId() {\n return this._sessionId;\n};\n\n/**\n * Increments the eventId and returns it.\n * @private\n */\nAmplitudeClient.prototype.nextEventId = function nextEventId() {\n this._eventId++;\n return this._eventId;\n};\n\n/**\n * Increments the identifyId and returns it.\n * @private\n */\nAmplitudeClient.prototype.nextIdentifyId = function nextIdentifyId() {\n this._identifyId++;\n return this._identifyId;\n};\n\n/**\n * Increments the sequenceNumber and returns it.\n * @private\n */\nAmplitudeClient.prototype.nextSequenceNumber = function nextSequenceNumber() {\n this._sequenceNumber++;\n return this._sequenceNumber;\n};\n\n/**\n * Returns the total count of unsent events and identifys\n * @private\n */\nAmplitudeClient.prototype._unsentCount = function _unsentCount() {\n return this._unsentEvents.length + this._unsentIdentifys.length;\n};\n\n/**\n * Send events if ready. Returns true if events are sent.\n * @private\n */\nAmplitudeClient.prototype._sendEventsIfReady = function _sendEventsIfReady() {\n if (this._unsentCount() === 0) {\n return false;\n }\n\n // if batching disabled, send any unsent events immediately\n if (!this.options.batchEvents) {\n this.sendEvents();\n return true;\n }\n\n // if batching enabled, check if min threshold met for batch size\n if (this._unsentCount() >= this.options.eventUploadThreshold) {\n this.sendEvents();\n return true;\n }\n\n // if beacon transport is activated, send events immediately\n // because there is no way to retry them later\n if (this.options.transport === Constants.TRANSPORT_BEACON) {\n this.sendEvents();\n return true;\n }\n\n // otherwise schedule an upload after 30s\n if (!this._updateScheduled) {\n // make sure we only schedule 1 upload\n this._updateScheduled = true;\n setTimeout(function () {\n this._updateScheduled = false;\n this.sendEvents();\n }.bind(this), this.options.eventUploadPeriodMillis);\n }\n return false; // an upload was scheduled, no events were uploaded\n};\n\n/**\n * Clears any stored events and metadata. Storage is then re-created on next event sending.\n * @public\n * @return {boolean} True if metadata was cleared, false if none existed\n */\nAmplitudeClient.prototype.clearStorage = function clearStorage() {\n return this._metadataStorage.clear();\n};\n\n/**\n * Helper function to fetch values from storage\n * Storage argument allows for localStoraoge and sessionStoraoge\n * @private\n */\nAmplitudeClient.prototype._getFromStorage = function _getFromStorage(storage, key) {\n return storage.getItem(key + this._storageSuffix);\n};\n\n/**\n * Helper function to set values in storage\n * Storage argument allows for localStoraoge and sessionStoraoge\n * @private\n */\nAmplitudeClient.prototype._setInStorage = function _setInStorage(storage, key, value) {\n storage.setItem(key + this._storageSuffix, value);\n};\n\n/**\n * Fetches deviceId, userId, event meta data from amplitude cookie\n * @private\n */\nvar _loadCookieData = function _loadCookieData(scope) {\n if (!scope._useOldCookie) {\n var props = scope._metadataStorage.load();\n if (type(props) === 'object') {\n _loadCookieDataProps(scope, props);\n }\n return;\n }\n var cookieData = scope.cookieStorage.get(scope._oldCookiename);\n if (type(cookieData) === 'object') {\n _loadCookieDataProps(scope, cookieData);\n return;\n }\n};\nvar _upgradeCookieData = function _upgradeCookieData(scope) {\n var cookieData = scope.cookieStorage.get(scope._oldCookiename);\n if (type(cookieData) === 'object') {\n _loadCookieDataProps(scope, cookieData);\n _saveCookieData(scope);\n }\n};\nvar _loadCookieDataProps = function _loadCookieDataProps(scope, cookieData) {\n if (cookieData.deviceId) {\n scope.options.deviceId = cookieData.deviceId;\n }\n if (cookieData.userId) {\n scope.options.userId = cookieData.userId;\n }\n if (cookieData.optOut !== null && cookieData.optOut !== undefined) {\n // Do not clobber config opt out value if cookieData has optOut as false\n if (cookieData.optOut !== false) {\n scope.options.optOut = cookieData.optOut;\n }\n }\n if (cookieData.sessionId) {\n scope._sessionId = parseInt(cookieData.sessionId, 10);\n }\n if (cookieData.lastEventTime) {\n scope._lastEventTime = parseInt(cookieData.lastEventTime, 10);\n }\n if (cookieData.eventId) {\n scope._eventId = parseInt(cookieData.eventId, 10);\n }\n if (cookieData.identifyId) {\n scope._identifyId = parseInt(cookieData.identifyId, 10);\n }\n if (cookieData.sequenceNumber) {\n scope._sequenceNumber = parseInt(cookieData.sequenceNumber, 10);\n }\n};\n\n/**\n * Saves deviceId, userId, event meta data to amplitude cookie\n * @private\n */\nvar _saveCookieData = function _saveCookieData(scope) {\n var cookieData = {\n deviceId: scope.options.deviceId,\n userId: scope.options.userId,\n optOut: scope.options.optOut,\n sessionId: scope._sessionId,\n lastEventTime: scope._lastEventTime,\n eventId: scope._eventId,\n identifyId: scope._identifyId,\n sequenceNumber: scope._sequenceNumber\n };\n if (scope._useOldCookie) {\n scope.cookieStorage.set(scope.options.cookieName + scope._storageSuffix, cookieData);\n } else {\n scope._metadataStorage.save(cookieData);\n }\n};\n\n/**\n * Parse the utm properties out of cookies and query for adding to user properties.\n * @private\n */\nAmplitudeClient.prototype._initUtmData = function _initUtmData(queryParams, cookieParams) {\n queryParams = queryParams || this._getUrlParams();\n cookieParams = cookieParams || this.cookieStorage.get('__utmz');\n var utmProperties = getUtmData(cookieParams, queryParams);\n _sendParamsReferrerUserProperties(this, utmProperties);\n return utmProperties;\n};\n\n/**\n * Unset the utm params from the Amplitude instance and update the identify.\n * @private\n */\nAmplitudeClient.prototype._unsetUTMParams = function _unsetUTMParams() {\n var identify = new Identify();\n identify.unset(Constants.REFERRER);\n identify.unset(Constants.REFERRING_DOMAIN);\n identify.unset(Constants.UTM_SOURCE);\n identify.unset(Constants.UTM_MEDIUM);\n identify.unset(Constants.UTM_CAMPAIGN);\n identify.unset(Constants.UTM_TERM);\n identify.unset(Constants.UTM_CONTENT);\n this.identify(identify);\n};\n\n/**\n * The calling function should determine when it is appropriate to send these user properties. This function\n * will no longer contain any session storage checking logic.\n * @private\n */\nvar _sendParamsReferrerUserProperties = function _sendParamsReferrerUserProperties(scope, userProperties) {\n if (type(userProperties) !== 'object' || Object.keys(userProperties).length === 0) {\n return;\n }\n\n // setOnce the initial user properties\n var identify = new Identify();\n for (var key in userProperties) {\n if (Object.prototype.hasOwnProperty.call(userProperties, key)) {\n identify.setOnce('initial_' + key, userProperties[key]);\n identify.set(key, userProperties[key]);\n }\n }\n scope.identify(identify);\n};\n\n/**\n * @private\n */\nAmplitudeClient.prototype._getReferrer = function _getReferrer() {\n var urlRefer = this._getReferrerFromUrlParam(this._getUrlParams());\n if (urlRefer) return urlRefer;else return typeof document !== 'undefined' ? document.referrer : '';\n};\n\n/**\n * @private\n */\nAmplitudeClient.prototype._getUrlParams = function _getUrlParams() {\n return GlobalScope.location.search;\n};\n\n/**\n * Try to fetch Google Gclid from url params.\n * @private\n */\nAmplitudeClient.prototype._saveGclid = function _saveGclid(urlParams) {\n var gclid = utils.getQueryParam('gclid', urlParams);\n if (utils.isEmptyString(gclid)) {\n return;\n }\n var gclidProperties = {\n gclid: gclid\n };\n _sendParamsReferrerUserProperties(this, gclidProperties);\n return gclidProperties;\n};\n\n/**\n * Try to fetch Facebook Fbclid from url params.\n * @private\n */\nAmplitudeClient.prototype._saveFbclid = function _saveFbclid(urlParams) {\n var fbclid = utils.getQueryParam('fbclid', urlParams);\n if (utils.isEmptyString(fbclid)) {\n return;\n }\n var fbclidProperties = {\n fbclid: fbclid\n };\n _sendParamsReferrerUserProperties(this, fbclidProperties);\n return fbclidProperties;\n};\n\n/**\n * Try to fetch Amplitude device id from url params.\n * @private\n */\nAmplitudeClient.prototype._getDeviceIdFromUrlParam = function _getDeviceIdFromUrlParam(urlParams) {\n return utils.getQueryParam(Constants.AMP_DEVICE_ID_PARAM, urlParams);\n};\n\n/**\n * Try to fetch referrer from url params.\n * @private\n */\nAmplitudeClient.prototype._getReferrerFromUrlParam = function _getReferrerFromUrlParam(urlParams) {\n return utils.getQueryParam(Constants.AMP_REFERRER_PARAM, urlParams);\n};\n\n/**\n * Parse the domain from referrer info\n * @private\n */\nAmplitudeClient.prototype._getReferringDomain = function _getReferringDomain(referrer) {\n if (utils.isEmptyString(referrer)) {\n return null;\n }\n var parts = referrer.split('/');\n if (parts.length >= 3) {\n return parts[2];\n }\n return null;\n};\n\n/**\n * Fetch the referrer information, parse the domain and send.\n * Since user properties are propagated on the server, only send once per session, don't need to send with every event\n * @private\n */\nAmplitudeClient.prototype._saveReferrer = function _saveReferrer(referrer) {\n if (utils.isEmptyString(referrer)) {\n return;\n }\n var referrerInfo = {\n referrer: referrer,\n referring_domain: this._getReferringDomain(referrer)\n };\n _sendParamsReferrerUserProperties(this, referrerInfo);\n return referrerInfo;\n};\n\n/**\n * Saves unsent events and identifies to localStorage. JSON stringifies event queues before saving.\n * Note: this is called automatically every time events are logged, unless you explicitly set option saveEvents to false.\n * @private\n */\nAmplitudeClient.prototype.saveEvents = function saveEvents() {\n try {\n var serializedUnsentEvents = JSON.stringify(this._unsentEvents.map(function (_ref) {\n var event = _ref.event;\n return event;\n }));\n this._setInStorage(localStorage$1, this.options.unsentKey, serializedUnsentEvents);\n } catch (e) {} /* eslint-disable-line no-empty */\n\n try {\n var serializedIdentifys = JSON.stringify(this._unsentIdentifys.map(function (unsentIdentify) {\n return unsentIdentify.event;\n }));\n this._setInStorage(localStorage$1, this.options.unsentIdentifyKey, serializedIdentifys);\n } catch (e) {} /* eslint-disable-line no-empty */\n};\n\n/**\n * Sets a customer domain for the amplitude cookie. Useful if you want to support cross-subdomain tracking.\n * @public\n * @param {string} domain to set.\n * @example amplitudeClient.setDomain('.amplitude.com');\n */\nAmplitudeClient.prototype.setDomain = function setDomain(domain) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setDomain'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!utils.validateInput(domain, 'domain', 'string')) {\n return;\n }\n try {\n this.cookieStorage.options({\n expirationDays: this.options.cookieExpiration,\n secure: this.options.secureCookie,\n domain: domain,\n sameSite: this.options.sameSiteCookie\n });\n this.options.domain = this.cookieStorage.options().domain;\n _loadCookieData(this);\n _saveCookieData(this);\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Sets an identifier for the current user.\n * @public\n * @param {string} userId - identifier to set. Can be null.\n * @param {boolean} startNewSession - (optional) if start a new session or not\n * @example amplitudeClient.setUserId('joe@gmail.com');\n */\nAmplitudeClient.prototype.setUserId = function setUserId(userId) {\n var startNewSession = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n if (!utils.validateInput(startNewSession, 'startNewSession', 'boolean')) {\n return;\n }\n if (this._shouldDeferCall()) {\n return this._q.push(['setUserId'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n try {\n this.options.userId = userId !== undefined && userId !== null && '' + userId || null;\n if (startNewSession) {\n if (this.options.unsetParamsReferrerOnNewSession) {\n this._unsetUTMParams();\n }\n this._newSession = true;\n this._sessionId = new Date().getTime();\n this._runNewSessionStartCallbacks();\n\n // only capture UTM params and referrer if new session\n if (this.options.saveParamsReferrerOncePerSession) {\n this._trackParamsAndReferrer();\n }\n }\n _saveCookieData(this);\n\n // Update core identity store to propagate new user info\n // to experiment SDK and trigger a fetch if the ID has changed.\n if (this._connector) {\n this._connector.identityStore.editIdentity().setUserId(this.options.userId).commit();\n }\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Add user to a group or groups. You need to specify a groupType and groupName(s).\n *\n * For example you can group people by their organization.\n * In that case, groupType is \"orgId\" and groupName would be the actual ID(s).\n * groupName can be a string or an array of strings to indicate a user in multiple gruups.\n * You can also call setGroup multiple times with different groupTypes to track multiple types of groups (up to 5 per app).\n *\n * Note: this will also set groupType: groupName as a user property.\n * See the [advanced topics article](https://developers.amplitude.com/docs/javascript#user-groups) for more information.\n * @public\n * @param {string} groupType - the group type (ex: orgId)\n * @param {string|list} groupName - the name of the group (ex: 15), or a list of names of the groups\n * @example amplitudeClient.setGroup('orgId', 15); // this adds the current user to orgId 15.\n */\nAmplitudeClient.prototype.setGroup = function (groupType, groupName) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setGroup'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('setGroup()') || !utils.validateInput(groupType, 'groupType', 'string') || utils.isEmptyString(groupType)) {\n return;\n }\n var groups = {};\n groups[groupType] = groupName;\n var identify = new Identify().set(groupType, groupName);\n this._logEvent(Constants.IDENTIFY_EVENT, null, null, identify.userPropertiesOperations, groups, null, null, null);\n};\n\n/**\n * Sets whether to opt current user out of tracking.\n * @public\n * @param {boolean} enable - if true then no events will be logged or sent.\n * @example: amplitude.setOptOut(true);\n */\nAmplitudeClient.prototype.setOptOut = function setOptOut(enable) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setOptOut'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!utils.validateInput(enable, 'enable', 'boolean')) {\n return;\n }\n try {\n this.options.optOut = enable;\n _saveCookieData(this);\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Set a custom Session ID for the current session.\n * Note: This is not recommended unless you know what you are doing because the Session ID of a session is utilized for all session metrics in Amplitude.\n * The Session ID to set for the current session must be in milliseconds since epoch (Unix Timestamp).\n * @public\n * @param {int} sessionId to set.\n * @example amplitudeClient.setSessionId(1622158968000);\n */\nAmplitudeClient.prototype.setSessionId = function setSessionId(sessionId) {\n if (!utils.validateInput(sessionId, 'sessionId', 'number')) {\n return;\n }\n try {\n this._sessionId = sessionId;\n _saveCookieData(this);\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Sets the current Unix timestamp as the new Session ID for the instance.\n * @public\n * @example amplitudeClient.resetSessionId();\n */\nAmplitudeClient.prototype.resetSessionId = function resetSessionId() {\n this.setSessionId(new Date().getTime());\n};\n\n/**\n * Regenerates a new random deviceId for current user. Note: this is not recommended unless you know what you\n * are doing. This can be used in conjunction with `setUserId(null)` to anonymize users after they log out.\n * With a null userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n * This uses src/uuid.js to regenerate the deviceId.\n * @public\n */\nAmplitudeClient.prototype.regenerateDeviceId = function regenerateDeviceId() {\n if (this._shouldDeferCall()) {\n return this._q.push(['regenerateDeviceId'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n this.setDeviceId(base64Id());\n};\n\n/**\n * Sets a custom deviceId for current user. **Values may not have `.` inside them**\n * Note: this is not recommended unless you know what you are doing (like if you have your own system for managing deviceIds).\n * Make sure the deviceId you set is sufficiently unique\n * (we recommend something like a UUID - see src/uuid.js for an example of how to generate) to prevent conflicts with other devices in our system.\n * @public\n * @param {string} deviceId - custom deviceId for current user.\n * @example amplitudeClient.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');\n */\nAmplitudeClient.prototype.setDeviceId = function setDeviceId(deviceId) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setDeviceId'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!utils.validateDeviceId(deviceId)) {\n return;\n }\n try {\n if (!utils.isEmptyString(deviceId)) {\n this.options.deviceId = '' + deviceId;\n _saveCookieData(this);\n\n // Update core identity store to propagate new user info\n // to experiment SDK and trigger a fetch if the ID has changed.\n if (this._connector) {\n this._connector.identityStore.editIdentity().setDeviceId(this.options.deviceId).commit();\n }\n }\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Sets the network transport type for events. Typically used to set to 'beacon'\n * on an end-of-lifecycle event handler such as `onpagehide` or `onvisibilitychange`\n * @public\n * @param {string} transport - transport mechanism to use for events. Must be one of `http` or `beacon`.\n * @example amplitudeClient.setTransport('beacon');\n */\nAmplitudeClient.prototype.setTransport = function setTransport(transport) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setTransport'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!utils.validateTransport(transport)) {\n return;\n }\n this.options.transport = transport;\n};\n\n/**\n * Sets user properties for the current user.\n * @public\n * @param {object} - object with string keys and values for the user properties to set.\n * @param {boolean} - DEPRECATED opt_replace: in earlier versions of the JS SDK the user properties object was kept in\n * memory and replace = true would replace the object in memory. Now the properties are no longer stored in memory, so replace is deprecated.\n * @example amplitudeClient.setUserProperties({'gender': 'female', 'sign_up_complete': true})\n */\nAmplitudeClient.prototype.setUserProperties = function setUserProperties(userProperties) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setUserProperties'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('setUserProperties()') || !utils.validateInput(userProperties, 'userProperties', 'object')) {\n return;\n }\n // sanitize the userProperties dict before converting into identify\n var sanitized = utils.truncate(utils.validateProperties(userProperties));\n if (Object.keys(sanitized).length === 0) {\n return;\n }\n\n // convert userProperties into an identify call\n var identify = new Identify();\n for (var property in sanitized) {\n if (Object.prototype.hasOwnProperty.call(sanitized, property)) {\n identify.set(property, sanitized[property]);\n }\n }\n this.identify(identify);\n};\n\n/**\n * Clear all of the user properties for the current user. Note: clearing user properties is irreversible!\n * @public\n * @example amplitudeClient.clearUserProperties();\n */\nAmplitudeClient.prototype.clearUserProperties = function clearUserProperties() {\n if (this._shouldDeferCall()) {\n return this._q.push(['clearUserProperties'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('clearUserProperties()')) {\n return;\n }\n var identify = new Identify();\n identify.clearAll();\n this.identify(identify);\n};\n\n/**\n * Applies the proxied functions on the proxied object to an instance of the real object.\n * Used to convert proxied Identify and Revenue objects.\n * @private\n */\nvar _convertProxyObjectToRealObject = function _convertProxyObjectToRealObject(instance, proxy) {\n for (var i = 0; i < proxy._q.length; i++) {\n var fn = instance[proxy._q[i][0]];\n if (type(fn) === 'function') {\n fn.apply(instance, proxy._q[i].slice(1));\n }\n }\n return instance;\n};\n\n/**\n * Send an identify call containing user property operations to Amplitude servers.\n * See the [Identify](https://amplitude.github.io/Amplitude-JavaScript/Identify/)\n * reference page for more information on the Identify API and user property operations.\n * @param {Identify} identify_obj - the Identify object containing the user property operations to send.\n * @param {Amplitude~eventCallback} opt_callback - (optional) callback function to run when the identify event has been sent.\n * Note: the server response code and response body from the identify event upload are passed to the callback function.\n * @param {Amplitude~eventCallback} opt_error_callback - (optional) a callback function to run after the event logging\n * fails. The failure can be from the request being malformed or from a network failure\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @example\n * var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');\n * amplitude.identify(identify);\n */\nAmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback, outOfSession) {\n if (this._shouldDeferCall()) {\n return this._q.push(['identify'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('identify()')) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'API key is not set'\n });\n return;\n }\n\n // if identify input is a proxied object created by the async loading snippet, convert it into an identify object\n if (type(identify_obj) === 'object' && Object.prototype.hasOwnProperty.call(identify_obj, '_q')) {\n identify_obj = _convertProxyObjectToRealObject(new Identify(), identify_obj);\n }\n if (identify_obj instanceof Identify) {\n // only send if there are operations\n if (Object.keys(identify_obj.userPropertiesOperations).length > 0) {\n return this._logEvent(Constants.IDENTIFY_EVENT, null, null, identify_obj.userPropertiesOperations, null, null, null, opt_callback, opt_error_callback, outOfSession);\n } else {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'No user property operations'\n });\n }\n } else {\n utils.log.error('Invalid identify input type. Expected Identify object but saw ' + type(identify_obj));\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Invalid identify input type'\n });\n }\n};\nAmplitudeClient.prototype.groupIdentify = function (group_type, group_name, identify_obj, opt_callback, opt_error_callback, outOfSession) {\n if (this._shouldDeferCall()) {\n return this._q.push(['groupIdentify'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('groupIdentify()')) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'API key is not set'\n });\n return;\n }\n if (!utils.validateInput(group_type, 'group_type', 'string') || utils.isEmptyString(group_type)) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Invalid group type'\n });\n return;\n }\n if (group_name === null || group_name === undefined) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Invalid group name'\n });\n return;\n }\n\n // if identify input is a proxied object created by the async loading snippet, convert it into an identify object\n if (type(identify_obj) === 'object' && Object.prototype.hasOwnProperty.call(identify_obj, '_q')) {\n identify_obj = _convertProxyObjectToRealObject(new Identify(), identify_obj);\n }\n if (identify_obj instanceof Identify) {\n // only send if there are operations\n if (Object.keys(identify_obj.userPropertiesOperations).length > 0) {\n return this._logEvent(Constants.GROUP_IDENTIFY_EVENT, null, null, null, _defineProperty({}, group_type, group_name), identify_obj.userPropertiesOperations, null, opt_callback, opt_error_callback, outOfSession);\n } else {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'No group property operations'\n });\n }\n } else {\n utils.log.error('Invalid identify input type. Expected Identify object but saw ' + type(identify_obj));\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Invalid identify input type'\n });\n }\n};\n\n/**\n * Set a versionName for your application.\n * @public\n * @param {string} versionName - The version to set for your application.\n * @example amplitudeClient.setVersionName('1.12.3');\n */\nAmplitudeClient.prototype.setVersionName = function setVersionName(versionName) {\n if (this._shouldDeferCall()) {\n return this._q.push(['setVersionName'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!utils.validateInput(versionName, 'versionName', 'string')) {\n return;\n }\n this.options.versionName = versionName;\n};\n\n/**\n * Private logEvent method. Keeps apiProperties from being publicly exposed.\n * @private\n */\nAmplitudeClient.prototype._logEvent = function _logEvent(eventType, eventProperties, apiProperties, userProperties, groups, groupProperties, timestamp, callback, errorCallback, outOfSession) {\n _loadCookieData(this); // reload cookie before each log event to sync event meta-data between windows and tabs\n\n if (!eventType) {\n _logErrorsWithCallbacks(callback, errorCallback, 0, 'No request sent', {\n reason: 'Missing eventType'\n });\n return;\n }\n if (this.options.optOut) {\n _logErrorsWithCallbacks(callback, errorCallback, 0, 'No request sent', {\n reason: 'optOut is set to true'\n });\n return;\n }\n try {\n var eventId;\n if (eventType === Constants.IDENTIFY_EVENT || eventType === Constants.GROUP_IDENTIFY_EVENT) {\n eventId = this.nextIdentifyId();\n } else {\n eventId = this.nextEventId();\n }\n var sequenceNumber = this.nextSequenceNumber();\n var eventTime = type(timestamp) === 'number' ? timestamp : new Date().getTime();\n if (outOfSession) {\n this._sessionId = -1;\n } else if (!this._sessionId || !this._lastEventTime || eventTime - this._lastEventTime > this.options.sessionTimeout) {\n this._sessionId = eventTime;\n this._runNewSessionStartCallbacks();\n }\n this._lastEventTime = eventTime;\n _saveCookieData(this);\n var osName = this._ua.browser.name;\n var osVersion = this._ua.browser.major;\n var deviceModel = this._ua.device.model || this._ua.os.name;\n var deviceVendor = this._ua.device.vendor;\n userProperties = userProperties || {};\n var trackingOptions = _objectSpread2({}, this._apiPropertiesTrackingOptions);\n apiProperties = _objectSpread2(_objectSpread2({}, apiProperties || {}), trackingOptions);\n eventProperties = eventProperties || {};\n groups = groups || {};\n groupProperties = groupProperties || {};\n var event = {\n device_id: this.options.deviceId,\n user_id: this.options.userId,\n timestamp: eventTime,\n event_id: eventId,\n session_id: this._sessionId || -1,\n event_type: eventType,\n version_name: this.options.versionName || null,\n platform: _shouldTrackField(this, 'platform') ? this.options.platform : null,\n os_name: _shouldTrackField(this, 'os_name') ? osName || null : null,\n os_version: _shouldTrackField(this, 'os_version') ? osVersion || null : null,\n device_model: _shouldTrackField(this, 'device_model') ? deviceModel || null : null,\n device_manufacturer: _shouldTrackField(this, 'device_manufacturer') ? deviceVendor || null : null,\n language: _shouldTrackField(this, 'language') ? this.options.language : null,\n api_properties: apiProperties,\n event_properties: utils.truncate(utils.validateProperties(eventProperties)),\n user_properties: utils.truncate(utils.validateProperties(userProperties)),\n uuid: uuid(),\n library: this.options.library,\n sequence_number: sequenceNumber,\n // for ordering events and identifys\n groups: utils.truncate(utils.validateGroups(groups)),\n group_properties: utils.truncate(utils.validateProperties(groupProperties)),\n user_agent: this._userAgent,\n partner_id: this.options.partnerId || null\n };\n if (_isObservePlanSet(this)) {\n event.plan = {\n branch: this.options.plan.branch || undefined,\n source: this.options.plan.source || undefined,\n version: this.options.plan.version || undefined,\n versionId: this.options.plan.versionId || undefined\n };\n }\n if (_isIngestionMetadataSet(this)) {\n event.ingestion_metadata = {\n source_name: this.options.ingestionMetadata.sourceName || undefined,\n source_version: this.options.ingestionMetadata.sourceVersion || undefined\n };\n }\n if (eventType === Constants.IDENTIFY_EVENT || eventType === Constants.GROUP_IDENTIFY_EVENT) {\n this._unsentIdentifys.push({\n event: event,\n callback: callback,\n errorCallback: errorCallback\n });\n this._limitEventsQueued(this._unsentIdentifys);\n } else {\n this._unsentEvents.push({\n event: event,\n callback: callback,\n errorCallback: errorCallback\n });\n this._limitEventsQueued(this._unsentEvents);\n }\n if (this.options.saveEvents) {\n this.saveEvents();\n }\n this._sendEventsIfReady();\n\n // In the case of an identify event, update the core user store so the experiment SDK can fetch new variants and\n // utilize user properties in real time.\n if (eventType === Constants.IDENTIFY_EVENT && this._connector) {\n this._connector.identityStore.editIdentity().updateUserProperties(utils.truncate(utils.validateProperties(userProperties))).commit();\n }\n return eventId;\n } catch (e) {\n utils.log.error(e);\n }\n};\nvar _isObservePlanSet = function _isObservePlanSet(scope) {\n return scope.options.plan && (scope.options.plan.source || scope.options.plan.branch || scope.options.plan.version || scope.options.plan.versionId);\n};\nvar _isIngestionMetadataSet = function _isIngestionMetadataSet(scope) {\n return scope.options.ingestionMetadata && (scope.options.ingestionMetadata.sourceName || scope.options.ingestionMetadata.sourceVersion);\n};\nvar _shouldTrackField = function _shouldTrackField(scope, field) {\n return !!scope.options.trackingOptions[field];\n};\nvar _generateApiPropertiesTrackingConfig = function _generateApiPropertiesTrackingConfig(scope) {\n // to limit size of config payload, only send fields that have been disabled\n var fields = ['city', 'country', 'dma', 'ip_address', 'region'];\n var config = {};\n for (var i = 0; i < fields.length; i++) {\n var field = fields[i];\n if (!_shouldTrackField(scope, field)) {\n config[field] = false;\n }\n }\n return config;\n};\n\n/**\n * Remove old events from the beginning of the array if too many have accumulated. Default limit is 1000 events.\n * @private\n */\nAmplitudeClient.prototype._limitEventsQueued = function _limitEventsQueued(queue) {\n if (queue.length > this.options.savedMaxCount) {\n var deletedEvents = queue.splice(0, queue.length - this.options.savedMaxCount);\n deletedEvents.forEach(function (event) {\n _logErrorsWithCallbacks(event.callback, event.errorCallback, 0, 'No request sent', {\n reason: 'Event dropped because options.savedMaxCount exceeded. User may be offline or have a content blocker'\n });\n });\n }\n};\n\n/**\n * This is the callback for logEvent and identify calls. It gets called after the event/identify is uploaded,\n * and the server response code and response body from the upload request are passed to the callback function.\n * @callback Amplitude~eventCallback\n * @param {number} responseCode - Server response code for the event / identify upload request.\n * @param {string} responseBody - Server response body for the event / identify upload request.\n * @param {object} details - (optional) Additional information associated with sending event.\n */\n\n/**\n * Log an event with eventType and eventProperties\n * @public\n * @param {string} eventType - name of event\n * @param {object} eventProperties - (optional) an object with string keys and values for the event properties.\n * @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @param {Amplitude~eventCallback} opt_error_callback - (optional) a callback function to run after the event logging\n * fails. The failure can be from the request being malformed or from a network failure\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @param {boolean} outOfSession - (optional) if this event is out of session or not\n * @example amplitudeClient.logEvent('Clicked Homepage Button', {'finished_flow': false, 'clicks': 15});\n */\nAmplitudeClient.prototype.logEvent = function logEvent(eventType, eventProperties, opt_callback, opt_error_callback) {\n var outOfSession = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;\n if (this._shouldDeferCall()) {\n return this._q.push(['logEvent'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n return this.logEventWithTimestamp(eventType, eventProperties, null, opt_callback, opt_error_callback, outOfSession);\n};\n\n/**\n * Log an event with eventType and eventProperties and a custom timestamp\n * @public\n * @param {string} eventType - name of event\n * @param {object} eventProperties - (optional) an object with string keys and values for the event properties.\n * @param {number} timestamp - (optional) the custom timestamp as milliseconds since epoch.\n * @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @param {Amplitude~eventCallback} opt_error_callback - (optional) a callback function to run after the event logging\n * fails. The failure can be from the request being malformed or from a network failure\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @param {boolean} outOfSession - (optional) if out of the sessioin or not\n * @example amplitudeClient.logEventWithTimestamp('Clicked Homepage Button', {'finished_flow': false, 'clicks': 15}, Date.now());\n */\nAmplitudeClient.prototype.logEventWithTimestamp = function logEvent(eventType, eventProperties, timestamp, opt_callback, opt_error_callback) {\n var outOfSession = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;\n if (this._shouldDeferCall()) {\n return this._q.push(['logEventWithTimestamp'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('logEvent()')) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'API key not set'\n });\n return -1;\n }\n if (!utils.validateInput(eventType, 'eventType', 'string')) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Invalid type for eventType'\n });\n return -1;\n }\n if (utils.isEmptyString(eventType)) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Missing eventType'\n });\n return -1;\n }\n if (!utils.validateInput(outOfSession, 'outOfSession', 'boolean')) {\n _logErrorsWithCallbacks(opt_callback, opt_error_callback, 0, 'No request sent', {\n reason: 'Invalid outOfSession value'\n });\n }\n return this._logEvent(eventType, eventProperties, null, null, null, null, timestamp, opt_callback, opt_error_callback, outOfSession);\n};\n\n/**\n * Log an event with eventType, eventProperties, and groups. Use this to set event-level groups.\n * Note: the group(s) set only apply for the specific event type being logged and does not persist on the user\n * (unless you explicitly set it with setGroup).\n *\n * See the [advanced topics article](https://developers.amplitude.com/docs/javascript#user-groups) for more information\n * about groups and Count by Distinct on the Amplitude platform.\n * @public\n * @param {string} eventType - name of event\n * @param {object} eventProperties - (optional) an object with string keys and values for the event properties.\n * @param {object} groups - (optional) an object with string groupType: groupName values for the event being logged.\n * groupName can be a string or an array of strings.\n * @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @param {Amplitude~eventCallback} opt_error_callback - (optional) a callback function to run after the event logging\n * fails. The failure can be from the request being malformed or from a network failure\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @example amplitudeClient.logEventWithGroups('Clicked Button', null, {'orgId': 24});\n */\nAmplitudeClient.prototype.logEventWithGroups = function (eventType, eventProperties, groups, opt_callback, opt_error_callback) {\n var outOfSession = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;\n if (this._shouldDeferCall()) {\n return this._q.push(['logEventWithGroups'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('logEventWithGroups()')) {\n _logErrorsWithCallbacks(event.callback, event.errorCallback, 0, 'No request sent', {\n reason: 'API key not set'\n });\n return -1;\n }\n if (!utils.validateInput(eventType, 'eventType', 'string')) {\n _logErrorsWithCallbacks(event.callback, event.errorCallback, 0, 'No request sent', {\n reason: 'Invalid type for eventType'\n });\n return -1;\n }\n if (!utils.validateInput(outOfSession, 'outOfSession', 'boolean')) {\n _logErrorsWithCallbacks(event.callback, event.errorCallback, 0, 'No request sent', {\n reason: 'Invalid outOfSession value'\n });\n }\n return this._logEvent(eventType, eventProperties, null, null, groups, null, null, opt_callback, opt_error_callback, outOfSession);\n};\n\n/**\n * Test that n is a number or a numeric value.\n * @private\n */\nvar _isNumber = function _isNumber(n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n};\n\n/**\n * Handles errors that are sent to both callbacks\n * @private\n */\nvar _logErrorsWithCallbacks = function _logErrorsWithCallbacks(opt_callback, opt_error_callback, status, response, details) {\n if (type(opt_callback) === 'function') {\n opt_callback(status, response, details);\n }\n if (type(opt_error_callback) === 'function') {\n opt_error_callback(status, response, details);\n }\n};\n\n/**\n * Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like\n * revenueType and event properties.\n *\n * See the [Revenue](https://amplitude.github.io/Amplitude-JavaScript/Revenue/)\n * reference page for more information on the Revenue interface and logging revenue.\n * @public\n * @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.\n * @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);\n * amplitude.logRevenueV2(revenue);\n */\nAmplitudeClient.prototype.logRevenueV2 = function logRevenueV2(revenue_obj) {\n if (this._shouldDeferCall()) {\n return this._q.push(['logRevenueV2'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n if (!this._apiKeySet('logRevenueV2()')) {\n return;\n }\n\n // if revenue input is a proxied object created by the async loading snippet, convert it into an revenue object\n if (type(revenue_obj) === 'object' && Object.prototype.hasOwnProperty.call(revenue_obj, '_q')) {\n revenue_obj = _convertProxyObjectToRealObject(new Revenue(), revenue_obj);\n }\n if (revenue_obj instanceof Revenue) {\n // only send if revenue is valid\n if (revenue_obj && revenue_obj._isValidRevenue()) {\n return this.logEvent(Constants.REVENUE_EVENT, revenue_obj._toJSONObject());\n }\n } else {\n utils.log.error('Invalid revenue input type. Expected Revenue object but saw ' + type(revenue_obj));\n }\n};\n{\n /**\n * Log revenue event with a price, quantity, and product identifier. DEPRECATED - use logRevenueV2\n * @public\n * @deprecated\n * @param {number} price - price of revenue event\n * @param {number} quantity - (optional) quantity of products in revenue event. If no quantity specified default to 1.\n * @param {string} product - (optional) product identifier\n * @example amplitudeClient.logRevenue(3.99, 1, 'product_1234');\n */\n AmplitudeClient.prototype.logRevenue = function logRevenue(price, quantity, product) {\n if (this._shouldDeferCall()) {\n return this._q.push(['logRevenue'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n\n // Test that the parameters are of the right type.\n if (!this._apiKeySet('logRevenue()') || !_isNumber(price) || quantity !== undefined && !_isNumber(quantity)) {\n // utils.log('Price and quantity arguments to logRevenue must be numbers');\n return -1;\n }\n return this._logEvent(Constants.REVENUE_EVENT, {}, {\n productId: product,\n special: 'revenue_amount',\n quantity: quantity || 1,\n price: price\n }, null, null, null, null, null);\n };\n}\n\n/**\n * Calls error callback on unsent events\n * @private\n */\nAmplitudeClient.prototype._logErrorsOnEvents = function _logErrorsOnEvents(maxEventId, maxIdentifyId, status, response) {\n var queues = ['_unsentEvents', '_unsentIdentifys'];\n for (var j = 0; j < queues.length; j++) {\n var queue = queues[j];\n var maxId = queue === '_unsentEvents' ? maxEventId : maxIdentifyId;\n for (var i = 0; i < this[queue].length || 0; i++) {\n var unsentEvent = this[queue][i];\n if (unsentEvent.event.event_id <= maxId) {\n if (unsentEvent.errorCallback) {\n unsentEvent.errorCallback(status, response);\n }\n }\n }\n }\n};\n\n/**\n * Remove events in storage with event ids up to and including maxEventId.\n * @private\n */\nAmplitudeClient.prototype.removeEvents = function removeEvents(maxEventId, maxIdentifyId, status, response) {\n _removeEvents(this, '_unsentEvents', maxEventId, status, response);\n _removeEvents(this, '_unsentIdentifys', maxIdentifyId, status, response);\n};\n\n/**\n * Helper function to remove events up to maxId from a single queue.\n * Does a true filter in case events get out of order or old events are removed.\n * @private\n */\nvar _removeEvents = function _removeEvents(scope, eventQueue, maxId, status, response) {\n if (maxId < 0) {\n return;\n }\n var filteredEvents = [];\n for (var i = 0; i < scope[eventQueue].length || 0; i++) {\n var unsentEvent = scope[eventQueue][i];\n if (unsentEvent.event.event_id > maxId) {\n filteredEvents.push(unsentEvent);\n } else {\n if (unsentEvent.callback) {\n unsentEvent.callback(status, response);\n }\n }\n }\n scope[eventQueue] = filteredEvents;\n};\n\n/**\n * Send unsent events. Note: this is called automatically after events are logged if option batchEvents is false.\n * If batchEvents is true, then events are only sent when batch criterias are met.\n * @private\n */\nAmplitudeClient.prototype.sendEvents = function sendEvents() {\n if (!this._apiKeySet('sendEvents()')) {\n this.removeEvents(Infinity, Infinity, 0, 'No request sent', {\n reason: 'API key not set'\n });\n return;\n }\n if (this.options.optOut) {\n this.removeEvents(Infinity, Infinity, 0, 'No request sent', {\n reason: 'Opt out is set to true'\n });\n return;\n }\n\n // How is it possible to get into this state?\n if (this._unsentCount() === 0) {\n return;\n }\n\n // We only make one request at a time. sendEvents will be invoked again once\n // the last request completes.\n // beacon data is sent synchronously, so don't pause for it\n if (this.options.transport !== Constants.TRANSPORT_BEACON) {\n if (this._sending) {\n return;\n }\n this._sending = true;\n }\n var protocol = this.options.forceHttps ? 'https' : 'https:' === GlobalScope.location.protocol ? 'https' : 'http';\n var url = protocol + '://' + this.options.apiEndpoint;\n\n // fetch events to send\n var numEvents = Math.min(this._unsentCount(), this.options.uploadBatchSize);\n var mergedEvents = this._mergeEventsAndIdentifys(numEvents);\n var maxEventId = mergedEvents.maxEventId;\n var maxIdentifyId = mergedEvents.maxIdentifyId;\n var events = JSON.stringify(mergedEvents.eventsToSend.map(function (_ref2) {\n var event = _ref2.event;\n return event;\n }));\n var uploadTime = new Date().getTime();\n var data = {\n client: this.options.apiKey,\n e: events,\n v: Constants.API_VERSION,\n upload_time: uploadTime,\n checksum: md5(Constants.API_VERSION + this.options.apiKey + events + uploadTime)\n };\n if (this.options.transport === Constants.TRANSPORT_BEACON && typeof navigator !== 'undefined') {\n var success = navigator.sendBeacon(url, new URLSearchParams(data));\n if (success) {\n this.removeEvents(maxEventId, maxIdentifyId, 200, 'success');\n if (this.options.saveEvents) {\n this.saveEvents();\n }\n } else {\n this._logErrorsOnEvents(maxEventId, maxIdentifyId, 0, '');\n }\n return;\n }\n var scope = this;\n try {\n new Request(url, data, this.options.headers).send(function (status, response) {\n scope._sending = false;\n try {\n if (status === 200) {\n scope.removeEvents(maxEventId, maxIdentifyId, status, response);\n\n // Update the event cache after the removal of sent events.\n if (scope.options.saveEvents) {\n scope.saveEvents();\n }\n\n // Send more events if any queued during previous send.\n scope._sendEventsIfReady();\n\n // handle payload too large\n } else {\n scope._logErrorsOnEvents(maxEventId, maxIdentifyId, status, response);\n if (status === 413) {\n // utils.log('request too large');\n // Can't even get this one massive event through. Drop it, even if it is an identify.\n if (scope.options.uploadBatchSize === 1) {\n scope.removeEvents(maxEventId, maxIdentifyId, status, response);\n }\n\n // The server complained about the length of the request. Backoff and try again.\n scope.options.uploadBatchSize = Math.ceil(numEvents / 2);\n scope.sendEvents();\n }\n }\n // else {\n // all the events are still queued, and will be retried when the next\n // event is sent In the interest of debugging, it would be nice to have\n // something like an event emitter for a better debugging experince\n // here.\n // }\n } catch (e) {\n // utils.log.error('failed upload');\n }\n });\n } catch (e) {\n var status = 0,\n response = 'Request failed to send';\n utils.log.error(response);\n scope._logErrorsOnEvents(maxEventId, maxIdentifyId, status, response);\n scope.removeEvents(maxEventId, maxIdentifyId, status, response, {\n reason: e.message\n });\n }\n};\n\n/**\n * Merge unsent events and identifys together in sequential order based on their sequence number, for uploading.\n * Identifys given higher priority than Events. Also earlier sequence given priority\n * @private\n */\nAmplitudeClient.prototype._mergeEventsAndIdentifys = function _mergeEventsAndIdentifys(numEvents) {\n // coalesce events from both queues\n var eventsToSend = [];\n var eventIndex = 0;\n var maxEventId = -1;\n var identifyIndex = 0;\n var maxIdentifyId = -1;\n while (eventsToSend.length < numEvents) {\n var unsentEvent = void 0;\n var noIdentifys = identifyIndex >= this._unsentIdentifys.length;\n var noEvents = eventIndex >= this._unsentEvents.length;\n\n // case 0: no events or identifys left\n // note this should not happen, this means we have less events and identifys than expected\n if (noEvents && noIdentifys) {\n utils.log.error('Merging Events and Identifys, less events and identifys than expected');\n break;\n }\n\n // case 1: no identifys - grab from events\n else if (noIdentifys) {\n unsentEvent = this._unsentEvents[eventIndex++];\n maxEventId = unsentEvent.event.event_id;\n\n // case 2: no events - grab from identifys\n } else if (noEvents) {\n unsentEvent = this._unsentIdentifys[identifyIndex++];\n maxIdentifyId = unsentEvent.event.event_id;\n\n // case 3: need to compare sequence numbers\n } else {\n // events logged before v2.5.0 won't have a sequence number, put those first\n if (!('sequence_number' in this._unsentEvents[eventIndex].event) || this._unsentEvents[eventIndex].event.sequence_number < this._unsentIdentifys[identifyIndex].event.sequence_number) {\n unsentEvent = this._unsentEvents[eventIndex++];\n maxEventId = unsentEvent.event.event_id;\n } else {\n unsentEvent = this._unsentIdentifys[identifyIndex++];\n maxIdentifyId = unsentEvent.event.event_id;\n }\n }\n eventsToSend.push(unsentEvent);\n }\n return {\n eventsToSend: eventsToSend,\n maxEventId: maxEventId,\n maxIdentifyId: maxIdentifyId\n };\n};\n{\n /**\n * Set global user properties. Note this is deprecated, and we recommend using setUserProperties\n * @public\n * @deprecated\n */\n AmplitudeClient.prototype.setGlobalUserProperties = function setGlobalUserProperties(userProperties) {\n this.setUserProperties(userProperties);\n };\n}\n\n/**\n * Get the current version of Amplitude's Javascript SDK.\n * @public\n * @returns {number} version number\n * @example var amplitudeVersion = amplitude.__VERSION__;\n */\nAmplitudeClient.prototype.__VERSION__ = function getVersion() {\n return this.options.library.version;\n};\n\n/**\n * Sets the library name and version. Default is `amplitude-js` and the version defined in package.json. Used if you're building another library on top of amplitude-js and want a custom data source value\n * @public\n * @param {string} name - Custom library name\n * @param {string} version - Custom library version\n */\nAmplitudeClient.prototype.setLibrary = function setLibrary(name, version) {\n if (name !== null && typeof name !== 'undefined') {\n this.options.library.name = name;\n }\n if (version !== null && typeof version !== 'undefined') {\n this.options.library.version = version;\n }\n};\n\n/**\n * Determines whether or not to push call to this._q or invoke it\n * @private\n */\nAmplitudeClient.prototype._shouldDeferCall = function _shouldDeferCall() {\n return this._pendingReadStorage || this._initializationDeferred;\n};\n\n/**\n * Defers Initialization by putting all functions into storage until users\n * have accepted terms for tracking\n * @private\n */\nAmplitudeClient.prototype._deferInitialization = function _deferInitialization() {\n this._initializationDeferred = true;\n this._q.push(['init'].concat(Array.prototype.slice.call(arguments, 0)));\n};\n\n/**\n * Enable tracking via logging events and dropping a cookie\n * Intended to be used with the deferInitialization configuration flag\n * This will drop a cookie and reset initialization deferred\n * @public\n */\nAmplitudeClient.prototype.enableTracking = function enableTracking() {\n // This will call init (which drops the cookie) and will run any pending tasks\n this._initializationDeferred = false;\n _saveCookieData(this);\n this.runQueuedFunctions();\n};\n\n/**\n * Find best server url if choose to enable dynamic configuration.\n */\nAmplitudeClient.prototype._refreshDynamicConfig = function _refreshDynamicConfig() {\n if (this.options.useDynamicConfig) {\n instance$1.refresh(this.options.serverZone, this.options.forceHttps, function () {\n this.options.apiEndpoint = instance$1.ingestionEndpoint;\n }.bind(this));\n }\n};\n\n/**\n * Returns the deviceId value.\n * @public\n * @return {string} Id of current device.\n */\nAmplitudeClient.prototype.getDeviceId = function getDeviceId() {\n return this.options.deviceId;\n};\n\n/**\n * Returns the userId.\n * @public\n * @return {string} Id of current user.\n */\nAmplitudeClient.prototype.getUserId = function getUserId() {\n return this.options.userId;\n};\n\n/**\n * Set a custom session expiration time.\n * @public\n * @param {number} timeInMillis - session expireation time in milliseconds.\n */\nAmplitudeClient.prototype.setMinTimeBetweenSessionsMillis = function setMinTimeBetweenSessionsMillis(timeInMillis) {\n if (!utils.validateInput(timeInMillis, 'timeInMillis', 'number')) {\n return;\n }\n if (this._shouldDeferCall()) {\n return this._q.push(['setMinTimeBetweenSessionsMillis'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n try {\n this.options.sessionTimeout = timeInMillis;\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Sets minimum number of events to batch together per request if batchEvents is true.\n * @public\n * @param {number} eventUploadThreshold - The number of the event upload threshold. Default value is 30.\n * @example amplitudeClient.setEventUploadThreshold(10);\n */\nAmplitudeClient.prototype.setEventUploadThreshold = function setEventUploadThreshold(eventUploadThreshold) {\n if (!utils.validateInput(eventUploadThreshold, 'eventUploadThreshold', 'number')) {\n return;\n }\n if (this._shouldDeferCall()) {\n return this._q.push(['setEventUploadThreshold'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n try {\n this.options.eventUploadThreshold = eventUploadThreshold;\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Dynamically adjust server URL\n * @public\n * @param {bool} useDynamicConfig - if enable dynamic config or not.\n * @example amplitudeClient.setUseDynamicConfig(true);\n */\nAmplitudeClient.prototype.setUseDynamicConfig = function setUseDynamicConfig(useDynamicConfig) {\n if (!utils.validateInput(useDynamicConfig, 'useDynamicConfig', 'boolean')) {\n return;\n }\n if (this._shouldDeferCall()) {\n return this._q.push(['setUseDynamicConfig'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n try {\n this.options.useDynamicConfig = useDynamicConfig;\n this._refreshDynamicConfig();\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Sets the server zone, used for server api endpoint and dynamic configuration.\n * @public\n * @param {string} serverZone - the server zone value. AmplitudeServerZone.US or AmplitudeServerZone.EU.\n * @param {bool} serverZoneBasedApi - (optional) update api endpoint with serverZone change or not. For data residency, recommend to enable it unless using own proxy server.\n * @example amplitudeClient.setServerZone(AmplitudeServerZone.EU, true);\n */\nAmplitudeClient.prototype.setServerZone = function setServerZone(serverZone) {\n var serverZoneBasedApi = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n if (serverZone !== AmplitudeServerZone.EU && serverZone !== AmplitudeServerZone.US || !utils.validateInput(serverZoneBasedApi, 'serverZoneBasedApi', 'boolean')) {\n return;\n }\n if (this._shouldDeferCall()) {\n return this._q.push(['setServerZone'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n try {\n this.options.serverZone = serverZone;\n this.options.serverZoneBasedApi = serverZoneBasedApi;\n if (serverZoneBasedApi) {\n this.options.apiEndpoint = getEventLogApi(this.options.serverZone);\n }\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Sets the server URL for the request.\n * @public\n * @param {string} serverUrl - The value of the server URL.\n * @example amplitudeClient.setServerUrl('api.amplitude.com');\n */\nAmplitudeClient.prototype.setServerUrl = function setServerUrl(serverUrl) {\n if (!utils.validateInput(serverUrl, 'serverUrl', 'string')) {\n return;\n }\n if (this._shouldDeferCall()) {\n return this._q.push(['setServerUrl'].concat(Array.prototype.slice.call(arguments, 0)));\n }\n try {\n this.options.apiEndpoint = serverUrl;\n } catch (e) {\n utils.log.error(e);\n }\n};\n\n/**\n * Deprecated legacy API of the Amplitude JS SDK - instance manager.\n *\n * Wraps around the current [AmplitudeClient](https://amplitude.github.io/Amplitude-JavaScript/) which provides more features\n * Function calls directly on amplitude have been deprecated. Please call methods on the default shared instance: amplitude.getInstance() instead.\n *\n * See the [3.0.0 changelog](https://github.com/amplitude/Amplitude-JavaScript/blob/ed405afb5f06d5cf5b72539a5d09179abcf7e1fe/README.md#300-update-and-logging-events-to-multiple-amplitude-apps) for more information about this change.\n * @constructor Amplitude\n * @public\n * @deprecated\n * @example var amplitude = new Amplitude();\n */\nvar Amplitude = function Amplitude() {\n this.options = _objectSpread2({}, DEFAULT_OPTIONS);\n this._q = [];\n this._instances = {}; // mapping of instance names to instances\n};\n\nAmplitude.prototype.Identify = Identify;\nAmplitude.prototype.Revenue = Revenue;\nAmplitude.prototype.getInstance = function getInstance(instance) {\n instance = utils.isEmptyString(instance) ? Constants.DEFAULT_INSTANCE : instance.toLowerCase();\n var client = this._instances[instance];\n if (client === undefined) {\n client = new AmplitudeClient(instance);\n this._instances[instance] = client;\n }\n return client;\n};\n{\n /**\n * Initializes the Amplitude Javascript SDK with your apiKey and any optional configurations.\n * This is required before any other methods can be called.\n * @public\n * @param {string} apiKey - The API key for your app.\n * @param {string} opt_userId - (optional) An identifier for this user.\n * @param {object} opt_config - (optional) Configuration options.\n * See [options.js](https://github.com/amplitude/Amplitude-JavaScript/blob/master/src/options.js#L14) for list of options and default values.\n * @param {function} opt_callback - (optional) Provide a callback function to run after initialization is complete.\n * @deprecated Please use amplitude.getInstance().init(apiKey, opt_userId, opt_config, opt_callback);\n * @example amplitude.init('API_KEY', 'USER_ID', {includeReferrer: true, includeUtm: true}, function() { alert('init complete'); });\n */\n Amplitude.prototype.init = function init(apiKey, opt_userId, opt_config, opt_callback) {\n this.getInstance().init(apiKey, opt_userId, opt_config, function (instance) {\n // make options such as deviceId available for callback functions\n this.options = instance.options;\n if (type(opt_callback) === 'function') {\n opt_callback(instance);\n }\n }.bind(this));\n };\n\n /**\n * Returns true if a new session was created during initialization, otherwise false.\n * @public\n * @return {boolean} Whether a new session was created during initialization.\n * @deprecated Please use amplitude.getInstance().isNewSession();\n */\n Amplitude.prototype.isNewSession = function isNewSession() {\n return this.getInstance().isNewSession();\n };\n\n /**\n * Returns the id of the current session.\n * @public\n * @return {number} Id of the current session.\n * @deprecated Please use amplitude.getInstance().getSessionId();\n */\n Amplitude.prototype.getSessionId = function getSessionId() {\n return this.getInstance().getSessionId();\n };\n\n /**\n * Increments the eventId and returns it.\n * @private\n */\n Amplitude.prototype.nextEventId = function nextEventId() {\n return this.getInstance().nextEventId();\n };\n\n /**\n * Increments the identifyId and returns it.\n * @private\n */\n Amplitude.prototype.nextIdentifyId = function nextIdentifyId() {\n return this.getInstance().nextIdentifyId();\n };\n\n /**\n * Increments the sequenceNumber and returns it.\n * @private\n */\n Amplitude.prototype.nextSequenceNumber = function nextSequenceNumber() {\n return this.getInstance().nextSequenceNumber();\n };\n\n /**\n * Saves unsent events and identifies to localStorage. JSON stringifies event queues before saving.\n * Note: this is called automatically every time events are logged, unless you explicitly set option saveEvents to false.\n * @private\n */\n Amplitude.prototype.saveEvents = function saveEvents() {\n this.getInstance().saveEvents();\n };\n\n /**\n * Sets a customer domain for the amplitude cookie. Useful if you want to support cross-subdomain tracking.\n * @public\n * @param {string} domain to set.\n * @deprecated Please use amplitude.getInstance().setDomain(domain);\n * @example amplitude.setDomain('.amplitude.com');\n */\n Amplitude.prototype.setDomain = function setDomain(domain) {\n this.getInstance().setDomain(domain);\n };\n\n /**\n * Sets an identifier for the current user.\n * @public\n * @param {string} userId - identifier to set. Can be null.\n * @deprecated Please use amplitude.getInstance().setUserId(userId);\n * @example amplitude.setUserId('joe@gmail.com');\n */\n Amplitude.prototype.setUserId = function setUserId(userId) {\n this.getInstance().setUserId(userId);\n };\n\n /**\n * Add user to a group or groups. You need to specify a groupType and groupName(s).\n * For example you can group people by their organization.\n * In that case groupType is \"orgId\" and groupName would be the actual ID(s).\n * groupName can be a string or an array of strings to indicate a user in multiple gruups.\n * You can also call setGroup multiple times with different groupTypes to track multiple types of groups (up to 5 per app).\n * Note: this will also set groupType: groupName as a user property.\n * See the [advanced topics article](https://developers.amplitude.com/docs/javascript#user-groups) for more information.\n * @public\n * @param {string} groupType - the group type (ex: orgId)\n * @param {string|list} groupName - the name of the group (ex: 15), or a list of names of the groups\n * @deprecated Please use amplitude.getInstance().setGroup(groupType, groupName);\n * @example amplitude.setGroup('orgId', 15); // this adds the current user to orgId 15.\n */\n Amplitude.prototype.setGroup = function (groupType, groupName) {\n this.getInstance().setGroup(groupType, groupName);\n };\n\n /**\n * Sets whether to opt current user out of tracking.\n * @public\n * @param {boolean} enable - if true then no events will be logged or sent.\n * @deprecated Please use amplitude.getInstance().setOptOut(enable);\n * @example: amplitude.setOptOut(true);\n */\n Amplitude.prototype.setOptOut = function setOptOut(enable) {\n this.getInstance().setOptOut(enable);\n };\n\n /**\n * Regenerates a new random deviceId for current user. Note: this is not recommended unless you know what you\n * are doing. This can be used in conjunction with `setUserId(null)` to anonymize users after they log out.\n * With a null userId and a completely new deviceId, the current user would appear as a brand new user in dashboard.\n * This uses src/uuid.js to regenerate the deviceId.\n * @public\n * @deprecated Please use amplitude.getInstance().regenerateDeviceId();\n */\n Amplitude.prototype.regenerateDeviceId = function regenerateDeviceId() {\n this.getInstance().regenerateDeviceId();\n };\n\n /**\n * Sets a custom deviceId for current user. Note: this is not recommended unless you know what you are doing\n * (like if you have your own system for managing deviceIds).\n *\n * Make sure the deviceId you set is sufficiently unique\n * (we recommend something like a UUID - see src/uuid.js for an example of how to generate) to prevent conflicts with other devices in our system.\n * @public\n * @param {string} deviceId - custom deviceId for current user.\n * @deprecated Please use amplitude.getInstance().setDeviceId(deviceId);\n * @example amplitude.setDeviceId('45f0954f-eb79-4463-ac8a-233a6f45a8f0');\n */\n Amplitude.prototype.setDeviceId = function setDeviceId(deviceId) {\n this.getInstance().setDeviceId(deviceId);\n };\n\n /**\n * Sets user properties for the current user.\n * @public\n * @param {object} userProperties - object with string keys and values for the user properties to set.\n * @param {boolean} opt_replace - Deprecated. In earlier versions of the JS SDK the user properties object was kept in\n * memory and replace = true would replace the object in memory. Now the properties are no longer stored in memory, so replace is deprecated.\n * @deprecated Please use amplitude.getInstance().setUserProperties(userProperties);\n * @example amplitude.setUserProperties({'gender': 'female', 'sign_up_complete': true})\n */\n Amplitude.prototype.setUserProperties = function setUserProperties(userProperties) {\n this.getInstance().setUserProperties(userProperties);\n };\n\n /**\n * Clear all of the user properties for the current user. Note: clearing user properties is irreversible!\n * @public\n * @deprecated Please use amplitude.getInstance().clearUserProperties();\n * @example amplitude.clearUserProperties();\n */\n Amplitude.prototype.clearUserProperties = function clearUserProperties() {\n this.getInstance().clearUserProperties();\n };\n\n /**\n * Send an identify call containing user property operations to Amplitude servers.\n * See the [Identify](https://amplitude.github.io/Amplitude-JavaScript/Identify/)\n * reference page for more information on the Identify API and user property operations.\n * @param {Identify} identify_obj - the Identify object containing the user property operations to send.\n * @param {Amplitude~eventCallback} opt_callback - (optional) callback function to run when the identify event has been sent.\n * Note: the server response code and response body from the identify event upload are passed to the callback function.\n * @deprecated Please use amplitude.getInstance().identify(identify);\n * @example\n * var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31');\n * amplitude.identify(identify);\n */\n Amplitude.prototype.identify = function (identify_obj, opt_callback) {\n this.getInstance().identify(identify_obj, opt_callback);\n };\n\n /**\n * Set a versionName for your application.\n * @public\n * @param {string} versionName - The version to set for your application.\n * @deprecated Please use amplitude.getInstance().setVersionName(versionName);\n * @example amplitude.setVersionName('1.12.3');\n */\n Amplitude.prototype.setVersionName = function setVersionName(versionName) {\n this.getInstance().setVersionName(versionName);\n };\n\n /**\n * This is the callback for logEvent and identify calls. It gets called after the event/identify is uploaded,\n * and the server response code and response body from the upload request are passed to the callback function.\n * @callback Amplitude~eventCallback\n * @param {number} responseCode - Server response code for the event / identify upload request.\n * @param {string} responseBody - Server response body for the event / identify upload request.\n */\n\n /**\n * Log an event with eventType and eventProperties\n * @public\n * @param {string} eventType - name of event\n * @param {object} eventProperties - (optional) an object with string keys and values for the event properties.\n * @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @deprecated Please use amplitude.getInstance().logEvent(eventType, eventProperties, opt_callback);\n * @example amplitude.logEvent('Clicked Homepage Button', {'finished_flow': false, 'clicks': 15});\n */\n Amplitude.prototype.logEvent = function logEvent(eventType, eventProperties, opt_callback) {\n return this.getInstance().logEvent(eventType, eventProperties, opt_callback);\n };\n\n /**\n * Log an event with eventType, eventProperties, and groups. Use this to set event-level groups.\n *\n * Note: the group(s) set only apply for the specific event type being logged and does not persist on the user\n * (unless you explicitly set it with setGroup).\n *\n * See the [advanced topics article](https://developers.amplitude.com/docs/javascript#user-groups) for more information\n * about groups and Count by Distinct on the Amplitude platform.\n * @public\n * @param {string} eventType - name of event\n * @param {object} eventProperties - (optional) an object with string keys and values for the event properties.\n * @param {object} groups - (optional) an object with string groupType: groupName values for the event being logged.\n * groupName can be a string or an array of strings.\n * @param {Amplitude~eventCallback} opt_callback - (optional) a callback function to run after the event is logged.\n * Note: the server response code and response body from the event upload are passed to the callback function.\n * @deprecated Please use amplitude.getInstance().logEventWithGroups(eventType, eventProperties, groups, opt_callback);\n * @example amplitude.logEventWithGroups('Clicked Button', null, {'orgId': 24});\n */\n Amplitude.prototype.logEventWithGroups = function (eventType, eventProperties, groups, opt_callback) {\n return this.getInstance().logEventWithGroups(eventType, eventProperties, groups, opt_callback);\n };\n\n /**\n * Log revenue with Revenue interface. The new revenue interface allows for more revenue fields like\n * revenueType and event properties.\n *\n * See the [Revenue](https://amplitude.github.io/Amplitude-JavaScript/Revenue/)\n * reference page for more information on the Revenue interface and logging revenue.\n * @public\n * @param {Revenue} revenue_obj - the revenue object containing the revenue data being logged.\n * @deprecated Please use amplitude.getInstance().logRevenueV2(revenue_obj);\n * @example var revenue = new amplitude.Revenue().setProductId('productIdentifier').setPrice(10.99);\n * amplitude.logRevenueV2(revenue);\n */\n Amplitude.prototype.logRevenueV2 = function logRevenueV2(revenue_obj) {\n return this.getInstance().logRevenueV2(revenue_obj);\n };\n\n /**\n * Log revenue event with a price, quantity, and product identifier.\n * @public\n * @param {number} price - price of revenue event\n * @param {number} quantity - (optional) quantity of products in revenue event. If no quantity specified default to 1.\n * @param {string} product - (optional) product identifier\n * @deprecated Please use amplitude.getInstance().logRevenueV2(revenue_obj);\n * @example amplitude.logRevenue(3.99, 1, 'product_1234');\n */\n Amplitude.prototype.logRevenue = function logRevenue(price, quantity, product) {\n return this.getInstance().logRevenue(price, quantity, product);\n };\n\n /**\n * Remove events in storage with event ids up to and including maxEventId.\n * @private\n */\n Amplitude.prototype.removeEvents = function removeEvents(maxEventId, maxIdentifyId) {\n this.getInstance().removeEvents(maxEventId, maxIdentifyId);\n };\n\n /**\n * Send unsent events. Note: this is called automatically after events are logged if option batchEvents is false.\n * If batchEvents is true, then events are only sent when batch criterias are met.\n * @private\n * @param {Amplitude~eventCallback} callback - (optional) callback to run after events are sent.\n * Note the server response code and response body are passed to the callback as input arguments.\n */\n Amplitude.prototype.sendEvents = function sendEvents(callback) {\n this.getInstance().sendEvents(callback);\n };\n\n /**\n * Set global user properties.\n * @public\n * @deprecated Please use amplitudeClient.setUserProperties\n */\n Amplitude.prototype.setGlobalUserProperties = function setGlobalUserProperties(userProperties) {\n this.getInstance().setUserProperties(userProperties);\n };\n}\n\n/**\n * Get the current version of Amplitude's Javascript SDK.\n * @public\n * @returns {number} version number\n * @example var amplitudeVersion = amplitude.__VERSION__;\n */\nAmplitude.prototype.__VERSION__ = version;\n\n// Entry point\nvar old = typeof GlobalScope !== 'undefined' && GlobalScope.amplitude || {};\nvar newInstance = new Amplitude();\nnewInstance._q = old._q || [];\n\n/**\n * Instantiates Amplitude object and runs all queued function logged by stubbed methods provided by snippets\n * Event queue allows async loading of SDK to not blocking client's app\n */\nfor (var instance in old._iq) {\n // migrate each instance's queue\n if (Object.prototype.hasOwnProperty.call(old._iq, instance)) {\n newInstance.getInstance(instance)._q = old._iq[instance]._q || [];\n }\n}\n\nexport { newInstance as default };\n","import decodeComponent from 'decode-uri-component';\nimport splitOnFirst from 'split-on-first';\nimport {includeKeys} from 'filter-obj';\n\nconst isNullOrUndefined = value => value === null || value === undefined;\n\n// eslint-disable-next-line unicorn/prefer-code-point\nconst strictUriEncode = string => encodeURIComponent(string).replace(/[!'()*]/g, x => `%${x.charCodeAt(0).toString(16).toUpperCase()}`);\n\nconst encodeFragmentIdentifier = Symbol('encodeFragmentIdentifier');\n\nfunction encoderForArrayFormat(options) {\n\tswitch (options.arrayFormat) {\n\t\tcase 'index': {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tconst index = result.length;\n\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result, [encode(key, options), '[', index, ']'].join(''),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '[', encode(index, options), ']=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\n\t\tcase 'bracket': {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\t[encode(key, options), '[]'].join(''),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '[]=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\n\t\tcase 'colon-list-separator': {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\t[encode(key, options), ':list='].join(''),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), ':list=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\n\t\tcase 'comma':\n\t\tcase 'separator':\n\t\tcase 'bracket-separator': {\n\t\t\tconst keyValueSep = options.arrayFormat === 'bracket-separator'\n\t\t\t\t? '[]='\n\t\t\t\t: '=';\n\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\t// Translate null to an empty string so that it doesn't serialize as 'null'\n\t\t\t\tvalue = value === null ? '' : value;\n\n\t\t\t\tif (result.length === 0) {\n\t\t\t\t\treturn [[encode(key, options), keyValueSep, encode(value, options)].join('')];\n\t\t\t\t}\n\n\t\t\t\treturn [[result, encode(value, options)].join(options.arrayFormatSeparator)];\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn key => (result, value) => {\n\t\t\t\tif (\n\t\t\t\t\tvalue === undefined\n\t\t\t\t\t|| (options.skipNull && value === null)\n\t\t\t\t\t|| (options.skipEmptyString && value === '')\n\t\t\t\t) {\n\t\t\t\t\treturn result;\n\t\t\t\t}\n\n\t\t\t\tif (value === null) {\n\t\t\t\t\treturn [\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tencode(key, options),\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\treturn [\n\t\t\t\t\t...result,\n\t\t\t\t\t[encode(key, options), '=', encode(value, options)].join(''),\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\t}\n}\n\nfunction parserForArrayFormat(options) {\n\tlet result;\n\n\tswitch (options.arrayFormat) {\n\t\tcase 'index': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /\\[(\\d*)]$/.exec(key);\n\n\t\t\t\tkey = key.replace(/\\[\\d*]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = {};\n\t\t\t\t}\n\n\t\t\t\taccumulator[key][result[1]] = value;\n\t\t\t};\n\t\t}\n\n\t\tcase 'bracket': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(\\[])$/.exec(key);\n\t\t\t\tkey = key.replace(/\\[]$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...accumulator[key], value];\n\t\t\t};\n\t\t}\n\n\t\tcase 'colon-list-separator': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tresult = /(:list)$/.exec(key);\n\t\t\t\tkey = key.replace(/:list$/, '');\n\n\t\t\t\tif (!result) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = [value];\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...accumulator[key], value];\n\t\t\t};\n\t\t}\n\n\t\tcase 'comma':\n\t\tcase 'separator': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = typeof value === 'string' && value.includes(options.arrayFormatSeparator);\n\t\t\t\tconst isEncodedArray = (typeof value === 'string' && !isArray && decode(value, options).includes(options.arrayFormatSeparator));\n\t\t\t\tvalue = isEncodedArray ? decode(value, options) : value;\n\t\t\t\tconst newValue = isArray || isEncodedArray ? value.split(options.arrayFormatSeparator).map(item => decode(item, options)) : (value === null ? value : decode(value, options));\n\t\t\t\taccumulator[key] = newValue;\n\t\t\t};\n\t\t}\n\n\t\tcase 'bracket-separator': {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tconst isArray = /(\\[])$/.test(key);\n\t\t\t\tkey = key.replace(/\\[]$/, '');\n\n\t\t\t\tif (!isArray) {\n\t\t\t\t\taccumulator[key] = value ? decode(value, options) : value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst arrayValue = value === null\n\t\t\t\t\t? []\n\t\t\t\t\t: value.split(options.arrayFormatSeparator).map(item => decode(item, options));\n\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = arrayValue;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...accumulator[key], ...arrayValue];\n\t\t\t};\n\t\t}\n\n\t\tdefault: {\n\t\t\treturn (key, value, accumulator) => {\n\t\t\t\tif (accumulator[key] === undefined) {\n\t\t\t\t\taccumulator[key] = value;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\taccumulator[key] = [...[accumulator[key]].flat(), value];\n\t\t\t};\n\t\t}\n\t}\n}\n\nfunction validateArrayFormatSeparator(value) {\n\tif (typeof value !== 'string' || value.length !== 1) {\n\t\tthrow new TypeError('arrayFormatSeparator must be single character string');\n\t}\n}\n\nfunction encode(value, options) {\n\tif (options.encode) {\n\t\treturn options.strict ? strictUriEncode(value) : encodeURIComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction decode(value, options) {\n\tif (options.decode) {\n\t\treturn decodeComponent(value);\n\t}\n\n\treturn value;\n}\n\nfunction keysSorter(input) {\n\tif (Array.isArray(input)) {\n\t\treturn input.sort();\n\t}\n\n\tif (typeof input === 'object') {\n\t\treturn keysSorter(Object.keys(input))\n\t\t\t.sort((a, b) => Number(a) - Number(b))\n\t\t\t.map(key => input[key]);\n\t}\n\n\treturn input;\n}\n\nfunction removeHash(input) {\n\tconst hashStart = input.indexOf('#');\n\tif (hashStart !== -1) {\n\t\tinput = input.slice(0, hashStart);\n\t}\n\n\treturn input;\n}\n\nfunction getHash(url) {\n\tlet hash = '';\n\tconst hashStart = url.indexOf('#');\n\tif (hashStart !== -1) {\n\t\thash = url.slice(hashStart);\n\t}\n\n\treturn hash;\n}\n\nfunction parseValue(value, options) {\n\tif (options.parseNumbers && !Number.isNaN(Number(value)) && (typeof value === 'string' && value.trim() !== '')) {\n\t\tvalue = Number(value);\n\t} else if (options.parseBooleans && value !== null && (value.toLowerCase() === 'true' || value.toLowerCase() === 'false')) {\n\t\tvalue = value.toLowerCase() === 'true';\n\t}\n\n\treturn value;\n}\n\nexport function extract(input) {\n\tinput = removeHash(input);\n\tconst queryStart = input.indexOf('?');\n\tif (queryStart === -1) {\n\t\treturn '';\n\t}\n\n\treturn input.slice(queryStart + 1);\n}\n\nexport function parse(query, options) {\n\toptions = {\n\t\tdecode: true,\n\t\tsort: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ',',\n\t\tparseNumbers: false,\n\t\tparseBooleans: false,\n\t\t...options,\n\t};\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst formatter = parserForArrayFormat(options);\n\n\t// Create an object with no prototype\n\tconst returnValue = Object.create(null);\n\n\tif (typeof query !== 'string') {\n\t\treturn returnValue;\n\t}\n\n\tquery = query.trim().replace(/^[?#&]/, '');\n\n\tif (!query) {\n\t\treturn returnValue;\n\t}\n\n\tfor (const parameter of query.split('&')) {\n\t\tif (parameter === '') {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst parameter_ = options.decode ? parameter.replace(/\\+/g, ' ') : parameter;\n\n\t\tlet [key, value] = splitOnFirst(parameter_, '=');\n\n\t\tif (key === undefined) {\n\t\t\tkey = parameter_;\n\t\t}\n\n\t\t// Missing `=` should be `null`:\n\t\t// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters\n\t\tvalue = value === undefined ? null : (['comma', 'separator', 'bracket-separator'].includes(options.arrayFormat) ? value : decode(value, options));\n\t\tformatter(decode(key, options), value, returnValue);\n\t}\n\n\tfor (const [key, value] of Object.entries(returnValue)) {\n\t\tif (typeof value === 'object' && value !== null) {\n\t\t\tfor (const [key2, value2] of Object.entries(value)) {\n\t\t\t\tvalue[key2] = parseValue(value2, options);\n\t\t\t}\n\t\t} else {\n\t\t\treturnValue[key] = parseValue(value, options);\n\t\t}\n\t}\n\n\tif (options.sort === false) {\n\t\treturn returnValue;\n\t}\n\n\t// TODO: Remove the use of `reduce`.\n\t// eslint-disable-next-line unicorn/no-array-reduce\n\treturn (options.sort === true ? Object.keys(returnValue).sort() : Object.keys(returnValue).sort(options.sort)).reduce((result, key) => {\n\t\tconst value = returnValue[key];\n\t\tif (Boolean(value) && typeof value === 'object' && !Array.isArray(value)) {\n\t\t\t// Sort object keys, not values\n\t\t\tresult[key] = keysSorter(value);\n\t\t} else {\n\t\t\tresult[key] = value;\n\t\t}\n\n\t\treturn result;\n\t}, Object.create(null));\n}\n\nexport function stringify(object, options) {\n\tif (!object) {\n\t\treturn '';\n\t}\n\n\toptions = {encode: true,\n\t\tstrict: true,\n\t\tarrayFormat: 'none',\n\t\tarrayFormatSeparator: ',', ...options};\n\n\tvalidateArrayFormatSeparator(options.arrayFormatSeparator);\n\n\tconst shouldFilter = key => (\n\t\t(options.skipNull && isNullOrUndefined(object[key]))\n\t\t|| (options.skipEmptyString && object[key] === '')\n\t);\n\n\tconst formatter = encoderForArrayFormat(options);\n\n\tconst objectCopy = {};\n\n\tfor (const [key, value] of Object.entries(object)) {\n\t\tif (!shouldFilter(key)) {\n\t\t\tobjectCopy[key] = value;\n\t\t}\n\t}\n\n\tconst keys = Object.keys(objectCopy);\n\n\tif (options.sort !== false) {\n\t\tkeys.sort(options.sort);\n\t}\n\n\treturn keys.map(key => {\n\t\tconst value = object[key];\n\n\t\tif (value === undefined) {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (value === null) {\n\t\t\treturn encode(key, options);\n\t\t}\n\n\t\tif (Array.isArray(value)) {\n\t\t\tif (value.length === 0 && options.arrayFormat === 'bracket-separator') {\n\t\t\t\treturn encode(key, options) + '[]';\n\t\t\t}\n\n\t\t\treturn value\n\t\t\t\t.reduce(formatter(key), [])\n\t\t\t\t.join('&');\n\t\t}\n\n\t\treturn encode(key, options) + '=' + encode(value, options);\n\t}).filter(x => x.length > 0).join('&');\n}\n\nexport function parseUrl(url, options) {\n\toptions = {\n\t\tdecode: true,\n\t\t...options,\n\t};\n\n\tlet [url_, hash] = splitOnFirst(url, '#');\n\n\tif (url_ === undefined) {\n\t\turl_ = url;\n\t}\n\n\treturn {\n\t\turl: url_?.split('?')?.[0] ?? '',\n\t\tquery: parse(extract(url), options),\n\t\t...(options && options.parseFragmentIdentifier && hash ? {fragmentIdentifier: decode(hash, options)} : {}),\n\t};\n}\n\nexport function stringifyUrl(object, options) {\n\toptions = {\n\t\tencode: true,\n\t\tstrict: true,\n\t\t[encodeFragmentIdentifier]: true,\n\t\t...options,\n\t};\n\n\tconst url = removeHash(object.url).split('?')[0] || '';\n\tconst queryFromUrl = extract(object.url);\n\n\tconst query = {\n\t\t...parse(queryFromUrl, {sort: false}),\n\t\t...object.query,\n\t};\n\n\tlet queryString = stringify(query, options);\n\tif (queryString) {\n\t\tqueryString = `?${queryString}`;\n\t}\n\n\tlet hash = getHash(object.url);\n\tif (object.fragmentIdentifier) {\n\t\tconst urlObjectForFragmentEncode = new URL(url);\n\t\turlObjectForFragmentEncode.hash = object.fragmentIdentifier;\n\t\thash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`;\n\t}\n\n\treturn `${url}${queryString}${hash}`;\n}\n\nexport function pick(input, filter, options) {\n\toptions = {\n\t\tparseFragmentIdentifier: true,\n\t\t[encodeFragmentIdentifier]: false,\n\t\t...options,\n\t};\n\n\tconst {url, query, fragmentIdentifier} = parseUrl(input, options);\n\n\treturn stringifyUrl({\n\t\turl,\n\t\tquery: includeKeys(query, filter),\n\t\tfragmentIdentifier,\n\t}, options);\n}\n\nexport function exclude(input, filter, options) {\n\tconst exclusionFilter = Array.isArray(filter) ? key => !filter.includes(key) : (key, value) => !filter(key, value);\n\n\treturn pick(input, exclusionFilter, options);\n}\n","const token = '%[a-f0-9]{2}';\nconst singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi');\nconst multiMatcher = new RegExp('(' + token + ')+', 'gi');\n\nfunction decodeComponents(components, split) {\n\ttry {\n\t\t// Try to decode the entire string first\n\t\treturn [decodeURIComponent(components.join(''))];\n\t} catch {\n\t\t// Do nothing\n\t}\n\n\tif (components.length === 1) {\n\t\treturn components;\n\t}\n\n\tsplit = split || 1;\n\n\t// Split the array in 2 parts\n\tconst left = components.slice(0, split);\n\tconst right = components.slice(split);\n\n\treturn Array.prototype.concat.call([], decodeComponents(left), decodeComponents(right));\n}\n\nfunction decode(input) {\n\ttry {\n\t\treturn decodeURIComponent(input);\n\t} catch {\n\t\tlet tokens = input.match(singleMatcher) || [];\n\n\t\tfor (let i = 1; i < tokens.length; i++) {\n\t\t\tinput = decodeComponents(tokens, i).join('');\n\n\t\t\ttokens = input.match(singleMatcher) || [];\n\t\t}\n\n\t\treturn input;\n\t}\n}\n\nfunction customDecodeURIComponent(input) {\n\t// Keep track of all the replacements and prefill the map with the `BOM`\n\tconst replaceMap = {\n\t\t'%FE%FF': '\\uFFFD\\uFFFD',\n\t\t'%FF%FE': '\\uFFFD\\uFFFD',\n\t};\n\n\tlet match = multiMatcher.exec(input);\n\twhile (match) {\n\t\ttry {\n\t\t\t// Decode as big chunks as possible\n\t\t\treplaceMap[match[0]] = decodeURIComponent(match[0]);\n\t\t} catch {\n\t\t\tconst result = decode(match[0]);\n\n\t\t\tif (result !== match[0]) {\n\t\t\t\treplaceMap[match[0]] = result;\n\t\t\t}\n\t\t}\n\n\t\tmatch = multiMatcher.exec(input);\n\t}\n\n\t// Add `%C2` at the end of the map to make sure it does not replace the combinator before everything else\n\treplaceMap['%C2'] = '\\uFFFD';\n\n\tconst entries = Object.keys(replaceMap);\n\n\tfor (const key of entries) {\n\t\t// Replace all decoded components\n\t\tinput = input.replace(new RegExp(key, 'g'), replaceMap[key]);\n\t}\n\n\treturn input;\n}\n\nexport default function decodeUriComponent(encodedURI) {\n\tif (typeof encodedURI !== 'string') {\n\t\tthrow new TypeError('Expected `encodedURI` to be of type `string`, got `' + typeof encodedURI + '`');\n\t}\n\n\ttry {\n\t\t// Try the built in decoder first\n\t\treturn decodeURIComponent(encodedURI);\n\t} catch {\n\t\t// Fallback to a more advanced decoder\n\t\treturn customDecodeURIComponent(encodedURI);\n\t}\n}\n","export default function splitOnFirst(string, separator) {\n\tif (!(typeof string === 'string' && typeof separator === 'string')) {\n\t\tthrow new TypeError('Expected the arguments to be of type `string`');\n\t}\n\n\tif (string === '' || separator === '') {\n\t\treturn [];\n\t}\n\n\tconst separatorIndex = string.indexOf(separator);\n\n\tif (separatorIndex === -1) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\tstring.slice(0, separatorIndex),\n\t\tstring.slice(separatorIndex + separator.length)\n\t];\n}\n","export function includeKeys(object, predicate) {\n\tconst result = {};\n\n\tif (Array.isArray(predicate)) {\n\t\tfor (const key of predicate) {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(object, key);\n\t\t\tif (descriptor?.enumerable) {\n\t\t\t\tObject.defineProperty(result, key, descriptor);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// `Reflect.ownKeys()` is required to retrieve symbol properties\n\t\tfor (const key of Reflect.ownKeys(object)) {\n\t\t\tconst descriptor = Object.getOwnPropertyDescriptor(object, key);\n\t\t\tif (descriptor.enumerable) {\n\t\t\t\tconst value = object[key];\n\t\t\t\tif (predicate(key, value, object)) {\n\t\t\t\t\tObject.defineProperty(result, key, descriptor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result;\n}\n\nexport function excludeKeys(object, predicate) {\n\tif (Array.isArray(predicate)) {\n\t\tconst set = new Set(predicate);\n\t\treturn includeKeys(object, key => !set.has(key));\n\t}\n\n\treturn includeKeys(object, (key, value, object) => !predicate(key, value, object));\n}\n","import * as queryString from './base.js';\n\nexport default queryString;\n","var ApplicationContextProviderImpl = /** @class */ (function () {\n function ApplicationContextProviderImpl() {\n }\n ApplicationContextProviderImpl.prototype.getApplicationContext = function () {\n return {\n versionName: this.versionName,\n language: getLanguage(),\n platform: 'Web',\n os: undefined,\n deviceModel: undefined,\n };\n };\n return ApplicationContextProviderImpl;\n}());\nvar getLanguage = function () {\n return ((typeof navigator !== 'undefined' &&\n ((navigator.languages && navigator.languages[0]) ||\n navigator.language)) ||\n '');\n};\n\nvar EventBridgeImpl = /** @class */ (function () {\n function EventBridgeImpl() {\n this.queue = [];\n }\n EventBridgeImpl.prototype.logEvent = function (event) {\n if (!this.receiver) {\n if (this.queue.length < 512) {\n this.queue.push(event);\n }\n }\n else {\n this.receiver(event);\n }\n };\n EventBridgeImpl.prototype.setEventReceiver = function (receiver) {\n this.receiver = receiver;\n if (this.queue.length > 0) {\n this.queue.forEach(function (event) {\n receiver(event);\n });\n this.queue = [];\n }\n };\n return EventBridgeImpl;\n}());\n\n/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\nvar __assign = function () {\n __assign = Object.assign || function __assign(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nvar isEqual = function (obj1, obj2) {\n var primitive = ['string', 'number', 'boolean', 'undefined'];\n var typeA = typeof obj1;\n var typeB = typeof obj2;\n if (typeA !== typeB) {\n return false;\n }\n for (var _i = 0, primitive_1 = primitive; _i < primitive_1.length; _i++) {\n var p = primitive_1[_i];\n if (p === typeA) {\n return obj1 === obj2;\n }\n }\n // check null\n if (obj1 == null && obj2 == null) {\n return true;\n }\n else if (obj1 == null || obj2 == null) {\n return false;\n }\n // if got here - objects\n if (obj1.length !== obj2.length) {\n return false;\n }\n //check if arrays\n var isArrayA = Array.isArray(obj1);\n var isArrayB = Array.isArray(obj2);\n if (isArrayA !== isArrayB) {\n return false;\n }\n if (isArrayA && isArrayB) {\n //arrays\n for (var i = 0; i < obj1.length; i++) {\n if (!isEqual(obj1[i], obj2[i])) {\n return false;\n }\n }\n }\n else {\n //objects\n var sorted1 = Object.keys(obj1).sort();\n var sorted2 = Object.keys(obj2).sort();\n if (!isEqual(sorted1, sorted2)) {\n return false;\n }\n //compare object values\n var result_1 = true;\n Object.keys(obj1).forEach(function (key) {\n if (!isEqual(obj1[key], obj2[key])) {\n result_1 = false;\n }\n });\n return result_1;\n }\n return true;\n};\n\nvar ID_OP_SET = '$set';\nvar ID_OP_UNSET = '$unset';\nvar ID_OP_CLEAR_ALL = '$clearAll';\n// Polyfill for Object.entries\nif (!Object.entries) {\n Object.entries = function (obj) {\n var ownProps = Object.keys(obj);\n var i = ownProps.length;\n var resArray = new Array(i);\n while (i--) {\n resArray[i] = [ownProps[i], obj[ownProps[i]]];\n }\n return resArray;\n };\n}\nvar IdentityStoreImpl = /** @class */ (function () {\n function IdentityStoreImpl() {\n this.identity = { userProperties: {} };\n this.listeners = new Set();\n }\n IdentityStoreImpl.prototype.editIdentity = function () {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n var self = this;\n var actingUserProperties = __assign({}, this.identity.userProperties);\n var actingIdentity = __assign(__assign({}, this.identity), { userProperties: actingUserProperties });\n return {\n setUserId: function (userId) {\n actingIdentity.userId = userId;\n return this;\n },\n setDeviceId: function (deviceId) {\n actingIdentity.deviceId = deviceId;\n return this;\n },\n setUserProperties: function (userProperties) {\n actingIdentity.userProperties = userProperties;\n return this;\n },\n setOptOut: function (optOut) {\n actingIdentity.optOut = optOut;\n return this;\n },\n updateUserProperties: function (actions) {\n var actingProperties = actingIdentity.userProperties || {};\n for (var _i = 0, _a = Object.entries(actions); _i < _a.length; _i++) {\n var _b = _a[_i], action = _b[0], properties = _b[1];\n switch (action) {\n case ID_OP_SET:\n for (var _c = 0, _d = Object.entries(properties); _c < _d.length; _c++) {\n var _e = _d[_c], key = _e[0], value = _e[1];\n actingProperties[key] = value;\n }\n break;\n case ID_OP_UNSET:\n for (var _f = 0, _g = Object.keys(properties); _f < _g.length; _f++) {\n var key = _g[_f];\n delete actingProperties[key];\n }\n break;\n case ID_OP_CLEAR_ALL:\n actingProperties = {};\n break;\n }\n }\n actingIdentity.userProperties = actingProperties;\n return this;\n },\n commit: function () {\n self.setIdentity(actingIdentity);\n return this;\n },\n };\n };\n IdentityStoreImpl.prototype.getIdentity = function () {\n return __assign({}, this.identity);\n };\n IdentityStoreImpl.prototype.setIdentity = function (identity) {\n var originalIdentity = __assign({}, this.identity);\n this.identity = __assign({}, identity);\n if (!isEqual(originalIdentity, this.identity)) {\n this.listeners.forEach(function (listener) {\n listener(identity);\n });\n }\n };\n IdentityStoreImpl.prototype.addIdentityListener = function (listener) {\n this.listeners.add(listener);\n };\n IdentityStoreImpl.prototype.removeIdentityListener = function (listener) {\n this.listeners.delete(listener);\n };\n return IdentityStoreImpl;\n}());\n\nvar safeGlobal = typeof globalThis !== 'undefined'\n ? globalThis\n : typeof global !== 'undefined'\n ? global\n : self;\n\nvar AnalyticsConnector = /** @class */ (function () {\n function AnalyticsConnector() {\n this.identityStore = new IdentityStoreImpl();\n this.eventBridge = new EventBridgeImpl();\n this.applicationContextProvider = new ApplicationContextProviderImpl();\n }\n AnalyticsConnector.getInstance = function (instanceName) {\n if (!safeGlobal['analyticsConnectorInstances']) {\n safeGlobal['analyticsConnectorInstances'] = {};\n }\n if (!safeGlobal['analyticsConnectorInstances'][instanceName]) {\n safeGlobal['analyticsConnectorInstances'][instanceName] =\n new AnalyticsConnector();\n }\n return safeGlobal['analyticsConnectorInstances'][instanceName];\n };\n return AnalyticsConnector;\n}());\n\nexport { AnalyticsConnector };\n","import accents from \"remove-accents\";\nimport tippy from \"tippy.js\";\n\n/**\n * Get css breakpoint from body::after\n */\n// IE FIX FOR getComputedStyle\nif (!window.getComputedStyle) {\n window.getComputedStyle = function (el) {\n this.el = el;\n this.getPropertyValue = function (prop) {\n var re = /(\\-([a-z]){1})/g;\n if (prop == 'float') prop = 'styleFloat';\n if (re.test(prop)) {\n prop = prop.replace(re, function () {\n return arguments[2].toUpperCase();\n });\n }\n return el.currentStyle[prop] ? el.currentStyle[prop] : null;\n };\n return this;\n };\n}\n\nconst getBreakpoint = (config = { selector: 'body', pseudoElement: '::after' }) => {\n const selector = document.querySelector(config.selector);\n\n let breakpoint;\n\n if (selector) {\n breakpoint = window.getComputedStyle(selector, config.pseudoElement).getPropertyValue('content');\n }\n\n // IE8 DEFAULT VALUE\n if (!breakpoint) {\n breakpoint = 'desktop';\n }\n\n // IE9-10 REMOVE QUOTE FROM CONTENT STRING\n breakpoint = breakpoint.replace(/[\"']/g, '');\n\n if (breakpoint !== window.deviceWidth) {\n window.deviceWidth = breakpoint;\n }\n\n return breakpoint;\n};\n\nconst getMenuBreakpoint = () => {\n return getBreakpoint({\n selector: 'header',\n pseudoElement: '::after'\n });\n};\n\n/*\n* Output Browser name on HTML tag\n */\nconst outputBrowserNameHTMLtag = () => {\n if (browser) {\n const browserName = browser?.name?.toLowerCase().split(' ').join('-');\n\n $('html').addClass(`browser-${browserName}`).attr('data-browser', browserName);\n }\n};\n\nconst outputOSNameHTMLtag = () => {\n if (browser) {\n let osName = browser?.os?.toLowerCase();\n\n if(osName) {\n if (osName.includes('windows')) {\n osName = 'windows';\n } else if (osName === 'mac os') {\n osName = 'macos';\n } else if (osName !== 'ios'\n && osName !== 'linux') {\n osName = 'other';\n }\n }\n\n document.documentElement.classList.add(`os-${osName}`);\n document.documentElement.setAttribute('data-os', osName);\n }\n};\n\n/*\n* Get query string parameter based on their name\n */\nconst getUrlParameter = (sParam, mode = null) => {\n let searchFrom = window.location.search;\n\n if (mode) {\n if (mode.hash) {\n searchFrom = window.location.hash;\n }\n }\n\n let sPageURL = searchFrom.substring(1),\n sURLVariables = sPageURL.split('&');\n\n for (var i = 0; i < sURLVariables.length; i++) {\n var sParameterName = sURLVariables[i].split('=');\n\n if (sParameterName[0] === sParam) {\n return sParameterName[1];\n }\n }\n};\n\n/*\n* Get the current env (www.coveo.com -> www)\n*/\n\nconst getCurrentEnv = () => {\n return window.location.hostname.split('.')[0];\n};\n\n/*\n* Add or modify query string parameter of an URL\n*/\nconst addOrModifyQsParameter = (url, key, value) => {\n const expression = new RegExp(\"([?&])\" + key + \"=.*?(&|$)\", \"i\");\n const separator = url.indexOf(\"?\") === -1 ? \"?\" : \"&\";\n \n return url.match(expression)\n ? url.replace(expression, `$1${key}=${encodeURIComponent(value)}$2`)\n : `${url}${separator}${key}=${encodeURIComponent(value)}`;\n};\n\nconst serializeObject = () => {\n /*!\n * jQuery serializeObject - v0.2 - 1/20/2010\n * http://benalman.com/projects/jquery-misc-plugins/\n *\n * Copyright (c) 2010 \"Cowboy\" Ben Alman\n * Dual licensed under the MIT and GPL licenses.\n * http://benalman.com/about/license/\n */\n\n// Whereas .serializeArray() serializes a form into an array, .serializeObject()\n// serializes a form into an (arguably more useful) object.\n\n (function($,undefined){\n '$:nomunge'; // Used by YUI compressor.\n\n $.fn.serializeObject = function(){\n var obj = {};\n\n $.each( this.serializeArray(), function(i,o){\n var n = o.name,\n v = o.value;\n\n obj[n] = obj[n] === undefined ? v\n : $.isArray( obj[n] ) ? obj[n].concat( v )\n : [ obj[n], v ];\n });\n\n return obj;\n };\n\n })(jQuery);\n};\n\n/*\n* Detect if url has specific segment\n* Append this segment to the form submit tracking\n* Ex: resources_webinars, resources_ebooks, contact_demo, etc\n */\nconst setSegment = () => {\n let url = window.location.pathname.split('/');\n\n if(url.length <= 3) {\n url = url[url.length - 1];\n } else {\n if(url.indexOf('resources') > -1) {\n url = `${url[url.length - 3]}_${url[url.length - 2]}`;\n } else {\n url = `${url[url.length - 2]}_${url[url.length - 1]}`;\n }\n }\n\n return url;\n};\n\nconst preventMaterialSelectDoubleClick = () => {\n if(!$('html').hasClass('ie11')) {\n const selectWrapper = document.querySelectorAll('.select-wrapper');\n\n if(selectWrapper) {\n selectWrapper.forEach(el => el.addEventListener('click', e => e.stopPropagation()));\n }\n }\n};\n\n/*\n* Prevent window resize to trigger twice\n */\nconst debouncer = (func, timeout) => {\n let timeoutID, currentTimeout = timeout || 0;\n\n return function() {\n let scope = this , args = arguments;\n clearTimeout( timeoutID );\n\n timeoutID = setTimeout(function () {\n func.apply(scope, Array.prototype.slice.call(args));\n }, currentTimeout);\n };\n};\n\n/**\n * Function to sort alphabetically an array of objects by some specific key.\n * @param {String} property Key of the object to sort.\n */\nconst sortArrayOfObject = (property) => {\n let sortOrder = 1;\n\n if(property[0] === \"-\") {\n sortOrder = -1;\n property = property.substr(1);\n }\n\n return function (a,b) {\n if(sortOrder == -1){\n return b[property].localeCompare(a[property]);\n } else {\n return a[property].localeCompare(b[property]);\n }\n };\n};\n\n/**\n* Remove duplicate objects from an array\n* @param {array} Array that contain the objects.\n* @param {String} property Key of the object to remove.\n */\nconst removeDuplicateObjects = (arr, comp) => {\n const array = arr\n .map(e => e[comp])\n // store the keys of the unique objects\n .map((e, i, final) => final.indexOf(e) === i && i)\n // eliminate the dead keys & store unique objects\n .filter(e => arr[e]).map(e => arr[e]);\n\n return array;\n};\n\n/**\n* Remove duplicate objects from an array\n* @param {String} String to minify.\n */\nconst minifyString = (string) => {\n string = string.replace(/\\n/g, '').replace(/\\s\\s+/g, ' ');\n\n return string;\n};\n\n/*\n* Trigger lity.js on element with data-btn-lity\n */\nconst openLity = () => {\n const $btnOpenLity = $('[data-open-lity]');\n\n $btnOpenLity.on('click', function() {\n const url = $(this).data('href');\n\n lity(url);\n });\n};\n\nconst getLanguage = () => {\n const pathName = window.location.pathname;\n\n if (pathName.length) {\n const language = pathName.split('/');\n\n if (language.length) {\n return language[1];\n }\n }\n};\n\n/********************************************/\n/******** smoothScrollingAnchor *************/\n/********************************************/\n\nconst smoothScrollingAnchor = data => {\n let scrollOffset = 120;\n let onDone = null;\n let scrollProgress = 0;\n\n if (data) {\n if (\"offset\" in data) {\n scrollOffset = data.offset;\n }\n\n if (\"onDone\" in data) {\n onDone = data.onDone;\n }\n }\n\n const completeRoutine = (target, event) => {\n // Callback after animation\n // Must change focus!\n const $target = $(target);\n\n if (onDone) {\n onDone({\n source: $(event.target)[0],\n target: $target[0]\n });\n }\n\n if ($target.is(\":focus\")) { // Checking if the target was focused\n return false;\n } else {\n $target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable\n //$target.focus(); // Set focus again\n };\n };\n\n const scrollRoutine = (target, event, progress = 0) => {\n const initialOffsetTop = target.offset().top;\n\n $('html, body').stop().animate({\n scrollTop: target.offset().top - scrollOffset - Math.abs(parseInt($('header').css('margin-top')))\n }, {\n duration: 1000 * (1 - progress),\n progress: function(animation, progress, remaining) {\n if (initialOffsetTop != target.offset().top\n && scrollProgress + 0.2 <= progress) {\n scrollProgress = progress;\n scrollRoutine(target, event, progress);\n }\n },\n complete: () => {\n completeRoutine(target, event);\n }\n });\n };\n\n // Select all links with hashes\n $('a[href^=\"#\"]:not(.noscroll)')\n // Remove links that don't actually link to nothing\n .not('[href=\"#\"]')\n .not('[href=\"#0\"]')\n .click(function(event) {\n // On-page links\n if (location.pathname.replace(/^\\//, '') == this.pathname.replace(/^\\//, '')\n && location.hostname == this.hostname) {\n // Figure out element to scroll to\n let target = $(this.hash);\n target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');\n\n // Does a scroll target exist?\n if (target.length) {\n // Only prevent default if animation is actually gonna happen\n event.preventDefault();\n\n scrollRoutine(target, event);\n }\n }\n });\n};\n\n/*\n Sets the max number of lines to be displayed in a given element\n*/\n\nconst getLineBreaks = textElement => {\n if (!textElement || !textElement.parentNode || textElement.nodeType !== 3) {\n return [];\n }\n \n const range = document.createRange();\n const lines = [];\n\n range.setStart(textElement, 0);\n\n const text = textElement.textContent;\n let prevBottom = range.getBoundingClientRect().bottom;\n let lastFound = 0;\n let bottom = 0;\n\n for (let current = 1; current <= text.length; current++) {\n range.setStart(textElement, current);\n\n if (current < text.length - 1) {\n range.setEnd(textElement, current + 1);\n }\n\n bottom = range.getBoundingClientRect().bottom;\n\n if (bottom > prevBottom) {\n lines.push(text.substr(lastFound, current - lastFound - 1));\n \n prevBottom = bottom;\n lastFound = current - 1;\n }\n current++;\n }\n\n lines.push(text.substr(lastFound));\n \n return lines;\n};\n\nconst setMaxLines = (element, maxLines) => {\n const lines = getLineBreaks(element.childNodes[0]);\n\n let newTextContent = '';\n if (lines.length > maxLines) {\n for (let i = 0; i < maxLines; i++) {\n newTextContent += lines[i];\n }\n\n element.textContent = newTextContent.slice(0, -3) + '...';\n }\n};\n/*\n* Load Vue/js runtime DEV or PRODUCTION script\n* componentName: The attribute name in data-vue-component. Ex: data-vue-component=\"accordionBox\"\n*/\nconst initVue = (config = {}) => {\n const then = config.then || null;\n const componentName = config.componentName || null;\n const env = window.location.hostname.split('.')[0];\n const prodUrls = ['stagingenv', 'prodcmenv', 'www'];\n const isDev = (env.indexOf(prodUrls) === -1);\n const scriptID = 'vuejsruntime';\n\n let vuejsScriptUrl = '/public/js/external/vuejs/vue.v2.6.12.js';\n\n if(!isDev) {\n vuejsScriptUrl = '/public/js/external/vuejs/vue.min.v2.6.12.js';\n }\n\n // IE 11 fix\n if (window.NodeList && !NodeList.prototype.forEach) {\n NodeList.prototype.forEach = Array.prototype.forEach;\n }\n\n /*\n * Load Vue.js runtime javascript once.\n * If vue has loaded, init the component only\n */\n if($(`[data-vue-component=\"${componentName}\"]`).length) {\n if(typeof Vue === 'undefined' && !$(`#${scriptID}`).length) {\n loadJS(vuejsScriptUrl, function() {\n if(then) {\n then();\n }\n }, null, null, scriptID, false);\n } else {\n const interval = setInterval(() => {\n if(typeof Vue !== 'undefined') {\n clearInterval(interval);\n\n if(then) {\n then();\n }\n }\n }, 250);\n }\n }\n};\n\n/*\n* Select an