/*! VERSION | 11.0.88 */(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[7040],{79554:(e,t,n)=>{"use strict";n.d(t,{V:()=>l});var i=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:r(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),r=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},o=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(t){e(t)}),this.queue=[])},e}(),s=function(){return(s=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,l):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=l?l.replace(a[1],a[2]):void 0:this[a[0]]=l?a[1].call(this,l,a[2]):void 0:4===a.length&&(this[a[0]]=l?a[3].call(this,l.replace(a[1],a[2])):void 0):this[a]=l||o;p+=2}},$=function(e,t){for(var n in t)if(typeof t[n]===u&&t[n].length>0){for(var i=0;i350?B(e,350):e,this},this.setUA(n),this};H.VERSION="0.7.33",H.BROWSER=G([p,f,"major"]),H.CPU=G([v]),H.DEVICE=G([l,h,d,g,y,_,m,b,E]),H.ENGINE=H.OS=G([p,f]),typeof t!==a?(e.exports&&(t=e.exports=H),t.UAParser=H):n.amdO?o!==(i=(function(){return H}).call(t,n,t,e))&&(e.exports=i):typeof r!==a&&(r.UAParser=H);var Y=typeof r!==a&&(r.jQuery||r.Zepto);if(Y&&!Y.ua){var J=new H;Y.ua=J.getResult(),Y.ua.get=function(){return J.getUA()},Y.ua.set=function(e){J.setUA(e);var t=J.getResult();for(var n in t)Y.ua[n]=t[n]}}}("object"==typeof window?window:this)},4327:function(e,t,n){var i;!function(r){"use strict";function o(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function s(e,t,n,i,r,s){var a;return o((a=o(o(t,e),o(i,s)))<>>32-r,n)}function a(e,t,n,i,r,o,a){return s(t&n|~t&i,e,t,r,o,a)}function u(e,t,n,i,r,o,a){return s(t&i|n&~i,e,t,r,o,a)}function c(e,t,n,i,r,o,a){return s(t^n^i,e,t,r,o,a)}function l(e,t,n,i,r,o,a){return s(n^(t|~i),e,t,r,o,a)}function p(e,t){e[t>>5]|=128<>>9<<4)+14]=t;var n,i,r,s,p,d=1732584193,h=-271733879,f=-1732584194,v=271733878;for(n=0;n>5]>>>t%32&255);return n}function h(e){var t,n=[];for(t=0,n[(e.length>>2)-1]=void 0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+i.charAt(15&t);return r}function v(e){return unescape(encodeURIComponent(e))}function g(e){var t;return d(p(h(t=v(e)),8*t.length))}function y(e,t){return function(e,t){var n,i,r=h(e),o=[],s=[];for(o[15]=s[15]=void 0,r.length>16&&(r=p(r,8*e.length)),n=0;n<16;n+=1)o[n]=909522486^r[n],s[n]=1549556828^r[n];return i=p(o.concat(h(t)),512+8*t.length),d(p(s.concat(i),640))}(v(e),v(t))}function m(e,t,n){return t?n?y(t,e):f(y(t,e)):n?g(e):f(g(e))}void 0!==(i=(function(){return m}).call(t,n,t,e))&&(e.exports=i)}(0)},77040:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>eQ});var i,r,o={};function s(){return"object"==typeof window&&(null==window?void 0:window.document)!==void 0}n.r(o),n.d(o,{exclude:()=>k,extract:()=>I,parse:()=>w,parseUrl:()=>O,pick:()=>T,stringify:()=>S,stringifyUrl:()=>N});var a=function(){var e;if(s()){var t=Array;if(void 0!==window.Prototype&&(null===(e=t.prototype)||void 0===e?void 0:e.toJSON)!==void 0)return delete t.prototype.toJSON,!0}return!1},u=n(4327),c=n.n(u);let l="%[a-f0-9]{2}",p=RegExp("("+l+")|([^%]+?)","gi"),d=RegExp("("+l+")+","gi");function h(e,t){if(!("string"==typeof e&&"string"==typeof t))throw TypeError("Expected the arguments to be of type `string`");if(""===e||""===t)return[];let n=e.indexOf(t);return -1===n?[]:[e.slice(0,n),e.slice(n+t.length)]}let f=e=>null==e,v=e=>encodeURIComponent(e).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),g=Symbol("encodeFragmentIdentifier");function y(e){if("string"!=typeof e||1!==e.length)throw TypeError("arrayFormatSeparator must be single character string")}function m(e,t){return t.encode?t.strict?v(e):encodeURIComponent(e):e}function _(e,t){return t.decode?function(e){if("string"!=typeof e)throw TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof e+"`");try{return decodeURIComponent(e)}catch{return function(e){let t={"%FE%FF":"��","%FF%FE":"��"},n=d.exec(e);for(;n;){try{t[n[0]]=decodeURIComponent(n[0])}catch{let e=function(e){try{return decodeURIComponent(e)}catch{let t=e.match(p)||[];for(let n=1;n{if(t=/\[(\d*)]$/.exec(e),e=e.replace(/\[\d*]$/,""),!t){i[e]=n;return}void 0===i[e]&&(i[e]={}),i[e][t[1]]=n};case"bracket":return(e,n,i)=>{if(t=/(\[])$/.exec(e),e=e.replace(/\[]$/,""),!t){i[e]=n;return}if(void 0===i[e]){i[e]=[n];return}i[e]=[...i[e],n]};case"colon-list-separator":return(e,n,i)=>{if(t=/(:list)$/.exec(e),e=e.replace(/:list$/,""),!t){i[e]=n;return}if(void 0===i[e]){i[e]=[n];return}i[e]=[...i[e],n]};case"comma":case"separator":return(t,n,i)=>{let r="string"==typeof n&&n.includes(e.arrayFormatSeparator),o="string"==typeof n&&!r&&_(n,e).includes(e.arrayFormatSeparator);n=o?_(n,e):n;let s=r||o?n.split(e.arrayFormatSeparator).map(t=>_(t,e)):null===n?n:_(n,e);i[t]=s};case"bracket-separator":return(t,n,i)=>{let r=/(\[])$/.test(t);if(t=t.replace(/\[]$/,""),!r){i[t]=n?_(n,e):n;return}let o=null===n?[]:n.split(e.arrayFormatSeparator).map(t=>_(t,e));if(void 0===i[t]){i[t]=o;return}i[t]=[...i[t],...o]};default:return(e,t,n)=>{if(void 0===n[e]){n[e]=t;return}n[e]=[...[n[e]].flat(),t]}}}(t),i=Object.create(null);if("string"!=typeof e||!(e=e.trim().replace(/^[?#&]/,"")))return i;for(let r of e.split("&")){if(""===r)continue;let e=t.decode?r.replace(/\+/g," "):r,[o,s]=h(e,"=");void 0===o&&(o=e),s=void 0===s?null:["comma","separator","bracket-separator"].includes(t.arrayFormat)?s:_(s,t),n(_(o,t),s,i)}for(let[e,n]of Object.entries(i))if("object"==typeof n&&null!==n)for(let[e,i]of Object.entries(n))n[e]=E(i,t);else i[e]=E(n,t);return!1===t.sort?i:(!0===t.sort?Object.keys(i).sort():Object.keys(i).sort(t.sort)).reduce((e,t)=>{let n=i[t];return n&&"object"==typeof n&&!Array.isArray(n)?e[t]=function e(t){return Array.isArray(t)?t.sort():"object"==typeof t?e(Object.keys(t)).sort((e,t)=>Number(e)-Number(t)).map(e=>t[e]):t}(n):e[t]=n,e},Object.create(null))}function S(e,t){if(!e)return"";y((t={encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:",",...t}).arrayFormatSeparator);let n=n=>t.skipNull&&f(e[n])||t.skipEmptyString&&""===e[n],i=function(e){switch(e.arrayFormat){case"index":return t=>(n,i)=>{let r=n.length;return void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:null===i?[...n,[m(t,e),"[",r,"]"].join("")]:[...n,[m(t,e),"[",m(r,e),"]=",m(i,e)].join("")]};case"bracket":return t=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:null===i?[...n,[m(t,e),"[]"].join("")]:[...n,[m(t,e),"[]=",m(i,e)].join("")];case"colon-list-separator":return t=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:null===i?[...n,[m(t,e),":list="].join("")]:[...n,[m(t,e),":list=",m(i,e)].join("")];case"comma":case"separator":case"bracket-separator":{let t="bracket-separator"===e.arrayFormat?"[]=":"=";return n=>(i,r)=>void 0===r||e.skipNull&&null===r||e.skipEmptyString&&""===r?i:(r=null===r?"":r,0===i.length)?[[m(n,e),t,m(r,e)].join("")]:[[i,m(r,e)].join(e.arrayFormatSeparator)]}default:return t=>(n,i)=>void 0===i||e.skipNull&&null===i||e.skipEmptyString&&""===i?n:null===i?[...n,m(t,e)]:[...n,[m(t,e),"=",m(i,e)].join("")]}}(t),r={};for(let[t,i]of Object.entries(e))n(t)||(r[t]=i);let o=Object.keys(r);return!1!==t.sort&&o.sort(t.sort),o.map(n=>{let r=e[n];return void 0===r?"":null===r?m(n,t):Array.isArray(r)?0===r.length&&"bracket-separator"===t.arrayFormat?m(n,t)+"[]":r.reduce(i(n),[]).join("&"):m(n,t)+"="+m(r,t)}).filter(e=>e.length>0).join("&")}function O(e,t){t={decode:!0,...t};let[n,i]=h(e,"#");return void 0===n&&(n=e),{url:n?.split("?")?.[0]??"",query:w(I(e),t),...t&&t.parseFragmentIdentifier&&i?{fragmentIdentifier:_(i,t)}:{}}}function N(e,t){t={encode:!0,strict:!0,[g]:!0,...t};let n=b(e.url).split("?")[0]||"",i=S({...w(I(e.url),{sort:!1}),...e.query},t);i&&(i=`?${i}`);let r=function(e){let t="",n=e.indexOf("#");return -1!==n&&(t=e.slice(n)),t}(e.url);if(e.fragmentIdentifier){let i=new URL(n);i.hash=e.fragmentIdentifier,r=t[g]?i.hash:`#${e.fragmentIdentifier}`}return`${n}${i}${r}`}function T(e,t,n){let{url:i,query:r,fragmentIdentifier:o}=O(e,n={parseFragmentIdentifier:!0,[g]:!1,...n});return N({url:i,query:function(e,t){let n={};if(Array.isArray(t))for(let i of t){let t=Object.getOwnPropertyDescriptor(e,i);(null==t?void 0:t.enumerable)&&Object.defineProperty(n,i,t)}else for(let i of Reflect.ownKeys(e)){let r=Object.getOwnPropertyDescriptor(e,i);if(r.enumerable){let o=e[i];t(i,o,e)&&Object.defineProperty(n,i,r)}}return n}(r,t),fragmentIdentifier:o},n)}function k(e,t,n){return T(e,Array.isArray(t)?e=>!t.includes(e):(e,n)=>!t(e,n),n)}var A=n(58315),R=n.n(A),C=n(79554);function P(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,i)}return n}function U(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,i=Array(t);n127&&i<2048?t+=String.fromCharCode(i>>6|192)+String.fromCharCode(63&i|128):t+=String.fromCharCode(i>>12|224)+String.fromCharCode(i>>6&63|128)+String.fromCharCode(63&i|128)}return t},decode:function(e){for(var t="",n=0,i=0,r=0;n191&&i<224?(t+=String.fromCharCode((31&i)<<6|63&e.charCodeAt(n+1)),n+=2):(t+=String.fromCharCode((15&i)<<12|(63&e.charCodeAt(n+1))<<6|63&e.charCodeAt(n+2)),n+=3);return t}},B="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==n.g?n.g:void 0,W={_keyStr:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode:function(e){try{if(B.btoa&&B.atob)return B.btoa(unescape(encodeURIComponent(e)))}catch(e){}return W._encode(e)},_encode:function(e){var t,n,i,r,o,s,a,u="",c=0;for(e=K.encode(e);c>2,o=(3&t)<<4|n>>4,s=(15&n)<<2|i>>6,a=63&i,isNaN(n)?s=a=64:isNaN(i)&&(a=64),u=u+W._keyStr.charAt(r)+W._keyStr.charAt(o)+W._keyStr.charAt(s)+W._keyStr.charAt(a);return u},decode:function(e){try{if(B.btoa&&B.atob)return decodeURIComponent(escape(B.atob(e)))}catch(e){}return W._decode(e)},_decode:function(e){var t,n,i,r,o,s,a,u="",c=0;for(e=e.replace(/[^A-Za-z0-9+/=]/g,"");c>4,n=(15&o)<<4|s>>2,i=(3&s)<<6|a,u+=String.fromCharCode(t),64!==s&&(u+=String.fromCharCode(n)),64!==a&&(u+=String.fromCharCode(i));return K.decode(u)}},$=Object.prototype.toString;function z(e){switch($.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":(e=e.valueOf?e.valueOf():Object.prototype.valueOf.apply(e),x(e))}var X={DISABLE:0,ERROR:1,WARN:2,INFO:3},H=X.WARN,Y={error:function(e){H>=X.ERROR&&J(e)},warn:function(e){H>=X.WARN&&J(e)},info:function(e){H>=X.INFO&&J(e)}},J=function(e){try{console.log("[Amplitude] "+e)}catch(e){}},Q=function(e,t,n){return z(e)===n||(Y.error("Invalid "+t+" input type. Expected "+n+" but received "+z(e)),!1)},Z=function(e){var t=z(e);if("object"!==t)return Y.error("Error: invalid properties format. Expecting Javascript object, received "+t+", ignoring"),{};if(Object.keys(e).length>V.MAX_PROPERTY_KEYS)return Y.error("Error: too many properties (more than 1000), ignoring"),{};var n={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=i,o=z(r);"string"!==o&&(r=String(r),Y.warn("WARNING: Non-string property key, received type "+o+', coercing to string "'+r+'"'));var s=et(r,e[i]);null!==s&&(n[r]=s)}return n},ee=["nan","function","arguments","regexp","element"],et=function e(t,n){var i=z(n);if(-1!==ee.indexOf(i))Y.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),Y.warn('WARNING: Property key "'+t+'" with value type error, coercing to '+n);else if("array"===i){for(var r=[],o=0;oV.MAX_STRING_LENGTH?n.substring(0,V.MAX_STRING_LENGTH):n;return t},validateGroups:function(e){var t=z(e);if("object"!==t)return Y.error("Error: invalid groups format. Expecting Javascript object, received "+t+", ignoring"),{};var n={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=i,o=z(r);"string"!==o&&(r=String(r),Y.warn("WARNING: Non-string groupType, received type "+o+', coercing to string "'+r+'"'));var s=en(r,e[i]);null!==s&&(n[r]=s)}return n},validateInput:Q,validateProperties:Z,validateDeviceId:function(e){return!!Q(e,"deviceId","string")&&(!(e.indexOf(".")>=0)||(Y.error("Device IDs may not contain '.' characters. Value will be ignored: \"".concat(e,'"')),!1))},validateTransport:function(e){return!!Q(e,"transport","string")&&(e!==V.TRANSPORT_HTTP&&e!==V.TRANSPORT_BEACON?(Y.error("transport value must be one of '".concat(V.TRANSPORT_BEACON,"' or '").concat(V.TRANSPORT_HTTP,"'")),!1):e===V.TRANSPORT_HTTP||"undefined"==typeof navigator||!!navigator.sendBeacon||(Y.error("browser does not support sendBeacon, so transport must be HTTP"),!1))},validateSessionId:function(e){return!!(Q(e,"sessionId","number")&&new Date(e).getTime()>0)||(Y.error("sessionId value must in milliseconds since epoch (Unix Timestamp)"),!1)},getLocation:function(){return B.location},getHost:function(e){var t=B.location?B.location.hostname:"";if(e){if("undefined"!=typeof document){var n=document.createElement("a");return n.href=e,n.hostname||t}if("function"==typeof URL)return new URL(e).hostname||t}return t}},er=function(e){try{for(var t=document.cookie.split(";"),n=null,i=0;i0&&void 0!==arguments[0]?arguments[0]:"",n=t.split(".")[V.LAST_EVENT_TIME_INDEX];return(n&&(e=parseInt(n,32)),e)?e:(ei.log.warn("unable to parse malformed cookie: ".concat(t)),0)},ea={set:eo,get:er,getAll:function(e){try{var t,n=document.cookie.split(";").map(function(e){return e.trimStart()}),i=[],r=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=L(e))){n&&(e=n);var i=0,r=function(){};return{s:r,n:function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}},e:function(e){throw e},f:r}}throw TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}(n);try{for(r.s();!(t=r.n()).done;){for(var o=t.value;" "===o.charAt(0);)o=o.substring(1);0===o.indexOf(e)&&i.push(o.substring(e.length))}}catch(e){r.e(e)}finally{r.f()}return i}catch(e){return[]}},sortByEventTime:function(e){return((function(e){if(Array.isArray(e))return F(e)})(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()).sort(function(e,t){var n=es(e);return es(t)-n})},areCookiesEnabled:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=V.COOKIE_TEST_PREFIX;if("undefined"==typeof document)return!1;var n=!1;try{var i=String(Date.now());eo(t,i,e),ei.log.info("Testing if cookies available"),n=er(t+"=")===i}catch(e){ei.log.warn('Error thrown when checking for cookies. Reason: "'.concat(e,'"'))}finally{ei.log.info("Cleaning up cookies availability test"),eo(t,null,e)}return n}},eu=function(){for(var e="",t=0;t<22;++t)e+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".charAt(Math.floor(64*Math.random()));return e},ec=function(e){var t=ei.getHost(e).split("."),n=[],i="_tldtest_"+eu();if(ei.isWebWorkerEnvironment())return"";for(var r=t.length-2;r>=0;--r)n.push(t.slice(r).join("."));for(var o=0;o0?Object.prototype.hasOwnProperty.call(this.userPropertiesOperations,eS)||ei.log.error("Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll"):this.userPropertiesOperations[eS]="-",this},eO.prototype.prepend=function(e,t){return this._addOperation("$prepend",e,t),this},eO.prototype.set=function(e,t){return this._addOperation("$set",e,t),this},eO.prototype.setOnce=function(e,t){return this._addOperation("$setOnce",e,t),this},eO.prototype.unset=function(e){return this._addOperation("$unset",e,"-"),this},eO.prototype.preInsert=function(e,t){return this._addOperation("$preInsert",e,t),this},eO.prototype.postInsert=function(e,t){return this._addOperation("$postInsert",e,t),this},eO.prototype.remove=function(e,t){return this._addOperation("$remove",e,t),this},eO.prototype._addOperation=function(e,t,n){if(Object.prototype.hasOwnProperty.call(this.userPropertiesOperations,eS)){ei.log.error("This identify already contains a $clearAll operation, skipping operation "+e);return}if(-1!==this.properties.indexOf(t)){ei.log.error('User property "'+t+'" already used in this identify, skipping operation '+e);return}Object.prototype.hasOwnProperty.call(this.userPropertiesOperations,e)||(this.userPropertiesOperations[e]={}),this.userPropertiesOperations[e][t]=n,this.properties.push(t)};var eN=function(e,t,n){this.url=e,this.data=t||{},this.headers=n};eN.prototype.send=function(e){if(B.XDomainRequest){var t=new B.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(o.stringify(this.data))}else if("undefined"!=typeof XMLHttpRequest){var n=new XMLHttpRequest;n.open("POST",this.url,!0),n.onreadystatechange=function(){4===n.readyState&&e(n.status,n.responseText)},function(e,t){for(var n in t)("Cross-Origin-Resource-Policy"!==n||t[n])&&e.setRequestHeader(n,t[n])}(n,this.headers),n.send(o.stringify(this.data))}else{var i=void 0;fetch(this.url,{method:"POST",headers:this.headers,body:o.stringify(this.data)}).then(function(e){return i=e.status,e.text()}).then(function(t){e(i,t)})}};var eT=function(){this._price=null,this._productId=null,this._quantity=1,this._revenueType=null,this._properties=null};eT.prototype.setProductId=function(e){return"string"!==z(e)?ei.log.error("Unsupported type for productId: "+z(e)+", expecting string"):ei.isEmptyString(e)?ei.log.error("Invalid empty productId"):this._productId=e,this},eT.prototype.setQuantity=function(e){return"number"!==z(e)?ei.log.error("Unsupported type for quantity: "+z(e)+", expecting number"):this._quantity=parseInt(e),this},eT.prototype.setPrice=function(e){return"number"!==z(e)?ei.log.error("Unsupported type for price: "+z(e)+", expecting number"):this._price=e,this},eT.prototype.setRevenueType=function(e){return"string"!==z(e)?ei.log.error("Unsupported type for revenueType: "+z(e)+", expecting string"):this._revenueType=e,this},eT.prototype.setEventProperties=function(e){return"object"!==z(e)?ei.log.error("Unsupported type for eventProperties: "+z(e)+", expecting object"):this._properties=ei.validateProperties(e),this},eT.prototype._isValidRevenue=function(){return"number"===z(this._price)||(ei.log.error("Invalid revenue, need to set price field"),!1)},eT.prototype._toJSONObject=function(){var e="object"===z(this._properties)?this._properties:{};return null!==this._productId&&(e[V.REVENUE_PRODUCT_ID]=this._productId),null!==this._quantity&&(e[V.REVENUE_QUANTITY]=this._quantity),null!==this._price&&(e[V.REVENUE_PRICE]=this._price),null!==this._revenueType&&(e[V.REVENUE_REVENUE_TYPE]=this._revenueType),e};var ek={US:"US",EU:"EU"},eA=function(e){var t=V.EVENT_LOG_URL;switch(e){case ek.EU:t=V.EVENT_LOG_EU_URL;break;case ek.US:t=V.EVENT_LOG_URL}return t},eR=function(e){var t=V.DYNAMIC_CONFIG_URL;switch(e){case ek.EU:t=V.DYNAMIC_CONFIG_EU_URL;break;case ek.US:t=V.DYNAMIC_CONFIG_URL}return t},eC="8.21.9",eP={apiEndpoint:V.EVENT_LOG_URL,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,ingestionMetadata:{sourceName:"",sourceVersion:""},language:({getLanguage:function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage)||""}}).getLanguage(),library:{name:"amplitude-js",version:eC},logLevel:"WARN",logAttributionCapturedEvent:!1,optOut:!1,onError:function(){},onExitPage:function(){},onNewSessionStart:function(){},plan:{branch:"",source:"",version:"",versionId:""},platform:"Web",savedMaxCount:1e3,saveEvents:!0,saveParamsReferrerOncePerSession:!0,secureCookie:!1,sessionTimeout:18e5,storage:V.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:V.TRANSPORT_HTTP,unsetParamsReferrerOnNewSession:!1,unsentKey:"amplitude_unsent",unsentIdentifyKey:"amplitude_unsent_identify",uploadBatchSize:100,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8","Cross-Origin-Resource-Policy":"cross-origin"},serverZone:ek.US,useDynamicConfig:!1,serverZoneBasedApi:!1,sessionId:null,partnerId:""},eU=new(function(){function e(){return D(this,e),e.instance||(this.ingestionEndpoint=V.EVENT_LOG_URL,e.instance=this),e.instance}return q(e,[{key:"refresh",value:function(e,t,n){var i="https";t||"https:"===B.location.protocol||(i="http");var r=i+"://"+eR(e),o=this;if(B.XDomainRequest){var s=new B.XDomainRequest;s.open("GET",r,!0),s.onload=function(){var e=JSON.parse(s.responseText);o.ingestionEndpoint=e.ingestionEndpoint,n&&n()},s.onerror=function(){},s.ontimeout=function(){},s.onprogress=function(){},s.send()}else{var a=new XMLHttpRequest;a.open("GET",r,!0),a.onreadystatechange=function(){if(4===a.readyState&&200===a.status){var e=JSON.parse(a.responseText);o.ingestionEndpoint=e.ingestionEndpoint,n&&n()}},a.send()}}}]),e}()),ex=function(e){s()||ei.isWebWorkerEnvironment()||ei.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=ei.isEmptyString(e)?V.DEFAULT_INSTANCE:e.toLowerCase(),this._unsentEvents=[],this._unsentIdentifys=[],this.options=U(U({},eP),{},{headers:U({},eP.headers),ingestionMetadata:U({},eP.ingestionMetadata),library:U({},eP.library),plan:U({},eP.plan),trackingOptions:U({},eP.trackingOptions)}),this._q=[],this._sending=!1,this._updateScheduled=!1,this._onInitCallbacks=[],this._onNewSessionStartCallbacks=[],this._eventId=0,this._identifyId=0,this._lastEventTime=null,this._newSession=!1,this._sequenceNumber=0,this._sessionId=null,this._isInitialized=!1,this._connector=null,this._userAgent="undefined"!=typeof navigator&&navigator&&navigator.userAgent||null,this._ua=new(R())(this._userAgent).getResult()};ex.prototype.Identify=eO,ex.prototype.Revenue=eT,ex.prototype.init=function(e,t,n,i){var r=this;if("string"!==z(e)||ei.isEmptyString(e)){ei.log.error("Invalid apiKey. Please re-initialize with a valid apiKey");return}try{this._connector=C.V.getInstance(this._instanceName),ej(this.options,n),(s()||ei.isWebWorkerEnvironment())&&void 0!==B.Prototype&&Array.prototype.toJSON&&(a(),ei.log.warn("Prototype.js injected Array.prototype.toJSON. Deleting Array.prototype.toJSON to prevent double-stringify")),this.options.cookieName!==eP.cookieName&&ei.log.warn("The cookieName option is deprecated. We will be ignoring it for newer cookies"),this.options.serverZoneBasedApi&&(this.options.apiEndpoint=eA(this.options.serverZone)),this._refreshDynamicConfig(),this.options.apiKey=e,this._storageSuffix="_"+e+(this._instanceName===V.DEFAULT_INSTANCE?"":"_"+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=V.COOKIE_PREFIX+"_"+this._storageSuffixV5,this.cookieStorage=new eb().getStorage(this.options.disableCookies),this.cookieStorage.options({expirationDays:this.options.cookieExpiration,domain:this.options.domain,secure:this.options.secureCookie,sameSite:this.options.sameSiteCookie}),this._metadataStorage=new eI({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 o=!!this.cookieStorage.get(this._oldCookiename),u=!!this._metadataStorage.load();if(this._useOldCookie=!u&&o&&!this.options.cookieForceUpgrade,this.options.deferInitialization&&!(u||o)){this._deferInitialization(e,t,n,i);return}this.options.domain=this.cookieStorage.options().domain,"string"===z(this.options.logLevel)&&ei.setLogLevel(this.options.logLevel);var c=e$(this);this._apiPropertiesTrackingOptions=Object.keys(c).length>0?{tracking_options:c}:{},this.options.cookieForceUpgrade&&o&&(u||eM(this),this.cookieStorage.remove(this._oldCookiename)),eq(this),this._pendingReadStorage=!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)),n&&n.onNewSessionStart&&this.onNewSessionStart(this.options.onNewSessionStart),function(){n&&n.deviceId&&!ei.validateDeviceId(n.deviceId)&&(ei.log.error('Invalid device ID rejected. Randomly generated UUID will be used instead of "'.concat(n.deviceId,'"')),delete n.deviceId),r.options.deviceId=r._getInitialDeviceId(n&&n.deviceId,void 0),r.options.userId="string"===z(t)&&!ei.isEmptyString(t)&&t||"number"===z(t)&&t.toString()||r.options.userId||null;var e=new Date().getTime(),i=!r._sessionId||!r._lastEventTime||e-r._lastEventTime>r.options.sessionTimeout||r.options.sessionId;i&&(r.options.unsetParamsReferrerOnNewSession&&r._unsetUTMParams(),r._newSession=!0,r._sessionId=r.options.sessionId||e,r.options.sessionId=void 0,r.options.saveParamsReferrerOncePerSession&&r._trackParamsAndReferrer()),r.options.saveParamsReferrerOncePerSession||r._trackParamsAndReferrer(),r.options.saveEvents&&(eD(r._unsentEvents),eD(r._unsentIdentifys)),r._lastEventTime=e,eF(r),r._pendingReadStorage=!1,r._sendEventsIfReady();for(var o=0;oi.length;--r){var o=n.slice(n.length-r).join(".");ea.set(this._cookieName,null,{domain:"."+o})}ea.set(this._cookieName,null,{})}},ex.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||eu()};var eD=function(e){for(var t=0;t0&&this.logEvent(V.ATTRIBUTION_EVENT,r)}};var ej=function e(t,n){if("object"===z(n)){var i=new Set(["headers"]),r=new Set(["eventUploadPeriodMillis"]);for(var o in n)i.has(o)?t[o]=U(U({},t[o]),n[o]):Object.prototype.hasOwnProperty.call(n,o)&&function(i){if(Object.prototype.hasOwnProperty.call(t,i)){var o=n[i],s=z(t[i]);if("transport"!==i||ei.validateTransport(o)){if("sessionId"===i&&null!==o){t[i]=ei.validateSessionId(o)?o:null;return}ei.validateInput(o,i+" option",s)&&("boolean"===s?t[i]=!!o:"string"===s&&!ei.isEmptyString(o)||"number"===s&&(o>0||0===o&&r.has(i))||"function"===s?t[i]=o:"object"===s&&e(t[i],o))}}}(o)}};ex.prototype.runQueuedFunctions=function(){var e=this._q;this._q=[];for(var t=0;t=this.options.eventUploadThreshold||this.options.transport===V.TRANSPORT_BEACON?(this.sendEvents(),!0):(this._updateScheduled||(this._updateScheduled=!0,setTimeout((function(){this._updateScheduled=!1,this.sendEvents()}).bind(this),this.options.eventUploadPeriodMillis)),!1))},ex.prototype.clearStorage=function(){return this._metadataStorage.clear()},ex.prototype._getFromStorage=function(e,t){return e.getItem(t+this._storageSuffix)},ex.prototype._setInStorage=function(e,t,n){e.setItem(t+this._storageSuffix,n)};var eq=function(e){if(!e._useOldCookie){var t=e._metadataStorage.load();"object"===z(t)&&eL(e,t);return}var n=e.cookieStorage.get(e._oldCookiename);if("object"===z(n)){eL(e,n);return}},eM=function(e){var t=e.cookieStorage.get(e._oldCookiename);"object"===z(t)&&(eL(e,t),eF(e))},eL=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))},eF=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)};ex.prototype._initUtmData=function(e,t){e=e||this._getUrlParams();var n=ew(t=t||this.cookieStorage.get("__utmz"),e);return eG(this,n),n},ex.prototype._unsetUTMParams=function(){var e=new eO;e.unset(V.REFERRER),e.unset(V.REFERRING_DOMAIN),e.unset(V.UTM_SOURCE),e.unset(V.UTM_MEDIUM),e.unset(V.UTM_CAMPAIGN),e.unset(V.UTM_TERM),e.unset(V.UTM_CONTENT),this.identify(e)};var eG=function(e,t){if("object"===z(t)&&0!==Object.keys(t).length){var n=new eO;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(n.setOnce("initial_"+i,t[i]),n.set(i,t[i]));e.identify(n)}};ex.prototype._getReferrer=function(){return this._getReferrerFromUrlParam(this._getUrlParams())||("undefined"!=typeof document?document.referrer:"")},ex.prototype._getUrlParams=function(){return B.location.search},ex.prototype._saveGclid=function(e){var t=ei.getQueryParam("gclid",e);if(!ei.isEmptyString(t)){var n={gclid:t};return eG(this,n),n}},ex.prototype._saveFbclid=function(e){var t=ei.getQueryParam("fbclid",e);if(!ei.isEmptyString(t)){var n={fbclid:t};return eG(this,n),n}},ex.prototype._getDeviceIdFromUrlParam=function(e){return ei.getQueryParam(V.AMP_DEVICE_ID_PARAM,e)},ex.prototype._getReferrerFromUrlParam=function(e){return ei.getQueryParam(V.AMP_REFERRER_PARAM,e)},ex.prototype._getReferringDomain=function(e){if(ei.isEmptyString(e))return null;var t=e.split("/");return t.length>=3?t[2]:null},ex.prototype._saveReferrer=function(e){if(!ei.isEmptyString(e)){var t={referrer:e,referring_domain:this._getReferringDomain(e)};return eG(this,t),t}},ex.prototype.saveEvents=function(){try{var e=JSON.stringify(this._unsentEvents.map(function(e){return e.event}));this._setInStorage(e_,this.options.unsentKey,e)}catch(e){}try{var t=JSON.stringify(this._unsentIdentifys.map(function(e){return e.event}));this._setInStorage(e_,this.options.unsentIdentifyKey,t)}catch(e){}},ex.prototype.setDomain=function(e){if(this._shouldDeferCall())return this._q.push(["setDomain"].concat(Array.prototype.slice.call(arguments,0)));if(ei.validateInput(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,eq(this),eF(this)}catch(e){ei.log.error(e)}},ex.prototype.setUserId=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(ei.validateInput(t,"startNewSession","boolean")){if(this._shouldDeferCall())return this._q.push(["setUserId"].concat(Array.prototype.slice.call(arguments,0)));try{this.options.userId=null!=e&&""+e||null,t&&(this.options.unsetParamsReferrerOnNewSession&&this._unsetUTMParams(),this._newSession=!0,this._sessionId=new Date().getTime(),this._runNewSessionStartCallbacks(),this.options.saveParamsReferrerOncePerSession&&this._trackParamsAndReferrer()),eF(this),this._connector&&this._connector.identityStore.editIdentity().setUserId(this.options.userId).commit()}catch(e){ei.log.error(e)}}},ex.prototype.setGroup=function(e,t){if(this._shouldDeferCall())return this._q.push(["setGroup"].concat(Array.prototype.slice.call(arguments,0)));if(!(!this._apiKeySet("setGroup()")||!ei.validateInput(e,"groupType","string")||ei.isEmptyString(e))){var n={};n[e]=t;var i=new eO().set(e,t);this._logEvent(V.IDENTIFY_EVENT,null,null,i.userPropertiesOperations,n,null,null,null)}},ex.prototype.setOptOut=function(e){if(this._shouldDeferCall())return this._q.push(["setOptOut"].concat(Array.prototype.slice.call(arguments,0)));if(ei.validateInput(e,"enable","boolean"))try{this.options.optOut=e,eF(this)}catch(e){ei.log.error(e)}},ex.prototype.setSessionId=function(e){if(ei.validateInput(e,"sessionId","number"))try{this._sessionId=e,eF(this)}catch(e){ei.log.error(e)}},ex.prototype.resetSessionId=function(){this.setSessionId(new Date().getTime())},ex.prototype.regenerateDeviceId=function(){if(this._shouldDeferCall())return this._q.push(["regenerateDeviceId"].concat(Array.prototype.slice.call(arguments,0)));this.setDeviceId(eu())},ex.prototype.setDeviceId=function(e){if(this._shouldDeferCall())return this._q.push(["setDeviceId"].concat(Array.prototype.slice.call(arguments,0)));if(ei.validateDeviceId(e))try{!ei.isEmptyString(e)&&(this.options.deviceId=""+e,eF(this),this._connector&&this._connector.identityStore.editIdentity().setDeviceId(this.options.deviceId).commit())}catch(e){ei.log.error(e)}},ex.prototype.setTransport=function(e){if(this._shouldDeferCall())return this._q.push(["setTransport"].concat(Array.prototype.slice.call(arguments,0)));ei.validateTransport(e)&&(this.options.transport=e)},ex.prototype.setUserProperties=function(e){if(this._shouldDeferCall())return this._q.push(["setUserProperties"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("setUserProperties()")&&ei.validateInput(e,"userProperties","object")){var t=ei.truncate(ei.validateProperties(e));if(0!==Object.keys(t).length){var n=new eO;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&n.set(i,t[i]);this.identify(n)}}},ex.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 eO;e.clearAll(),this.identify(e)}};var eV=function(e,t){for(var n=0;n0)return this._logEvent(V.IDENTIFY_EVENT,null,null,e.userPropertiesOperations,null,null,null,t,n,i);eX(t,n,0,"No request sent",{reason:"No user property operations"})}else ei.log.error("Invalid identify input type. Expected Identify object but saw "+z(e)),eX(t,n,0,"No request sent",{reason:"Invalid identify input type"})},ex.prototype.groupIdentify=function(e,t,n,i,r,o){if(this._shouldDeferCall())return this._q.push(["groupIdentify"].concat(Array.prototype.slice.call(arguments,0)));if(!this._apiKeySet("groupIdentify()")){eX(i,r,0,"No request sent",{reason:"API key is not set"});return}if(!ei.validateInput(e,"group_type","string")||ei.isEmptyString(e)){eX(i,r,0,"No request sent",{reason:"Invalid group type"});return}if(null==t){eX(i,r,0,"No request sent",{reason:"Invalid group name"});return}if("object"===z(n)&&Object.prototype.hasOwnProperty.call(n,"_q")&&(n=eV(new eO,n)),n instanceof eO){if(Object.keys(n.userPropertiesOperations).length>0)return this._logEvent(V.GROUP_IDENTIFY_EVENT,null,null,null,M({},e,t),n.userPropertiesOperations,null,i,r,o);eX(i,r,0,"No request sent",{reason:"No group property operations"})}else ei.log.error("Invalid identify input type. Expected Identify object but saw "+z(n)),eX(i,r,0,"No request sent",{reason:"Invalid identify input type"})},ex.prototype.setVersionName=function(e){if(this._shouldDeferCall())return this._q.push(["setVersionName"].concat(Array.prototype.slice.call(arguments,0)));ei.validateInput(e,"versionName","string")&&(this.options.versionName=e)},ex.prototype._logEvent=function(e,t,n,i,r,o,s,a,u,c){if(eq(this),!e){eX(a,u,0,"No request sent",{reason:"Missing eventType"});return}if(this.options.optOut){eX(a,u,0,"No request sent",{reason:"optOut is set to true"});return}try{l=e===V.IDENTIFY_EVENT||e===V.GROUP_IDENTIFY_EVENT?this.nextIdentifyId():this.nextEventId();var l,p=this.nextSequenceNumber(),d="number"===z(s)?s:new Date().getTime();c?this._sessionId=-1:this._sessionId&&this._lastEventTime&&!(d-this._lastEventTime>this.options.sessionTimeout)||(this._sessionId=d,this._runNewSessionStartCallbacks()),this._lastEventTime=d,eF(this);var h=this._ua.browser.name,f=this._ua.browser.major,v=this._ua.device.model||this._ua.os.name,g=this._ua.device.vendor;i=i||{};var y=U({},this._apiPropertiesTrackingOptions);n=U(U({},n||{}),y),t=t||{},r=r||{},o=o||{};var m={device_id:this.options.deviceId,user_id:this.options.userId,timestamp:d,event_id:l,session_id:this._sessionId||-1,event_type:e,version_name:this.options.versionName||null,platform:eW(this,"platform")?this.options.platform:null,os_name:eW(this,"os_name")&&h||null,os_version:eW(this,"os_version")&&f||null,device_model:eW(this,"device_model")&&v||null,device_manufacturer:eW(this,"device_manufacturer")&&g||null,language:eW(this,"language")?this.options.language:null,api_properties:n,event_properties:ei.truncate(ei.validateProperties(t)),user_properties:ei.truncate(ei.validateProperties(i)),uuid:function e(t){return t?(t^16*Math.random()>>t/4).toString(16):"10000000-1000-4000-8000-100000000000".replace(/[018]/g,e)}(),library:this.options.library,sequence_number:p,groups:ei.truncate(ei.validateGroups(r)),group_properties:ei.truncate(ei.validateProperties(o)),user_agent:this._userAgent,partner_id:this.options.partnerId||null};return eK(this)&&(m.plan={branch:this.options.plan.branch||void 0,source:this.options.plan.source||void 0,version:this.options.plan.version||void 0,versionId:this.options.plan.versionId||void 0}),eB(this)&&(m.ingestion_metadata={source_name:this.options.ingestionMetadata.sourceName||void 0,source_version:this.options.ingestionMetadata.sourceVersion||void 0}),e===V.IDENTIFY_EVENT||e===V.GROUP_IDENTIFY_EVENT?(this._unsentIdentifys.push({event:m,callback:a,errorCallback:u}),this._limitEventsQueued(this._unsentIdentifys)):(this._unsentEvents.push({event:m,callback:a,errorCallback:u}),this._limitEventsQueued(this._unsentEvents)),this.options.saveEvents&&this.saveEvents(),this._sendEventsIfReady(),e===V.IDENTIFY_EVENT&&this._connector&&this._connector.identityStore.editIdentity().updateUserProperties(ei.truncate(ei.validateProperties(i))).commit(),l}catch(e){ei.log.error(e)}};var eK=function(e){return e.options.plan&&(e.options.plan.source||e.options.plan.branch||e.options.plan.version||e.options.plan.versionId)},eB=function(e){return e.options.ingestionMetadata&&(e.options.ingestionMetadata.sourceName||e.options.ingestionMetadata.sourceVersion)},eW=function(e,t){return!!e.options.trackingOptions[t]},e$=function(e){for(var t=["city","country","dma","ip_address","region"],n={},i=0;ithis.options.savedMaxCount&&e.splice(0,e.length-this.options.savedMaxCount).forEach(function(e){eX(e.callback,e.errorCallback,0,"No request sent",{reason:"Event dropped because options.savedMaxCount exceeded. User may be offline or have a content blocker"})})},ex.prototype.logEvent=function(e,t,n,i){var r=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return this._shouldDeferCall()?this._q.push(["logEvent"].concat(Array.prototype.slice.call(arguments,0))):this.logEventWithTimestamp(e,t,null,n,i,r)},ex.prototype.logEventWithTimestamp=function(e,t,n,i,r){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return this._shouldDeferCall()?this._q.push(["logEventWithTimestamp"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logEvent()")?ei.validateInput(e,"eventType","string")?ei.isEmptyString(e)?(eX(i,r,0,"No request sent",{reason:"Missing eventType"}),-1):(ei.validateInput(o,"outOfSession","boolean")||eX(i,r,0,"No request sent",{reason:"Invalid outOfSession value"}),this._logEvent(e,t,null,null,null,null,n,i,r,o)):(eX(i,r,0,"No request sent",{reason:"Invalid type for eventType"}),-1):(eX(i,r,0,"No request sent",{reason:"API key not set"}),-1)},ex.prototype.logEventWithGroups=function(e,t,n,i,r){var o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];return this._shouldDeferCall()?this._q.push(["logEventWithGroups"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logEventWithGroups()")?ei.validateInput(e,"eventType","string")?(ei.validateInput(o,"outOfSession","boolean")||eX(event.callback,event.errorCallback,0,"No request sent",{reason:"Invalid outOfSession value"}),this._logEvent(e,t,null,null,n,null,null,i,r,o)):(eX(event.callback,event.errorCallback,0,"No request sent",{reason:"Invalid type for eventType"}),-1):(eX(event.callback,event.errorCallback,0,"No request sent",{reason:"API key not set"}),-1)};var ez=function(e){return!isNaN(parseFloat(e))&&isFinite(e)},eX=function(e,t,n,i,r){"function"===z(e)&&e(n,i,r),"function"===z(t)&&t(n,i,r)};ex.prototype.logRevenueV2=function(e){if(this._shouldDeferCall())return this._q.push(["logRevenueV2"].concat(Array.prototype.slice.call(arguments,0)));if(this._apiKeySet("logRevenueV2()")){if("object"===z(e)&&Object.prototype.hasOwnProperty.call(e,"_q")&&(e=eV(new eT,e)),e instanceof eT){if(e&&e._isValidRevenue())return this.logEvent(V.REVENUE_EVENT,e._toJSONObject())}else ei.log.error("Invalid revenue input type. Expected Revenue object but saw "+z(e))}},ex.prototype.logRevenue=function(e,t,n){return this._shouldDeferCall()?this._q.push(["logRevenue"].concat(Array.prototype.slice.call(arguments,0))):this._apiKeySet("logRevenue()")&&ez(e)&&(void 0===t||ez(t))?this._logEvent(V.REVENUE_EVENT,{},{productId:n,special:"revenue_amount",quantity:t||1,price:e},null,null,null,null,null):-1},ex.prototype._logErrorsOnEvents=function(e,t,n,i){for(var r=["_unsentEvents","_unsentIdentifys"],o=0;on?o.push(a):a.callback&&a.callback(i,r)}e[t]=o}};ex.prototype.sendEvents=function(){if(!this._apiKeySet("sendEvents()")){this.removeEvents(1/0,1/0,0,"No request sent",{reason:"API key not set"});return}if(this.options.optOut){this.removeEvents(1/0,1/0,0,"No request sent",{reason:"Opt out is set to true"});return}if(0!==this._unsentCount()){if(this.options.transport!==V.TRANSPORT_BEACON){if(this._sending)return;this._sending=!0}var e=(this.options.forceHttps?"https":"https:"===B.location.protocol?"https":"http")+"://"+this.options.apiEndpoint,t=Math.min(this._unsentCount(),this.options.uploadBatchSize),n=this._mergeEventsAndIdentifys(t),i=n.maxEventId,r=n.maxIdentifyId,o=JSON.stringify(n.eventsToSend.map(function(e){return e.event})),s=new Date().getTime(),a={client:this.options.apiKey,e:o,v:V.API_VERSION,upload_time:s,checksum:c()(V.API_VERSION+this.options.apiKey+o+s)};if(this.options.transport===V.TRANSPORT_BEACON&&"undefined"!=typeof navigator){navigator.sendBeacon(e,new URLSearchParams(a))?(this.removeEvents(i,r,200,"success"),this.options.saveEvents&&this.saveEvents()):this._logErrorsOnEvents(i,r,0,"");return}var u=this;try{new eN(e,a,this.options.headers).send(function(e,n){u._sending=!1;try{200===e?(u.removeEvents(i,r,e,n),u.options.saveEvents&&u.saveEvents(),u._sendEventsIfReady()):(u._logErrorsOnEvents(i,r,e,n),413===e&&(1===u.options.uploadBatchSize&&u.removeEvents(i,r,e,n),u.options.uploadBatchSize=Math.ceil(t/2),u.sendEvents()))}catch(e){}})}catch(e){var l="Request failed to send";ei.log.error(l),u._logErrorsOnEvents(i,r,0,l),u.removeEvents(i,r,0,l,{reason:e.message})}}},ex.prototype._mergeEventsAndIdentifys=function(e){for(var t=[],n=0,i=-1,r=0,o=-1;t.length=this._unsentIdentifys.length,u=n>=this._unsentEvents.length;if(u&&a){ei.log.error("Merging Events and Identifys, less events and identifys than expected");break}a?i=(s=this._unsentEvents[n++]).event.event_id:u?o=(s=this._unsentIdentifys[r++]).event.event_id:"sequence_number"in this._unsentEvents[n].event&&!(this._unsentEvents[n].event.sequence_number1)||void 0===arguments[1]||arguments[1];if((e===ek.EU||e===ek.US)&&ei.validateInput(t,"serverZoneBasedApi","boolean")){if(this._shouldDeferCall())return this._q.push(["setServerZone"].concat(Array.prototype.slice.call(arguments,0)));try{this.options.serverZone=e,this.options.serverZoneBasedApi=t,t&&(this.options.apiEndpoint=eA(this.options.serverZone))}catch(e){ei.log.error(e)}}},ex.prototype.setServerUrl=function(e){if(ei.validateInput(e,"serverUrl","string")){if(this._shouldDeferCall())return this._q.push(["setServerUrl"].concat(Array.prototype.slice.call(arguments,0)));try{this.options.apiEndpoint=e}catch(e){ei.log.error(e)}}};var eY=function(){this.options=U({},eP),this._q=[],this._instances={}};eY.prototype.Identify=eO,eY.prototype.Revenue=eT,eY.prototype.getInstance=function(e){e=ei.isEmptyString(e)?V.DEFAULT_INSTANCE:e.toLowerCase();var t=this._instances[e];return void 0===t&&(t=new ex(e),this._instances[e]=t),t},eY.prototype.init=function(e,t,n,i){this.getInstance().init(e,t,n,(function(e){this.options=e.options,"function"===z(i)&&i(e)}).bind(this))},eY.prototype.isNewSession=function(){return this.getInstance().isNewSession()},eY.prototype.getSessionId=function(){return this.getInstance().getSessionId()},eY.prototype.nextEventId=function(){return this.getInstance().nextEventId()},eY.prototype.nextIdentifyId=function(){return this.getInstance().nextIdentifyId()},eY.prototype.nextSequenceNumber=function(){return this.getInstance().nextSequenceNumber()},eY.prototype.saveEvents=function(){this.getInstance().saveEvents()},eY.prototype.setDomain=function(e){this.getInstance().setDomain(e)},eY.prototype.setUserId=function(e){this.getInstance().setUserId(e)},eY.prototype.setGroup=function(e,t){this.getInstance().setGroup(e,t)},eY.prototype.setOptOut=function(e){this.getInstance().setOptOut(e)},eY.prototype.regenerateDeviceId=function(){this.getInstance().regenerateDeviceId()},eY.prototype.setDeviceId=function(e){this.getInstance().setDeviceId(e)},eY.prototype.setUserProperties=function(e){this.getInstance().setUserProperties(e)},eY.prototype.clearUserProperties=function(){this.getInstance().clearUserProperties()},eY.prototype.identify=function(e,t){this.getInstance().identify(e,t)},eY.prototype.setVersionName=function(e){this.getInstance().setVersionName(e)},eY.prototype.logEvent=function(e,t,n){return this.getInstance().logEvent(e,t,n)},eY.prototype.logEventWithGroups=function(e,t,n,i){return this.getInstance().logEventWithGroups(e,t,n,i)},eY.prototype.logRevenueV2=function(e){return this.getInstance().logRevenueV2(e)},eY.prototype.logRevenue=function(e,t,n){return this.getInstance().logRevenue(e,t,n)},eY.prototype.removeEvents=function(e,t){this.getInstance().removeEvents(e,t)},eY.prototype.sendEvents=function(e){this.getInstance().sendEvents(e)},eY.prototype.setGlobalUserProperties=function(e){this.getInstance().setUserProperties(e)},eY.prototype.__VERSION__=eC;var eJ=void 0!==B&&B.amplitude||{},eQ=new eY;for(var eZ in eQ._q=eJ._q||[],eJ._iq)Object.prototype.hasOwnProperty.call(eJ._iq,eZ)&&(eQ.getInstance(eZ)._q=eJ._iq[eZ]._q||[])}}]);