-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path10.7ef58643.iframe.bundle.js
1 lines (1 loc) · 95.4 KB
/
10.7ef58643.iframe.bundle.js
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{1151:function(module,exports,__webpack_require__){(function(process,global,Buffer){var factory;factory=function(){"use strict";function _typeof(obj){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj})(obj)}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||!1,descriptor.configurable=!0,"value"in descriptor&&(descriptor.writable=!0),Object.defineProperty(target,descriptor.key,descriptor)}}function _defineProperty(obj,key,value){return key in obj?Object.defineProperty(obj,key,{value:value,enumerable:!0,configurable:!0,writable:!0}):obj[key]=value,obj}function _objectSpread(target){for(var i=1;i<arguments.length;i++){var source=null!=arguments[i]?arguments[i]:{},ownKeys=Object.keys(source);"function"==typeof Object.getOwnPropertySymbols&&(ownKeys=ownKeys.concat(Object.getOwnPropertySymbols(source).filter((function(sym){return Object.getOwnPropertyDescriptor(source,sym).enumerable})))),ownKeys.forEach((function(key){_defineProperty(target,key,source[key])}))}return target}function _toConsumableArray(arr){return function _arrayWithoutHoles(arr){if(Array.isArray(arr)){for(var i=0,arr2=new Array(arr.length);i<arr.length;i++)arr2[i]=arr[i];return arr2}}(arr)||function _iterableToArray(iter){if(Symbol.iterator in Object(iter)||"[object Arguments]"===Object.prototype.toString.call(iter))return Array.from(iter)}(arr)||function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var SpecialEventType,IdentifyOperation,LogLevel,Status;function isBrowserEnv(){return"object"==typeof window&&void 0!==(null===window||void 0===window?void 0:window.document)}!function(SpecialEventType){SpecialEventType.IDENTIFY="$identify"}(SpecialEventType||(SpecialEventType={})),function(IdentifyOperation){IdentifyOperation.SET="$set",IdentifyOperation.SET_ONCE="$setOnce",IdentifyOperation.ADD="$add",IdentifyOperation.APPEND="$append",IdentifyOperation.PREPEND="$prepend",IdentifyOperation.REMOVE="$remove",IdentifyOperation.PREINSERT="$preinsert",IdentifyOperation.POSTINSERT="$postinsert",IdentifyOperation.UNSET="$unset",IdentifyOperation.CLEAR_ALL="$clearAll"}(IdentifyOperation||(IdentifyOperation={})),function(LogLevel){LogLevel[LogLevel.None=0]="None",LogLevel[LogLevel.Error=1]="Error",LogLevel[LogLevel.Warn=2]="Warn",LogLevel[LogLevel.Verbose=3]="Verbose"}(LogLevel||(LogLevel={})),function(Status){Status.Unknown="unknown",Status.Skipped="skipped",Status.Success="success",Status.RateLimit="rate_limit",Status.PayloadTooLarge="payload_too_large",Status.Invalid="invalid",Status.Failed="failed"}(Status||(Status={})),function(Status){Status.fromHttpCode=function fromHttpCode(code){return code>=200&&code<300?Status.Success:429===code?Status.RateLimit:413===code?Status.PayloadTooLarge:code>=400&&code<500?Status.Invalid:code>=500?Status.Failed:Status.Unknown}}(Status||(Status={})),Status.Skipped;var fallbackGlobalObject={},getGlobalObject=function(){return function isNodeEnv(){var _a;return"object"==typeof process&&void 0!==(null===(_a=null==process?void 0:process.versions)||void 0===_a?void 0:_a.node)}()?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:fallbackGlobalObject},globalNamespace=function(){var global=getGlobalObject();return global.__AMPLITUDE__=global.__AMPLITUDE__||{},global.__AMPLITUDE__}(),PREFIX="Amplitude Logger ",Logger=function(){function Logger(){this._logLevel=0}return Logger.prototype.disable=function(){this._logLevel=0},Logger.prototype.enable=function(logLevel){void 0===logLevel&&(logLevel=LogLevel.Warn),this._logLevel=logLevel},Logger.prototype.log=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];this._logLevel<LogLevel.Verbose||global.console.log(PREFIX+"[Log]: "+args.join(" "))},Logger.prototype.warn=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];this._logLevel<LogLevel.Warn||global.console.warn(PREFIX+"[Warn]: "+args.join(" "))},Logger.prototype.error=function(){for(var args=[],_i=0;_i<arguments.length;_i++)args[_i]=arguments[_i];this._logLevel<LogLevel.Error||global.console.error(PREFIX+"[Error]: "+args.join(" "))},Logger}(),Constants_DEFAULT_INSTANCE=(globalNamespace.logger||(globalNamespace.logger=new Logger),"$default_instance"),Constants_API_VERSION=2,Constants_MAX_STRING_LENGTH=4096,Constants_MAX_PROPERTY_KEYS=1e3,Constants_IDENTIFY_EVENT="$identify",Constants_GROUP_IDENTIFY_EVENT="$groupidentify",Constants_DEVICE_ID_INDEX=0,Constants_USER_ID_INDEX=1,Constants_OPT_OUT_INDEX=2,Constants_SESSION_ID_INDEX=3,Constants_LAST_EVENT_TIME_INDEX=4,Constants_EVENT_ID_INDEX=5,Constants_IDENTIFY_ID_INDEX=6,Constants_SEQUENCE_NUMBER_INDEX=7,Constants_COOKIE_TEST_PREFIX="amp_cookie_test",Constants_COOKIE_PREFIX="amp",Constants_STORAGE_DEFAULT="",Constants_STORAGE_COOKIES="cookies",Constants_STORAGE_NONE="none",Constants_STORAGE_LOCAL="localStorage",Constants_STORAGE_SESSION="sessionStorage",Constants_REVENUE_EVENT="revenue_amount",Constants_REVENUE_PRODUCT_ID="$productId",Constants_REVENUE_QUANTITY="$quantity",Constants_REVENUE_PRICE="$price",Constants_REVENUE_REVENUE_TYPE="$revenueType",Constants_AMP_DEVICE_ID_PARAM="amp_device_id",Constants_REFERRER="referrer",Constants_UTM_SOURCE="utm_source",Constants_UTM_MEDIUM="utm_medium",Constants_UTM_CAMPAIGN="utm_campaign",Constants_UTM_TERM="utm_term",Constants_UTM_CONTENT="utm_content",Constants_ATTRIBUTION_EVENT="[Amplitude] Attribution Captured",Constants_TRANSPORT_HTTP="http",Constants_TRANSPORT_BEACON="beacon",UTF8_encode=function encode(s){for(var utftext="",n=0;n<s.length;n++){var c=s.charCodeAt(n);c<128?utftext+=String.fromCharCode(c):c>127&&c<2048?(utftext+=String.fromCharCode(c>>6|192),utftext+=String.fromCharCode(63&c|128)):(utftext+=String.fromCharCode(c>>12|224),utftext+=String.fromCharCode(c>>6&63|128),utftext+=String.fromCharCode(63&c|128))}return utftext},UTF8_decode=function decode(utftext){for(var s="",i=0,c=0,c1=0,c2=0;i<utftext.length;)(c=utftext.charCodeAt(i))<128?(s+=String.fromCharCode(c),i++):c>191&&c<224?(c1=utftext.charCodeAt(i+1),s+=String.fromCharCode((31&c)<<6|63&c1),i+=2):(c1=utftext.charCodeAt(i+1),c2=utftext.charCodeAt(i+2),s+=String.fromCharCode((15&c)<<12|(63&c1)<<6|63&c2),i+=3);return s},Base64={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function encode(input){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(input)))}catch(e){}return Base64._encode(input)},_encode:function _encode(input){var chr1,chr2,chr3,enc1,enc2,enc3,enc4,output="",i=0;for(input=UTF8_encode(input);i<input.length;)enc1=(chr1=input.charCodeAt(i++))>>2,enc2=(3&chr1)<<4|(chr2=input.charCodeAt(i++))>>4,enc3=(15&chr2)<<2|(chr3=input.charCodeAt(i++))>>6,enc4=63&chr3,isNaN(chr2)?enc3=enc4=64:isNaN(chr3)&&(enc4=64),output=output+Base64._keyStr.charAt(enc1)+Base64._keyStr.charAt(enc2)+Base64._keyStr.charAt(enc3)+Base64._keyStr.charAt(enc4);return output},decode:function decode(input){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(input)))}catch(e){}return Base64._decode(input)},_decode:function _decode(input){var chr1,chr2,chr3,enc2,enc3,enc4,output="",i=0;for(input=input.replace(/[^A-Za-z0-9+/=]/g,"");i<input.length;)chr1=Base64._keyStr.indexOf(input.charAt(i++))<<2|(enc2=Base64._keyStr.indexOf(input.charAt(i++)))>>4,chr2=(15&enc2)<<4|(enc3=Base64._keyStr.indexOf(input.charAt(i++)))>>2,chr3=(3&enc3)<<6|(enc4=Base64._keyStr.indexOf(input.charAt(i++))),output+=String.fromCharCode(chr1),64!==enc3&&(output+=String.fromCharCode(chr2)),64!==enc4&&(output+=String.fromCharCode(chr3));return output=UTF8_decode(output)}},toString=Object.prototype.toString;function type(val){switch(toString.call(val)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===val?"null":void 0===val?"undefined":val!=val?"nan":val&&1===val.nodeType?"element":void 0!==Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(val)?"buffer":_typeof(val=val.valueOf?val.valueOf():Object.prototype.valueOf.apply(val))}var localStorage,logLevels={DISABLE:0,ERROR:1,WARN:2,INFO:3},logLevel=logLevels.WARN,log={error:function error(s){logLevel>=logLevels.ERROR&&_log(s)},warn:function warn(s){logLevel>=logLevels.WARN&&_log(s)},info:function info(s){logLevel>=logLevels.INFO&&_log(s)}},_log=function _log(s){try{console.log("[Amplitude] "+s)}catch(e){}},_truncateValue=function _truncateValue(value){return"string"===type(value)&&value.length>Constants_MAX_STRING_LENGTH?value.substring(0,Constants_MAX_STRING_LENGTH):value},validateInput=function validateInput(input,name,expectedType){return type(input)===expectedType||(log.error("Invalid "+name+" input type. Expected "+expectedType+" but received "+type(input)),!1)},validateProperties=function validateProperties(properties){var propsType=type(properties);if("object"!==propsType)return log.error("Error: invalid properties format. Expecting Javascript object, received "+propsType+", ignoring"),{};if(Object.keys(properties).length>Constants_MAX_PROPERTY_KEYS)return log.error("Error: too many properties (more than 1000), ignoring"),{};var copy={};for(var property in properties)if(Object.prototype.hasOwnProperty.call(properties,property)){var key=property,keyType=type(key);"string"!==keyType&&(key=String(key),log.warn("WARNING: Non-string property key, received type "+keyType+', coercing to string "'+key+'"'));var value=validatePropertyValue(key,properties[property]);null!==value&&(copy[key]=value)}return copy},invalidValueTypes=["nan","function","arguments","regexp","element"],validatePropertyValue=function validatePropertyValue(key,value){var valueType=type(value);if(-1!==invalidValueTypes.indexOf(valueType))log.warn('WARNING: Property key "'+key+'" with invalid value type '+valueType+", ignoring"),value=null;else if("undefined"===valueType)value=null;else if("error"===valueType)value=String(value),log.warn('WARNING: Property key "'+key+'" with value type error, coercing to '+value);else if("array"===valueType){for(var arrayCopy=[],i=0;i<value.length;i++){var element=value[i],elemType=type(element);"array"!==elemType?"object"===elemType?arrayCopy.push(validateProperties(element)):arrayCopy.push(validatePropertyValue(key,element)):log.warn("WARNING: Cannot have "+elemType+" nested in an array property value, skipping")}value=arrayCopy}else"object"===valueType&&(value=validateProperties(value));return value},validateGroupName=function validateGroupName(key,groupName){var groupNameType=type(groupName);if("string"===groupNameType)return groupName;if("date"===groupNameType||"number"===groupNameType||"boolean"===groupNameType)return groupName=String(groupName),log.warn("WARNING: Non-string groupName, received type "+groupNameType+', coercing to string "'+groupName+'"'),groupName;if("array"===groupNameType){for(var arrayCopy=[],i=0;i<groupName.length;i++){var element=groupName[i],elemType=type(element);"array"!==elemType&&"object"!==elemType?"string"===elemType?arrayCopy.push(element):"date"!==elemType&&"number"!==elemType&&"boolean"!==elemType||(element=String(element),log.warn("WARNING: Non-string groupName, received type "+elemType+', coercing to string "'+element+'"'),arrayCopy.push(element)):log.warn("WARNING: Skipping nested "+elemType+" in array groupName")}return arrayCopy}log.warn("WARNING: Non-string groupName, received type "+groupNameType+". Please use strings or array of strings for groupName")},utils_setLogLevel=function setLogLevel(logLevelName){Object.prototype.hasOwnProperty.call(logLevels,logLevelName)&&(logLevel=logLevels[logLevelName])},utils_log=log,utils_isEmptyString=function isEmptyString(str){return!str||0===str.length},utils_getQueryParam=function getQueryParam(name,query){name=name.replace(/[[]/,"\\[").replace(/[\]]/,"\\]");var results=new RegExp("[\\?&]"+name+"=([^&#]*)").exec(query);return null===results?void 0:decodeURIComponent(results[1].replace(/\+/g," "))},utils_truncate=function truncate(value){if("array"===type(value))for(var i=0;i<value.length;i++)value[i]=truncate(value[i]);else if("object"===type(value))for(var key in value)key in value&&(value[key]=truncate(value[key]));else value=_truncateValue(value);return value},utils_validateGroups=function validateGroups(groups){var groupsType=type(groups);if("object"!==groupsType)return log.error("Error: invalid groups format. Expecting Javascript object, received "+groupsType+", ignoring"),{};var copy={};for(var group in groups)if(Object.prototype.hasOwnProperty.call(groups,group)){var key=group,keyType=type(key);"string"!==keyType&&(key=String(key),log.warn("WARNING: Non-string groupType, received type "+keyType+', coercing to string "'+key+'"'));var value=validateGroupName(key,groups[group]);null!==value&&(copy[key]=value)}return copy},utils_validateInput=validateInput,utils_validateProperties=validateProperties,utils_validateDeviceId=function validateDeviceId(deviceId){return!(!validateInput(deviceId,"deviceId","string")||deviceId.includes(".")&&(log.error("Device IDs may not contain '.' characters. Value will be ignored: \"".concat(deviceId,'"')),1))},utils_validateTransport=function validateTransport(transport){return!(!validateInput(transport,"transport","string")||(transport!==Constants_TRANSPORT_HTTP&&transport!==Constants_TRANSPORT_BEACON?(log.error("transport value must be one of '".concat(Constants_TRANSPORT_BEACON,"' or '").concat(Constants_TRANSPORT_HTTP,"'")),1):transport!==Constants_TRANSPORT_HTTP&&!navigator.sendBeacon&&(log.error("browser does not support sendBeacon, so transport must be HTTP"),1)))},getLocation=function getLocation(){return window.location},base64Id=function base64Id(){for(var str="",i=0;i<22;++i)str+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(64*Math.random()));return str},get=function get(name){try{for(var ca=document.cookie.split(";"),value=null,i=0;i<ca.length;i++){for(var c=ca[i];" "===c.charAt(0);)c=c.substring(1,c.length);if(0===c.indexOf(name)){value=c.substring(name.length,c.length);break}}return value}catch(e){return null}},set=function set(name,value,opts){var expires=null!==value?opts.expirationDays:-1;if(expires){var date=new Date;date.setTime(date.getTime()+24*expires*60*60*1e3),expires=date}var str=name+"="+value;expires&&(str+="; expires="+expires.toUTCString()),str+="; path=/",opts.domain&&(str+="; domain="+opts.domain),opts.secure&&(str+="; Secure"),opts.sameSite&&(str+="; SameSite="+opts.sameSite),document.cookie=str},getLastEventTime=function getLastEventTime(){var parsedValue,cookie=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",strValue=cookie.split(".")[Constants_LAST_EVENT_TIME_INDEX];return strValue&&(parsedValue=parseInt(strValue,32)),parsedValue||(utils_log.warn("unable to parse malformed cookie: ".concat(cookie)),0)},baseCookie_set=set,baseCookie_get=get,baseCookie_getAll=function getAll(name){try{var cookieArray=document.cookie.split(";").map((function(c){return c.trimStart()})),values=[],_iteratorNormalCompletion=!0,_didIteratorError=!1,_iteratorError=void 0;try{for(var _step,_iterator=cookieArray[Symbol.iterator]();!(_iteratorNormalCompletion=(_step=_iterator.next()).done);_iteratorNormalCompletion=!0){for(var cookie=_step.value;" "===cookie.charAt(0);)cookie=cookie.substring(1);0===cookie.indexOf(name)&&values.push(cookie.substring(name.length))}}catch(err){_didIteratorError=!0,_iteratorError=err}finally{try{_iteratorNormalCompletion||null==_iterator.return||_iterator.return()}finally{if(_didIteratorError)throw _iteratorError}}return values}catch(e){return[]}},baseCookie_sortByEventTime=function sortByEventTime(cookies){return _toConsumableArray(cookies).sort((function(c1,c2){var t1=getLastEventTime(c1);return getLastEventTime(c2)-t1}))},baseCookie_areCookiesEnabled=function areCookiesEnabled(){var opts=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},cookieName=Constants_COOKIE_TEST_PREFIX+base64Id(),_areCookiesEnabled=!1;try{var uid=String(new Date);set(cookieName,uid,opts),utils_log.info("Testing if cookies available"),_areCookiesEnabled=get(cookieName+"=")===uid}catch(e){utils_log.warn('Error thrown when checking for cookies. Reason: "'.concat(e,'"'))}finally{utils_log.info("Cleaning up cookies availability test"),set(cookieName,null,opts)}return _areCookiesEnabled},getHost=function getHost(url){var a=document.createElement("a");return a.href=url,a.hostname||location.hostname},topDomain=function topDomain(url){for(var parts=getHost(url).split("."),levels=[],cname="_tldtest_"+base64Id(),i=parts.length-2;i>=0;--i)levels.push(parts.slice(i).join("."));for(var _i=0;_i<levels.length;++_i){var domain=levels[_i],opts={domain:"."+domain};if(baseCookie_set(cname,1,opts),baseCookie_get(cname))return baseCookie_set(cname,null,opts),domain}return""},_options={expirationDays:void 0,domain:void 0},_domainSpecific=function _domainSpecific(name){var suffix="";return _options.domain&&(suffix="."===_options.domain.charAt(0)?_options.domain.substring(1):_options.domain),name+suffix},get$1=function get(name){var nameEq=_domainSpecific(name)+"=",value=baseCookie_get(nameEq);try{if(value)return JSON.parse(Base64.decode(value))}catch(e){return null}return null},set$1=function set(name,value){try{return baseCookie_set(_domainSpecific(name),Base64.encode(JSON.stringify(value)),_options),!0}catch(e){return!1}},remove=function remove(name){try{return baseCookie_set(_domainSpecific(name),null,_options),!0}catch(e){return!1}},Cookie={reset:function reset(){_options={expirationDays:void 0,domain:void 0}},options:function options(opts){if(0===arguments.length)return _options;opts=opts||{},_options.expirationDays=opts.expirationDays,_options.secure=opts.secure,_options.sameSite=opts.sameSite;var domain=utils_isEmptyString(opts.domain)?"."+topDomain(getLocation().href):opts.domain,token=Math.random();_options.domain=domain,set$1("amplitude_test",token);var stored=get$1("amplitude_test");return stored&&stored===token||(domain=null),remove("amplitude_test"),_options.domain=domain,_options},get:get$1,set:set$1,remove:remove,setRaw:function setRaw(name,value){try{return baseCookie_set(_domainSpecific(name),value,_options),!0}catch(e){return!1}},getRaw:function getRaw(name){var nameEq=_domainSpecific(name)+"=";return baseCookie_get(nameEq)}};if(function windowLocalStorageAvailable(){var result,uid=new Date;try{return window.localStorage.setItem(uid,uid),result=window.localStorage.getItem(uid)===String(uid),window.localStorage.removeItem(uid),result}catch(e){}return!1}())localStorage=window.localStorage;else if(window.globalStorage)try{localStorage=window.globalStorage[window.location.hostname]}catch(e){}else if("undefined"!=typeof document){var div=document.createElement("div"),attrKey="localStorage";div.style.display="none",document.getElementsByTagName("head")[0].appendChild(div),div.addBehavior&&(div.addBehavior("#default#userdata"),localStorage={length:0,setItem:function setItem(k,v){div.load(attrKey),div.getAttribute(k)||this.length++,div.setAttribute(k,v),div.save(attrKey)},getItem:function getItem(k){return div.load(attrKey),div.getAttribute(k)},removeItem:function removeItem(k){div.load(attrKey),div.getAttribute(k)&&this.length--,div.removeAttribute(k),div.save(attrKey)},clear:function clear(){div.load(attrKey);for(var attr,i=0;attr=div.XMLDocument.documentElement.attributes[i++];)div.removeAttribute(attr.name);div.save(attrKey),this.length=0},key:function key(k){return div.load(attrKey),div.XMLDocument.documentElement.attributes[k]}},div.load(attrKey),localStorage.length=div.XMLDocument.documentElement.attributes.length)}localStorage||(localStorage={length:0,setItem:function setItem(k,v){},getItem:function getItem(k){},removeItem:function removeItem(k){},clear:function clear(){},key:function key(k){}});var _storageOptionExists,ampLocalStorage=localStorage,cookieStorage=function cookieStorage(){this.storage=null};cookieStorage.prototype.getStorage=function(){return null!==this.storage||(baseCookie_areCookiesEnabled()?this.storage=Cookie:this.storage={_options:{expirationDays:void 0,domain:void 0,secure:!1},reset:function reset(){this._options={expirationDays:void 0,domain:void 0,secure:!1}},options:function options(opts){return 0===arguments.length?this._options:(opts=opts||{},this._options.expirationDays=opts.expirationDays||this._options.expirationDays,this._options.domain=opts.domain||this._options.domain||window&&window.location&&window.location.hostname,this._options.secure=opts.secure||!1)},get:function get(name){try{return JSON.parse(ampLocalStorage.getItem("amp_cookiestore_"+name))}catch(e){}return null},set:function set(name,value){try{return ampLocalStorage.setItem("amp_cookiestore_"+name,JSON.stringify(value)),!0}catch(e){}return!1},remove:function remove(name){try{ampLocalStorage.removeItem("amp_cookiestore_"+name)}catch(e){return!1}}}),this.storage};var storageOptionExists=(_defineProperty(_storageOptionExists={},Constants_STORAGE_COOKIES,!0),_defineProperty(_storageOptionExists,Constants_STORAGE_NONE,!0),_defineProperty(_storageOptionExists,Constants_STORAGE_LOCAL,!0),_defineProperty(_storageOptionExists,Constants_STORAGE_SESSION,!0),_storageOptionExists),MetadataStorage=function(){function MetadataStorage(_ref){var storageKey=_ref.storageKey,disableCookies=_ref.disableCookies,domain=_ref.domain,secure=_ref.secure,sameSite=_ref.sameSite,expirationDays=_ref.expirationDays,storage=_ref.storage;!function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}(this,MetadataStorage),this.storageKey=storageKey,this.domain=domain,this.secure=secure,this.sameSite=sameSite,this.expirationDays=expirationDays,this.cookieDomain="";var writableTopDomain=topDomain(getLocation().href);if(this.cookieDomain=domain||(writableTopDomain?"."+writableTopDomain:null),storageOptionExists[storage])this.storage=storage;else{var disableCookieStorage=disableCookies||!baseCookie_areCookiesEnabled({domain:this.cookieDomain,secure:this.secure,sameSite:this.sameSite,expirationDays:this.expirationDays});this.storage=disableCookieStorage?Constants_STORAGE_LOCAL:Constants_STORAGE_COOKIES}}return function _createClass(Constructor,protoProps,staticProps){return protoProps&&_defineProperties(Constructor.prototype,protoProps),staticProps&&_defineProperties(Constructor,staticProps),Constructor}(MetadataStorage,[{key:"getCookieStorageKey",value:function getCookieStorageKey(){if(!this.domain)return this.storageKey;var suffix="."===this.domain.charAt(0)?this.domain.substring(1):this.domain;return"".concat(this.storageKey).concat(suffix?"_".concat(suffix):"")}},{key:"save",value:function save(_ref2){var deviceId=_ref2.deviceId,userId=_ref2.userId,optOut=_ref2.optOut,sessionId=_ref2.sessionId,lastEventTime=_ref2.lastEventTime,eventId=_ref2.eventId,identifyId=_ref2.identifyId,sequenceNumber=_ref2.sequenceNumber;if(this.storage!==Constants_STORAGE_NONE){var value=[deviceId,Base64.encode(userId||""),optOut?"1":"",sessionId?sessionId.toString(32):"0",lastEventTime?lastEventTime.toString(32):"0",eventId?eventId.toString(32):"0",identifyId?identifyId.toString(32):"0",sequenceNumber?sequenceNumber.toString(32):"0"].join(".");switch(this.storage){case Constants_STORAGE_SESSION:window.sessionStorage&&window.sessionStorage.setItem(this.storageKey,value);break;case Constants_STORAGE_LOCAL:ampLocalStorage.setItem(this.storageKey,value);break;case Constants_STORAGE_COOKIES:this.saveCookie(value)}}}},{key:"saveCookie",value:function saveCookie(value){baseCookie_set(this.getCookieStorageKey(),value,{domain:this.cookieDomain,secure:this.secure,sameSite:this.sameSite,expirationDays:this.expirationDays})}},{key:"load",value:function load(){var str,_this=this;if(this.storage===Constants_STORAGE_COOKIES){var cookieKey=this.getCookieStorageKey()+"=",allCookies=baseCookie_getAll(cookieKey);if(0===allCookies.length||1===allCookies.length)str=allCookies[0];else{var latestCookie=baseCookie_sortByEventTime(allCookies)[0];allCookies.forEach((function(){return baseCookie_set(_this.getCookieStorageKey(),null,{})})),this.saveCookie(latestCookie),str=baseCookie_get(cookieKey)}}if(str||(str=ampLocalStorage.getItem(this.storageKey)),!str)try{str=window.sessionStorage&&window.sessionStorage.getItem(this.storageKey)}catch(e){utils_log.info('window.sessionStorage unavailable. Reason: "'.concat(e,'"'))}if(!str)return null;var values=str.split("."),userId=null;if(values[Constants_USER_ID_INDEX])try{userId=Base64.decode(values[Constants_USER_ID_INDEX])}catch(e){userId=null}return{deviceId:values[Constants_DEVICE_ID_INDEX],userId:userId,optOut:"1"===values[Constants_OPT_OUT_INDEX],sessionId:parseInt(values[Constants_SESSION_ID_INDEX],32),lastEventTime:parseInt(values[Constants_LAST_EVENT_TIME_INDEX],32),eventId:parseInt(values[Constants_EVENT_ID_INDEX],32),identifyId:parseInt(values[Constants_IDENTIFY_ID_INDEX],32),sequenceNumber:parseInt(values[Constants_SEQUENCE_NUMBER_INDEX],32)}}},{key:"clear",value:function clear(){var str;if(this.storage===Constants_STORAGE_COOKIES&&(str=baseCookie_get(this.getCookieStorageKey()+"="),baseCookie_set(this.getCookieStorageKey(),null,{domain:this.cookieDomain,secure:this.secure,sameSite:this.sameSite,expirationDays:0})),str||(str=ampLocalStorage.getItem(this.storageKey),ampLocalStorage.clear()),!str)try{str=window.sessionStorage&&window.sessionStorage.getItem(this.storageKey),window.sessionStorage.clear()}catch(e){utils_log.info('window.sessionStorage unavailable. Reason: "'.concat(e,'"'))}return!!str}}]),MetadataStorage}(),Identify=function Identify(){this.userPropertiesOperations={},this.properties=[]};Identify.prototype.add=function(property,value){return"number"===type(value)||"string"===type(value)?this._addOperation("$add",property,value):utils_log.error("Unsupported type for value: "+type(value)+", expecting number or string"),this},Identify.prototype.append=function(property,value){return this._addOperation("$append",property,value),this},Identify.prototype.clearAll=function(){return Object.keys(this.userPropertiesOperations).length>0?(Object.prototype.hasOwnProperty.call(this.userPropertiesOperations,"$clearAll")||utils_log.error("Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll"),this):(this.userPropertiesOperations.$clearAll="-",this)},Identify.prototype.prepend=function(property,value){return this._addOperation("$prepend",property,value),this},Identify.prototype.set=function(property,value){return this._addOperation("$set",property,value),this},Identify.prototype.setOnce=function(property,value){return this._addOperation("$setOnce",property,value),this},Identify.prototype.unset=function(property){return this._addOperation("$unset",property,"-"),this},Identify.prototype.preInsert=function(property,value){return this._addOperation("$preInsert",property,value),this},Identify.prototype.postInsert=function(property,value){return this._addOperation("$postInsert",property,value),this},Identify.prototype.remove=function(property,value){return this._addOperation("$remove",property,value),this},Identify.prototype._addOperation=function(operation,property,value){Object.prototype.hasOwnProperty.call(this.userPropertiesOperations,"$clearAll")?utils_log.error("This identify already contains a $clearAll operation, skipping operation "+operation):-1===this.properties.indexOf(property)?(Object.prototype.hasOwnProperty.call(this.userPropertiesOperations,operation)||(this.userPropertiesOperations[operation]={}),this.userPropertiesOperations[operation][property]=value,this.properties.push(property)):utils_log.error('User property "'+property+'" already used in this identify, skipping operation '+operation)};var commonjsGlobal="undefined"!=typeof window?window:void 0!==global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(fn,module){return fn(module={exports:{}},module.exports),module.exports}var md5=createCommonjsModule((function(module){!function($){function safeAdd(x,y){var lsw=(65535&x)+(65535&y);return(x>>16)+(y>>16)+(lsw>>16)<<16|65535&lsw}function md5cmn(q,a,b,x,s,t){return safeAdd(function bitRotateLeft(num,cnt){return num<<cnt|num>>>32-cnt}(safeAdd(safeAdd(a,q),safeAdd(x,t)),s),b)}function md5ff(a,b,c,d,x,s,t){return md5cmn(b&c|~b&d,a,b,x,s,t)}function md5gg(a,b,c,d,x,s,t){return md5cmn(b&d|c&~d,a,b,x,s,t)}function md5hh(a,b,c,d,x,s,t){return md5cmn(b^c^d,a,b,x,s,t)}function md5ii(a,b,c,d,x,s,t){return md5cmn(c^(b|~d),a,b,x,s,t)}function binlMD5(x,len){var i,olda,oldb,oldc,oldd;x[len>>5]|=128<<len%32,x[14+(len+64>>>9<<4)]=len;var a=1732584193,b=-271733879,c=-1732584194,d=271733878;for(i=0;i<x.length;i+=16)olda=a,oldb=b,oldc=c,oldd=d,a=md5ff(a,b,c,d,x[i],7,-680876936),d=md5ff(d,a,b,c,x[i+1],12,-389564586),c=md5ff(c,d,a,b,x[i+2],17,606105819),b=md5ff(b,c,d,a,x[i+3],22,-1044525330),a=md5ff(a,b,c,d,x[i+4],7,-176418897),d=md5ff(d,a,b,c,x[i+5],12,1200080426),c=md5ff(c,d,a,b,x[i+6],17,-1473231341),b=md5ff(b,c,d,a,x[i+7],22,-45705983),a=md5ff(a,b,c,d,x[i+8],7,1770035416),d=md5ff(d,a,b,c,x[i+9],12,-1958414417),c=md5ff(c,d,a,b,x[i+10],17,-42063),b=md5ff(b,c,d,a,x[i+11],22,-1990404162),a=md5ff(a,b,c,d,x[i+12],7,1804603682),d=md5ff(d,a,b,c,x[i+13],12,-40341101),c=md5ff(c,d,a,b,x[i+14],17,-1502002290),a=md5gg(a,b=md5ff(b,c,d,a,x[i+15],22,1236535329),c,d,x[i+1],5,-165796510),d=md5gg(d,a,b,c,x[i+6],9,-1069501632),c=md5gg(c,d,a,b,x[i+11],14,643717713),b=md5gg(b,c,d,a,x[i],20,-373897302),a=md5gg(a,b,c,d,x[i+5],5,-701558691),d=md5gg(d,a,b,c,x[i+10],9,38016083),c=md5gg(c,d,a,b,x[i+15],14,-660478335),b=md5gg(b,c,d,a,x[i+4],20,-405537848),a=md5gg(a,b,c,d,x[i+9],5,568446438),d=md5gg(d,a,b,c,x[i+14],9,-1019803690),c=md5gg(c,d,a,b,x[i+3],14,-187363961),b=md5gg(b,c,d,a,x[i+8],20,1163531501),a=md5gg(a,b,c,d,x[i+13],5,-1444681467),d=md5gg(d,a,b,c,x[i+2],9,-51403784),c=md5gg(c,d,a,b,x[i+7],14,1735328473),a=md5hh(a,b=md5gg(b,c,d,a,x[i+12],20,-1926607734),c,d,x[i+5],4,-378558),d=md5hh(d,a,b,c,x[i+8],11,-2022574463),c=md5hh(c,d,a,b,x[i+11],16,1839030562),b=md5hh(b,c,d,a,x[i+14],23,-35309556),a=md5hh(a,b,c,d,x[i+1],4,-1530992060),d=md5hh(d,a,b,c,x[i+4],11,1272893353),c=md5hh(c,d,a,b,x[i+7],16,-155497632),b=md5hh(b,c,d,a,x[i+10],23,-1094730640),a=md5hh(a,b,c,d,x[i+13],4,681279174),d=md5hh(d,a,b,c,x[i],11,-358537222),c=md5hh(c,d,a,b,x[i+3],16,-722521979),b=md5hh(b,c,d,a,x[i+6],23,76029189),a=md5hh(a,b,c,d,x[i+9],4,-640364487),d=md5hh(d,a,b,c,x[i+12],11,-421815835),c=md5hh(c,d,a,b,x[i+15],16,530742520),a=md5ii(a,b=md5hh(b,c,d,a,x[i+2],23,-995338651),c,d,x[i],6,-198630844),d=md5ii(d,a,b,c,x[i+7],10,1126891415),c=md5ii(c,d,a,b,x[i+14],15,-1416354905),b=md5ii(b,c,d,a,x[i+5],21,-57434055),a=md5ii(a,b,c,d,x[i+12],6,1700485571),d=md5ii(d,a,b,c,x[i+3],10,-1894986606),c=md5ii(c,d,a,b,x[i+10],15,-1051523),b=md5ii(b,c,d,a,x[i+1],21,-2054922799),a=md5ii(a,b,c,d,x[i+8],6,1873313359),d=md5ii(d,a,b,c,x[i+15],10,-30611744),c=md5ii(c,d,a,b,x[i+6],15,-1560198380),b=md5ii(b,c,d,a,x[i+13],21,1309151649),a=md5ii(a,b,c,d,x[i+4],6,-145523070),d=md5ii(d,a,b,c,x[i+11],10,-1120210379),c=md5ii(c,d,a,b,x[i+2],15,718787259),b=md5ii(b,c,d,a,x[i+9],21,-343485551),a=safeAdd(a,olda),b=safeAdd(b,oldb),c=safeAdd(c,oldc),d=safeAdd(d,oldd);return[a,b,c,d]}function binl2rstr(input){var i,output="",length32=32*input.length;for(i=0;i<length32;i+=8)output+=String.fromCharCode(input[i>>5]>>>i%32&255);return output}function rstr2binl(input){var i,output=[];for(output[(input.length>>2)-1]=void 0,i=0;i<output.length;i+=1)output[i]=0;var length8=8*input.length;for(i=0;i<length8;i+=8)output[i>>5]|=(255&input.charCodeAt(i/8))<<i%32;return output}function rstr2hex(input){var x,i,output="";for(i=0;i<input.length;i+=1)x=input.charCodeAt(i),output+="0123456789abcdef".charAt(x>>>4&15)+"0123456789abcdef".charAt(15&x);return output}function str2rstrUTF8(input){return unescape(encodeURIComponent(input))}function rawMD5(s){return function rstrMD5(s){return binl2rstr(binlMD5(rstr2binl(s),8*s.length))}(str2rstrUTF8(s))}function rawHMACMD5(k,d){return function rstrHMACMD5(key,data){var i,hash,bkey=rstr2binl(key),ipad=[],opad=[];for(ipad[15]=opad[15]=void 0,bkey.length>16&&(bkey=binlMD5(bkey,8*key.length)),i=0;i<16;i+=1)ipad[i]=909522486^bkey[i],opad[i]=1549556828^bkey[i];return hash=binlMD5(ipad.concat(rstr2binl(data)),512+8*data.length),binl2rstr(binlMD5(opad.concat(hash),640))}(str2rstrUTF8(k),str2rstrUTF8(d))}function md5(string,key,raw){return key?raw?rawHMACMD5(key,string):function hexHMACMD5(k,d){return rstr2hex(rawHMACMD5(k,d))}(key,string):raw?rawMD5(string):function hexMD5(s){return rstr2hex(rawMD5(s))}(string)}module.exports?module.exports=md5:$.md5=md5}(commonjsGlobal)})),getOwnPropertySymbols=Object.getOwnPropertySymbols,hasOwnProperty=Object.prototype.hasOwnProperty,propIsEnumerable=Object.prototype.propertyIsEnumerable;function toObject(val){if(null==val)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(val)}var objectAssign=function shouldUseNative(){try{if(!Object.assign)return!1;var test1=new String("abc");if(test1[5]="de","5"===Object.getOwnPropertyNames(test1)[0])return!1;for(var test2={},i=0;i<10;i++)test2["_"+String.fromCharCode(i)]=i;if("0123456789"!==Object.getOwnPropertyNames(test2).map((function(n){return test2[n]})).join(""))return!1;var test3={};return"abcdefghijklmnopqrst".split("").forEach((function(letter){test3[letter]=letter})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},test3)).join("")}catch(err){return!1}}()?Object.assign:function(target,source){for(var from,symbols,to=toObject(target),s=1;s<arguments.length;s++){for(var key in from=Object(arguments[s]))hasOwnProperty.call(from,key)&&(to[key]=from[key]);if(getOwnPropertySymbols){symbols=getOwnPropertySymbols(from);for(var i=0;i<symbols.length;i++)propIsEnumerable.call(from,symbols[i])&&(to[symbols[i]]=from[symbols[i]])}}return to};function encode(value,opts){return opts.encode?opts.strict?encodeURIComponent(value).replace(/[!'()*]/g,(function(c){return"%"+c.charCodeAt(0).toString(16).toUpperCase()})):encodeURIComponent(value):value}new RegExp("%[a-f0-9]{2}","gi"),new RegExp("(%[a-f0-9]{2})+","gi");var queryString_stringify=function(obj,opts){!1===(opts=objectAssign({encode:!0,strict:!0,arrayFormat:"none"},opts)).sort&&(opts.sort=function(){});var formatter=function encoderForArrayFormat(opts){switch(opts.arrayFormat){case"index":return function(key,value,index){return null===value?[encode(key,opts),"[",index,"]"].join(""):[encode(key,opts),"[",encode(index,opts),"]=",encode(value,opts)].join("")};case"bracket":return function(key,value){return null===value?encode(key,opts):[encode(key,opts),"[]=",encode(value,opts)].join("")};default:return function(key,value){return null===value?encode(key,opts):[encode(key,opts),"=",encode(value,opts)].join("")}}}(opts);return obj?Object.keys(obj).sort(opts.sort).map((function(key){var val=obj[key];if(void 0===val)return"";if(null===val)return encode(key,opts);if(Array.isArray(val)){var result=[];return val.slice().forEach((function(val2){void 0!==val2&&result.push(formatter(key,val2,result.length))})),result.join("&")}return encode(key,opts)+"="+encode(val,opts)})).filter((function(x){return x.length>0})).join("&"):""},Request=function Request(url,data,headers){this.url=url,this.data=data||{},this.headers=headers};Request.prototype.send=function(callback){if(window.XDomainRequest){var xdr=new window.XDomainRequest;xdr.open("POST",this.url,!0),xdr.onload=function(){callback(200,xdr.responseText)},xdr.onerror=function(){"Request Entity Too Large"===xdr.responseText?callback(413,xdr.responseText):callback(500,xdr.responseText)},xdr.ontimeout=function(){},xdr.onprogress=function(){},xdr.send(queryString_stringify(this.data))}else{var xhr=new XMLHttpRequest;xhr.open("POST",this.url,!0),xhr.onreadystatechange=function(){4===xhr.readyState&&callback(xhr.status,xhr.responseText)},function setHeaders(xhr,headers){for(var header in headers)xhr.setRequestHeader(header,headers[header])}(xhr,this.headers),xhr.send(queryString_stringify(this.data))}};var Revenue=function Revenue(){this._price=null,this._productId=null,this._quantity=1,this._revenueType=null,this._properties=null};Revenue.prototype.setProductId=function setProductId(productId){return"string"!==type(productId)?utils_log.error("Unsupported type for productId: "+type(productId)+", expecting string"):utils_isEmptyString(productId)?utils_log.error("Invalid empty productId"):this._productId=productId,this},Revenue.prototype.setQuantity=function setQuantity(quantity){return"number"!==type(quantity)?utils_log.error("Unsupported type for quantity: "+type(quantity)+", expecting number"):this._quantity=parseInt(quantity),this},Revenue.prototype.setPrice=function setPrice(price){return"number"!==type(price)?utils_log.error("Unsupported type for price: "+type(price)+", expecting number"):this._price=price,this},Revenue.prototype.setRevenueType=function setRevenueType(revenueType){return"string"!==type(revenueType)?utils_log.error("Unsupported type for revenueType: "+type(revenueType)+", expecting string"):this._revenueType=revenueType,this},Revenue.prototype.setEventProperties=function setEventProperties(eventProperties){return"object"!==type(eventProperties)?utils_log.error("Unsupported type for eventProperties: "+type(eventProperties)+", expecting object"):this._properties=utils_validateProperties(eventProperties),this},Revenue.prototype._isValidRevenue=function _isValidRevenue(){return"number"===type(this._price)||(utils_log.error("Invalid revenue, need to set price field"),!1)},Revenue.prototype._toJSONObject=function _toJSONObject(){var obj="object"===type(this._properties)?this._properties:{};return null!==this._productId&&(obj[Constants_REVENUE_PRODUCT_ID]=this._productId),null!==this._quantity&&(obj[Constants_REVENUE_QUANTITY]=this._quantity),null!==this._price&&(obj[Constants_REVENUE_PRICE]=this._price),null!==this._revenueType&&(obj[Constants_REVENUE_REVENUE_TYPE]=this._revenueType),obj};var uaParser=createCommonjsModule((function(module,exports){!function(window,undefined$1){var MODEL="model",NAME="name",TYPE="type",VENDOR="vendor",VERSION="version",MOBILE="mobile",TABLET="tablet",SMARTTV="smarttv",enumerize=function(arr){var enums={};for(var i in arr)enums[arr[i].toUpperCase()]=arr[i];return enums},has=function(str1,str2){return"string"==typeof str1&&-1!==lowerize(str2).indexOf(lowerize(str1))},lowerize=function(str){return str.toLowerCase()},trim=function(str,len){if("string"==typeof str)return str=str.replace(/^\s+|\s+$/g,""),void 0===len?str:str.substring(0,255)},rgxMapper=function(ua,arrays){for(var j,k,p,q,matches,match,i=0;i<arrays.length&&!matches;){var regex=arrays[i],props=arrays[i+1];for(j=k=0;j<regex.length&&!matches;)if(matches=regex[j++].exec(ua))for(p=0;p<props.length;p++)match=matches[++k],"object"==typeof(q=props[p])&&q.length>0?2==q.length?"function"==typeof q[1]?this[q[0]]=q[1].call(this,match):this[q[0]]=q[1]:3==q.length?"function"!=typeof q[1]||q[1].exec&&q[1].test?this[q[0]]=match?match.replace(q[1],q[2]):void 0:this[q[0]]=match?q[1].call(this,match,q[2]):void 0:4==q.length&&(this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):void 0):this[q]=match||void 0;i+=2}},strMapper=function(str,map){for(var i in map)if("object"==typeof map[i]&&map[i].length>0){for(var j=0;j<map[i].length;j++)if(has(map[i][j],str))return"?"===i?void 0:i}else if(has(map[i],str))return"?"===i?void 0:i;return str},windowsVersionMap={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},regexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[NAME,VERSION],[/opios[\/ ]+([\w\.]+)/i],[VERSION,[NAME,"Opera Mini"]],[/\bopr\/([\w\.]+)/i],[VERSION,[NAME,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[NAME,VERSION],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[VERSION,[NAME,"UCBrowser"]],[/\bqbcore\/([\w\.]+)/i],[VERSION,[NAME,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,"WeChat"]],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[VERSION,[NAME,"IE"]],[/yabrowser\/([\w\.]+)/i],[VERSION,[NAME,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Secure Browser"],VERSION],[/\bfocus\/([\w\.]+)/i],[VERSION,[NAME,"Firefox Focus"]],[/\bopt\/([\w\.]+)/i],[VERSION,[NAME,"Opera Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[VERSION,[NAME,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,"Dolphin"]],[/coast\/([\w\.]+)/i],[VERSION,[NAME,"Opera Coast"]],[/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,"MIUI Browser"]],[/fxios\/([-\w\.]+)/i],[VERSION,[NAME,"Firefox"]],[/\bqihu|(qi?ho?o?|360)browser/i],[[NAME,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[NAME,/(.+)/,"$1 Browser"],VERSION],[/(comodo_dragon)\/([\w\.]+)/i],[[NAME,/_/g," "],VERSION],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[NAME,VERSION],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i],[NAME],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[NAME,"Facebook"],VERSION],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[NAME,VERSION],[/\bgsa\/([\w\.]+) .*safari\//i],[VERSION,[NAME,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[VERSION,[NAME,"Chrome Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[NAME,"Chrome WebView"],VERSION],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[VERSION,[NAME,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.]+) .*mobile\/\w+ (safari)/i],[VERSION,[NAME,"Mobile Safari"]],[/version\/([\w\.]+) .*(mobile ?safari|safari)/i],[VERSION,NAME],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,strMapper,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[NAME,"Netscape"],VERSION],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[NAME,VERSION]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[["architecture","arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[["architecture","armhf"]],[/windows (ce|mobile); ppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[["architecture",/ower/,"",lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[["architecture",lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[MODEL,[VENDOR,"Samsung"],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,"Samsung"],[TYPE,MOBILE]],[/((ipod|iphone)\d+,\d+)/i],[MODEL,[VENDOR,"Apple"],[TYPE,MOBILE]],[/(ipad\d+,\d+)/i],[MODEL,[VENDOR,"Apple"],[TYPE,TABLET]],[/\((ip(?:hone|od)[\w ]*);/i],[MODEL,[VENDOR,"Apple"],[TYPE,MOBILE]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[MODEL,[VENDOR,"Apple"],[TYPE,TABLET]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[MODEL,[VENDOR,"Huawei"],[TYPE,TABLET]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}-[atu]?[ln][01259x][012359][an]?)\b(?!.+d\/s)/i],[MODEL,[VENDOR,"Huawei"],[TYPE,MOBILE]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,"Xiaomi"],[TYPE,MOBILE]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[MODEL,/_/g," "],[VENDOR,"Xiaomi"],[TYPE,TABLET]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],[MODEL,[VENDOR,"OPPO"],[TYPE,MOBILE]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[MODEL,[VENDOR,"Vivo"],[TYPE,MOBILE]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[MODEL,[VENDOR,"Realme"],[TYPE,MOBILE]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[MODEL,[VENDOR,"Motorola"],[TYPE,MOBILE]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[MODEL,[VENDOR,"Motorola"],[TYPE,TABLET]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,"LG"],[TYPE,TABLET]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[MODEL,[VENDOR,"LG"],[TYPE,MOBILE]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[MODEL,[VENDOR,"Lenovo"],[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[MODEL,/_/g," "],[VENDOR,"Nokia"],[TYPE,MOBILE]],[/(pixel c)\b/i],[MODEL,[VENDOR,"Google"],[TYPE,TABLET]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[MODEL,[VENDOR,"Google"],[TYPE,MOBILE]],[/droid.+ ([c-g]\d{4}|so[-l]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,"Sony"],[TYPE,MOBILE]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[MODEL,"Xperia Tablet"],[VENDOR,"Sony"],[TYPE,TABLET]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[MODEL,[VENDOR,"OnePlus"],[TYPE,MOBILE]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[MODEL,[VENDOR,"Amazon"],[TYPE,TABLET]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[MODEL,/(.+)/g,"Fire Phone $1"],[VENDOR,"Amazon"],[TYPE,MOBILE]],[/(playbook);[-\w\),; ]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[MODEL,[VENDOR,"BlackBerry"],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[MODEL,[VENDOR,"ASUS"],[TYPE,TABLET]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[MODEL,[VENDOR,"ASUS"],[TYPE,MOBILE]],[/(nexus 9)/i],[MODEL,[VENDOR,"HTC"],[TYPE,TABLET]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony)[-_ ]?([-\w]*)/i],[VENDOR,[MODEL,/_/g," "],[TYPE,MOBILE]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[MODEL,[VENDOR,"Acer"],[TYPE,TABLET]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[MODEL,[VENDOR,"Meizu"],[TYPE,MOBILE]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,MOBILE]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/(surface duo)/i],[MODEL,[VENDOR,"Microsoft"],[TYPE,TABLET]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[MODEL,[VENDOR,"Fairphone"],[TYPE,MOBILE]],[/(u304aa)/i],[MODEL,[VENDOR,"AT&T"],[TYPE,MOBILE]],[/\bsie-(\w*)/i],[MODEL,[VENDOR,"Siemens"],[TYPE,MOBILE]],[/\b(rct\w+) b/i],[MODEL,[VENDOR,"RCA"],[TYPE,TABLET]],[/\b(venue[\d ]{2,7}) b/i],[MODEL,[VENDOR,"Dell"],[TYPE,TABLET]],[/\b(q(?:mv|ta)\w+) b/i],[MODEL,[VENDOR,"Verizon"],[TYPE,TABLET]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[MODEL,[VENDOR,"Barnes & Noble"],[TYPE,TABLET]],[/\b(tm\d{3}\w+) b/i],[MODEL,[VENDOR,"NuVision"],[TYPE,TABLET]],[/\b(k88) b/i],[MODEL,[VENDOR,"ZTE"],[TYPE,TABLET]],[/\b(nx\d{3}j) b/i],[MODEL,[VENDOR,"ZTE"],[TYPE,MOBILE]],[/\b(gen\d{3}) b.+49h/i],[MODEL,[VENDOR,"Swiss"],[TYPE,MOBILE]],[/\b(zur\d{3}) b/i],[MODEL,[VENDOR,"Swiss"],[TYPE,TABLET]],[/\b((zeki)?tb.*\b) b/i],[MODEL,[VENDOR,"Zeki"],[TYPE,TABLET]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[VENDOR,"Dragon Touch"],MODEL,[TYPE,TABLET]],[/\b(ns-?\w{0,9}) b/i],[MODEL,[VENDOR,"Insignia"],[TYPE,TABLET]],[/\b((nxa|next)-?\w{0,9}) b/i],[MODEL,[VENDOR,"NextBook"],[TYPE,TABLET]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[VENDOR,"Voice"],MODEL,[TYPE,MOBILE]],[/\b(lvtel\-)?(v1[12]) b/i],[[VENDOR,"LvTel"],MODEL,[TYPE,MOBILE]],[/\b(ph-1) /i],[MODEL,[VENDOR,"Essential"],[TYPE,MOBILE]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[MODEL,[VENDOR,"Envizen"],[TYPE,TABLET]],[/\b(trio[-\w\. ]+) b/i],[MODEL,[VENDOR,"MachSpeed"],[TYPE,TABLET]],[/\btu_(1491) b/i],[MODEL,[VENDOR,"Rotor"],[TYPE,TABLET]],[/(shield[\w ]+) b/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,TABLET]],[/(sprint) (\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g," "],[VENDOR,"Microsoft"],[TYPE,MOBILE]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,"Zebra"],[TYPE,TABLET]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,"Zebra"],[TYPE,MOBILE]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[VENDOR,MODEL,[TYPE,"console"]],[/droid.+; (shield) bui/i],[MODEL,[VENDOR,"Nvidia"],[TYPE,"console"]],[/(playstation [345portablevi]+)/i],[MODEL,[VENDOR,"Sony"],[TYPE,"console"]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[MODEL,[VENDOR,"Microsoft"],[TYPE,"console"]],[/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,"SmartTV"],[VENDOR,"Samsung"],[TYPE,SMARTTV]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[VENDOR,"LG"],[TYPE,SMARTTV]],[/(apple) ?tv/i],[VENDOR,[MODEL,"Apple TV"],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,"Chromecast"],[VENDOR,"Google"],[TYPE,SMARTTV]],[/droid.+aft(\w)( bui|\))/i],[MODEL,[VENDOR,"Amazon"],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i],[MODEL,[VENDOR,"Sharp"],[TYPE,SMARTTV]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[VENDOR,trim],[MODEL,trim],[TYPE,SMARTTV]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[TYPE,SMARTTV]],[/((pebble))app/i],[VENDOR,MODEL,[TYPE,"wearable"]],[/droid.+; (glass) \d/i],[MODEL,[VENDOR,"Google"],[TYPE,"wearable"]],[/droid.+; (wt63?0{2,3})\)/i],[MODEL,[VENDOR,"Zebra"],[TYPE,"wearable"]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[VENDOR,[TYPE,"embedded"]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[MODEL,[TYPE,MOBILE]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[MODEL,[TYPE,TABLET]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[TYPE,TABLET]],[/(phone|mobile(?:[;\/]| safari)|pda(?=.+windows ce))/i],[[TYPE,MOBILE]],[/(android[-\w\. ]{0,9});.+buil/i],[MODEL,[VENDOR,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[VERSION,[NAME,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[NAME,VERSION],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/microsoft (windows) (vista|xp)/i],[NAME,VERSION],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[NAME,[VERSION,strMapper,windowsVersionMap]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[NAME,"Windows"],[VERSION,strMapper,windowsVersionMap]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,"."],[NAME,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[NAME,"Mac OS"],[VERSION,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86)/i],[VERSION,NAME],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,"BlackBerry"]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[VERSION,[NAME,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[VERSION,[NAME,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[VERSION,[NAME,"webOS"]],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,"Chromecast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[NAME,"Chromium OS"],VERSION],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([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,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[NAME,VERSION],[/(sunos) ?([\w\.\d]*)/i],[[NAME,"Solaris"],VERSION],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[NAME,VERSION]]},UAParser=function(ua,extensions){if("object"==typeof ua&&(extensions=ua,ua=void 0),!(this instanceof UAParser))return new UAParser(ua,extensions).getResult();var _ua=ua||(void 0!==window&&window.navigator&&window.navigator.userAgent?window.navigator.userAgent:""),_rgxmap=extensions?function(regexes,extensions){var mergedRegexes={};for(var i in regexes)extensions[i]&&extensions[i].length%2==0?mergedRegexes[i]=extensions[i].concat(regexes[i]):mergedRegexes[i]=regexes[i];return mergedRegexes}(regexes,extensions):regexes;return this.getBrowser=function(){var _browser={name:void 0,version:void 0};return rgxMapper.call(_browser,_ua,_rgxmap.browser),_browser.major=function(version){return"string"==typeof version?version.replace(/[^\d\.]/g,"").split(".")[0]:void 0}(_browser.version),_browser},this.getCPU=function(){var _cpu={architecture:void 0};return rgxMapper.call(_cpu,_ua,_rgxmap.cpu),_cpu},this.getDevice=function(){var _device={vendor:void 0,model:void 0,type:void 0};return rgxMapper.call(_device,_ua,_rgxmap.device),_device},this.getEngine=function(){var _engine={name:void 0,version:void 0};return rgxMapper.call(_engine,_ua,_rgxmap.engine),_engine},this.getOS=function(){var _os={name:void 0,version:void 0};return rgxMapper.call(_os,_ua,_rgxmap.os),_os},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return _ua},this.setUA=function(ua){return _ua="string"==typeof ua&&ua.length>255?trim(ua,255):ua,this},this.setUA(_ua),this};UAParser.VERSION="0.7.28",UAParser.BROWSER=enumerize([NAME,VERSION,"major"]),UAParser.CPU=enumerize(["architecture"]),UAParser.DEVICE=enumerize([MODEL,VENDOR,TYPE,"console",MOBILE,SMARTTV,TABLET,"wearable","embedded"]),UAParser.ENGINE=UAParser.OS=enumerize([NAME,VERSION]),module.exports&&(exports=module.exports=UAParser),exports.UAParser=UAParser;var $=void 0!==window&&(window.jQuery||window.Zepto);if($&&!$.ua){var parser=new UAParser;$.ua=parser.getResult(),$.ua.get=function(){return parser.getUA()},$.ua.set=function(ua){parser.setUA(ua);var result=parser.getResult();for(var prop in result)$.ua[prop]=result[prop]}}}("object"==typeof window?window:commonjsGlobal)})),uuid=(uaParser.UAParser,function uuid(a){return a?(a^16*Math.random()>>a/4).toString(16):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,uuid)}),DEFAULT_OPTIONS={apiEndpoint:"api.amplitude.com",batchEvents:!1,cookieExpiration:365,cookieName:"amplitude_id",sameSiteCookie:"Lax",cookieForceUpgrade:!1,deferInitialization:!1,disableCookies:!1,deviceIdFromUrlParam:!1,domain:"",eventUploadPeriodMillis:3e4,eventUploadThreshold:30,forceHttps:!0,includeFbclid:!1,includeGclid:!1,includeReferrer:!1,includeUtm:!1,language:function getLanguage(){return navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||""}(),logLevel:"WARN",logAttributionCapturedEvent:!1,optOut:!1,onError:function onError(){},onExitPage:function onExitPage(){},platform:"Web",savedMaxCount:1e3,saveEvents:!0,saveParamsReferrerOncePerSession:!0,secureCookie:!1,sessionTimeout:18e5,storage:Constants_STORAGE_DEFAULT,trackingOptions:{city:!0,country:!0,carrier:!0,device_manufacturer:!0,device_model:!0,dma:!0,ip_address:!0,language:!0,os_name:!0,os_version:!0,platform:!0,region:!0,version_name:!0},transport:Constants_TRANSPORT_HTTP,unsetParamsReferrerOnNewSession:!1,unsentKey:"amplitude_unsent",unsentIdentifyKey:"amplitude_unsent_identify",uploadBatchSize:100,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}},AmplitudeClient=function AmplitudeClient(instanceName){isBrowserEnv()||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"),this._instanceName=utils_isEmptyString(instanceName)?Constants_DEFAULT_INSTANCE:instanceName.toLowerCase(),this._unsentEvents=[],this._unsentIdentifys=[],this._ua=new uaParser(navigator.userAgent).getResult(),this.options=_objectSpread({},DEFAULT_OPTIONS,{trackingOptions:_objectSpread({},DEFAULT_OPTIONS.trackingOptions)}),this.cookieStorage=(new cookieStorage).getStorage(),this._q=[],this._sending=!1,this._updateScheduled=!1,this._onInit=[],this._eventId=0,this._identifyId=0,this._lastEventTime=null,this._newSession=!1,this._sequenceNumber=0,this._sessionId=null,this._isInitialized=!1,this._userAgent=navigator&&navigator.userAgent||null};AmplitudeClient.prototype.Identify=Identify,AmplitudeClient.prototype.Revenue=Revenue,AmplitudeClient.prototype.init=function init(apiKey,opt_userId,opt_config,opt_callback){var _this=this;if("string"!==type(apiKey)||utils_isEmptyString(apiKey))utils_log.error("Invalid apiKey. Please re-initialize with a valid apiKey");else try{_parseConfig(this.options,opt_config),isBrowserEnv()&&void 0!==window.Prototype&&Array.prototype.toJSON&&(function(){var _a;if(isBrowserEnv()){var augmentedWindow=window,augmentedArray=Array;if(void 0!==augmentedWindow.Prototype&&void 0!==(null===(_a=augmentedArray.prototype)||void 0===_a?void 0:_a.toJSON))delete augmentedArray.prototype.toJSON}}(),utils_log.warn("Prototype.js injected Array.prototype.toJSON. Deleting Array.prototype.toJSON to prevent double-stringify")),this.options.cookieName!==DEFAULT_OPTIONS.cookieName&&utils_log.warn("The cookieName option is deprecated. We will be ignoring it for newer cookies"),this.options.apiKey=apiKey,this._storageSuffix="_"+apiKey+(this._instanceName===Constants_DEFAULT_INSTANCE?"":"_"+this._instanceName),this._storageSuffixV5=apiKey.slice(0,6),this._oldCookiename=this.options.cookieName+this._storageSuffix,this._unsentKey=this.options.unsentKey+this._storageSuffix,this._unsentIdentifyKey=this.options.unsentIdentifyKey+this._storageSuffix,this._cookieName=Constants_COOKIE_PREFIX+"_"+this._storageSuffixV5,this.cookieStorage.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie,sameSite:this.options.sameSiteCookie}),this._metadataStorage=new MetadataStorage({storageKey:this._cookieName,disableCookies:this.options.disableCookies,expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie,sameSite:this.options.sameSiteCookie,storage:this.options.storage});var hasOldCookie=!!this.cookieStorage.get(this._oldCookiename),hasNewCookie=!!this._metadataStorage.load();this._useOldCookie=!hasNewCookie&&hasOldCookie&&!this.options.cookieForceUpgrade;var hasCookie=hasNewCookie||hasOldCookie;if(this.options.domain=this.cookieStorage.options().domain,this.options.deferInitialization&&!hasCookie)return void this._deferInitialization(apiKey,opt_userId,opt_config,opt_callback);"string"===type(this.options.logLevel)&&utils_setLogLevel(this.options.logLevel);var trackingOptions=_generateApiPropertiesTrackingConfig(this);this._apiPropertiesTrackingOptions=Object.keys(trackingOptions).length>0?{tracking_options:trackingOptions}:{},this.options.cookieForceUpgrade&&hasOldCookie&&(hasNewCookie||_upgradeCookieData(this),this.cookieStorage.remove(this._oldCookiename)),_loadCookieData(this),this._pendingReadStorage=!0,this.options.saveEvents&&(this._unsentEvents=this._loadSavedUnsentEvents(this.options.unsentKey).map((function(event){return{event:event}})).concat(this._unsentEvents),this._unsentIdentifys=this._loadSavedUnsentEvents(this.options.unsentIdentifyKey).map((function(event){return{event:event}})).concat(this._unsentIdentifys)),function initFromStorage(storedDeviceId){opt_config&&opt_config.deviceId&&!utils_validateDeviceId(opt_config.deviceId)&&(utils_log.error('Invalid device ID rejected. Randomly generated UUID will be used instead of "'.concat(opt_config.deviceId,'"')),delete opt_config.deviceId),_this.options.deviceId=_this._getInitialDeviceId(opt_config&&opt_config.deviceId,storedDeviceId),_this.options.userId="string"===type(opt_userId)&&!utils_isEmptyString(opt_userId)&&opt_userId||"number"===type(opt_userId)&&opt_userId.toString()||_this.options.userId||null;var now=(new Date).getTime();(!_this._sessionId||!_this._lastEventTime||now-_this._lastEventTime>_this.options.sessionTimeout)&&(_this.options.unsetParamsReferrerOnNewSession&&_this._unsetUTMParams(),_this._newSession=!0,_this._sessionId=now,_this.options.saveParamsReferrerOncePerSession&&_this._trackParamsAndReferrer()),_this.options.saveParamsReferrerOncePerSession||_this._trackParamsAndReferrer(),_this.options.saveEvents&&(_validateUnsentEventQueue(_this._unsentEvents),_validateUnsentEventQueue(_this._unsentIdentifys)),_this._lastEventTime=now,_saveCookieData(_this),_this._pendingReadStorage=!1,_this._sendEventsIfReady();for(var i=0;i<_this._onInit.length;i++)_this._onInit[i](_this);_this._onInit=[],_this._isInitialized=!0}(),this.runQueuedFunctions(),"function"===type(opt_callback)&&opt_callback(this);var onExitPage=this.options.onExitPage;"function"!==type(onExitPage)||this.pageHandlersAdded||(this.pageHandlersAdded=!0,window.addEventListener("pagehide",(function(){!function handleVisibilityChange(){var prevTransport=_this.options.transport;_this.setTransport(Constants_TRANSPORT_BEACON),onExitPage(),_this.setTransport(prevTransport)}()}),!1))}catch(err){utils_log.error(err),"function"===type(opt_config.onError)&&opt_config.onError(err)}},AmplitudeClient.prototype.deleteLowerLevelDomainCookies=function(){var host=getHost(),cookieHost=this.options.domain&&"."===this.options.domain[0]?this.options.domain.slice(1):this.options.domain;if(cookieHost&&host!==cookieHost&&new RegExp(cookieHost+"$").test(host)){for(var hostParts=host.split("."),cookieHostParts=cookieHost.split("."),i=hostParts.length;i>cookieHostParts.length;--i){var deleteDomain=hostParts.slice(hostParts.length-i).join(".");baseCookie_set(this._cookieName,null,{domain:"."+deleteDomain})}baseCookie_set(this._cookieName,null,{})}},AmplitudeClient.prototype._getInitialDeviceId=function(configDeviceId,storedDeviceId){if(configDeviceId)return configDeviceId;if(this.options.deviceIdFromUrlParam){var deviceIdFromUrlParam=this._getDeviceIdFromUrlParam(this._getUrlParams());if(deviceIdFromUrlParam)return deviceIdFromUrlParam}return this.options.deviceId?this.options.deviceId:storedDeviceId||base64Id()};var _validateUnsentEventQueue=function _validateUnsentEventQueue(queue){for(var i=0;i<queue.length;i++){var userProperties=queue[i].event.user_properties,eventProperties=queue[i].event.event_properties,groups=queue[i].event.groups;queue[i].event.user_properties=utils_validateProperties(userProperties),queue[i].event.event_properties=utils_validateProperties(eventProperties),queue[i].event.groups=utils_validateGroups(groups)}};AmplitudeClient.prototype._trackParamsAndReferrer=function _trackParamsAndReferrer(){var utmProperties,referrerProperties,gclidProperties,fbclidProperties;if(this.options.includeUtm&&(utmProperties=this._initUtmData()),this.options.includeReferrer&&(referrerProperties=this._saveReferrer(this._getReferrer())),this.options.includeGclid&&(gclidProperties=this._saveGclid(this._getUrlParams())),this.options.includeFbclid&&(fbclidProperties=this._saveFbclid(this._getUrlParams())),this.options.logAttributionCapturedEvent){var attributionProperties=_objectSpread({},utmProperties,referrerProperties,gclidProperties,fbclidProperties);Object.keys(attributionProperties).length>0&&this.logEvent(Constants_ATTRIBUTION_EVENT,attributionProperties)}};var _parseConfig=function _parseConfig(options,config){if("object"===type(config)){var freeFormObjectKeys=new Set(["headers"]),parseValidateAndLoad=function parseValidateAndLoad(key){if(Object.prototype.hasOwnProperty.call(options,key)){var inputValue=config[key],expectedType=type(options[key]);("transport"!==key||utils_validateTransport(inputValue))&&utils_validateInput(inputValue,key+" option",expectedType)&&("boolean"===expectedType?options[key]=!!inputValue:"string"===expectedType&&!utils_isEmptyString(inputValue)||"number"===expectedType&&inputValue>0||"function"===expectedType?options[key]=inputValue:"object"===expectedType&&_parseConfig(options[key],inputValue))}};for(var key in config)freeFormObjectKeys.has(key)?options[key]=_objectSpread({},options[key],config[key]):Object.prototype.hasOwnProperty.call(config,key)&&parseValidateAndLoad(key)}};AmplitudeClient.prototype.runQueuedFunctions=function(){var queue=this._q;this._q=[];for(var i=0;i<queue.length;i++){var fn=this[queue[i][0]];"function"===type(fn)&&fn.apply(this,queue[i].slice(1))}},AmplitudeClient.prototype._apiKeySet=function _apiKeySet(methodName){return!utils_isEmptyString(this.options.apiKey)||(utils_log.error("Invalid apiKey. Please set a valid apiKey with init() before calling "+methodName),!1)},AmplitudeClient.prototype._loadSavedUnsentEvents=function _loadSavedUnsentEvents(unsentKey){var savedUnsentEventsString=this._getFromStorage(ampLocalStorage,unsentKey),unsentEvents=this._parseSavedUnsentEventsString(savedUnsentEventsString,unsentKey);return this._setInStorage(ampLocalStorage,unsentKey,JSON.stringify(unsentEvents)),unsentEvents},AmplitudeClient.prototype._parseSavedUnsentEventsString=function _parseSavedUnsentEventsString(savedUnsentEventsString,unsentKey){if(utils_isEmptyString(savedUnsentEventsString))return[];if("string"===type(savedUnsentEventsString))try{var events=JSON.parse(savedUnsentEventsString);if("array"===type(events))return events}catch(e){}return utils_log.error("Unable to load "+unsentKey+" events. Restart with a new empty queue."),[]},AmplitudeClient.prototype.isNewSession=function isNewSession(){return this._newSession},AmplitudeClient.prototype.onInit=function(callback){this._isInitialized?callback(this):this._onInit.push(callback)},AmplitudeClient.prototype.getSessionId=function getSessionId(){return this._sessionId},AmplitudeClient.prototype.nextEventId=function nextEventId(){return this._eventId++,this._eventId},AmplitudeClient.prototype.nextIdentifyId=function nextIdentifyId(){return this._identifyId++,this._identifyId},AmplitudeClient.prototype.nextSequenceNumber=function nextSequenceNumber(){return this._sequenceNumber++,this._sequenceNumber},AmplitudeClient.prototype._unsentCount=function _unsentCount(){return this._unsentEvents.length+this._unsentIdentifys.length},AmplitudeClient.prototype._sendEventsIfReady=function _sendEventsIfReady(){return 0!==this._unsentCount()&&(this.options.batchEvents?this._unsentCount()>=this.options.eventUploadThreshold||this.options.transport===Constants_TRANSPORT_BEACON?(this.sendEvents(),!0):(this._updateScheduled||(this._updateScheduled=!0,setTimeout(function(){this._updateScheduled=!1,this.sendEvents()}.bind(this),this.options.eventUploadPeriodMillis)),!1):(this.sendEvents(),!0))},AmplitudeClient.prototype.clearStorage=function clearStorage(){return this._metadataStorage.clear()},AmplitudeClient.prototype._getFromStorage=function _getFromStorage(storage,key){return storage.getItem(key+this._storageSuffix)},AmplitudeClient.prototype._setInStorage=function _setInStorage(storage,key,value){storage.setItem(key+this._storageSuffix,value)};var _loadCookieData=function _loadCookieData(scope){if(scope._useOldCookie){var cookieData=scope.cookieStorage.get(scope._oldCookiename);"object"!==type(cookieData)||_loadCookieDataProps(scope,cookieData)}else{var props=scope._metadataStorage.load();"object"===type(props)&&_loadCookieDataProps(scope,props)}},_upgradeCookieData=function _upgradeCookieData(scope){var cookieData=scope.cookieStorage.get(scope._oldCookiename);"object"===type(cookieData)&&(_loadCookieDataProps(scope,cookieData),_saveCookieData(scope))},_loadCookieDataProps=function _loadCookieDataProps(scope,cookieData){cookieData.deviceId&&(scope.options.deviceId=cookieData.deviceId),cookieData.userId&&(scope.options.userId=cookieData.userId),null!==cookieData.optOut&&void 0!==cookieData.optOut&&!1!==cookieData.optOut&&(scope.options.optOut=cookieData.optOut),cookieData.sessionId&&(scope._sessionId=parseInt(cookieData.sessionId,10)),cookieData.lastEventTime&&(scope._lastEventTime=parseInt(cookieData.lastEventTime,10)),cookieData.eventId&&(scope._eventId=parseInt(cookieData.eventId,10)),cookieData.identifyId&&(scope._identifyId=parseInt(cookieData.identifyId,10)),cookieData.sequenceNumber&&(scope._sequenceNumber=parseInt(cookieData.sequenceNumber,10))},_saveCookieData=function _saveCookieData(scope){var cookieData={deviceId:scope.options.deviceId,userId:scope.options.userId,optOut:scope.options.optOut,sessionId:scope._sessionId,lastEventTime:scope._lastEventTime,eventId:scope._eventId,identifyId:scope._identifyId,sequenceNumber:scope._sequenceNumber};scope._useOldCookie?scope.cookieStorage.set(scope.options.cookieName+scope._storageSuffix,cookieData):scope._metadataStorage.save(cookieData)};AmplitudeClient.prototype._initUtmData=function _initUtmData(queryParams,cookieParams){queryParams=queryParams||this._getUrlParams();var utmProperties=function getUtmData(rawCookie,query){var cookie=rawCookie?"?"+rawCookie.split(".").slice(-1)[0].replace(/\|/g,"&"):"",fetchParam=function fetchParam(queryName,query,cookieName,cookie){return utils_getQueryParam(queryName,query)||utils_getQueryParam(cookieName,cookie)},utmSource=fetchParam(Constants_UTM_SOURCE,query,"utmcsr",cookie),utmMedium=fetchParam(Constants_UTM_MEDIUM,query,"utmcmd",cookie),utmCampaign=fetchParam(Constants_UTM_CAMPAIGN,query,"utmccn",cookie),utmTerm=fetchParam(Constants_UTM_TERM,query,"utmctr",cookie),utmContent=fetchParam(Constants_UTM_CONTENT,query,"utmcct",cookie),utmData={},addIfNotNull=function addIfNotNull(key,value){utils_isEmptyString(value)||(utmData[key]=value)};return addIfNotNull(Constants_UTM_SOURCE,utmSource),addIfNotNull(Constants_UTM_MEDIUM,utmMedium),addIfNotNull(Constants_UTM_CAMPAIGN,utmCampaign),addIfNotNull(Constants_UTM_TERM,utmTerm),addIfNotNull(Constants_UTM_CONTENT,utmContent),utmData}(cookieParams=cookieParams||this.cookieStorage.get("__utmz"),queryParams);return _sendParamsReferrerUserProperties(this,utmProperties),utmProperties},AmplitudeClient.prototype._unsetUTMParams=function _unsetUTMParams(){var identify=new Identify;identify.unset(Constants_REFERRER),identify.unset(Constants_UTM_SOURCE),identify.unset(Constants_UTM_MEDIUM),identify.unset(Constants_UTM_CAMPAIGN),identify.unset(Constants_UTM_TERM),identify.unset(Constants_UTM_CONTENT),this.identify(identify)};var _sendParamsReferrerUserProperties=function _sendParamsReferrerUserProperties(scope,userProperties){if("object"===type(userProperties)&&0!==Object.keys(userProperties).length){var identify=new Identify;for(var key in userProperties)Object.prototype.hasOwnProperty.call(userProperties,key)&&(identify.setOnce("initial_"+key,userProperties[key]),identify.set(key,userProperties[key]));scope.identify(identify)}};AmplitudeClient.prototype._getReferrer=function _getReferrer(){return document.referrer},AmplitudeClient.prototype._getUrlParams=function _getUrlParams(){return location.search},AmplitudeClient.prototype._saveGclid=function _saveGclid(urlParams){var gclid=utils_getQueryParam("gclid",urlParams);if(!utils_isEmptyString(gclid)){var gclidProperties={gclid:gclid};return _sendParamsReferrerUserProperties(this,gclidProperties),gclidProperties}},AmplitudeClient.prototype._saveFbclid=function _saveFbclid(urlParams){var fbclid=utils_getQueryParam("fbclid",urlParams);if(!utils_isEmptyString(fbclid)){var fbclidProperties={fbclid:fbclid};return _sendParamsReferrerUserProperties(this,fbclidProperties),fbclidProperties}},AmplitudeClient.prototype._getDeviceIdFromUrlParam=function _getDeviceIdFromUrlParam(urlParams){return utils_getQueryParam(Constants_AMP_DEVICE_ID_PARAM,urlParams)},AmplitudeClient.prototype._getReferringDomain=function _getReferringDomain(referrer){if(utils_isEmptyString(referrer))return null;var parts=referrer.split("/");return parts.length>=3?parts[2]:null},AmplitudeClient.prototype._saveReferrer=function _saveReferrer(referrer){if(!utils_isEmptyString(referrer)){var referrerInfo={referrer:referrer,referring_domain:this._getReferringDomain(referrer)};return _sendParamsReferrerUserProperties(this,referrerInfo),referrerInfo}},AmplitudeClient.prototype.saveEvents=function saveEvents(){try{var serializedUnsentEvents=JSON.stringify(this._unsentEvents.map((function(_ref){return _ref.event})));this._setInStorage(ampLocalStorage,this.options.unsentKey,serializedUnsentEvents)}catch(e){}try{var serializedIdentifys=JSON.stringify(this._unsentIdentifys.map((function(unsentIdentify){return unsentIdentify.event})));this._setInStorage(ampLocalStorage,this.options.unsentIdentifyKey,serializedIdentifys)}catch(e){}},AmplitudeClient.prototype.setDomain=function setDomain(domain){if(this._shouldDeferCall())return this._q.push(["setDomain"].concat(Array.prototype.slice.call(arguments,0)));if(utils_validateInput(domain,"domain","string"))try{this.cookieStorage.options({expirationDays:this.options.cookieExpiration,secure:this.options.secureCookie,domain:domain,sameSite:this.options.sameSiteCookie}),this.options.domain=this.cookieStorage.options().domain,_loadCookieData(this),_saveCookieData(this)}catch(e){utils_log.error(e)}},AmplitudeClient.prototype.setUserId=function setUserId(userId){if(this._shouldDeferCall())return this._q.push(["setUserId"].concat(Array.prototype.slice.call(arguments,0)));try{this.options.userId=null!=userId&&""+userId||null,_saveCookieData(this)}catch(e){utils_log.error(e)}},AmplitudeClient.prototype.setGroup=function(groupType,groupName){if(this._shouldDeferCall())return this._q.push(["setGroup"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setGroup()")&&utils_validateInput(groupType,"groupType","string")&&!utils_isEmptyString(groupType)){var groups={};groups[groupType]=groupName;var identify=(new Identify).set(groupType,groupName);this._logEvent(Constants_IDENTIFY_EVENT,null,null,identify.userPropertiesOperations,groups,null,null,null)}},AmplitudeClient.prototype.setOptOut=function setOptOut(enable){if(this._shouldDeferCall())return this._q.push(["setOptOut"].concat(Array.prototype.slice.call(arguments,0)));if(utils_validateInput(enable,"enable","boolean"))try{this.options.optOut=enable,_saveCookieData(this)}catch(e){utils_log.error(e)}},AmplitudeClient.prototype.setSessionId=function setSessionId(sessionId){if(utils_validateInput(sessionId,"sessionId","number"))try{this._sessionId=sessionId,_saveCookieData(this)}catch(e){utils_log.error(e)}},AmplitudeClient.prototype.resetSessionId=function resetSessionId(){this.setSessionId((new Date).getTime())},AmplitudeClient.prototype.regenerateDeviceId=function regenerateDeviceId(){if(this._shouldDeferCall())return this._q.push(["regenerateDeviceId"].concat(Array.prototype.slice.call(arguments,0)));this.setDeviceId(base64Id())},AmplitudeClient.prototype.setDeviceId=function setDeviceId(deviceId){if(this._shouldDeferCall())return this._q.push(["setDeviceId"].concat(Array.prototype.slice.call(arguments,0)));if(utils_validateDeviceId(deviceId))try{utils_isEmptyString(deviceId)||(this.options.deviceId=""+deviceId,_saveCookieData(this))}catch(e){utils_log.error(e)}},AmplitudeClient.prototype.setTransport=function setTransport(transport){if(this._shouldDeferCall())return this._q.push(["setTransport"].concat(Array.prototype.slice.call(arguments,0)));utils_validateTransport(transport)&&(this.options.transport=transport)},AmplitudeClient.prototype.setUserProperties=function setUserProperties(userProperties){if(this._shouldDeferCall())return this._q.push(["setUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setUserProperties()")&&utils_validateInput(userProperties,"userProperties","object")){var sanitized=utils_truncate(utils_validateProperties(userProperties));if(0!==Object.keys(sanitized).length){var identify=new Identify;for(var property in sanitized)Object.prototype.hasOwnProperty.call(sanitized,property)&&identify.set(property,sanitized[property]);this.identify(identify)}}},AmplitudeClient.prototype.clearUserProperties=function clearUserProperties(){if(this._shouldDeferCall())return this._q.push(["clearUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("clearUserProperties()")){var identify=new Identify;identify.clearAll(),this.identify(identify)}};var _convertProxyObjectToRealObject=function _convertProxyObjectToRealObject(instance,proxy){for(var i=0;i<proxy._q.length;i++){var fn=instance[proxy._q[i][0]];"function"===type(fn)&&fn.apply(instance,proxy._q[i].slice(1))}return instance};AmplitudeClient.prototype.identify=function(identify_obj,opt_callback,opt_error_callback){if(this._shouldDeferCall())return this._q.push(["identify"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("identify()"))if("object"===type(identify_obj)&&Object.prototype.hasOwnProperty.call(identify_obj,"_q")&&(identify_obj=_convertProxyObjectToRealObject(new Identify,identify_obj)),identify_obj instanceof Identify){if(Object.keys(identify_obj.userPropertiesOperations).length>0)return this._logEvent(Constants_IDENTIFY_EVENT,null,null,identify_obj.userPropertiesOperations,null,null,null,opt_callback,opt_error_callback);_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"No user property operations"})}else utils_log.error("Invalid identify input type. Expected Identify object but saw "+type(identify_obj)),_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"Invalid identify input type"});else _logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"API key is not set"})},AmplitudeClient.prototype.groupIdentify=function(group_type,group_name,identify_obj,opt_callback,opt_error_callback){if(this._shouldDeferCall())return this._q.push(["groupIdentify"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("groupIdentify()"))if(utils_validateInput(group_type,"group_type","string")&&!utils_isEmptyString(group_type))if(null!=group_name)if("object"===type(identify_obj)&&Object.prototype.hasOwnProperty.call(identify_obj,"_q")&&(identify_obj=_convertProxyObjectToRealObject(new Identify,identify_obj)),identify_obj instanceof Identify){if(Object.keys(identify_obj.userPropertiesOperations).length>0)return this._logEvent(Constants_GROUP_IDENTIFY_EVENT,null,null,null,_defineProperty({},group_type,group_name),identify_obj.userPropertiesOperations,null,opt_callback,opt_error_callback);_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"No group property operations"})}else utils_log.error("Invalid identify input type. Expected Identify object but saw "+type(identify_obj)),_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"Invalid identify input type"});else _logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"Invalid group name"});else _logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"Invalid group type"});else _logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"API key is not set"})},AmplitudeClient.prototype.setVersionName=function setVersionName(versionName){if(this._shouldDeferCall())return this._q.push(["setVersionName"].concat(Array.prototype.slice.call(arguments,0)));utils_validateInput(versionName,"versionName","string")&&(this.options.versionName=versionName)},AmplitudeClient.prototype._logEvent=function _logEvent(eventType,eventProperties,apiProperties,userProperties,groups,groupProperties,timestamp,callback,errorCallback){if(_loadCookieData(this),eventType)if(this.options.optOut)_logErrorsWithCallbacks(callback,errorCallback,0,"No request sent",{reason:"optOut is set to true"});else try{var eventId;eventId=eventType===Constants_IDENTIFY_EVENT||eventType===Constants_GROUP_IDENTIFY_EVENT?this.nextIdentifyId():this.nextEventId();var sequenceNumber=this.nextSequenceNumber(),eventTime="number"===type(timestamp)?timestamp:(new Date).getTime();(!this._sessionId||!this._lastEventTime||eventTime-this._lastEventTime>this.options.sessionTimeout)&&(this._sessionId=eventTime),this._lastEventTime=eventTime,_saveCookieData(this);var osName=this._ua.browser.name,osVersion=this._ua.browser.major,deviceModel=this._ua.device.model||this._ua.os.name,deviceVendor=this._ua.device.vendor;userProperties=userProperties||{};var trackingOptions=_objectSpread({},this._apiPropertiesTrackingOptions);apiProperties=_objectSpread({},apiProperties||{},trackingOptions),eventProperties=eventProperties||{},groups=groups||{},groupProperties=groupProperties||{};var event={device_id:this.options.deviceId,user_id:this.options.userId,timestamp:eventTime,event_id:eventId,session_id:this._sessionId||-1,event_type:eventType,version_name:this.options.versionName||null,platform:_shouldTrackField(this,"platform")?this.options.platform:null,os_name:_shouldTrackField(this,"os_name")&&osName||null,os_version:_shouldTrackField(this,"os_version")&&osVersion||null,device_model:_shouldTrackField(this,"device_model")&&deviceModel||null,device_manufacturer:_shouldTrackField(this,"device_manufacturer")&&deviceVendor||null,language:_shouldTrackField(this,"language")?this.options.language:null,api_properties:apiProperties,event_properties:utils_truncate(utils_validateProperties(eventProperties)),user_properties:utils_truncate(utils_validateProperties(userProperties)),uuid:uuid(),library:{name:"amplitude-js",version:"8.6.0"},sequence_number:sequenceNumber,groups:utils_truncate(utils_validateGroups(groups)),group_properties:utils_truncate(utils_validateProperties(groupProperties)),user_agent:this._userAgent};return eventType===Constants_IDENTIFY_EVENT||eventType===Constants_GROUP_IDENTIFY_EVENT?(this._unsentIdentifys.push({event:event,callback:callback,errorCallback:errorCallback}),this._limitEventsQueued(this._unsentIdentifys)):(this._unsentEvents.push({event:event,callback:callback,errorCallback:errorCallback}),this._limitEventsQueued(this._unsentEvents)),this.options.saveEvents&&this.saveEvents(),this._sendEventsIfReady(),eventId}catch(e){utils_log.error(e)}else _logErrorsWithCallbacks(callback,errorCallback,0,"No request sent",{reason:"Missing eventType"})};var _shouldTrackField=function _shouldTrackField(scope,field){return!!scope.options.trackingOptions[field]},_generateApiPropertiesTrackingConfig=function _generateApiPropertiesTrackingConfig(scope){for(var fields=["city","country","dma","ip_address","region"],config={},i=0;i<fields.length;i++){var field=fields[i];_shouldTrackField(scope,field)||(config[field]=!1)}return config};AmplitudeClient.prototype._limitEventsQueued=function _limitEventsQueued(queue){queue.length>this.options.savedMaxCount&&queue.splice(0,queue.length-this.options.savedMaxCount).forEach((function(event){_logErrorsWithCallbacks(event.callback,event.errorCallback,0,"No request sent",{reason:"Event dropped because options.savedMaxCount exceeded. User may be offline or have a content blocker"})}))},AmplitudeClient.prototype.logEvent=function logEvent(eventType,eventProperties,opt_callback,opt_error_callback){return this._shouldDeferCall()?this._q.push(["logEvent"].concat(Array.prototype.slice.call(arguments,0))):this.logEventWithTimestamp(eventType,eventProperties,null,opt_callback,opt_error_callback)},AmplitudeClient.prototype.logEventWithTimestamp=function logEvent(eventType,eventProperties,timestamp,opt_callback,opt_error_callback){return this._shouldDeferCall()?this._q.push(["logEventWithTimestamp"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logEvent()")?utils_validateInput(eventType,"eventType","string")?utils_isEmptyString(eventType)?(_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"Missing eventType"}),-1):this._logEvent(eventType,eventProperties,null,null,null,null,timestamp,opt_callback,opt_error_callback):(_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"Invalid type for eventType"}),-1):(_logErrorsWithCallbacks(opt_callback,opt_error_callback,0,"No request sent",{reason:"API key not set"}),-1)},AmplitudeClient.prototype.logEventWithGroups=function(eventType,eventProperties,groups,opt_callback,opt_error_callback){return this._shouldDeferCall()?this._q.push(["logEventWithGroups"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logEventWithGroups()")?utils_validateInput(eventType,"eventType","string")?this._logEvent(eventType,eventProperties,null,null,groups,null,null,opt_callback,opt_error_callback):(_logErrorsWithCallbacks(event.callback,event.errorCallback,0,"No request sent",{reason:"Invalid type for eventType"}),-1):(_logErrorsWithCallbacks(event.callback,event.errorCallback,0,"No request sent",{reason:"API key not set"}),-1)};var _isNumber=function _isNumber(n){return!isNaN(parseFloat(n))&&isFinite(n)},_logErrorsWithCallbacks=function _logErrorsWithCallbacks(opt_callback,opt_error_callback,status,response,details){"function"===type(opt_callback)&&opt_callback(status,response,details),"function"===type(opt_error_callback)&&opt_error_callback(status,response,details)};AmplitudeClient.prototype.logRevenueV2=function logRevenueV2(revenue_obj){if(this._shouldDeferCall())return this._q.push(["logRevenueV2"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("logRevenueV2()"))if("object"===type(revenue_obj)&&Object.prototype.hasOwnProperty.call(revenue_obj,"_q")&&(revenue_obj=_convertProxyObjectToRealObject(new Revenue,revenue_obj)),revenue_obj instanceof Revenue){if(revenue_obj&&revenue_obj._isValidRevenue())return this.logEvent(Constants_REVENUE_EVENT,revenue_obj._toJSONObject())}else utils_log.error("Invalid revenue input type. Expected Revenue object but saw "+type(revenue_obj))},AmplitudeClient.prototype.logRevenue=function logRevenue(price,quantity,product){return this._shouldDeferCall()?this._q.push(["logRevenue"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logRevenue()")&&_isNumber(price)&&(void 0===quantity||_isNumber(quantity))?this._logEvent(Constants_REVENUE_EVENT,{},{productId:product,special:"revenue_amount",quantity:quantity||1,price:price},null,null,null,null,null):-1},AmplitudeClient.prototype._logErrorsOnEvents=function _logErrorsOnEvents(maxEventId,maxIdentifyId,status,response){for(var queues=["_unsentEvents","_unsentIdentifys"],j=0;j<queues.length;j++)for(var queue=queues[j],maxId="_unsentEvents"===queue?maxEventId:maxIdentifyId,i=0;i<this[queue].length;i++){var unsentEvent=this[queue][i];unsentEvent.event.event_id<=maxId&&unsentEvent.errorCallback&&unsentEvent.errorCallback(status,response)}},AmplitudeClient.prototype.removeEvents=function removeEvents(maxEventId,maxIdentifyId,status,response){_removeEvents(this,"_unsentEvents",maxEventId,status,response),_removeEvents(this,"_unsentIdentifys",maxIdentifyId,status,response)};var _removeEvents=function _removeEvents(scope,eventQueue,maxId,status,response){if(!(maxId<0)){for(var filteredEvents=[],i=0;i<scope[eventQueue].length;i++){var unsentEvent=scope[eventQueue][i];unsentEvent.event.event_id>maxId?filteredEvents.push(unsentEvent):unsentEvent.callback&&unsentEvent.callback(status,response)}scope[eventQueue]=filteredEvents}};AmplitudeClient.prototype.sendEvents=function sendEvents(){if(this._apiKeySet("sendEvents()")){if(this.options.optOut)this.removeEvents(1/0,1/0,0,"No request sent",{reason:"Opt out is set to true"});else if(0!==this._unsentCount()){if(this.options.transport!==Constants_TRANSPORT_BEACON){if(this._sending)return;this._sending=!0}var url=(this.options.forceHttps||"https:"===window.location.protocol?"https":"http")+"://"+this.options.apiEndpoint,numEvents=Math.min(this._unsentCount(),this.options.uploadBatchSize),mergedEvents=this._mergeEventsAndIdentifys(numEvents),maxEventId=mergedEvents.maxEventId,maxIdentifyId=mergedEvents.maxIdentifyId,events=JSON.stringify(mergedEvents.eventsToSend.map((function(_ref2){return _ref2.event}))),uploadTime=(new Date).getTime(),data={client:this.options.apiKey,e:events,v:Constants_API_VERSION,upload_time:uploadTime,checksum:md5(Constants_API_VERSION+this.options.apiKey+events+uploadTime)};if(this.options.transport!==Constants_TRANSPORT_BEACON){var scope=this;new Request(url,data,this.options.headers).send((function(status,response){scope._sending=!1;try{200===status&&"success"===response?(scope.removeEvents(maxEventId,maxIdentifyId,status,response),scope.options.saveEvents&&scope.saveEvents(),scope._sendEventsIfReady()):(scope._logErrorsOnEvents(maxEventId,maxIdentifyId,status,response),413===status&&(1===scope.options.uploadBatchSize&&scope.removeEvents(maxEventId,maxIdentifyId,status,response),scope.options.uploadBatchSize=Math.ceil(numEvents/2),scope.sendEvents()))}catch(e){}}))}else navigator.sendBeacon(url,new URLSearchParams(data))?(this.removeEvents(maxEventId,maxIdentifyId,200,"success"),this.options.saveEvents&&this.saveEvents()):this._logErrorsOnEvents(maxEventId,maxIdentifyId,0,"")}}else this.removeEvents(1/0,1/0,0,"No request sent",{reason:"API key not set"})},AmplitudeClient.prototype._mergeEventsAndIdentifys=function _mergeEventsAndIdentifys(numEvents){for(var eventsToSend=[],eventIndex=0,maxEventId=-1,identifyIndex=0,maxIdentifyId=-1;eventsToSend.length<numEvents;){var unsentEvent=void 0,noIdentifys=identifyIndex>=this._unsentIdentifys.length,noEvents=eventIndex>=this._unsentEvents.length;if(noEvents&&noIdentifys){utils_log.error("Merging Events and Identifys, less events and identifys than expected");break}noIdentifys?maxEventId=(unsentEvent=this._unsentEvents[eventIndex++]).event.event_id:noEvents?maxIdentifyId=(unsentEvent=this._unsentIdentifys[identifyIndex++]).event.event_id:!("sequence_number"in this._unsentEvents[eventIndex].event)||this._unsentEvents[eventIndex].event.sequence_number<this._unsentIdentifys[identifyIndex].event.sequence_number?maxEventId=(unsentEvent=this._unsentEvents[eventIndex++]).event.event_id:maxIdentifyId=(unsentEvent=this._unsentIdentifys[identifyIndex++]).event.event_id,eventsToSend.push(unsentEvent)}return{eventsToSend:eventsToSend,maxEventId:maxEventId,maxIdentifyId:maxIdentifyId}},AmplitudeClient.prototype.setGlobalUserProperties=function setGlobalUserProperties(userProperties){this.setUserProperties(userProperties)},AmplitudeClient.prototype.__VERSION__="8.6.0",AmplitudeClient.prototype._shouldDeferCall=function _shouldDeferCall(){return this._pendingReadStorage||this._initializationDeferred},AmplitudeClient.prototype._deferInitialization=function _deferInitialization(){this._initializationDeferred=!0,this._q.push(["init"].concat(Array.prototype.slice.call(arguments,0)))},AmplitudeClient.prototype.enableTracking=function enableTracking(){this._initializationDeferred=!1,_saveCookieData(this),this.runQueuedFunctions()};var Amplitude=function Amplitude(){this.options=_objectSpread({},DEFAULT_OPTIONS),this._q=[],this._instances={}};Amplitude.prototype.Identify=Identify,Amplitude.prototype.Revenue=Revenue,Amplitude.prototype.getInstance=function getInstance(instance){instance=utils_isEmptyString(instance)?Constants_DEFAULT_INSTANCE:instance.toLowerCase();var client=this._instances[instance];return void 0===client&&(client=new AmplitudeClient(instance),this._instances[instance]=client),client},Amplitude.prototype.runQueuedFunctions=function(){for(var i=0;i<this._q.length;i++){var fn=this[this._q[i][0]];"function"===type(fn)&&fn.apply(this,this._q[i].slice(1))}for(var instance in this._q=[],this._instances)Object.prototype.hasOwnProperty.call(this._instances,instance)&&this._instances[instance].runQueuedFunctions()},Amplitude.prototype.init=function init(apiKey,opt_userId,opt_config,opt_callback){this.getInstance().init(apiKey,opt_userId,opt_config,function(instance){this.options=instance.options,"function"===type(opt_callback)&&opt_callback(instance)}.bind(this))},Amplitude.prototype.isNewSession=function isNewSession(){return this.getInstance().isNewSession()},Amplitude.prototype.getSessionId=function getSessionId(){return this.getInstance().getSessionId()},Amplitude.prototype.nextEventId=function nextEventId(){return this.getInstance().nextEventId()},Amplitude.prototype.nextIdentifyId=function nextIdentifyId(){return this.getInstance().nextIdentifyId()},Amplitude.prototype.nextSequenceNumber=function nextSequenceNumber(){return this.getInstance().nextSequenceNumber()},Amplitude.prototype.saveEvents=function saveEvents(){this.getInstance().saveEvents()},Amplitude.prototype.setDomain=function setDomain(domain){this.getInstance().setDomain(domain)},Amplitude.prototype.setUserId=function setUserId(userId){this.getInstance().setUserId(userId)},Amplitude.prototype.setGroup=function(groupType,groupName){this.getInstance().setGroup(groupType,groupName)},Amplitude.prototype.setOptOut=function setOptOut(enable){this.getInstance().setOptOut(enable)},Amplitude.prototype.regenerateDeviceId=function regenerateDeviceId(){this.getInstance().regenerateDeviceId()},Amplitude.prototype.setDeviceId=function setDeviceId(deviceId){this.getInstance().setDeviceId(deviceId)},Amplitude.prototype.setUserProperties=function setUserProperties(userProperties){this.getInstance().setUserProperties(userProperties)},Amplitude.prototype.clearUserProperties=function clearUserProperties(){this.getInstance().clearUserProperties()},Amplitude.prototype.identify=function(identify_obj,opt_callback){this.getInstance().identify(identify_obj,opt_callback)},Amplitude.prototype.setVersionName=function setVersionName(versionName){this.getInstance().setVersionName(versionName)},Amplitude.prototype.logEvent=function logEvent(eventType,eventProperties,opt_callback){return this.getInstance().logEvent(eventType,eventProperties,opt_callback)},Amplitude.prototype.logEventWithGroups=function(eventType,eventProperties,groups,opt_callback){return this.getInstance().logEventWithGroups(eventType,eventProperties,groups,opt_callback)},Amplitude.prototype.logRevenueV2=function logRevenueV2(revenue_obj){return this.getInstance().logRevenueV2(revenue_obj)},Amplitude.prototype.logRevenue=function logRevenue(price,quantity,product){return this.getInstance().logRevenue(price,quantity,product)},Amplitude.prototype.removeEvents=function removeEvents(maxEventId,maxIdentifyId){this.getInstance().removeEvents(maxEventId,maxIdentifyId)},Amplitude.prototype.sendEvents=function sendEvents(callback){this.getInstance().sendEvents(callback)},Amplitude.prototype.setGlobalUserProperties=function setGlobalUserProperties(userProperties){this.getInstance().setUserProperties(userProperties)},Amplitude.prototype.__VERSION__="8.6.0";var old=window.amplitude||{},newInstance=new Amplitude;for(var instance in newInstance._q=old._q||[],old._iq)Object.prototype.hasOwnProperty.call(old._iq,instance)&&(newInstance.getInstance(instance)._q=old._iq[instance]._q||[]);return newInstance.runQueuedFunctions(),newInstance},module.exports=factory()}).call(this,__webpack_require__(46),__webpack_require__(43),__webpack_require__(56).Buffer)}}]);