UNPKG

amplitude-js

Version:
1 lines 61.1 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define("amplitude",t):(e=e||self).amplitude=t()}(this,function(){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{},i=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(i=i.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),i.forEach(function(e){o(t,e,n[e])})}return t}var p="$default_instance",c=2,n=4096,a=1e3,g="$identify",m="$groupidentify",r="amp_cookie_test",l="amp",s="revenue_amount",u="$productId",d="$quantity",h="$price",f="$revenueType",y="amp_device_id",_="referrer",w="utm_source",b="utm_medium",I="utm_campaign",S="utm_term",k="utm_content",E="[Amplitude] Attribution Captured",O=function(e){for(var t="",n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t+=String.fromCharCode(i):(127<i&&i<2048?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t},x=function(e){for(var t="",n=0,i=0,o=0,r=0;n<e.length;)(i=e.charCodeAt(n))<128?(t+=String.fromCharCode(i),n++):191<i&&i<224?(o=e.charCodeAt(n+1),t+=String.fromCharCode((31&i)<<6|63&o),n+=2):(o=e.charCodeAt(n+1),r=e.charCodeAt(n+2),t+=String.fromCharCode((15&i)<<12|(63&o)<<6|63&r),n+=3);return t},N={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(window.btoa&&window.atob)return window.btoa(unescape(encodeURIComponent(e)))}catch(e){}return N._encode(e)},_encode:function(e){var t,n,i,o,r,s,a,u="",c=0;for(e=O(e);c<e.length;)o=(t=e.charCodeAt(c++))>>2,r=(3&t)<<4|(n=e.charCodeAt(c++))>>4,s=(15&n)<<2|(i=e.charCodeAt(c++))>>6,a=63&i,isNaN(n)?s=a=64:isNaN(i)&&(a=64),u=u+N._keyStr.charAt(o)+N._keyStr.charAt(r)+N._keyStr.charAt(s)+N._keyStr.charAt(a);return u},decode:function(e){try{if(window.btoa&&window.atob)return decodeURIComponent(escape(window.atob(e)))}catch(e){}return N._decode(e)},_decode:function(e){var t,n,i,o,r,s,a="",u=0;for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");u<e.length;)t=N._keyStr.indexOf(e.charAt(u++))<<2|(o=N._keyStr.indexOf(e.charAt(u++)))>>4,n=(15&o)<<4|(r=N._keyStr.indexOf(e.charAt(u++)))>>2,i=(3&r)<<6|(s=N._keyStr.indexOf(e.charAt(u++))),a+=String.fromCharCode(t),64!==r&&(a+=String.fromCharCode(n)),64!==s&&(a+=String.fromCharCode(i));return a=x(a)}},A=Object.prototype.toString;function C(e){switch(A.call(e)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}return null===e?"null":void 0===e?"undefined":e!=e?"nan":e&&1===e.nodeType?"element":"undefined"!=typeof Buffer&&"function"==typeof Buffer.isBuffer&&Buffer.isBuffer(e)?"buffer":t(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e))}var e,T={DISABLE:0,ERROR:1,WARN:2,INFO:3},P=T.WARN,R={error:function(e){P>=T.ERROR&&q(e)},warn:function(e){P>=T.WARN&&q(e)},info:function(e){P>=T.INFO&&q(e)}},q=function(e){try{console.log("[Amplitude] "+e)}catch(e){}},D=function(e){return"string"===C(e)&&e.length>n?e.substring(0,n):e},j=function(e){var t=C(e);if("object"!==t)return R.error("Error: invalid properties format. Expecting Javascript object, received "+t+", ignoring"),{};if(Object.keys(e).length>a)return R.error("Error: too many properties (more than 1000), ignoring"),{};var n={};for(var i in e)if(e.hasOwnProperty(i)){var o=i,r=C(o);"string"!==r&&(o=String(o),R.warn("WARNING: Non-string property key, received type "+r+', coercing to string "'+o+'"'));var s=K(o,e[i]);null!==s&&(n[o]=s)}return n},U=["nan","function","arguments","regexp","element"],K=function e(t,n){var i=C(n);if(-1!==U.indexOf(i))R.warn('WARNING: Property key "'+t+'" with invalid value type '+i+", ignoring"),n=null;else if("undefined"===i)n=null;else if("error"===i)n=String(n),R.warn('WARNING: Property key "'+t+'" with value type error, coercing to '+n);else if("array"===i){for(var o=[],r=0;r<n.length;r++){var s=n[r],a=C(s);"array"!==a?"object"===a?o.push(j(s)):o.push(e(t,s)):R.warn("WARNING: Cannot have "+a+" nested in an array property value, skipping")}n=o}else"object"===i&&(n=j(n));return n},M=function(e,t){var n=C(t);if("string"===n)return t;if("date"===n||"number"===n||"boolean"===n)return t=String(t),R.warn("WARNING: Non-string groupName, received type "+n+', coercing to string "'+t+'"'),t;if("array"===n){for(var i=[],o=0;o<t.length;o++){var r=t[o],s=C(r);"array"!==s&&"object"!==s?"string"===s?i.push(r):"date"!==s&&"number"!==s&&"boolean"!==s||(r=String(r),R.warn("WARNING: Non-string groupName, received type "+s+', coercing to string "'+r+'"'),i.push(r)):R.warn("WARNING: Skipping nested "+s+" in array groupName")}return i}R.warn("WARNING: Non-string groupName, received type "+n+". Please use strings or array of strings for groupName")},z=function(e){T.hasOwnProperty(e)&&(P=T[e])},B=R,G=function(e){return!e||0===e.length},V=function(e,t){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var n=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(t);return null===n?void 0:decodeURIComponent(n[1].replace(/\+/g," "))},F=function e(t){if("array"===C(t))for(var n=0;n<t.length;n++)t[n]=e(t[n]);else if("object"===C(t))for(var i in t)t.hasOwnProperty(i)&&(t[i]=e(t[i]));else t=D(t);return t},L=function(e){var t=C(e);if("object"!==t)return R.error("Error: invalid groups format. Expecting Javascript object, received "+t+", ignoring"),{};var n={};for(var i in e)if(e.hasOwnProperty(i)){var o=i,r=C(o);"string"!==r&&(o=String(o),R.warn("WARNING: Non-string groupType, received type "+r+', coercing to string "'+o+'"'));var s=M(o,e[i]);null!==s&&(n[o]=s)}return n},W=function(e,t,n){return C(e)===n||(R.error("Invalid "+t+" input type. Expected "+n+" but received "+C(e)),!1)},$=j,J=function(){return window.location},Q=function(){for(var e="",t=0;t<22;++t)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(64*Math.random()));return e},X=function(e){try{for(var t=document.cookie.split(";"),n=null,i=0;i<t.length;i++){for(var o=t[i];" "===o.charAt(0);)o=o.substring(1,o.length);if(0===o.indexOf(e)){n=o.substring(e.length,o.length);break}}return n}catch(e){return null}},H=function(e,t,n){var i=null!==t?n.expirationDays:-1;if(i){var o=new Date;o.setTime(o.getTime()+24*i*60*60*1e3),i=o}var r=e+"="+t;i&&(r+="; expires="+i.toUTCString()),r+="; path=/",n.domain&&(r+="; domain="+n.domain),n.secure&&(r+="; Secure"),n.sameSite&&(r+="; SameSite="+n.sameSite),document.cookie=r},Z=H,Y=X,ee=function(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:{},t=String(new Date);try{var n=r+Q();H(n,t,e);var i=X(n+"=")===t;return H(n,null,e),i}catch(e){}return!1},te=function(e){var t=document.createElement("a");return t.href=e,t.hostname||location.hostname},ne=function(e){for(var t=te(e).split("."),n=[],i="_tldtest_"+Q(),o=t.length-2;0<=o;--o)n.push(t.slice(o).join("."));for(var r=0;r<n.length;++r){var s=n[r],a={domain:"."+s};if(Z(i,1,a),Y(i))return Z(i,null,a),s}return""},ie={expirationDays:void 0,domain:void 0},oe=function(e){var t="";return ie.domain&&(t="."===ie.domain.charAt(0)?ie.domain.substring(1):ie.domain),e+t},re=function(e){var t=oe(e)+"=",n=Y(t);try{if(n)return JSON.parse(N.decode(n))}catch(e){return null}return null},se=function(e,t){try{return Z(oe(e),N.encode(JSON.stringify(t)),ie),!0}catch(e){return!1}},ae=function(e){try{return Z(oe(e),null,ie),!0}catch(e){return!1}},ue={reset:function(){ie={expirationDays:void 0,domain:void 0}},options:function(e){if(0===arguments.length)return ie;e=e||{},ie.expirationDays=e.expirationDays,ie.secure=e.secure,ie.sameSite=e.sameSite;var t=G(e.domain)?"."+ne(J().href):e.domain,n=Math.random();ie.domain=t,se("amplitude_test",n);var i=re("amplitude_test");return i&&i===n||(t=null),ae("amplitude_test"),ie.domain=t,ie},get:re,set:se,remove:ae,setRaw:function(e,t){try{return Z(oe(e),t,ie),!0}catch(e){return!1}},getRaw:function(e){var t=oe(e)+"=";return Y(t)}};if(function(){var e,t=new Date;try{return window.localStorage.setItem(t,t),e=window.localStorage.getItem(t)===String(t),window.localStorage.removeItem(t),e}catch(e){}return!1}())e=window.localStorage;else if(window.globalStorage)try{e=window.globalStorage[window.location.hostname]}catch(e){}else if("undefined"!=typeof document){var ce=document.createElement("div"),pe="localStorage";ce.style.display="none",document.getElementsByTagName("head")[0].appendChild(ce),ce.addBehavior&&(ce.addBehavior("#default#userdata"),e={length:0,setItem:function(e,t){ce.load(pe),ce.getAttribute(e)||this.length++,ce.setAttribute(e,t),ce.save(pe)},getItem:function(e){return ce.load(pe),ce.getAttribute(e)},removeItem:function(e){ce.load(pe),ce.getAttribute(e)&&this.length--,ce.removeAttribute(e),ce.save(pe)},clear:function(){ce.load(pe);for(var e,t=0;e=ce.XMLDocument.documentElement.attributes[t++];)ce.removeAttribute(e.name);ce.save(pe),this.length=0},key:function(e){return ce.load(pe),ce.XMLDocument.documentElement.attributes[e]}},ce.load(pe),e.length=ce.XMLDocument.documentElement.attributes.length)}e||(e={length:0,setItem:function(e,t){},getItem:function(e){},removeItem:function(e){},clear:function(){},key:function(e){}});var le=e,de=function(){this.storage=null};de.prototype.getStorage=function(){if(null!==this.storage)return this.storage;if(ee())this.storage=ue;else{var n="amp_cookiestore_";this.storage={_options:{expirationDays:void 0,domain:void 0,secure:!1},reset:function(){this._options={expirationDays:void 0,domain:void 0,secure:!1}},options:function(e){return 0===arguments.length?this._options:(e=e||{},this._options.expirationDays=e.expirationDays||this._options.expirationDays,this._options.domain=e.domain||this._options.domain||window&&window.location&&window.location.hostname,this._options.secure=e.secure||!1)},get:function(e){try{return JSON.parse(le.getItem(n+e))}catch(e){}return null},set:function(e,t){try{return le.setItem(n+e,JSON.stringify(t)),!0}catch(e){}return!1},remove:function(e){try{le.removeItem(n+e)}catch(e){return!1}}}}return this.storage};var he=function(){function u(e){var t=e.storageKey,n=e.disableCookies,i=e.domain,o=e.secure,r=e.sameSite,s=e.expirationDays;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),this.storageKey=t,this.domain=i,this.secure=o,this.sameSite=r,this.expirationDays=s,this.cookieDomain="";var a=ne(J().href);this.cookieDomain=i||(a?"."+a:null),this.disableCookieStorage=n||!ee({domain:this.cookieDomain,secure:this.secure,sameSite:this.sameSite,expirationDays:this.expirationDays})}var e,t,n;return e=u,(t=[{key:"getCookieStorageKey",value:function(){if(!this.domain)return this.storageKey;var e="."===this.domain.charAt(0)?this.domain.substring(1):this.domain;return"".concat(this.storageKey).concat(e?"_".concat(e):"")}},{key:"save",value:function(e){var t=e.deviceId,n=e.userId,i=e.optOut,o=e.sessionId,r=e.lastEventTime,s=e.eventId,a=e.identifyId,u=e.sequenceNumber,c=[t,N.encode(n||""),i?"1":"",o?o.toString(32):"0",r?r.toString(32):"0",s?s.toString(32):"0",a?a.toString(32):"0",u?u.toString(32):"0"].join(".");this.disableCookieStorage?le.setItem(this.storageKey,c):Z(this.getCookieStorageKey(),c,{domain:this.cookieDomain,secure:this.secure,sameSite:this.sameSite,expirationDays:this.expirationDays})}},{key:"load",value:function(){var e;if(this.disableCookieStorage||(e=Y(this.getCookieStorageKey()+"=")),e||(e=le.getItem(this.storageKey)),!e)return null;var t=e.split("."),n=null;if(t[1])try{n=N.decode(t[1])}catch(e){n=null}return{deviceId:t[0],userId:n,optOut:"1"===t[2],sessionId:parseInt(t[3],32),lastEventTime:parseInt(t[4],32),eventId:parseInt(t[5],32),identifyId:parseInt(t[6],32),sequenceNumber:parseInt(t[7],32)}}}])&&i(e.prototype,t),n&&i(e,n),u}(),fe="$clearAll",ve=function(){this.userPropertiesOperations={},this.properties=[]};ve.prototype.add=function(e,t){return"number"===C(t)||"string"===C(t)?this._addOperation("$add",e,t):B.error("Unsupported type for value: "+C(t)+", expecting number or string"),this},ve.prototype.append=function(e,t){return this._addOperation("$append",e,t),this},ve.prototype.clearAll=function(){return 0<Object.keys(this.userPropertiesOperations).length?this.userPropertiesOperations.hasOwnProperty(fe)||B.error("Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll"):this.userPropertiesOperations[fe]="-",this},ve.prototype.prepend=function(e,t){return this._addOperation("$prepend",e,t),this},ve.prototype.set=function(e,t){return this._addOperation("$set",e,t),this},ve.prototype.setOnce=function(e,t){return this._addOperation("$setOnce",e,t),this},ve.prototype.unset=function(e){return this._addOperation("$unset",e,"-"),this},ve.prototype._addOperation=function(e,t,n){this.userPropertiesOperations.hasOwnProperty(fe)?B.error("This identify already contains a $clearAll operation, skipping operation "+e):-1===this.properties.indexOf(t)?(this.userPropertiesOperations.hasOwnProperty(e)||(this.userPropertiesOperations[e]={}),this.userPropertiesOperations[e][t]=n,this.properties.push(t)):B.error('User property "'+t+'" already used in this identify, skipping operation '+e)};var ge="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function me(e,t){return e(t={exports:{}},t.exports),t.exports}var ye=me(function(s){!function(e){function l(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function a(e,t,n,i,o,r){return l((s=l(l(t,e),l(i,r)))<<(a=o)|s>>>32-a,n);var s,a}function d(e,t,n,i,o,r,s){return a(t&n|~t&i,e,t,o,r,s)}function h(e,t,n,i,o,r,s){return a(t&i|n&~i,e,t,o,r,s)}function f(e,t,n,i,o,r,s){return a(t^n^i,e,t,o,r,s)}function v(e,t,n,i,o,r,s){return a(n^(t|~i),e,t,o,r,s)}function u(e,t){var n,i,o,r,s;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var a=1732584193,u=-271733879,c=-1732584194,p=271733878;for(n=0;n<e.length;n+=16)u=v(u=v(u=v(u=v(u=f(u=f(u=f(u=f(u=h(u=h(u=h(u=h(u=d(u=d(u=d(u=d(o=u,c=d(r=c,p=d(s=p,a=d(i=a,u,c,p,e[n],7,-680876936),u,c,e[n+1],12,-389564586),a,u,e[n+2],17,606105819),p,a,e[n+3],22,-1044525330),c=d(c,p=d(p,a=d(a,u,c,p,e[n+4],7,-176418897),u,c,e[n+5],12,1200080426),a,u,e[n+6],17,-1473231341),p,a,e[n+7],22,-45705983),c=d(c,p=d(p,a=d(a,u,c,p,e[n+8],7,1770035416),u,c,e[n+9],12,-1958414417),a,u,e[n+10],17,-42063),p,a,e[n+11],22,-1990404162),c=d(c,p=d(p,a=d(a,u,c,p,e[n+12],7,1804603682),u,c,e[n+13],12,-40341101),a,u,e[n+14],17,-1502002290),p,a,e[n+15],22,1236535329),c=h(c,p=h(p,a=h(a,u,c,p,e[n+1],5,-165796510),u,c,e[n+6],9,-1069501632),a,u,e[n+11],14,643717713),p,a,e[n],20,-373897302),c=h(c,p=h(p,a=h(a,u,c,p,e[n+5],5,-701558691),u,c,e[n+10],9,38016083),a,u,e[n+15],14,-660478335),p,a,e[n+4],20,-405537848),c=h(c,p=h(p,a=h(a,u,c,p,e[n+9],5,568446438),u,c,e[n+14],9,-1019803690),a,u,e[n+3],14,-187363961),p,a,e[n+8],20,1163531501),c=h(c,p=h(p,a=h(a,u,c,p,e[n+13],5,-1444681467),u,c,e[n+2],9,-51403784),a,u,e[n+7],14,1735328473),p,a,e[n+12],20,-1926607734),c=f(c,p=f(p,a=f(a,u,c,p,e[n+5],4,-378558),u,c,e[n+8],11,-2022574463),a,u,e[n+11],16,1839030562),p,a,e[n+14],23,-35309556),c=f(c,p=f(p,a=f(a,u,c,p,e[n+1],4,-1530992060),u,c,e[n+4],11,1272893353),a,u,e[n+7],16,-155497632),p,a,e[n+10],23,-1094730640),c=f(c,p=f(p,a=f(a,u,c,p,e[n+13],4,681279174),u,c,e[n],11,-358537222),a,u,e[n+3],16,-722521979),p,a,e[n+6],23,76029189),c=f(c,p=f(p,a=f(a,u,c,p,e[n+9],4,-640364487),u,c,e[n+12],11,-421815835),a,u,e[n+15],16,530742520),p,a,e[n+2],23,-995338651),c=v(c,p=v(p,a=v(a,u,c,p,e[n],6,-198630844),u,c,e[n+7],10,1126891415),a,u,e[n+14],15,-1416354905),p,a,e[n+5],21,-57434055),c=v(c,p=v(p,a=v(a,u,c,p,e[n+12],6,1700485571),u,c,e[n+3],10,-1894986606),a,u,e[n+10],15,-1051523),p,a,e[n+1],21,-2054922799),c=v(c,p=v(p,a=v(a,u,c,p,e[n+8],6,1873313359),u,c,e[n+15],10,-30611744),a,u,e[n+6],15,-1560198380),p,a,e[n+13],21,1309151649),c=v(c,p=v(p,a=v(a,u,c,p,e[n+4],6,-145523070),u,c,e[n+11],10,-1120210379),a,u,e[n+2],15,718787259),p,a,e[n+9],21,-343485551),a=l(a,i),u=l(u,o),c=l(c,r),p=l(p,s);return[a,u,c,p]}function c(e){var t,n="",i=32*e.length;for(t=0;t<i;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function p(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var i=8*e.length;for(t=0;t<i;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function i(e){var t,n,i="0123456789abcdef",o="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),o+=i.charAt(t>>>4&15)+i.charAt(15&t);return o}function n(e){return unescape(encodeURIComponent(e))}function o(e){return c(u(p(t=n(e)),8*t.length));var t}function r(e,t){return function(e,t){var n,i,o=p(e),r=[],s=[];for(r[15]=s[15]=void 0,16<o.length&&(o=u(o,8*e.length)),n=0;n<16;n+=1)r[n]=909522486^o[n],s[n]=1549556828^o[n];return i=u(r.concat(p(t)),512+8*t.length),c(u(s.concat(i),640))}(n(e),n(t))}function t(e,t,n){return t?n?r(t,e):i(r(t,e)):n?o(e):i(o(e))}s.exports?s.exports=t:e.md5=t}(ge)}),_e=function(e){return encodeURIComponent(e).replace(/[!'()*]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})},we=Object.getOwnPropertySymbols,be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable;var Se=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map(function(e){return t[e]}).join(""))return!1;var i={};return"abcdefghijklmnopqrst".split("").forEach(function(e){i[e]=e}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},i)).join("")}catch(e){return!1}}()?Object.assign:function(e,t){for(var n,i,o=function(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}(e),r=1;r<arguments.length;r++){for(var s in n=Object(arguments[r]))be.call(n,s)&&(o[s]=n[s]);if(we){i=we(n);for(var a=0;a<i.length;a++)Ie.call(n,i[a])&&(o[i[a]]=n[i[a]])}}return o},ke="%[a-f0-9]{2}";new RegExp(ke,"gi"),new RegExp("("+ke+")+","gi");function Ee(e,t){return t.encode?t.strict?_e(e):encodeURIComponent(e):e}var Oe=function(i,o){!1===(o=Se({encode:!0,strict:!0,arrayFormat:"none"},o)).sort&&(o.sort=function(){});var r=function(i){switch(i.arrayFormat){case"index":return function(e,t,n){return null===t?[Ee(e,i),"[",n,"]"].join(""):[Ee(e,i),"[",Ee(n,i),"]=",Ee(t,i)].join("")};case"bracket":return function(e,t){return null===t?Ee(e,i):[Ee(e,i),"[]=",Ee(t,i)].join("")};default:return function(e,t){return null===t?Ee(e,i):[Ee(e,i),"=",Ee(t,i)].join("")}}}(o);return i?Object.keys(i).sort(o.sort).map(function(t){var e=i[t];if(void 0===e)return"";if(null===e)return Ee(t,o);if(Array.isArray(e)){var n=[];return e.slice().forEach(function(e){void 0!==e&&n.push(r(t,e,n.length))}),n.join("&")}return Ee(t,o)+"="+Ee(e,o)}).filter(function(e){return 0<e.length}).join("&"):""},xe=function(e,t){this.url=e,this.data=t||{}};xe.prototype.send=function(e){if(!!window.XDomainRequest){var t=new window.XDomainRequest;t.open("POST",this.url,!0),t.onload=function(){e(200,t.responseText)},t.onerror=function(){"Request Entity Too Large"===t.responseText?e(413,t.responseText):e(500,t.responseText)},t.ontimeout=function(){},t.onprogress=function(){},t.send(Oe(this.data))}else{var n=new XMLHttpRequest;n.open("POST",this.url,!0),n.onreadystatechange=function(){4===n.readyState&&e(n.status,n.responseText)},n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(Oe(this.data))}};var Ne=function(){this._price=null,this._productId=null,this._quantity=1,this._revenueType=null,this._properties=null};Ne.prototype.setProductId=function(e){return"string"!==C(e)?B.error("Unsupported type for productId: "+C(e)+", expecting string"):G(e)?B.error("Invalid empty productId"):this._productId=e,this},Ne.prototype.setQuantity=function(e){return"number"!==C(e)?B.error("Unsupported type for quantity: "+C(e)+", expecting number"):this._quantity=parseInt(e),this},Ne.prototype.setPrice=function(e){return"number"!==C(e)?B.error("Unsupported type for price: "+C(e)+", expecting number"):this._price=e,this},Ne.prototype.setRevenueType=function(e){return"string"!==C(e)?B.error("Unsupported type for revenueType: "+C(e)+", expecting string"):this._revenueType=e,this},Ne.prototype.setEventProperties=function(e){return"object"!==C(e)?B.error("Unsupported type for eventProperties: "+C(e)+", expecting object"):this._properties=$(e),this},Ne.prototype._isValidRevenue=function(){return"number"===C(this._price)||(B.error("Invalid revenue, need to set price field"),!1)},Ne.prototype._toJSONObject=function(){var e="object"===C(this._properties)?this._properties:{};return null!==this._productId&&(e[u]=this._productId),null!==this._quantity&&(e[d]=this._quantity),null!==this._price&&(e[h]=this._price),null!==this._revenueType&&(e[f]=this._revenueType),e};var Ae,Ce=me(function(b,I){!function(o,l){var d="function",e="model",t="name",n="type",i="vendor",r="version",s="architecture",a="console",u="mobile",c="tablet",p="smarttv",h="wearable",f={extend:function(e,t){var n={};for(var i in e)t[i]&&t[i].length%2==0?n[i]=t[i].concat(e[i]):n[i]=e[i];return n},has:function(e,t){return"string"==typeof e&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return"string"==typeof e?e.replace(/[^\d\.]/g,"").split(".")[0]:l},trim:function(e){return e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},v={rgx:function(e,t){for(var n,i,o,r,s,a,u=0;u<t.length&&!s;){var c=t[u],p=t[u+1];for(n=i=0;n<c.length&&!s;)if(s=c[n++].exec(e))for(o=0;o<p.length;o++)a=s[++i],"object"==typeof(r=p[o])&&0<r.length?2==r.length?typeof r[1]==d?this[r[0]]=r[1].call(this,a):this[r[0]]=r[1]:3==r.length?typeof r[1]!==d||r[1].exec&&r[1].test?this[r[0]]=a?a.replace(r[1],r[2]):l:this[r[0]]=a?r[1].call(this,a,r[2]):l:4==r.length&&(this[r[0]]=a?r[3].call(this,a.replace(r[1],r[2])):l):this[r]=a||l;u+=2}},str:function(e,t){for(var n in t)if("object"==typeof t[n]&&0<t[n].length){for(var i=0;i<t[n].length;i++)if(f.has(t[n][i],e))return"?"===n?l:n}else if(f.has(t[n],e))return"?"===n?l:n;return e}},g={browser:{oldsafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}}},device:{amazon:{model:{"Fire Phone":["SD","KF"]}},sprint:{model:{"Evo Shift 4G":"7373KT"},vendor:{HTC:"APA",Sprint:"Sprint"}}},os:{windows:{version:{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"}}}},m={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],[t,r],[/(opios)[\/\s]+([\w\.]+)/i],[[t,"Opera Mini"],r],[/\s(opr)\/([\w\.]+)/i],[[t,"Opera"],r],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(bidubrowser|baidubrowser)[\/\s]?([\w\.]+)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i],[t,r],[/(konqueror)\/([\w\.]+)/i],[[t,"Konqueror"],r],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[[t,"IE"],r],[/(edge|edgios|edga|edg)\/((\d+)?[\w\.]+)/i],[[t,"Edge"],r],[/(yabrowser)\/([\w\.]+)/i],[[t,"Yandex"],r],[/(Avast)\/([\w\.]+)/i],[[t,"Avast Secure Browser"],r],[/(AVG)\/([\w\.]+)/i],[[t,"AVG Secure Browser"],r],[/(puffin)\/([\w\.]+)/i],[[t,"Puffin"],r],[/(focus)\/([\w\.]+)/i],[[t,"Firefox Focus"],r],[/(opt)\/([\w\.]+)/i],[[t,"Opera Touch"],r],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[[t,"UCBrowser"],r],[/(comodo_dragon)\/([\w\.]+)/i],[[t,/_/g," "],r],[/(windowswechat qbcore)\/([\w\.]+)/i],[[t,"WeChat(Win) Desktop"],r],[/(micromessenger)\/([\w\.]+)/i],[[t,"WeChat"],r],[/(brave)\/([\w\.]+)/i],[[t,"Brave"],r],[/(qqbrowserlite)\/([\w\.]+)/i],[t,r],[/(QQ)\/([\d\.]+)/i],[t,r],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],[t,r],[/(baiduboxapp)[\/\s]?([\w\.]+)/i],[t,r],[/(2345Explorer)[\/\s]?([\w\.]+)/i],[t,r],[/(MetaSr)[\/\s]?([\w\.]+)/i],[t],[/(LBBROWSER)/i],[t],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[r,[t,"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],[r,[t,"Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/android.+(line)\/([\w\.]+)\/iab/i],[t,r],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[r,[t,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[t,/(.+)/,"$1 WebView"],r],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[[t,/(.+(?:g|us))(.+)/,"$1 $2"],r],[/((?:android.+)crmo|crios)\/([\w\.]+)/i,/android.+(chrome)\/([\w\.]+)\s+(?:mobile\s?safari)/i],[[t,"Chrome Mobile"],r],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],[r,[t,"Android Browser"]],[/(sailfishbrowser)\/([\w\.]+)/i],[[t,"Sailfish Browser"],r],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[t,r],[/(dolfin)\/([\w\.]+)/i],[[t,"Dolphin"],r],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[[t,"360 Browser"]],[/(coast)\/([\w\.]+)/i],[[t,"Opera Coast"],r],[/fxios\/([\w\.-]+)/i],[r,[t,"Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],[r,[t,"Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],[r,t],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[[t,"GSA"],r],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[t,[r,v.str,g.browser.oldsafari.version]],[/(webkit|khtml)\/([\w\.]+)/i],[t,r],[/(navigator|netscape)\/([\w\.-]+)/i],[[t,"Netscape"],r],[/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)/i,/(mozilla)\/([\w\.]+).+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[t,r]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[s,"amd64"]],[/(ia32(?=;))/i],[[s,f.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[s,"ia32"]],[/windows\s(ce|mobile);\sppc;/i],[[s,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[s,/ower/,"",f.lowerize]],[/(sun4\w)[;\)]/i],[[s,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+[;l]))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[[s,f.lowerize]]],device:[[/\((ipad|playbook);[\w\s\),;-]+(rim|apple)/i],[e,i,[n,c]],[/applecoremedia\/[\w\.]+ \((ipad)/],[e,[i,"Apple"],[n,c]],[/(apple\s{0,1}tv)/i],[[e,"Apple TV"],[i,"Apple"],[n,p]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],[i,e,[n,c]],[/(kf[A-z]+)\sbuild\/.+silk\//i],[e,[i,"Amazon"],[n,c]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],[[e,v.str,g.device.amazon.model],[i,"Amazon"],[n,u]],[/android.+aft([bms])\sbuild/i],[e,[i,"Amazon"],[n,p]],[/\((ip[honed|\s\w*]+);.+(apple)/i],[e,i,[n,u]],[/\((ip[honed|\s\w*]+);/i],[e,[i,"Apple"],[n,u]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],[i,e,[n,u]],[/\(bb10;\s(\w+)/i],[e,[i,"BlackBerry"],[n,u]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone|p00c)/i],[e,[i,"Asus"],[n,c]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[[i,"Sony"],[e,"Xperia Tablet"],[n,c]],[/android.+\s([c-g]\d{4}|so[-l]\w+)(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[e,[i,"Sony"],[n,u]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],[i,e,[n,a]],[/android.+;\s(shield)\sbuild/i],[e,[i,"Nvidia"],[n,a]],[/(playstation\s[34portablevi]+)/i],[e,[i,"Sony"],[n,a]],[/(sprint\s(\w+))/i],[[i,v.str,g.device.sprint.vendor],[e,v.str,g.device.sprint.model],[n,u]],[/(htc)[;_\s-]+([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[i,[e,/_/g," "],[n,u]],[/(nexus\s9)/i],[e,[i,"HTC"],[n,c]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p|vog-l29|ane-lx1|eml-l29)/i],[e,[i,"Huawei"],[n,u]],[/android.+(bah2?-a?[lw]\d{2})/i],[e,[i,"Huawei"],[n,c]],[/(microsoft);\s(lumia[\s\w]+)/i],[i,e,[n,u]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],[e,[i,"Microsoft"],[n,a]],[/(kin\.[onetw]{3})/i],[[e,/\./g," "],[i,"Microsoft"],[n,u]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],[e,[i,"Motorola"],[n,u]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[e,[i,"Motorola"],[n,c]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[i,f.trim],[e,f.trim],[n,p]],[/hbbtv.+maple;(\d+)/i],[[e,/^/,"SmartTV"],[i,"Samsung"],[n,p]],[/\(dtv[\);].+(aquos)/i],[e,[i,"Sharp"],[n,p]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,/((SM-T\w+))/i],[[i,"Samsung"],e,[n,c]],[/smart-tv.+(samsung)/i],[i,[n,p],e],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[[i,"Samsung"],e,[n,u]],[/sie-(\w*)/i],[e,[i,"Siemens"],[n,u]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[[i,"Nokia"],e,[n,u]],[/android[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],[e,[i,"Acer"],[n,c]],[/android.+([vl]k\-?\d{3})\s+build/i],[e,[i,"LG"],[n,c]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[[i,"LG"],e,[n,c]],[/(lg) netcast\.tv/i],[i,e,[n,p]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],[e,[i,"LG"],[n,u]],[/(lenovo)\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+))/i],[i,e,[n,c]],[/android.+(ideatab[a-z0-9\-\s]+)/i],[e,[i,"Lenovo"],[n,c]],[/(lenovo)[_\s-]?([\w-]+)/i],[i,e,[n,u]],[/linux;.+((jolla));/i],[i,e,[n,u]],[/((pebble))app\/[\d\.]+\s/i],[i,e,[n,h]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[i,e,[n,u]],[/crkey/i],[[e,"Chromecast"],[i,"Google"],[n,p]],[/android.+;\s(glass)\s\d/i],[e,[i,"Google"],[n,h]],[/android.+;\s(pixel c)[\s)]/i],[e,[i,"Google"],[n,c]],[/android.+;\s(pixel( [23])?( xl)?)[\s)]/i],[e,[i,"Google"],[n,u]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:a\d|one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[[e,/_/g," "],[i,"Xiaomi"],[n,u]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],[[e,/_/g," "],[i,"Xiaomi"],[n,c]],[/android.+;\s(m[1-5]\snote)\sbuild/i],[e,[i,"Meizu"],[n,u]],[/(mz)-([\w-]{2,})/i],[[i,"Meizu"],e,[n,u]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})[\s)]/i],[e,[i,"OnePlus"],[n,u]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],[e,[i,"RCA"],[n,c]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],[e,[i,"Dell"],[n,c]],[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],[e,[i,"Verizon"],[n,c]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[[i,"Barnes & Noble"],e,[n,c]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],[e,[i,"NuVision"],[n,c]],[/android.+;\s(k88)\sbuild/i],[e,[i,"ZTE"],[n,c]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],[e,[i,"Swiss"],[n,u]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],[e,[i,"Swiss"],[n,c]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],[e,[i,"Zeki"],[n,c]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[[i,"Dragon Touch"],e,[n,c]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],[e,[i,"Insignia"],[n,c]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],[e,[i,"NextBook"],[n,c]],[/android.+[;\/]\s*(Xtreme\_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],[[i,"Voice"],e,[n,u]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[[i,"LvTel"],e,[n,u]],[/android.+;\s(PH-1)\s/i],[e,[i,"Essential"],[n,u]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],[e,[i,"Envizen"],[n,c]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],[i,e,[n,c]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],[e,[i,"MachSpeed"],[n,c]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],[i,e,[n,c]],[/android.+[;\/]\s*TU_(1491)\s+build/i],[e,[i,"Rotor"],[n,c]],[/android.+(KS(.+))\s+build/i],[e,[i,"Amazon"],[n,c]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],[i,e,[n,c]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[n,f.lowerize],i,e],[/[\s\/\(](smart-?tv)[;\)]/i],[[n,p]],[/(android[\w\.\s\-]{0,9});.+build/i],[e,[i,"Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[r,[t,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[r,[t,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[t,r],[/rv\:([\w\.]{1,9}).+(gecko)/i],[r,t]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[t,r],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],[[t,v.str,g.os.windows.name],[r,v.str,g.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[t,"Windows"],[r,v.str,g.os.windows.version]],[/\((bb)(10);/i],[[t,"BlackBerry"],r],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i],[t,r],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],[[t,"Symbian"],r],[/\((series40);/i],[t],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[t,"Firefox OS"],r],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],[[t,"Linux"],r],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[t,"Chromium OS"],r],[/(sunos)\s?([\w\.\d]*)/i],[[t,"Solaris"],r],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],[[t,"Linux"],r],[/(iphone)(?:.*os\s*([\w]*)\slike\smac|;\sopera)/i],[[t,"iPhone"],[r,/_/g,"."]],[/(ipad)(?:.*os\s*([\w]*)\slike\smac|;\sopera)/i],[[t,"iPad"],[r,/_/g,"."]],[/(haiku)\s(\w+)/i],[t,r],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[[r,/_/g,"."],[t,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[[t,"Mac"],[r,/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],[t,r]]},y=function(e,t){if("object"==typeof e&&(t=e,e=l),!(this instanceof y))return new y(e,t).getResult();var n=e||(o&&o.navigator&&o.navigator.userAgent?o.navigator.userAgent:""),i=t?f.extend(m,t):m;return this.getBrowser=function(){var e={name:l,version:l};return v.rgx.call(e,n,i.browser),e.major=f.major(e.version),e},this.getCPU=function(){var e={architecture:l};return v.rgx.call(e,n,i.cpu),e},this.getDevice=function(){var e={vendor:l,model:l,type:l};return v.rgx.call(e,n,i.device),e},this.getEngine=function(){var e={name:l,version:l};return v.rgx.call(e,n,i.engine),e},this.getOS=function(){var e={name:l,version:l};return v.rgx.call(e,n,i.os),e},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 n},this.setUA=function(e){return n=e,this},this};y.VERSION="0.7.21",y.BROWSER={NAME:t,MAJOR:"major",VERSION:r},y.CPU={ARCHITECTURE:s},y.DEVICE={MODEL:e,VENDOR:i,TYPE:n,CONSOLE:a,MOBILE:u,SMARTTV:p,TABLET:c,WEARABLE:h,EMBEDDED:"embedded"},y.ENGINE={NAME:t,VERSION:r},y.OS={NAME:t,VERSION:r},b.exports&&(I=b.exports=y),I.UAParser=y;var _=o&&(o.jQuery||o.Zepto);if(_&&!_.ua){var w=new y;_.ua=w.getResult(),_.ua.get=function(){return w.getUA()},_.ua.set=function(e){w.setUA(e);var t=w.getResult();for(var n in t)_.ua[n]=t[n]}}}("object"==typeof window?window:ge)}),Te=(Ce.UAParser,"7.2.2"),Pe={apiEndpoint:"api.amplitude.com",batchEvents:!1,cookieExpiration:3650,cookieName:"amplitude_id",sameSiteCookie:"Lax",cookieForceUpgrade:!1,deferInitialization:!1,disableCookies:!1,deviceIdFromUrlParam:!1,domain:"",eventUploadPeriodMillis:3e4,eventUploadThreshold:30,forceHttps:!0,includeGclid:!1,includeReferrer:!1,includeUtm:!1,language:function(){return navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||""}(),logLevel:"WARN",logAttributionCapturedEvent:!1,optOut:!1,onError:function(){},platform:"Web",savedMaxCount:1e3,saveEvents:!0,saveParamsReferrerOncePerSession:!0,secureCookie:!1,sessionTimeout:18e5,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},unsetParamsReferrerOnNewSession:!1,unsentKey:"amplitude_unsent",unsentIdentifyKey:"amplitude_unsent_identify",uploadBatchSize:100},Re=function(e){this._instanceName=G(e)?p:e.toLowerCase(),this._unsentEvents=[],this._unsentIdentifys=[],this._ua=new Ce(navigator.userAgent).getResult(),this.options=v({},Pe,{trackingOptions:v({},Pe.trackingOptions)}),this.cookieStorage=(new de).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};Re.prototype.Identify=ve,Re.prototype.Revenue=Ne,Re.prototype.init=function(e,i,o,t){var r=this;if("string"!==C(e)||G(e))B.error("Invalid apiKey. Please re-initialize with a valid apiKey");else try{De(this.options,o),this.options.cookieName!==Pe.cookieName&&B.warn("The cookieName option is deprecated. We will be ignoring it for newer cookies"),this.options.apiKey=e,this._storageSuffix="_"+e+(this._instanceName===p?"":"_"+this._instanceName),this._storageSuffixV5=e.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=l+"_"+this._storageSuffixV5,this.cookieStorage.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie,sameSite:this.options.sameSiteCookie}),this._metadataStorage=new he({storageKey:this._cookieName,disableCookies:this.options.disableCookies,expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie,sameSite:this.options.sameSiteCookie});var n=!!this.cookieStorage.get(this._oldCookiename),s=!!this._metadataStorage.load();this._useOldCookie=!s&&n&&!this.options.cookieForceUpgrade;var a=s||n;if(this.options.domain=this.cookieStorage.options().domain,this.options.deferInitialization&&!a)return void this._deferInitialization(e,i,o,t);"string"===C(this.options.logLevel)&&z(this.options.logLevel);var u=Ve(this);this._apiPropertiesTrackingOptions=0<Object.keys(u).length?{tracking_options:u}:{},this.options.cookieForceUpgrade&&n&&(s||Ue(this),this.cookieStorage.remove(this._oldCookiename)),je(this),this._pendingReadStorage=!0;var c=function(e){r.options.deviceId=r._getInitialDeviceId(o&&o.deviceId,e),r.options.userId="string"===C(i)&&!G(i)&&i||"number"===C(i)&&i.toString()||r.options.userId||null;var t=(new Date).getTime();(!r._sessionId||!r._lastEventTime||t-r._lastEventTime>r.options.sessionTimeout)&&(r.options.unsetParamsReferrerOnNewSession&&r._unsetUTMParams(),r._newSession=!0,r._sessionId=t,r.options.saveParamsReferrerOncePerSession&&r._trackParamsAndReferrer()),r.options.saveParamsReferrerOncePerSession||r._trackParamsAndReferrer(),r.options.saveEvents&&(qe(r._unsentEvents),qe(r._unsentIdentifys)),r._lastEventTime=t,Me(r),r._pendingReadStorage=!1,r._sendEventsIfReady();for(var n=0;n<r._onInit.length;n++)r._onInit[n](r);r._onInit=[],r._isInitialized=!0};this.options.saveEvents&&(this._unsentEvents=this._loadSavedUnsentEvents(this.options.unsentKey).map(function(e){return{event:e}}).concat(this._unsentEvents),this._unsentIdentifys=this._loadSavedUnsentEvents(this.options.unsentIdentifyKey).map(function(e){return{event:e}}).concat(this._unsentIdentifys)),c(),this.runQueuedFunctions(),"function"===C(t)&&t(this)}catch(e){B.error(e),this.options.onError(e)}},Re.prototype.deleteLowerLevelDomainCookies=function(){var e=te(),t=this.options.domain&&"."===this.options.domain[0]?this.options.domain.slice(1):this.options.domain;if(t&&e!==t&&new RegExp(t+"$").test(e)){for(var n=e.split("."),i=t.split("."),o=n.length;o>i.length;--o){var r=n.slice(n.length-o).join(".");Z(this._cookieName,null,{domain:"."+r})}Z(this._cookieName,null,{})}},Re.prototype._getInitialDeviceId=function(e,t){if(e)return e;if(this.options.deviceIdFromUrlParam){var n=this._getDeviceIdFromUrlParam(this._getUrlParams());if(n)return n}return this.options.deviceId?this.options.deviceId:t||Q()};var qe=function(e){for(var t=0;t<e.length;t++){var n=e[t].event.user_properties,i=e[t].event.event_properties,o=e[t].event.groups;e[t].event.user_properties=$(n),e[t].event.event_properties=$(i),e[t].event.groups=L(o)}};Re.prototype._migrateUnsentEvents=function(e){var r=this;Promise.all([Ae.getItem(this.options.unsentKey),Ae.getItem(this.options.unsentIdentifyKey)]).then(function(e){if(r.options.saveEvents){var t=e[0],n=e[1],i=[],o=[];t&&(i.push(Ae.setItem(r.options.unsentKey+r._storageSuffix,JSON.stringify(t))),o.push(Ae.removeItem(r.options.unsentKey))),n&&(i.push(Ae.setItem(r.options.unsentIdentifyKey+r._storageSuffix,JSON.stringify(n))),o.push(Ae.removeItem(r.options.unsentIdentifyKey))),0<i.length&&Promise.all(i).then(function(){}).catch(function(e){r.options.onError(e)})}}).then(e).catch(function(e){r.options.onError(e)})},Re.prototype._trackParamsAndReferrer=function(){var e,t,n;if(this.options.includeUtm&&(e=this._initUtmData()),this.options.includeReferrer&&(t=this._saveReferrer(this._getReferrer())),this.options.includeGclid&&(n=this._saveGclid(this._getUrlParams())),this.options.logAttributionCapturedEvent){var i=v({},e,t,n);0<Object.keys(i).length&&this.logEvent(E,i)}};var De=function i(o,r){if("object"===C(r)){var e=function(e){if(o.hasOwnProperty(e)){var t=r[e],n=C(o[e]);W(t,e+" option",n)&&("boolean"===n?o[e]=!!t:"string"===n&&!G(t)||"number"===n&&0<t?o[e]=t:"object"===n&&i(o[e],t))}};for(var t in r)r.hasOwnProperty(t)&&e(t)}};Re.prototype.runQueuedFunctions=function(){var e=this._q;this._q=[];for(var t=0;t<e.length;t++){var n=this[e[t][0]];"function"===C(n)&&n.apply(this,e[t].slice(1))}},Re.prototype._apiKeySet=function(e){return!G(this.options.apiKey)||(B.error("Invalid apiKey. Please set a valid apiKey with init() before calling "+e),!1)},Re.prototype._loadSavedUnsentEvents=function(e){var t=this._getFromStorage(le,e),n=this._parseSavedUnsentEventsString(t,e);return this._setInStorage(le,e,JSON.stringify(n)),n},Re.prototype._parseSavedUnsentEventsString=function(e,t){if(G(e))return[];if("string"===C(e))try{var n=JSON.parse(e);if("array"===C(n))return n}catch(e){}return B.error("Unable to load "+t+" events. Restart with a new empty queue."),[]},Re.prototype.isNewSession=function(){return this._newSession},Re.prototype.onInit=function(e){this._isInitialized?e(this):this._onInit.push(e)},Re.prototype.getSessionId=function(){return this._sessionId},Re.prototype.nextEventId=function(){return this._eventId++,this._eventId},Re.prototype.nextIdentifyId=function(){return this._identifyId++,this._identifyId},Re.prototype.nextSequenceNumber=function(){return this._sequenceNumber++,this._sequenceNumber},Re.prototype._unsentCount=function(){return this._unsentEvents.length+this._unsentIdentifys.length},Re.prototype._sendEventsIfReady=function(){return 0!==this._unsentCount()&&(this.options.batchEvents?this._unsentCount()>=this.options.eventUploadThreshold?(this.sendEvents(),!0):(this._updateScheduled||(this._updateScheduled=!0,setTimeout(function(){this._updateScheduled=!1,this.sendEvents()}.bind(this),this.options.eventUploadPeriodMillis)),!1):(this.sendEvents(),!0))},Re.prototype._getFromStorage=function(e,t){return e.getItem(t+this._storageSuffix)},Re.prototype._setInStorage=function(e,t,n){e.setItem(t+this._storageSuffix,n)};var je=function(e){if(e._useOldCookie){var t=e.cookieStorage.get(e._oldCookiename);"object"!==C(t)||Ke(e,t)}else{var n=e._metadataStorage.load();"object"===C(n)&&Ke(e,n)}},Ue=function(e){var t=e.cookieStorage.get(e._oldCookiename);"object"===C(t)&&(Ke(e,t),Me(e))},Ke=function(e,t){t.deviceId&&(e.options.deviceId=t.deviceId),t.userId&&(e.options.userId=t.userId),null!==t.optOut&&void 0!==t.optOut&&!1!==t.optOut&&(e.options.optOut=t.optOut),t.sessionId&&(e._sessionId=parseInt(t.sessionId,10)),t.lastEventTime&&(e._lastEventTime=parseInt(t.lastEventTime,10)),t.eventId&&(e._eventId=parseInt(t.eventId,10)),t.identifyId&&(e._identifyId=parseInt(t.identifyId,10)),t.sequenceNumber&&(e._sequenceNumber=parseInt(t.sequenceNumber,10))},Me=function(e){var t={deviceId:e.options.deviceId,userId:e.options.userId,optOut:e.options.optOut,sessionId:e._sessionId,lastEventTime:e._lastEventTime,eventId:e._eventId,identifyId:e._identifyId,sequenceNumber:e._sequenceNumber};e._useOldCookie?e.cookieStorage.set(e.options.cookieName+e._storageSuffix,t):e._metadataStorage.save(t)};Re.prototype._initUtmData=function(e,t){e=e||this._getUrlParams(),t=t||this.cookieStorage.get("__utmz");var n,i,o,r,s,a,u,c,p,l,d,h=(i=e,o=(n=t)?"?"+n.split(".").slice(-1)[0].replace(/\|/g,"&"):"",s=(r=function(e,t,n,i){return V(e,t)||V(n,i)})(w,i,"utmcsr",o),a=r(b,i,"utmcmd",o),u=r(I,i,"utmccn",o),c=r(S,i,"utmctr",o),p=r(k,i,"utmcct",o),l={},(d=function(e,t){G(t)||(l[e]=t)})(w,s),d(b,a),d(I,u),d(S,c),d(k,p),l);return ze(this,h),h},Re.prototype._unsetUTMParams=function(){var e=new ve;e.unset(_),e.unset(w),e.unset(b),e.unset(I),e.unset(S),e.unset(k),this.identify(e)};var ze=function(e,t){if("object"===C(t)&&0!==Object.keys(t).length){var n=new ve;for(var i in t)t.hasOwnProperty(i)&&(n.setOnce("initial_"+i,t[i]),n.set(i,t[i]));e.identify(n)}};Re.prototype._getReferrer=function(){return document.referrer},Re.prototype._getUrlParams=function(){return location.search},Re.prototype._saveGclid=function(e){var t=V("gclid",e);if(!G(t)){var n={gclid:t};return ze(this,n),n}},Re.prototype._getDeviceIdFromUrlParam=function(e){return V(y,e)},Re.prototype._getReferringDomain=function(e){if(G(e))return null;var t=e.split("/");return 3<=t.length?t[2]:null},Re.prototype._saveReferrer=function(e){if(!G(e)){var t={referrer:e,referring_domain:this._getReferringDomain(e)};return ze(this,t),t}},Re.prototype.saveEvents=function(){try{var e=JSON.stringify(this._unsentEvents.map(function(e){return e.event}));this._setInStorage(le,this.options.unsentKey,e)}catch(e){}try{var t=JSON.stringify(this._unsentIdentifys.map(function(e){return e.event}));this._setInStorage(le,this.options.unsentIdentifyKey,t)}catch(e){}},Re.prototype.setDomain=function(e){if(this._shouldDeferCall())return this._q.push(["setDomain"].concat(Array.prototype.slice.call(arguments,0)));if(W(e,"domain","string"))try{this.cookieStorage.options({expirationDays:this.options.cookieExpiration,secure:this.options.secureCookie,domain:e,sameSite:this.options.sameSiteCookie}),this.options.domain=this.cookieStorage.options().domain,je(this),Me(this)}catch(e){B.error(e)}},Re.prototype.setUserId=function(e){if(this._shouldDeferCall())return this._q.push(["setUserId"].concat(Array.prototype.slice.call(arguments,0)));try{this.options.userId=null!=e&&""+e||null,Me(this)}catch(e){B.error(e)}},Re.prototype.setGroup=function(e,t){if(this._shouldDeferCall())return this._q.push(["setGroup"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setGroup()")&&W(e,"groupType","string")&&!G(e)){var n={};n[e]=t;var i=(new ve).set(e,t);this._logEvent(g,null,null,i.userPropertiesOperations,n,null,null,null)}},Re.prototype.setOptOut=function(e){if(this._shouldDeferCall())return this._q.push(["setOptOut"].concat(Array.prototype.slice.call(arguments,0)));if(W(e,"enable","boolean"))try{this.options.optOut=e,Me(this)}catch(e){B.error(e)}},Re.prototype.setSessionId=function(e){if(W(e,"sessionId","number"))try{this._sessionId=e,Me(this)}catch(e){B.error(e)}},Re.prototype.resetSessionId=function(){this.setSessionId((new Date).getTime())},Re.prototype.regenerateDeviceId=function(){if(this._shouldDeferCall())return this._q.push(["regenerateDeviceId"].concat(Array.prototype.slice.call(arguments,0)));this.setDeviceId(Q())},Re.prototype.setDeviceId=function(e){if(this._shouldDeferCall())return this._q.push(["setDeviceId"].concat(Array.prototype.slice.call(arguments,0)));if(W(e,"deviceId","string"))try{G(e)||(this.options.deviceId=""+e,Me(this))}catch(e){B.error(e)}},Re.prototype.setUserProperties=function(e){if(this._shouldDeferCall())return this._q.push(["setUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setUserProperties()")&&W(e,"userProperties","object")){var t=F($(e));if(0!==Object.keys(t).length){var n=new ve;for(var i in t)t.hasOwnProperty(i)&&n.set(i,t[i]);this.identify(n)}}},Re.prototype.clearUserProperties=function(){if(this._shouldDeferCall())return this._q.push(["clearUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("clearUserProperties()")){var e=new ve;e.clearAll(),this.identify(e)}};var Be=function(e,t){for(var n=0;n<t._q.length;n++){var i=e[t._q[n][0]];"function"===C(i)&&i.apply(e,t._q[n].slice(1))}return e};Re.prototype.i