@amplitude/analytics-browser 2.24.0 → 2.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- !function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n,r,i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function d(e){return this instanceof d?(this.v=e,this):new d(e)}function f(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||u(e,t)}))},t&&(r[e]=t(r[e])))}function u(e,t){try{!function(e){e.value instanceof d?Promise.resolve(e.value.v).then(a,c):l(o[0][2],e)}(i[e](t))}catch(e){l(o[0][3],e)}}function a(e){u("next",e)}function c(e){u("throw",e)}function l(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=a(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(n||(n={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(r||(r={}));var v,h="AMP",g="".concat(h,"_unsent"),y="$default_instance",m="https://api2.amplitude.com/2/httpapi",b="dclid",w="fbclid",E="gbraid",_="gclid",S="ko_click_id",T="li_fat_id",I="msclkid",k="rdt_cid",x="ttclid",O="twclid",P="wbraid",A={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],C=["authorization","cookie","set-cookie"],N=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!L(t,n))return!1}return!0},L=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=a(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)i=i&&N(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return N(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},U=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return i({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(v.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(v.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(v.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(v.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(v.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(v.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(v.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(v.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(v.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[v.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[v.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===v.ADD?"number"==typeof n:e===v.UNSET||e===v.REMOVE||L(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(v||(v={}));var q,j=[v.CLEAR_ALL,v.UNSET,v.SET,v.SET_ONCE,v.ADD,v.APPEND,v.PREPEND,v.PREINSERT,v.POSTINSERT,v.REMOVE];!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(q||(q={}));var D,M=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=q.Unknown),{event:e,code:t,message:n}},F=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},V=l([],c(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),$=function(e){var t,n=F();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,$)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,l([],c(r.entries()),!1).map((function(e){var t=c(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(V[r]):V[r]})).join("")},B=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=$(),this.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,(function(){var r,i;return u(this,(function(o){switch(o.label){case 0:return r=this.plugins.findIndex((function(t){return t.name===e})),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}}))}))},e.prototype.reset=function(e){this.applying=!1,this.plugins.map((function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)})),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return s(this,void 0,void 0,(function(){var t,n,r,o,s,l,d,f,p,v,h,g,y,m,b,w,E,_,S,T;return u(this,(function(u){switch(u.label){case 0:if(!e)return[2];t=c(e,1),n=t[0],r=c(e,2),o=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),s=this.plugins.filter((function(e){return"before"===e.type})),u.label=1;case 1:u.trys.push([1,6,7,8]),l=a(s),d=l.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(i({},n))]:[3,4];case 3:if(null===(y=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=y,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(_=l.return)&&_.call(l)}finally{if(E)throw E.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),u.label=9;case 9:u.trys.push([9,14,15,16]),v=a(p),h=v.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(i({},n))]:[3,12];case 11:if(null===(y=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=y,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=u.sent(),S={error:m},[3,16];case 15:try{h&&!h.done&&(T=v.return)&&T.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),w=b.map((function(e){var t=i({},n);return e.execute(t).catch((function(e){return M(t,0,String(e))}))})),Promise.all(w).then((function(e){var t=c(e,1)[0]||M(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return s(this,void 0,void 0,(function(){var e,t,n,r=this;return u(this,(function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return r.apply(e)})))];case 1:return i.sent(),t=this.plugins.filter((function(e){return"destination"===e.type})),n=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(n)];case 2:return i.sent(),[2]}}))}))},e.prototype.onIdentityChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)}))},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)}))},e.prototype.onOptOutChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}))},e}(),z=function(e,t){return i(i({},t),{event_type:r.IDENTIFY,user_properties:e.getUserProperties()})},W=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new B(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return s(this,void 0,void 0,(function(){var t,n,r,i,o,s,c,l;return u(this,(function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),n=a(t),r=n.next(),u.label=2;case 2:return r.done?[3,7]:(i=r.value,(o=i())&&"promise"in o?[4,o.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,o];case 5:u.sent(),u.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),c={error:s},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:u.sent(),u.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return i(i(i({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return W(this.dispatch(r))},e.prototype.identify=function(e,t){var n=z(e,t);return W(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,o){var s=function(e,t,n,o){var s;return i(i({},o),{event_type:r.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(s={},s[e]=t,s)})}(e,t,n,o);return W(this.dispatch(s))},e.prototype.setGroup=function(e,t,n){var o=function(e,t,n){var o,s=new U;return s.set(e,t),i(i({},n),{event_type:r.IDENTIFY,user_properties:s.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n);return W(this.dispatch(o))},e.prototype.revenue=function(e,t){var n=function(e,t){return i(i({},t),{event_type:r.REVENUE,event_properties:e.getEventProperties()})}(e,t);return W(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),W())},e.prototype._addPlugin=function(e){return W(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),W())},e.prototype._removePlugin=function(e){return W(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(M(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,(function(){var t=this;return u(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.getOperationAppliedUserProperties=function(e){var t={};if(void 0===e)return t;var r={};return Object.keys(e).forEach((function(t){Object.values(n).includes(t)||(r[t]=e[t])})),j.forEach((function(r){if(Object.keys(e).includes(r)){var i=e[r];switch(r){case n.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case n.UNSET:Object.keys(i).forEach((function(e){delete t[e]}));break;case n.SET:Object.assign(t,i)}}})),Object.assign(t,r),t},e.prototype.process=function(e){return s(this,void 0,void 0,(function(){var t,n,i,o;return u(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,M(e,0,"Event skipped due to optOut config")]:(e.event_type===r.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)]);case 1:return 200===(o=s.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=s.sent(),i=String(n),this.config.loggerProvider.error(i),[2,o=M(e,0,i)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=Boolean(e))},e.prototype.flush=function(){return W(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find((function(t){return t.name===e}));if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter((function(t){return t instanceof e}))},e}(),H=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),J=function(){function e(e,t,n){void 0===n&&(n="US"),this.callbackInfos=[],this.apiKey=e,this.serverUrl="US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config",this.logger=t,this.storage=new H(e,t)}return e.prototype.subscribe=function(e,t,n){var r=$(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex((function(t){return t.id===e}));return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,(function(){var e,t=this;return u(this,(function(n){switch(n.label){case 0:return[4,this.fetch()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach((function(n){t.sendCallback(n,e,"remote")})),[2]}}))}))},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,(function(){var t,n,r,i=this;return u(this,(function(o){switch(o.label){case 0:return t=this.fetch().then((function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)})),n=this.storage.fetchConfig().then((function(e){return e})),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),this.sendCallback(e,r,"cache")),[4,t];case 2:return o.sent(),[2]}}))}))},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:n=new Promise((function(e,n){setTimeout((function(){n("Timeout exceeded")}),t)})),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.fetch(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}}))}))},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce((function(e,t){return null===e?e:t in e?e[t]:null}),t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,(function(){var n,r,i,o,s,a,c=this;return u(this,(function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,l,d;return u(this,(function(u){switch(u.label){case 0:i=new AbortController,s=setTimeout((function(){return i.abort()}),t),u.label=1;case 1:return u.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:return(a=u.sent()).ok?[3,4]:[4,a.text()];case 3:return l=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(a.status,": ").concat(l)),[3,6];case 4:return[4,a.json()];case 5:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=u.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(s),[7];case 9:return r<e-1?[4,new Promise((function(e){return setTimeout(e,c.getJitterDelay(n))}))]:[3,11];case 10:u.sent(),u.label=11;case 11:return[2]}}))},o=this,s=0,l.label=1;case 1:return s<e?[5,i(s)]:[3,4];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];l.label=3;case 3:return s++,[3,1];case 4:return[2,r]}}))}))},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}();!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(D||(D={}));var Y,G="Amplitude Logger ",Q=function(){function e(){this.logLevel=D.None}return e.prototype.disable=function(){this.logLevel=D.None},e.prototype.enable=function(e){void 0===e&&(e=D.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Verbose||console.log("".concat(G,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Warn||console.warn("".concat(G,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Error||console.error("".concat(G,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Debug||console.log("".concat(G,"[Debug]: ").concat(e.join(" ")))},e}(),X=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){return N(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?i({},this.properties):{};return e[Y.REVENUE_PRODUCT_ID]=this.productId,e[Y.REVENUE_QUANTITY]=this.quantity,e[Y.REVENUE_PRICE]=this.price,e[Y.REVENUE_TYPE]=this.revenueType,e[Y.REVENUE_CURRENCY]=this.currency,e[Y.REVENUE]=this.revenue,e[Y.RECEIPT]=this.receipt,e[Y.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(Y||(Y={}));var Z=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:y,logLevel:D.Warn,loggerProvider:new Q,offline:!1,optOut:!1,serverUrl:m,serverZone:"US",useBatch:!1}},ee=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=Z();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=ne(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),te=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":m},ne=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=Z().serverZone),void 0===n&&(n=Z().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:Z().serverZone;return{serverZone:r,serverUrl:te(r,n)}},re=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function ie(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var oe=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,(function(){var n,r=this;return u(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(g,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map((function(e){return r.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=$()),new Promise((function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()}))},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter((function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)}))},e.prototype.scheduleEvents=function(e){var t=this;e.forEach((function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)}))},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout((function(){t.queue=t.queue.map((function(e){return e.timeout=0,e})),t.flush(!0)}),e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t,n,r=this;return u(this,(function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce((function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e}),[]).reduce((function(t,n){return s(r,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}}))}))}),Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),s(this,void 0,void 0,(function(){var n,r,i,s,a;return u(this,(function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,o(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new re,u.label=1;case 1:return u.trys.push([1,3,,4]),r=ne(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(i=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(i,e),[3,4]):("body"in i?this.fulfillRequest(e,i.statusCode,"".concat(i.status,": ").concat(ie(i))):this.fulfillRequest(e,i.statusCode,i.status),[2]);case 3:return s=u.sent(),a=(c=s)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.handleResponse({status:q.Failed,statusCode:0},e),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case q.Success:this.handleSuccessResponse(e,t);break;case q.Invalid:this.handleInvalidResponse(e,t);break;case q.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case q.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=l(l(l(l([],c(Object.values(e.body.eventsWithInvalidFields)),!1),c(Object.values(e.body.eventsWithMissingFields)),!1),c(Object.values(e.body.eventsWithInvalidIdLengths)),!1),c(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter((function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(ie(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(ie(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),u=new Set(i),a=new Set(o),c=t.filter((function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(ie(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(M(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),se=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ue(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ue=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ae=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}(),ce=function(){return ce=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ce.apply(this,arguments)};function le(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function de(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var fe=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=le(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var u=Array.isArray(e),a=Array.isArray(t);if(u!==a)return!1;if(!u||!a){var c=Object.keys(e).sort(),l=Object.keys(t).sort();if(!fe(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){fe(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!fe(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var pe,ve=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ce({},this.identity.userProperties),n=ce(ce({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,u,a=n.userProperties||{};try{for(var c=le(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=de(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var v=(i=void 0,le(Object.entries(p))),h=v.next();!h.done;h=v.next()){var g=de(h.value,2),y=g[0],m=g[1];a[y]=m}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,le(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete a[y=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(u=b.return)&&u.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":a={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return n.userProperties=a,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ce({},this.identity)},e.prototype.setIdentity=function(e){var t=ce({},this.identity);this.identity=ce({},e),fe(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),he="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,ge=function(){function e(){this.identityStore=new ve,this.eventBridge=new ae,this.applicationContextProvider=new se}return e.getInstance=function(t){return he.analyticsConnectorInstances||(he.analyticsConnectorInstances={}),he.analyticsConnectorInstances[t]||(he.analyticsConnectorInstances[t]=new e),he.analyticsConnectorInstances[t]},e}(),ye=function(e){return void 0===e&&(e=y),ge.getInstance(e)},me=function(){function e(){this.name="identity",this.type="before",this.identityStore=ye().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,(function(){var t;return u(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){return e.instanceName&&(this.identityStore=ye(e.instanceName).identityStore),[2]}))}))},e}(),be=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},we=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[h,t,e.substring(0,n)].filter(Boolean).join("_")},Ee=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},_e=function(){var e,t=F();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=Se(n[0]),i=Se(n[1]);return i?(e[r]=i,e):e}),{}):{}},Se=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Te=function(e){return function(){var t=i({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},Ie=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=a(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ke=function(e,t){return function(){var n,r,i={};try{for(var o=a(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Ie(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},xe=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<D.Debug||!c||!a)return e.apply(i,o);var l,d={type:"invoke public method",name:t,args:o,stacktrace:(l=1,void 0===l&&(l=0),((new Error).stack||"").split("\n").slice(2+l).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};r&&d.states&&(d.states.before=r());var f=e.apply(i,o);return f&&f.promise?f.promise.then((function(){r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=(new Date).toISOString()),a.debug(JSON.stringify(d,null,2))})):(r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=(new Date).toISOString()),a.debug(JSON.stringify(d,null,2))),f}},Oe=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},Pe=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return s(this,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return s(this,void 0,void 0,(function(){return u(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Ae=function(){function e(e){this.options=i({},e)}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,(function(){var t,n;return u(this,(function(r){switch(r.label){case 0:if(!F())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return r.sent(),[4,t.get(n)];case 3:return[2,r.sent()===e.testValue];case 4:return r.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){var t;return s(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=i.sent()))return[2,void 0];try{return void 0===(r=null!==(t=Re(n))&&void 0!==t?t:Ce(n))?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(r)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,(function(){var r,i,o;return u(this,(function(s){return r=F(),i=null!==(n=null===(t=null==r?void 0:r.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],o=i.find((function(t){return 0===t.indexOf(e+"=")})),o?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,(function(){var r,i,o,s,a,c,l;return u(this,(function(u){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(i=null!==t?r:-1)&&((s=new Date).setTime(s.getTime()+24*i*60*60*1e3),o=s),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=F())&&(c.document.cookie=a)}catch(t){l=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}return[2]}))}))},e.prototype.remove=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}}))}))},e.prototype.reset=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2]}))}))},e}(),Re=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},Ce=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},Ne=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[h,t,e.substring(0,n)].filter(Boolean).join("_")},Le=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return s(this,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,(function(){return u(this,(function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,(function(){return u(this,(function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,(function(){return u(this,(function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return s(this,void 0,void 0,(function(){return u(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),Ue=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,u,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case q.Success:return{status:T,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case q.Invalid:return{status:T,statusCode:S,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case q.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case q.RateLimit:return{status:T,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(_=e.throttled_events)&&void 0!==_?_:[]}};case q.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?q.Success:429===e?q.RateLimit:413===e?q.PayloadTooLarge:408===e?q.Timeout:e>=400&&e<500?q.Invalid:e>=500?q.Failed:q.Unknown},e}(),qe=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n,r,i;return u(this,(function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},n}(Ue);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(pe||(pe={}));var je=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],De="data-amp-track-",Me=["div","span","h1","h2","h3","h4","h5","h6"],Fe=l(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],c(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Ve=["*"];function $e(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Be(e,t,n){e&&ze({json:e,allowlist:t.map(We),excludelist:n.map(We),ancestors:[]})}function ze(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,s=e.excludelist,u=e.ancestors,d=e.parentObject,f=e.targetKey;i||(i=r);var p=Object.keys(i);try{for(var v=a(p),h=v.next();!h.done;h=v.next()){var g=h.value,y=l(l([],c(u),!1),[g],!1);$e(i[g])?He(y,o)&&!He(y,s)||delete i[g]:ze({json:r,targetObject:i[g],allowlist:o,excludelist:s,ancestors:y,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}0===Object.keys(i).length&&d&&f&&delete d[f]}function We(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function Ke(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Ke(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Ke(e,t,n+1,r+1)}function He(e,t){return t.some((function(t){return Ke(e,t)}))}var Je=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach((function(e){var t=c(e,2),n=t[0],r=t[1];i[n]=r}));else if(r instanceof Headers)r.forEach((function(e,t){i[t]=e}));else if("object"==typeof r&&null!==r)try{for(var o=a(Object.entries(r)),s=o.next();!s.done;s=o.next()){var u=c(s.value,2),l=u[0],d=u[1];i[l]=d}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return nt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=F();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=Ge(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){return u(this,(function(n){return 0===e.length?[2,null]:[2,et(this.body,e,t)]}))}))},e}(),Ye=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),nt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Ge(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){return u(this,(function(n){return 0===e.length?[2,null]:[2,et(this.body,e,t)]}))}))},e}();function Ge(e,t){var n,r,i,o=F(),s=null==o?void 0:o.TextEncoder;if(s){var u;if("string"==typeof e)u=e,i=(new s).encode(u).length;else if(e instanceof Blob)i=(u=e).size;else if(e instanceof URLSearchParams)u=e,i=(new s).encode(u.toString()).length;else if(ArrayBuffer.isView(e))i=(u=e).byteLength;else if(e instanceof ArrayBuffer)i=(u=e).byteLength;else if(e instanceof FormData){var l=e,d=0,f=0;try{for(var p=a(l.entries()),v=p.next();!v.done;v=p.next()){var h=c(v.value,2),g=h[0],y=h[1];if(d+=g.length,"string"==typeof y)d+=(new s).encode(y).length;else{if(!(y instanceof Blob))return;d+=y.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}i=d}else if(e instanceof ReadableStream)return void(u=e);return i}}var Qe,Xe=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,(function(e,t){r[t]=e})),nt(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,(function(){var e,t;return u(this,(function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}}))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,et(n.sent(),e,t)]}}))}))},e}(),Ze=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=a(i),s=o.next();!s.done;s=o.next()){var u=c(s.value.split(": "),2),l=u[0],d=u[1];l&&d&&(r[l]=d)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return nt(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){var n;return u(this,(function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Be(n,e,t),[2,n]):[2,null]}))}))},e}();function et(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Be(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Qe||(Qe={}));var tt="[REDACTED]",nt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,u=void 0===s?Qe.REMOVE:s,d=l([],c(C),!1),f={},p=function(t){var n=t.toLowerCase();d.find((function(e){return e.toLowerCase()===n}))?u===Qe.REDACT&&(f[t]=tt):o.find((function(e){return e.toLowerCase()===n}))?f[t]=e[t]:u===Qe.REDACT&&(f[t]=tt)};try{for(var v=a(Object.keys(e)),h=v.next();!h.done;h=v.next()){p(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}return f},rt=function(){function e(e,t,n,r,i,o,s,u,a,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=s,this.duration=u,this.responseWrapper=a,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(l([],c(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(l([],c(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter((function(e){var t=c(e,2);return t[0],void 0!==t[1]})))},e}();var it,ot,st,ut=function(e,t){void 0===t&&(t=$()),this.callback=e,this.id=t},at=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=F();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=F();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,u,a,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,p=null===(u=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send,v=null===(l=null===(c=null===(a=this.globalScope)||void 0===a?void 0:a.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&p&&v&&this.observeXhr(f,p,v);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(n){var r;try{n.callback(e)}catch(e){null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){var u,a;if(void 0!==o&&void 0!==s){var c,l,d,f="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?c=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(c=t.url,f=t.method),c)try{var p=new URL(c);c="".concat(p.protocol,"//").concat(p.host).concat(p.pathname).concat(p.search).concat(p.hash)}catch(e){null===(a=this.logger)||void 0===a||a.error("an unexpected error occurred while parsing the URL",e)}f=(null==n?void 0:n.method)||f,r&&(l=r.status),i&&(d={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var v=Math.floor(performance.now()-s),h=Math.floor(o+v),g=new rt(e,f,o,o,c,n,l,v,r,d,h);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,(function(){var t,i,o,s,a,c;return u(this,(function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while retrieving timestamps",e)}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return s=u.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Je(r):void 0,i?new Xe(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",e)}if(i)return[2,i];throw o}}))}))})},e.createXhrJsonParser=function(e,t){return function(){var n,r;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&(null===(r=t.logger)||void 0===r||r.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var o=this.globalScope.XMLHttpRequest.prototype,s=this;o.open=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var u=c(r,2),a=u[0],l=u[1];try{this.$$AmplitudeAnalyticsEvent=i({method:a,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},s.getTimestamps())}catch(e){null===(n=s.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,r)},o.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,s),u=t[0],a=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",(function(){var e;try{var t=i.getAllResponseHeaders(),n=i.getResponseHeader("content-length"),r=new Ze(i.status,t,n?parseInt(n,10):void 0,o),c=i.$$AmplitudeAnalyticsEvent.headers,l=new Ye(u,c);a.status=i.status,s.handleNetworkRequestEvent("xhr",{url:a.url,method:a.method},l,r,void 0,a.startTime,a.durationStart)}catch(t){null===(e=s.logger)||void 0===e||e.error("an unexpected error occurred while handling xhr send",t)}})),n.apply(i,t)},o.setRequestHeader=function(e,t){var n;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(n=s.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr setRequestHeader",e)}r.apply(this,[e,t])}}},e}(),ct=new at,lt=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,i(i(i(i({},A),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=_e();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=_e();return(e={})[b]=t[b],e[w]=t[w],e[E]=t[E],e[_]=t[_],e[S]=t[S],e[T]=t[T],e[I]=t[I],e[k]=t[k],e[x]=t[x],e[O]=t[O],e[P]=t[P],e},e}(),dt=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},ft=function(e){return dt(e,"attribution")},pt=function(e){return dt(e,"pageViews")},vt=function(e){return dt(e,"sessions")},ht=function(e){return"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},gt=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},yt=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},mt=function(e){if(gt(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},bt=function(e){if(yt(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},wt=function(e){var t;if(ht(e.autocapture)){var n=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),i(i({},n),{captureRules:null===(t=null==n?void 0:n.captureRules)||void 0===t?void 0:t.map((function(t){var n;if(t.urls&&t.hosts){var r=JSON.stringify(t.hosts),o=JSON.stringify(t.urls);return null===(n=e.loggerProvider)||void 0===n||n.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(r,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),i(i({},t),{hosts:void 0})}return t}))})}},Et=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return pt(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},_t=function(e,t){St(e,t)},St=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.resolve,u=e&&e[i];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},Tt=function(e){return e&&void 0!==e._q},It="2.24.0",kt=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts-sdk-script","/").concat(It),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,(function(){var r,o,s;return u(this,(function(u){return r=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,s=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=r),[2,i(i(i(i(i(i(i(i({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Ee()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:$(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent})]}))}))},e}(),xt=1e3,Ot=function(e){function n(t){var n,r,i,o=this;try{i=null===(n=F())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return t(n,e),n.prototype.set=function(t,n){var r;return s(this,void 0,void 0,(function(){var i;return u(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>xt?(i=n.length-xt,[4,e.prototype.set.call(this,t,n.slice(0,xt))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(xt,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},n}(Le),Pt=function(e){function n(){var t;return e.call(this,null===(t=F())||void 0===t?void 0:t.sessionStorage)||this}return t(n,e),n}(Le),At=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n=this;return u(this,(function(r){return[2,new Promise((function(r,i){"undefined"==typeof XMLHttpRequest&&i(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{r(n.buildResponse(JSON.parse(e)))}catch(e){r(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},n}(Ue),Rt=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n=this;return u(this,(function(r){return[2,new Promise((function(r,i){var o=F();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return r(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}}))]}))}))},n}(Ue),Ct=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,(function(){var r,i,o,s,a,l,d,f,p;return u(this,(function(u){switch(u.label){case 0:return r=function(e){return"".concat(h.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=c(i.split("."),6),s=o[0],a=o[1],l=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:s,userId:Lt(a),sessionId:Nt(d),lastEventId:Nt(p),lastEventTime:Nt(f),optOut:Boolean(l)}]}}))}))},Nt=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Lt=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Ut="[Amplitude]",qt="".concat(Ut," Form Started"),jt="".concat(Ut," Form Submitted"),Dt="".concat(Ut," File Downloaded"),Mt="session_start",Ft="session_end",Vt="".concat(Ut," File Extension"),$t="".concat(Ut," File Name"),Bt="".concat(Ut," Link ID"),zt="".concat(Ut," Link Text"),Wt="".concat(Ut," Link URL"),Kt="".concat(Ut," Form ID"),Ht="".concat(Ut," Form Name"),Jt="".concat(Ut," Form Destination"),Yt="cookie",Gt=function(e){function n(t,n,r,i,o,s,u,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_,S,T,I,k,x,O,P,A,R,C,N,L,U){void 0===r&&(r=new Pe),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Yt),void 0===g&&(g=new Q),void 0===y&&(y=D.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===S&&(S=""),void 0===T&&(T="US"),void 0===k&&(k=18e5),void 0===x&&(x=new Ot({loggerProvider:g})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===P&&(P="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!0);var q=e.call(this,{apiKey:t,storageProvider:x,transportProvider:Zt(P)})||this;return q.apiKey=t,q.appVersion=n,q.cookieOptions=i,q.defaultTracking=o,q.autocapture=s,q.flushIntervalMillis=a,q.flushMaxRetries=c,q.flushQueueSize=l,q.identityStorage=d,q.ingestionMetadata=f,q.instanceName=p,q.loggerProvider=g,q.logLevel=y,q.minIdLength=m,q.offline=b,q.partnerId=E,q.plan=_,q.serverUrl=S,q.serverZone=T,q.sessionTimeout=k,q.storageProvider=x,q.trackingOptions=O,q.transport=P,q.useBatch=A,q.fetchRemoteConfig=R,q.networkTrackingOptions=U,q.version=It,q._optOut=!1,q._cookieStorage=r,q.deviceId=u,q.lastEventId=v,q.lastEventTime=h,q.optOut=w,q.sessionId=I,q.pageCounter=N,q.userId=C,q.debugLogsEnabled=L,q.loggerProvider.enable(L?D.Debug:q.logLevel),q.networkTrackingOptions=U,q}return t(n,e),Object.defineProperty(n.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),n.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(we(this.apiKey),e)},n}(ee),Qt=function(e,t,n){return void 0===t&&(t={}),s(void 0,void 0,void 0,(function(){var r,o,s,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_,S,T,I,k,x,O,P,A,R,C,N,L,U,q,j,D,M,F,V,B,z,W,K,H,J,Y,G;return u(this,(function(u){switch(u.label){case 0:return r=t.identityStorage||Yt,I={},r===Yt?[3,1]:(s="",[3,5]);case 1:return null===(x=null===(k=t.cookieOptions)||void 0===k?void 0:k.domain)||void 0===x?[3,2]:(a=x,[3,4]);case 2:return[4,en()];case 3:a=u.sent(),u.label=4;case 4:s=a,u.label=5;case 5:return o=i.apply(void 0,[(I.domain=s,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=Xt(t.identityStorage,o),[4,Ct(e,c,null===(P=null===(O=t.cookieOptions)||void 0===O?void 0:O.upgrade)||void 0===P||P)];case 6:return l=u.sent(),[4,c.get(we(e))];case 7:return d=u.sent(),f=_e(),p=f.ampTimestamp?Number(f.ampTimestamp):void 0,v=!p||Date.now()<p,h=null!==(L=null!==(N=null!==(C=null!==(A=t.deviceId)&&void 0!==A?A:v?null!==(R=f.ampDeviceId)&&void 0!==R?R:f.deviceId:void 0)&&void 0!==C?C:null==d?void 0:d.deviceId)&&void 0!==N?N:l.deviceId)&&void 0!==L?L:$(),g=null!==(U=null==d?void 0:d.lastEventId)&&void 0!==U?U:l.lastEventId,y=null!==(q=null==d?void 0:d.lastEventTime)&&void 0!==q?q:l.lastEventTime,m=null!==(D=null!==(j=t.optOut)&&void 0!==j?j:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,b=null!==(M=null==d?void 0:d.sessionId)&&void 0!==M?M:l.sessionId,w=null!==(V=null!==(F=t.userId)&&void 0!==F?F:null==d?void 0:d.userId)&&void 0!==V?V:l.userId,n.previousSessionDeviceId=null!==(B=null==d?void 0:d.deviceId)&&void 0!==B?B:l.deviceId,n.previousSessionUserId=null!==(z=null==d?void 0:d.userId)&&void 0!==z?z:l.userId,E={ipAddress:null===(K=null===(W=t.trackingOptions)||void 0===W?void 0:W.ipAddress)||void 0===K||K,language:null===(J=null===(H=t.trackingOptions)||void 0===H?void 0:H.language)||void 0===J||J,platform:null===(G=null===(Y=t.trackingOptions)||void 0===Y?void 0:Y.platform)||void 0===G||G},_=null==d?void 0:d.pageCounter,S=null==d?void 0:d.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(T=new Gt(e,t.appVersion,c,o,t.defaultTracking,t.autocapture,h,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,g,y,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,m,t.partnerId,t.plan,t.serverUrl,t.serverZone,b,t.sessionTimeout,t.storageProvider,E,t.transport,t.useBatch,t.fetchRemoteConfig,w,_,S,t.networkTrackingOptions)).storageProvider.isEnabled()];case 8:return u.sent()||(T.loggerProvider.warn("Storage provider ".concat(T.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),T.storageProvider=new Pe),[2,T]}}))}))},Xt=function(e,t){switch(void 0===e&&(e=Yt),void 0===t&&(t={}),e){case"localStorage":return new Ot;case"sessionStorage":return new Pt;case"none":return new Pe;default:return new Ae(i(i({},t),{expirationDays:t.expiration}))}},Zt=function(e){return"xhr"===e?new At:"beacon"===e?new Rt:new qe},en=function(e){return s(void 0,void 0,void 0,(function(){var t,n,r,i,o,s,a;return u(this,(function(u){switch(u.label){case 0:return[4,(new Ae).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),r=[],i="AMP_TLDTEST",o=n.length-2;o>=0;--o)r.push(n.slice(o).join("."));o=0,u.label=2;case 2:return o<r.length?(s=r[o],[4,(a=new Ae({domain:"."+s})).set(i,1)]):[3,7];case 3:return u.sent(),[4,a.get(i)];case 4:return u.sent()?[4,a.remove(i)]:[3,6];case 5:return u.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},tn=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},nn=function(){var e,t=tn();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=rn(n[0]),i=rn(n[1]);return i?(e[r]=i,e):e}),{}):{}},rn=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},on="dclid",sn="fbclid",un="gbraid",an="gclid",cn="ko_click_id",ln="li_fat_id",dn="msclkid",fn="rdt_cid",pn="ttclid",vn="twclid",hn="wbraid",gn={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},yn=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,i(i(i(i({},gn),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=nn();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=nn();return(e={})[on]=t[on],e[sn]=t[sn],e[un]=t[un],e[an]=t[an],e[cn]=t[cn],e[ln]=t[ln],e[dn]=t[dn],e[fn]=t[fn],e[pn]=t[pn],e[vn]=t[vn],e[hn]=t[hn],e},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(it||(it={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(ot||(ot={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(st||(st={}));var mn,bn,wn=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},En=function(e){var t;void 0===e&&(e={});var n,r=tn(),o=void 0,a=!1,l=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,p=void 0===f?"[Amplitude] Page Viewed":f,v=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},h=function(){return s(void 0,void 0,void 0,(function(){var e,t,n;return u(this,(function(r){switch(r.label){case 0:return e=v("undefined"!=typeof location&&location.href||""),n={event_type:p},t=[{}],[4,_n()];case 1:return[2,(n.event_properties=i.apply(void 0,[i.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&v(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===l||"function"==typeof l&&l()},y="undefined"!=typeof location?location.href:null,m=function(){return s(void 0,void 0,void 0,(function(){var e,n,r,i;return u(this,(function(s){switch(s.label){case 0:return e=location.href,n=Tn(d,e,y||"")&&g(),y=e,n?(null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return i=(r=t).track,[4,h()];case 2:i.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}}))}))},b=function(){m()},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,i){return s(void 0,void 0,void 0,(function(){var s,l;return u(this,(function(u){switch(u.label){case 0:return t=i,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),a=!0,r&&(r.addEventListener("popstate",b),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=c(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),a&&m()}})),g()?(o.log("Tracking page view event"),l=(s=t).track,[4,h()]):[3,2];case 1:l.apply(s,[u.sent()]),u.label=2;case 2:return[2]}}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){var t;return u(this,(function(r){switch(r.label){case 0:return"attribution"===l&&Sn(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,h()]):[3,2];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=i(i({},e.event_properties),t.event_properties),r.label=2;case 2:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=i(i({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(e){return r&&(r.removeEventListener("popstate",b),a=!1),[2]}))}))}};return w},_n=function(){return s(void 0,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return e=wn,[4,(new yn).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},Sn=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[it.SET]||{},r=t[it.UNSET]||{},i=l(l([],c(Object.keys(n)),!1),c(Object.keys(r)),!1);return Object.keys(gn).every((function(e){return i.includes(e)}))}return!1},Tn=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},In=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return s(void 0,void 0,void 0,(function(){var i,o;return u(this,(function(s){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n,i=xn(e);t||r.track(qt,((n={})[Kt]=kn(e.id),n[Ht]=kn(e.name),n[Jt]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=xn(e);t||r.track(qt,((n={})[Kt]=kn(e.id),n[Ht]=kn(e.name),n[Jt]=o,n)),r.track(jt,((i={})[Kt]=kn(e.id),i[Ht]=kn(e.name),i[Jt]=o,i)),t=!1}))};Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?i():(o=F())?o.addEventListener("load",i):t.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},kn=function(e){if("string"==typeof e)return e},xn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},On=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,(function(){var i,o;return u(this,(function(s){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),s=null==i?void 0:i[1];s&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",(function(){var t;s&&r.track(Dt,((t={})[Vt]=s,t[$t]=n.pathname,t[Bt]=e.id,t[zt]=e.text,t[Wt]=e.href,t))}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=F())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},Pn=!1,An=function(){var e=F(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,(function(){return u(this,(function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",(function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout((function(){t.flush()}),e.flushIntervalMillis)})),n("offline",(function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2])}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)})),t=[],[2]}))}))}}};function Rn(e){var t,n;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var r=Object.keys(e);try{for(var i=a(r),o=i.next();!o.done;o=i.next()){var s=o.value;try{var u=e[s];"boolean"==typeof(null==u?void 0:u.enabled)&&(u.enabled?(delete u.enabled,0===Object.keys(u).length&&(e[s]=!0)):e[s]=!1),Rn(u)}catch(e){}}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}}}function Cn(e,t,n){var r,i,o=[];try{for(var s=a(null!=t?t:[]),u=s.next();!u.done;u=s.next()){var c=u.value;try{o.push(new RegExp(c))}catch(e){n.loggerProvider.warn("Invalid regex pattern: ".concat(c),e)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(o)}function Nn(e,t){var n,r,o,s,u,c,l;if(e){Rn(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e));var d=e;if(d&&"autocapture"in d){if("boolean"==typeof d.autocapture&&(t.autocapture=d.autocapture),"object"==typeof d.autocapture&&null!==d.autocapture){var f=i({},d.autocapture);if(void 0===t.autocapture&&(t.autocapture=d.autocapture),"object"==typeof d.autocapture.elementInteractions&&null!==d.autocapture.elementInteractions&&(null===(o=d.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===o?void 0:o.length)){f.elementInteractions=i({},d.autocapture.elementInteractions);var p=f.elementInteractions,v=null!==(s=p.pageUrlAllowlist)&&void 0!==s?s:[],h=d.autocapture.elementInteractions.pageUrlAllowlistRegex;p.pageUrlAllowlist=Cn(v,h,t),delete p.pageUrlAllowlistRegex}if("object"==typeof d.autocapture.networkTracking&&null!==d.autocapture.networkTracking&&(null===(u=d.autocapture.networkTracking.captureRules)||void 0===u?void 0:u.length)){f.networkTracking=i({},d.autocapture.networkTracking);var g=null!==(c=f.networkTracking.captureRules)&&void 0!==c?c:[];try{for(var y=a(g),m=y.next();!m.done;m=y.next()){var b=m.value;b.urls=Cn(null!==(l=b.urls)&&void 0!==l?l:[],b.urlsRegex,t),delete b.urlsRegex}}catch(e){n={error:e}}finally{try{m&&!m.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=i({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},f)),"object"==typeof t.autocapture&&(t.autocapture=i(i({},t.autocapture),f))}t.defaultTracking=t.autocapture}t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(mn||(mn={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(bn||(bn={}));var Ln=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,u,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case bn.Success:return{status:T,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case bn.Invalid:return{status:T,statusCode:S,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case bn.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case bn.RateLimit:return{status:T,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(_=e.throttled_events)&&void 0!==_?_:[]}};case bn.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?bn.Success:429===e?bn.RateLimit:413===e?bn.PayloadTooLarge:408===e?bn.Timeout:e>=400&&e<500?bn.Invalid:e>=500?bn.Failed:bn.Unknown},e}(),Un="Remote config fetch rejected due to timeout after 5 seconds",qn="Unexpected error occurred",jn=function(){function e(e){var t=e.localConfig,n=e.configKeys,r=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteNamespaceConfig=function(e,t){return s(r,void 0,void 0,(function(){var n,r,i;return u(this,(function(o){switch(o.label){case 0:return n=Date.now(),[4,this.fetchWithTimeout(t)];case 1:return(r=o.sent())&&(i=r.configs&&r.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-n,[2,i]):(this.metrics.fetchTimeAPIFail=Date.now()-n,[2,void 0])}}))}))},this.getRemoteConfig=function(e,t,n){return s(r,void 0,void 0,(function(){var r;return u(this,(function(i){switch(i.label){case 0:return[4,this.getRemoteNamespaceConfig(e,n)];case 1:return[2,null==(r=i.sent())?void 0:r[t]]}}))}))},this.fetchWithTimeout=function(e){return s(r,void 0,void 0,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout((function(){return t.abort()}),5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}}))}))},this.fetchRemoteConfig=function(e,t){return s(r,void 0,void 0,(function(){var n,r,o,s,c,l,d,f,p,v,h,g;return u(this,(function(u){switch(u.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:Un})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),u.label=1;case 1:u.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(r=a(this.configKeys),o=r.next();!o.done;o=r.next())s=o.value,n.append("config_keys",s)}catch(e){v={error:e}}finally{try{o&&!o.done&&(h=r.return)&&h.call(r)}finally{if(v)throw v.error}}return t&&n.set("session_id",String(t)),c={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,i(i({},c),{signal:e}))];case 2:if(null===(d=u.sent()))return[2,this.completeRequest({err:qn})];switch((new Ln).buildStatus(d.status)){case bn.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case bn.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=u.sent(),p=f,e.aborted?[2,this.completeRequest({err:Un})]:[2,this.completeRequest({err:null!==(g=p.message)&&void 0!==g?g:qn})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return s(r,void 0,void 0,(function(){var n=this;return u(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,n.attempts*n.retryTimeout)}))];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}}))}))},this.parseAndStoreConfig=function(e){return s(r,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}}))}))},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.configServerUrl?this.localConfig.configServerUrl:this.localConfig.serverZone===mn.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===mn.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw new Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),Dn=function(e){var t=e.localConfig,n=e.configKeys;return s(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,new jn({localConfig:t,configKeys:n})]}))}))},Mn="[Amplitude] Element Clicked",Fn="[Amplitude] Rage Click",Vn="[Amplitude] Element Tag",$n="[Amplitude] Element Text",Bn="[Amplitude] Page URL",zn="https://app.amplitude.com",Wn={US:zn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},Kn="data-amp-mask-attributes",Hn="data-amp-mask",Jn="*****";function Yn(e){return"function"==typeof e}function Gn(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Qn=Gn((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function Xn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Zn=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=a(o),u=s.next();!u.done;u=s.next()){u.value.remove(this)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(Yn(d))try{d()}catch(e){i=e instanceof Qn?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=a(f),v=p.next();!v.done;v=p.next()){var h=v.value;try{nr(h)}catch(e){i=null!=i?i:[],e instanceof Qn?i=l(l([],c(i)),c(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new Qn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)nr(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Xn(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Xn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),er=Zn.EMPTY;function tr(e){return e instanceof Zn||e&&"closed"in e&&Yn(e.remove)&&Yn(e.add)&&Yn(e.unsubscribe)}function nr(e){Yn(e)?e():e.unsubscribe()}var rr={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},ir=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([e,t],c(n)))};function or(e){ir((function(){throw e}))}function sr(){}function ur(e){e()}var ar=function(e){function n(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,tr(t)&&t.add(n)):n.destination=vr,n}return t(n,e),n.create=function(e,t,n){return new fr(e,t,n)},n.prototype.next=function(e){this.isStopped||this._next(e)},n.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(e){this.destination.next(e)},n.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(Zn),cr=Function.prototype.bind;function lr(e,t){return cr.call(e,t)}var dr=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){pr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){pr(e)}else pr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){pr(e)}},e}(),fr=function(e){function n(t,n,r){var i,o,s=e.call(this)||this;Yn(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&rr.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&lr(t.next,o),error:t.error&&lr(t.error,o),complete:t.complete&&lr(t.complete,o)}):i=t;return s.destination=new dr(i),s}return t(n,e),n}(ar);function pr(e){or(e)}var vr={closed:!0,next:sr,error:function(e){throw e},complete:sr},hr="function"==typeof Symbol&&Symbol.observable||"@@observable";function gr(e){return e}var yr=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof ar||function(e){return e&&Yn(e.next)&&Yn(e.error)&&Yn(e.complete)}(r)&&tr(r)?e:new fr(e,t,n);return ur((function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=mr(t))((function(t,r){var i=new fr({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[hr]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?gr:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=mr(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function mr(e){var t;return null!==(t=null!=e?e:rr.Promise)&&void 0!==t?t:Promise}function br(e){return Yn(null==e?void 0:e.lift)}function wr(e){return function(t){if(br(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Er(e,t,n,r,i){return new _r(e,t,n,r,i)}var _r=function(e){function n(t,n,r,i,o,s){var u=e.call(this,t)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t(n,e),n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},n}(ar);!function(e){function n(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,br(t)&&(r.lift=t.lift),r}t(n,e),n.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},n.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},n.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},n.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new Zn;var n=this.getSubject();t.add(this.source.subscribe(Er(n,void 0,(function(){e._teardown(),n.complete()}),(function(t){e._teardown(),n.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=Zn.EMPTY)}return t},n.prototype.refCount=function(){return wr((function(e,t){var n=null;e._refCount++;var r=Er(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)n=null;else{var r=e._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),t.unsubscribe()}}));e.subscribe(r),r.closed||(n=e.connect())}))(this)}}(yr);var Sr,Tr={now:function(){return(Tr.delegate||performance).now()},delegate:void 0},Ir={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new Zn((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Ir.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,l([],c(e)))},delegate:void 0};new yr((function(e){var t=Sr||Tr,n=t.now(),r=0,i=function(){e.closed||(r=Ir.requestAnimationFrame((function(o){r=0;var s=t.now();e.next({timestamp:Sr?s:o,elapsed:s-n}),i()})))};return i(),function(){r&&Ir.cancelAnimationFrame(r)}}));var kr=Gn((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),xr=function(e){function n(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t(n,e),n.prototype.lift=function(e){var t=new Or(this,this);return t.operator=e,t},n.prototype._throwIfClosed=function(){if(this.closed)throw new kr},n.prototype.next=function(e){var t=this;ur((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=a(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},n.prototype.error=function(e){var t=this;ur((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},n.prototype.complete=function(){var e=this;ur((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},n.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},n.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?er:(this.currentObservers=null,o.push(e),new Zn((function(){t.currentObservers=null,Xn(o,e)})))},n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},n.prototype.asObservable=function(){var e=new yr;return e.source=this,e},n.create=function(e,t){return new Or(e,t)},n}(yr),Or=function(e){function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t(n,e),n.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},n.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},n.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},n.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:er},n}(xr);!function(e){function n(t){var n=e.call(this)||this;return n._value=t,n}t(n,e),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(xr);var Pr={now:function(){return(Pr.delegate||Date).now()},delegate:void 0};!function(e){function n(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Pr);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}t(n,e),n.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,u=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,t)},n.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},n.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),u=0,a=1;a<r.length&&r[a]<=s;a+=2)u=a;u&&r.splice(0,u+1)}}}(xr),function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}t(n,e),n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,u=t._isComplete;n?e.error(o):(s||u)&&(r&&e.next(i),e.complete())},n.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},n.prototype.complete=function(){var t=this,n=t._hasValue,r=t._value;t._isComplete||(this._isComplete=!0,n&&e.prototype.next.call(this,r),e.prototype.complete.call(this))}}(xr);var Ar,Rr=function(e){function n(t,n){return e.call(this)||this}return t(n,e),n.prototype.schedule=function(e,t){return this},n}(Zn),Cr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([e,t],c(n)))},Nr=function(e){return clearInterval(e)},Lr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return t(n,e),n.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},n.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),Cr(e.flush.bind(e,this),n)},n.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Nr(t)},n.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},n.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Xn(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n}(Rr),Ur=1,qr={};function jr(e){return e in qr&&(delete qr[e],!0)}var Dr=function(e){var t=Ur++;return qr[t]=!0,Ar||(Ar=Promise.resolve()),Ar.then((function(){return jr(t)&&e()})),t},Mr=function(e){jr(e)},Fr={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Fr.delegate;return((null==n?void 0:n.setImmediate)||Dr).apply(void 0,l([],c(e)))},clearImmediate:function(e){return Mr(e)},delegate:void 0},Vr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=Fr.setImmediate(t.flush.bind(t,void 0))))},n.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(Fr.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},n}(Lr),$r=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Pr.now,e}(),Br=function(e){function n(t,n){void 0===n&&(n=$r.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return t(n,e),n.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},n}($r),zr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},n}(Br);new zr(Vr);var Wr=new Br(Lr),Kr=Wr,Hr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.schedule=function(t,n){return void 0===n&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},n.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},n}(Lr),Jr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(Br);new Jr(Hr);var Yr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=Ir.requestAnimationFrame((function(){return t.flush(void 0)}))))},n.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&n===t._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(Ir.cancelAnimationFrame(n),t._scheduled=void 0)},n}(Lr),Gr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},n}(Br);new Gr(Yr),function(e){function n(t,n){void 0===t&&(t=Qr),void 0===n&&(n=1/0);var r=e.call(this,t,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}t(n,e),n.prototype.flush=function(){for(var e,t,n=this.actions,r=this.maxFrames;(t=n[0])&&t.delay<=r&&(n.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=n.shift();)t.unsubscribe();throw e}},n.frameTimeFactor=10}(Br);var Qr=function(e){function n(t,n,r){void 0===r&&(r=t.index+=1);var i=e.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.index=r,i.active=!0,i.index=t.index=r,i}return t(n,e),n.prototype.schedule=function(t,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,t,r);this.active=!1;var i=new n(this.scheduler,this.work);return this.add(i),i.schedule(t,r)}return Zn.EMPTY},n.prototype.requestAsyncId=function(e,t,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(n.sortActions),1},n.prototype.recycleAsyncId=function(e,t,n){},n.prototype._execute=function(t,n){if(!0===this.active)return e.prototype._execute.call(this,t,n)},n.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},n}(Lr),Xr=new yr((function(e){return e.complete()}));function Zr(e){return e&&Yn(e.schedule)}function ei(e){return e[e.length-1]}function ti(e){return Zr(ei(e))?e.pop():void 0}var ni=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function ri(e){return Yn(null==e?void 0:e.then)}function ii(e){return Yn(e[hr])}function oi(e){return Symbol.asyncIterator&&Yn(null==e?void 0:e[Symbol.asyncIterator])}function si(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var ui,ai="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function ci(e){return Yn(null==e?void 0:e[ai])}function li(e){return f(this,arguments,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,d(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,d(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,d(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function di(e){return Yn(null==e?void 0:e.getReader)}function fi(e){if(e instanceof yr)return e;if(null!=e){if(ii(e))return i=e,new yr((function(e){var t=i[hr]();if(Yn(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ni(e))return r=e,new yr((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(ri(e))return n=e,new yr((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,or)}));if(oi(e))return pi(e);if(ci(e))return t=e,new yr((function(e){var n,r;try{for(var i=a(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(di(e))return pi(li(e))}var t,n,r,i;throw si(e)}function pi(e){return new yr((function(t){(function(e,t){var n,r,i,o;return s(this,void 0,void 0,(function(){var s,a;return u(this,(function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=p(e),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function vi(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(o),!i)return o}function hi(e,t){return void 0===t&&(t=0),wr((function(n,r){n.subscribe(Er(r,(function(n){return vi(r,e,(function(){return r.next(n)}),t)}),(function(){return vi(r,e,(function(){return r.complete()}),t)}),(function(n){return vi(r,e,(function(){return r.error(n)}),t)})))}))}function gi(e,t){return void 0===t&&(t=0),wr((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function yi(e,t){if(!e)throw new Error("Iterable cannot be null");return new yr((function(n){vi(n,t,(function(){var r=e[Symbol.asyncIterator]();vi(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function mi(e,t){if(null!=e){if(ii(e))return function(e,t){return fi(e).pipe(gi(t),hi(t))}(e,t);if(ni(e))return function(e,t){return new yr((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(ri(e))return function(e,t){return fi(e).pipe(gi(t),hi(t))}(e,t);if(oi(e))return yi(e,t);if(ci(e))return function(e,t){return new yr((function(n){var r;return vi(n,t,(function(){r=e[ai](),vi(n,t,(function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)}),0,!0)})),function(){return Yn(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(di(e))return function(e,t){return yi(li(e),t)}(e,t)}throw si(e)}function bi(e,t){return t?mi(e,t):fi(e)}function wi(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(ui||(ui={})),Gn((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),Gn((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Gn((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Gn((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var Ei=Gn((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function _i(e){throw new Ei(e)}function Si(e,t){return wr((function(n,r){var i=0;n.subscribe(Er(r,(function(n){r.next(e.call(t,n,i++))})))}))}var Ti=Array.isArray;function Ii(e){return Si((function(t){return function(e,t){return Ti(t)?e.apply(void 0,l([],c(t))):e(t)}(e,t)}))}function ki(e,t,n){return void 0===n&&(n=1/0),Yn(t)?ki((function(n,r){return Si((function(e,i){return t(n,e,r,i)}))(fi(e(n,r)))}),n):("number"==typeof t&&(n=t),wr((function(t,r){return function(e,t,n,r,i,o,s,u){var a=[],c=0,l=0,d=!1,f=function(){!d||a.length||c||t.complete()},p=function(e){return c<r?v(e):a.push(e)},v=function(e){o&&t.next(e),c++;var u=!1;fi(n(e,l++)).subscribe(Er(t,(function(e){null==i||i(e),o?p(e):t.next(e)}),(function(){u=!0}),void 0,(function(){if(u)try{c--;for(var e=function(){var e=a.shift();s?vi(t,s,(function(){return v(e)})):v(e)};a.length&&c<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(Er(t,p,(function(){d=!0,f()}))),function(){null==u||u()}}(t,r,e,n)})))}function xi(e){return void 0===e&&(e=1/0),ki(gr,e)}function Oi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return xi(1)(bi(e,ti(e)))}var Pi=["addListener","removeListener"],Ai=["addEventListener","removeEventListener"],Ri=["on","off"];function Ci(e,t,n,r){if(Yn(n)&&(r=n,n=void 0),r)return Ci(e,t,n).pipe(Ii(r));var i=c(function(e){return Yn(e.addEventListener)&&Yn(e.removeEventListener)}(e)?Ai.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return Yn(e.addListener)&&Yn(e.removeListener)}(e)?Pi.map(Ni(e,t)):function(e){return Yn(e.on)&&Yn(e.off)}(e)?Ri.map(Ni(e,t)):[],2),o=i[0],s=i[1];if(!o&&ni(e))return ki((function(e){return Ci(e,t,n)}))(fi(e));if(!o)throw new TypeError("Invalid event target");return new yr((function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}}))}function Ni(e,t){return function(n){return function(r){return e[n](t,r)}}}function Li(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Kr);var r=-1;return null!=t&&(Zr(t)?n=t:r=t),new yr((function(t){var i=wi(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}function Ui(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=ti(e),r=function(e,t){return"number"==typeof ei(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?fi(i[0]):xi(r)(bi(i,n)):Xr}new yr(sr);var qi=Array.isArray;function ji(e,t){return wr((function(n,r){var i=0;n.subscribe(Er(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function Di(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&qi(e[0])?e[0]:e).length?fi(t[0]):new yr(function(e){return function(t){for(var n=[],r=function(r){n.push(fi(e[r]).subscribe(Er(t,(function(e){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}t.next(e)}))))},i=0;n&&!t.closed&&i<e.length;i++)r(i)}}(t))}function Mi(e){return e<=0?function(){return Xr}:wr((function(t,n){var r=0;t.subscribe(Er(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function Fi(e,t){return t?function(n){return Oi(t.pipe(Mi(1),wr((function(e,t){e.subscribe(Er(t,sr))}))),n.pipe(Fi(e)))}:ki((function(t,n){return fi(e(t,n)).pipe(Mi(1),function(e){return Si((function(){return e}))}(t))}))}function Vi(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new xr}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,u=e.resetOnRefCountZero,a=void 0===u||u;return function(e){var t,r,o,u=0,c=!1,l=!1,d=function(){null==r||r.unsubscribe(),r=void 0},f=function(){d(),t=o=void 0,c=l=!1},p=function(){var e=t;f(),null==e||e.unsubscribe()};return wr((function(e,v){u++,l||c||d();var h=o=null!=o?o:n();v.add((function(){0!==--u||l||c||(r=$i(p,a))})),h.subscribe(v),!t&&u>0&&(t=new fr({next:function(e){return h.next(e)},error:function(e){l=!0,d(),r=$i(f,i,e),h.error(e)},complete:function(){c=!0,d(),r=$i(f,s),h.complete()}}),fi(e).subscribe(t))}))(e)}}function $i(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new fr({next:function(){i.unsubscribe(),e()}});return fi(t.apply(void 0,l([],c(n)))).subscribe(i)}}else e()}function Bi(e,t,n){void 0===t&&(t=Wr);var r=Li(e,t);return function(e,t){return wr((function(n,r){var i=null!=t?t:{},o=i.leading,s=void 0===o||o,u=i.trailing,a=void 0!==u&&u,c=!1,l=null,d=null,f=!1,p=function(){null==d||d.unsubscribe(),d=null,a&&(g(),f&&r.complete())},v=function(){d=null,f&&r.complete()},h=function(t){return d=fi(e(t)).subscribe(Er(r,p,v))},g=function(){if(c){c=!1;var e=l;l=null,r.next(e),!f&&h(e)}};n.subscribe(Er(r,(function(e){c=!0,l=e,(!d||d.closed)&&(s?g():h(e))}),(function(){f=!0,(!(a&&c&&d)||d.closed)&&r.complete()})))}))}((function(){return r}),n)}var zi=["input","select","textarea"],Wi=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t},Ki=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,u=e.pageUrlAllowlist,a=e.pageUrlExcludelist,c=e.shouldTrackEventResolver,l=null===(s=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===s?void 0:s.call(o);if(!l)return!1;if(c)return c(r,i);if(!Oe(window.location.href,u))return!1;if(a&&a.length>0&&Oe(window.location.href,a))return!1;var d=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=Wi(i,r);if(n&&f)return!0;if(t){var p=t.some((function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}));if(!p)return!1}switch(l){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},Hi=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},Ji=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:Ji(null==e?void 0:e.parentElement,t):null};var Yi=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};var Gi=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Kn,Hn]),Qi=["type"],Xi=["svg","path","g"],Zi=["password","hidden"];function eo(e,t){var n,r,i,o,s,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),l={tag:c},d=Array.from(null!==(o=null===(i=e.parentElement)||void 0===i?void 0:i.children)&&void 0!==o?o:[]);d.length&&(l.index=d.indexOf(e),l.indexOfType=d.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var f=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();f&&(l.prevSib=String(f));var p=e.getAttribute("id");p&&(l.id=String(p));var v=Array.from(e.classList);v.length&&(l.classes=v);var h={},g=Array.from(e.attributes).filter((function(e){return!Gi.has(e.name)})),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!zi.includes(i)&&!o}(e);if(!Zi.includes(String(e.getAttribute("type")))&&!Xi.includes(c))try{for(var m=a(g),b=m.next();!b.done;b=m.next()){var w=b.value;y&&!Qi.includes(w.name)||(t.has(w.name)?h[w.name]=Jn:h[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(h).length&&(l.attrs=h),l}var to=function(e,t,n){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}}))},no=/\b(?:\d[ -]*?){13,16}\b/,ro=/(\d{3}-?\d{2}-?\d{4})/g,io=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,oo=function(e){var t,n,r,i=this;this.replaceSensitiveString=function(e){var t,n;if("string"!=typeof e)return"";var r=e;r=(r=(r=r.replace(no,Jn)).replace(ro,Jn)).replace(io,Jn);try{for(var o=a(i.additionalMaskTextPatterns),s=o.next();!s.done;s=o.next()){var u=s.value;try{r=r.replace(u,Jn)}catch(e){}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r},this.getHierarchy=function(e){var t,n,r,o;if(!e)return[];for(var s,u=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),d=new Map,f=u.length-1;f>=0;f--){var p=u[f];if(p){var v=(s=p.getAttribute(Kn))?s.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0&&"id"!==e&&"class"!==e})):[],h=f===u.length-1?[]:null!==(r=d.get(u[f+1]))&&void 0!==r?r:new Set,g=new Set(l(l([],c(h),!1),c(v),!1));d.set(p,g)}}o=u.map((function(e){var t;return eo(e,null!==(t=d.get(e))&&void 0!==t?t:new Set)}));var y=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach((function(t){var n=c(t,2),r=n[0],o=n[1];e.attrs&&(e.attrs[r]=i.replaceSensitiveString(o))}))};try{for(var m=a(o),b=m.next();!b.done;b=m.next())y(b.value)}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}return o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?i.getText(t):i.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,o,s,u,a,l,d=null===(s=null===(o=null==t?void 0:t.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===s?void 0:s.call(o),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},p=i.getHierarchy(t),v=null===(u=p[0])||void 0===u?void 0:u.attrs,h=i.getNearestLabel(t),g=(a=null!=v?v:{},l=n,Object.entries(a).reduce((function(e,t){var n=c(t,2),r=n[0],i=n[1];if(r.startsWith(l)){var o=r.replace(l,"");o&&(e[o]=i||"")}return e}),{})),y=((r={})["[Amplitude] Element Hierarchy"]=p,r[Vn]=d,r[$n]=i.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Parent Label"]=h,r[Bn]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&i.replaceSensitiveString(document.title)||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return y["[Amplitude] Element ID"]=t.getAttribute("id")||"",y["[Amplitude] Element Class"]=t.getAttribute("class"),y["[Amplitude] Element Aria Label"]=null==v?void 0:v["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement&&(y["[Amplitude] Element Href"]=i.replaceSensitiveString(t.href)),Hi(y)},this.addAdditionalEventProperties=function(e,t,n,r,o){void 0===o&&(o=!1);var s={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(s)&&null!==s.event.target){if(o&&Wi(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=i.getEventProperties(s.type,s.closestTrackedAncestor,r),s;var u=Ji(s.event.target,n);return u&&(s.closestTrackedAncestor=u,s.targetElementProperties=i.getEventProperties(s.type,u,r)),s}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?i.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getText=function(e){if(null!==e.closest("[".concat(Hn,"]")))return Jn;var t="";if(e.querySelector("[".concat(Hn,"], [contenteditable]"))){var n=e.cloneNode(!0);n.querySelectorAll("[".concat(Hn,"], [contenteditable]")).forEach((function(e){e.innerText=Jn})),t=n.innerText||""}else t=e.innerText||"";return i.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var o=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),s=((t={})[Vn]=o,t[$n]=i.getText(e),t[Bn]=window.location.href.split("?")[0],t);return Hi(s)};var o=null!==(r=e.maskTextRegex)&&void 0!==r?r:[],s=[];try{for(var u=a(o),d=u.next();!d.done;d=u.next()){var f=d.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}this.additionalMaskTextPatterns=s},so=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?zn:t,r=this;this.endpoint=zn,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{dataExtractor:new oo({})}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist,a=n.dataExtractor;this.logger=r,i&&this.endpoint===zn&&(this.endpoint=i);var c=null;window.addEventListener("message",(function(e){var n,r,i,l,d;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var f,p=null==e?void 0:e.data,v=null==p?void 0:p.action;if(v)if("id"in p)null===(l=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===l||l.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(p);else if("ping"===v)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===v){var h=null==p?void 0:p.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;c=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:a.getEventTagProps,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u,extractDataFromDataSource:a.extractDataFromDataSource,dataExtractor:a,diagnostics:{autocapture:{version:"1.12.2"}}}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===v&&(null===(d=null==c?void 0:c.close)||void 0===d||d.call(c))}})),this.notify({action:"page-loaded"})},e}();function uo(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,u=e.shouldTrackEvent,l=e.evaluateTriggers,d=o.clickObservable,f=d.pipe(wr((function(e,t){var n,r=!1;e.subscribe(Er(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),ji((function(e){var t=c(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),p=Ui(f,d.pipe((t=s.debounceTime,void 0===n&&(n=Wr),wr((function(e,r){var i=null,o=null,s=null,u=function(){if(i){i.unsubscribe(),i=null;var e=o;o=null,r.next(e)}};function a(){var e=s+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);u()}e.subscribe(Er(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(a,t),r.add(i))}),(function(){u(),r.complete()}),void 0,(function(){o=i=null})))}))),Si((function(){return"timeout"})))),v=d.pipe(function(e,t){void 0===t&&(t=Wr);var n=Li(e,t);return Fi((function(){return n}))}(0),ji(Yi),ji((function(e){return u("click",e.closestTrackedAncestor)})),Si((function(e){return l(e)})),(r=p,wr((function(e,t){var n=[];return e.subscribe(Er(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),fi(r).subscribe(Er(t,(function(){var e=n;n=[],t.next(e)}),sr)),function(){n=null}}))));return v.subscribe((function(e){var t,n,r=(e.length,Mn);try{for(var o=a(e),s=o.next();!s.done;s=o.next()){var u=s.value;null==i||i.track(r,u.targetElementProperties)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}))}function ao(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,u=n.clickObservable,a=n.mutationObservable,d=n.navigateObservable,f=u.pipe(ji((function(e){return!o("click",e.closestTrackedAncestor)})),Si((function(e){var t=Ji(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),ji(Yi),ji((function(e){return s("click",e.closestTrackedAncestor)}))),p=[a];d&&p.push(d);var v,h,g=Ui.apply(void 0,l([],c(p),!1)),y=f.pipe((v=function(e){return g.pipe(Mi(1),function(e,t){var n=wi(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?_i:o,u=n.scheduler,a=void 0===u?null!=t?t:Wr:u,c=n.meta,l=void 0===c?null:c;if(null==r&&null==i)throw new TypeError("No timeout provided.");return wr((function(e,t){var n,o,u=null,c=0,d=function(e){o=vi(t,a,(function(){try{n.unsubscribe(),fi(s({meta:l,lastValue:u,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(Er(t,(function(e){null==o||o.unsubscribe(),c++,t.next(u=e),i>0&&d(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),u=null}))),!c&&d(null!=r?"number"==typeof r?r:+r-a.now():i)}))}({first:500,with:function(){return Xr}}),Si((function(){return e})))},wr((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(Er(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;fi(v(e,s)).subscribe(n=Er(t,(function(n){return t.next(h?h(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return y.subscribe((function(e){null==t||t.track(Mn,i("click",e.closestTrackedAncestor))}))}var co,lo=function(){return new yr((function(e){var t=new MutationObserver((function(t){e.next(t)}));return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}}))},fo=function(e){return void 0===e&&(e="click"),Ci(document,e,{capture:!0})},po={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},vo=function(e){var t,n,r,i,o=Object.values(po).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return o;try{for(var s=a(e),u=s.next();!u.done;u=s.next()){var c=u.value;try{try{for(var l=(r=void 0,a(c.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,p=po[f.event_type];p&&o[p].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},ho=function(e){var t,n,r,i,o=new Map;try{for(var s=a(e),u=s.next();!u.done;u=s.next()){var c=u.value;try{for(var l=(r=void 0,a(c.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var p=f.match.eventId,v=o.get(p);v||(v=[],o.set(p,v)),v.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},go=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return po[t.event_type]===e.type&&t.filters.every((function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)}))}))}))},yo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,s=new Set;try{for(var u=a(e),c=u.next();!c.done;c=u.next()){var l=c.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,a(d)),p=f.next();!p.done;p=f.next()){var v=p.value;s.add(v)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(s)}(go(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var o=a(i),s=o.next();!s.done;s=o.next()){var u=s.value;to(u.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}();!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(co||(co={}));var mo=function(e){var t,n,r,o,d,f,p,v;void 0===e&&(e={});var h=e.dataAttributePrefix,g=void 0===h?De:h,y=e.visualTaggingOptions,m=void 0===y?{enabled:!0,messenger:new so}:y;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:je,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:Me,e.debounceTime=null!==(r=e.debounceTime)&&void 0!==r?r:0,e.pageUrlExcludelist=null===(o=e.pageUrlExcludelist)||void 0===o?void 0:o.reduce((function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e}),[]);var b="@amplitude/plugin-autocapture-browser",w=[],E=new oo(e),_=vo(Object.values(null!==(f=null===(d=e.pageActions)||void 0===d?void 0:d.labeledEvents)&&void 0!==f?f:{})),S=ho(null!==(v=null===(p=e.pageActions)||void 0===p?void 0:p.triggers)&&void 0!==v?v:[]),T=function(e,t,n,r){return new yo(e,t,n,r)}(_,S,E,e);return{name:b,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,(function(){var r,o,a,d,f,p,v,h,y,I;return u(this,(function(k){return"undefined"==typeof document||(t.fetchRemoteConfig&&Dn({localConfig:t,configKeys:["analyticsSDK.pageActions"]}).then((function(n){return s(void 0,void 0,void 0,(function(){var r,o;return u(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,n.getRemoteConfig("analyticsSDK","pageActions")];case 1:return function(t){var n,r;t&&(e.pageActions=i(i({},e.pageActions),t),_=vo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),S=ho(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),T.update(_,S,e))}(s.sent()),[3,3];case 2:return r=s.sent(),null===(o=null==t?void 0:t.loggerProvider)||void 0===o||o.error("Failed to fetch remote config: ".concat(String(r))),[3,3];case 3:return[2]}}))}))})).catch((function(e){var n;null===(n=null==t?void 0:t.loggerProvider)||void 0===n||n.error("Failed to create remote config fetch: ".concat(String(e)))})),r=Ki(e,e.cssSelectorAllowlist),o=Ki(e,e.actionClickAllowlist),a=function(){var t,n,r=fo().pipe(Si((function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,g)})),Vi()),i=Ci(document,"change",{capture:!0}).pipe(Si((function(t){return E.addAdditionalEventProperties(t,"change",e.cssSelectorAllowlist,g)})),Vi());window.navigation&&(n=Ci(window.navigation,"navigate").pipe(Si((function(t){return E.addAdditionalEventProperties(t,"navigate",e.cssSelectorAllowlist,g)})),Vi()));var o=lo().pipe(Si((function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,g)})),Vi());return(t={})[co.ClickObservable]=r,t[co.ChangeObservable]=i,t[co.NavigateObservable]=n,t[co.MutationObservable]=o,t}(),d=uo({allObservables:a,options:e,amplitude:n,shouldTrackEvent:r,evaluateTriggers:T.evaluate.bind(T)}),w.push(d),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(ji(Yi),ji((function(e){return i("change",e.closestTrackedAncestor)})),Si((function(e){return o(e)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,l(l([],c(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:T.evaluate.bind(T)}),w.push(f),p=ao({allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,l(l([],c(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:o}),w.push(p),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(b," has been successfully added.")),window.opener&&m.enabled&&(v=e.cssSelectorAllowlist,h=e.actionClickAllowlist,null===(I=m.messenger)||void 0===I||I.setup(i(i({dataExtractor:E,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Wn[t.serverZone]}),{isElementSelectable:Ki(e,l(l([],c(v),!1),c(h),!1)),cssSelectorAllowlist:v,actionClickAllowlist:h})))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,r;return u(this,(function(i){try{for(e=a(w),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};function bo(e,t){var n,r,i,o,s=t.event,u=s.clientX,a=s.clientY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:a,a),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:a,a),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:u,u),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:u,u),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function wo(e){var t=e[0],n=e[e.length-1];return{rageClickEvent:i({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Eo(e){var t,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,s=[],u={};function a(e){s=[],u={},e&&(bo(u,e),s.push(e))}return o.pipe(ji(Yi),ji((function(e){return i("click",e.closestTrackedAncestor)})),Si((function(e){if(t&&clearTimeout(t),bo(u,e),0===s.length)return s.push(e),null;if(function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(s,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(s,e)||u.isOutOfBounds){var r=s.length>=4?wo(s):null;return a(e),r}return s.push(e),s.length>=4&&(t=setTimeout((function(){var e=wo(s),t=e.rageClickEvent,r=e.time;n.track(Fn,t,{time:r}),a()}),1e3)),null})),ji((function(e){return null!==e}))).subscribe((function(e){null!==e&&n.track(Fn,e.rageClickEvent,{time:e.time})}))}var _o,So=function(e){var t,n,r,o,d;void 0===e&&(e={});var f="@amplitude/plugin-frustration-browser",p=[],v=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:Ve,h=null!==(o=null===(r=e.deadClicks)||void 0===r?void 0:r.cssSelectorAllowlist)&&void 0!==o?o:Fe,g=null!==(d=e.dataAttributePrefix)&&void 0!==d?d:De,y=new oo(e),m=l([],c(new Set(l(l([],c(v),!1),c(h),!1))),!1);return{name:f,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,(function(){var r,o,s,a,d,b;return u(this,(function(u){return"undefined"==typeof document||(r=Ki(e,v),o=Ki(e,h),s=function(){var e,t,n=fo("pointerdown").pipe(Si((function(e){return y.addAdditionalEventProperties(e,"click",m,g,!0)})),Vi());window.navigation&&(t=Ci(window.navigation,"navigate").pipe(Si((function(e){return y.addAdditionalEventProperties(e,"navigate",m,g)})),Vi()));var r=lo().pipe(Si((function(e){return y.addAdditionalEventProperties(e,"mutation",m,g)})),Vi());return(e={})[co.ClickObservable]=n,e[co.ChangeObservable]=new yr,e[co.NavigateObservable]=t,e[co.MutationObservable]=r,e}(),a=Eo({allObservables:s,amplitude:n,shouldTrackRageClick:r}),p.push(a),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,o=e.shouldTrackDeadClick,s=n.clickObservable,u=n.mutationObservable,a=n.navigateObservable,d=s.pipe(ji(Yi),ji((function(e){return o("click",e.closestTrackedAncestor)})),ji((function(e){return null===e.event.target.closest('a[target="_blank"]')}))),f=[u];a&&f.push(a);var p=Ui.apply(void 0,l([],c(f),!1));return d.pipe(ki((function(e){var t;return Di(new yr((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),p.pipe(Mi(1),Si((function(){return null})))).pipe(ji((function(e){return null!==e})))})),Bi(3e3)).subscribe((function(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",i(i({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}))}({amplitude:n,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,g)},shouldTrackDeadClick:o}),p.push(d),null===(b=null==t?void 0:t.loggerProvider)||void 0===b||b.log("".concat(f," has been successfully added."))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,r;return u(this,(function(i){try{for(e=a(p),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},To="[Amplitude] Network Request",Io="500-599";function ko(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function xo(e,t){var n,r,i=t.split(",");try{for(var o=a(i),s=o.next();!s.done;s=o.next()){var u=c(s.value.split("-").map(Number),2),l=u[0],d=u[1];if(e===l&&void 0===d)return!0;if(e>=l&&e<=d)return!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function Oo(e){var t;if(e)try{var n=null===(t=F())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,u=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:r.href,host:u}}catch(e){return}}function Po(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return l([],c(R),!1);if(void 0===e){return}}}function Ao(e){var t,n;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)}function Ro(e,t){var n;void 0===t&&(t={});var r=Oo(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(ko(o,"*.amplitude.com")||ko(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return ko(o,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!xo(e.status,Io))return!1;if(t.captureRules&&(l([],c(t.captureRules),!1).reverse().find((function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find((function(e){return ko(t,e)})))&&(!r||!e.urls||Oe(r,e.urls))&&(!i||!e.methods||e.methods.find((function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((n||0===n)&&!xo(n,e.statusCodeRange||Io))}(t,o,e.status,e.url,e.method),i){var n=Po(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var s=Po(t.requestHeaders);if(e.requestWrapper&&s){var u=e.requestWrapper.headers(s);u&&(e.requestHeaders=u)}e.responseWrapper&&t.responseBody&&!Ao(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!Ao(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==i})),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find((function(e){return e.event_type===To})))return!0}catch(e){}return!1}(o,e.requestWrapper)}function Co(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude;return t.networkObservable.pipe(ji((function(e){return Ro(e.event,n)}))).subscribe((function(e){var t,n,i,o=e.event,a=Oo(o.url);if(a){var l=null===(n=o.responseWrapper)||void 0===n?void 0:n.bodySize,d=null===(i=o.requestWrapper)||void 0===i?void 0:i.bodySize;!function(e,t,n){s(this,void 0,void 0,(function(){var r,i,o;return u(this,(function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:r=c.apply(void 0,[s.sent(),2]),i=r[0],o=r[1],i&&(e["[Amplitude] Request Body"]=i),o&&(e["[Amplitude] Response Body"]=o),s.label=2;case 2:return null==n||n.track(To,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=a.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=a.query,t["[Amplitude] URL Fragment"]=a.fragment,t["[Amplitude] Request Method"]=o.method,t["[Amplitude] Status Code"]=o.status,t["[Amplitude] Start Time"]=o.startTime,t["[Amplitude] Completion Time"]=o.endTime,t["[Amplitude] Duration"]=o.duration,t["[Amplitude] Request Body Size"]=d,t["[Amplitude] Response Body Size"]=l,t["[Amplitude] Request Type"]=o.type,t["[Amplitude] Request Headers"]=o.requestHeaders,t["[Amplitude] Response Headers"]=o.responseHeaders,t),o,r)}}))}!function(e){e.NetworkObservable="networkObservable"}(_o||(_o={}));var No=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],i=function(){var e,n=new yr((function(e){var n=new ut((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return ct.subscribe(n,t),function(){ct.unsubscribe(n)}}));return(e={})[_o.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(o,a){return s(void 0,void 0,void 0,(function(){var s,c;return u(this,(function(u){return"undefined"==typeof document||(s=i(),c=Co({allObservables:s,networkTrackingOptions:e,amplitude:a}),r.push(c),null==(t=null==o?void 0:o.loggerProvider)||t.log("".concat(n," has been successfully added."))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,i;return u(this,(function(o){try{for(e=a(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};let Lo=-1;const Uo=e=>{addEventListener("pageshow",(t=>{t.persisted&&(Lo=t.timeStamp,e(t))}),!0)},qo=(e,t,n,r)=>{let i,o;return s=>{t.value>=0&&(s||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},jo=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Do=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Mo=()=>{const e=Do();return e?.activationStart??0},Fo=(e,t=-1)=>{const n=Do();let r="navigate";return Lo>=0?r="back-forward-cache":n&&(document.prerendering||Mo()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},Vo=new WeakMap;function $o(e,t){return Vo.get(e)||Vo.set(e,new t),Vo.get(e)}class Bo{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const zo=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Wo=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Ko=-1;const Ho=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Jo=e=>{"hidden"===document.visibilityState&&Ko>-1&&(Ko="visibilitychange"===e.type?e.timeStamp:0,Go())},Yo=()=>{addEventListener("visibilitychange",Jo,!0),addEventListener("prerenderingchange",Jo,!0)},Go=()=>{removeEventListener("visibilitychange",Jo,!0),removeEventListener("prerenderingchange",Jo,!0)},Qo=()=>{if(Ko<0){const e=Mo(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;Ko=t??Ho(),Yo(),Uo((()=>{setTimeout((()=>{Ko=Ho(),Yo()}))}))}return{get firstHiddenTime(){return Ko}}},Xo=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},Zo=[1800,3e3],es=(e,t={})=>{Xo((()=>{const n=Qo();let r,i=Fo("FCP");const o=zo("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Mo(),0),i.entries.push(t),r(!0)))}));o&&(r=qo(e,i,Zo,t.reportAllChanges),Uo((n=>{i=Fo("FCP"),r=qo(e,i,Zo,t.reportAllChanges),jo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},ts=[.1,.25];let ns=0,rs=1/0,is=0;const os=e=>{for(const t of e)t.interactionId&&(rs=Math.min(rs,t.interactionId),is=Math.max(is,t.interactionId),ns=is?(is-rs)/7+1:0)};let ss;const us=()=>ss?ns:performance.interactionCount??0;let as=0;class cs{u=[];l=new Map;m;p;v(){as=us(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor((us()-as)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.T){if(n?e.duration>n.T?(n.entries=[e],n.T=e.duration):e.duration===n.T&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],T:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.T-e.T)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const ls=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(t(e=Wo(e)),document.addEventListener("visibilitychange",e,{once:!0}))},ds=[200,500],fs=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&Xo((()=>{"interactionCount"in performance||ss||(ss=zo("event",os,{type:"event",buffered:!0,durationThreshold:0}));let n,r=Fo("INP");const i=$o(t,cs),o=e=>{ls((()=>{for(const t of e)i.h(t);const t=i.P();t&&t.T!==r.value&&(r.value=t.T,r.entries=t.entries,n())}))},s=zo("event",o,{durationThreshold:t.durationThreshold??40});n=qo(e,r,ds,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),Uo((()=>{i.v(),r=Fo("INP"),n=qo(e,r,ds,t.reportAllChanges)})))}))};class ps{m;h(e){this.m?.(e)}}const vs=[2500,4e3],hs=[800,1800],gs=e=>{document.prerendering?Xo((()=>gs(e))):"complete"!==document.readyState?addEventListener("load",(()=>gs(e)),!0):setTimeout(e)};function ys(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function ms(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(ys(e)),navigationStart:Math.floor(performance.timeOrigin)}}var bs=function(){var e=null,t=F(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,(function(){var o,s,a;return u(this,(function(u){return o=function(e){var n;if(!e)return"";var r=e;try{r=decodeURI(e)}catch(e){null===(n=t.loggerProvider)||void 0===n||n.error("Malformed URI sequence: ",e)}return r},void 0===n||(s=o(null==r?void 0:r.href),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":s,"[Amplitude] Page Path":o(null==r?void 0:r.pathname),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":s.split("?")[0]},((e,t={})=>{Xo((()=>{const n=Qo();let r,i=Fo("LCP");const o=$o(t,ps),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Mo(),0),i.entries=[t],r())},u=zo("largest-contentful-paint",s);if(u){r=qo(e,i,vs,t.reportAllChanges);const n=Wo((()=>{s(u.takeRecords()),u.disconnect(),r(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>ls(n)),{capture:!0,once:!0});Uo((n=>{i=Fo("LCP"),r=qo(e,i,vs,t.reportAllChanges),jo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((function(e){a["[Amplitude] LCP"]=ms(e)})),es((function(e){a["[Amplitude] FCP"]=ms(e)})),fs((function(e){a["[Amplitude] INP"]=ms(e)})),((e,t={})=>{es(Wo((()=>{let n,r=Fo("CLS",0);const i=$o(t,Bo),o=e=>{for(const t of e)i.h(t);i.i>r.value&&(r.value=i.i,r.entries=i.o,n())},s=zo("layout-shift",o);s&&(n=qo(e,r,ts,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),Uo((()=>{i.i=0,r=Fo("CLS",0),n=qo(e,r,ts,t.reportAllChanges),jo((()=>n()))})),setTimeout(n))})))})((function(e){a["[Amplitude] CLS"]=ms(e)})),((e,t={})=>{let n=Fo("TTFB"),r=qo(e,n,hs,t.reportAllChanges);gs((()=>{const i=Do();i&&(n.value=Math.max(i.responseStart-Mo(),0),n.entries=[i],r(!0),Uo((()=>{n=Fo("TTFB",0),r=qo(e,n,hs,t.reportAllChanges),r(!0)})))}))})((function(e){a["[Amplitude] TTFB"]=ms(e)})),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]}))}))}}},ws=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Es=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,u=o(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=o(a,["referrer","referring_domain"]);if(_s(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(u)!==JSON.stringify(l),f=ws(s||"")!==ws(c||""),p=!t||d||f;return p?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),p},_s=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))},Ss=function(){function e(e,t){var n,r,o;this.shouldTrackNewCampaign=!1,this.options=i({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,o=r,o?(o.startsWith(".")&&(o=o.substring(1)),[new RegExp("".concat(o.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=Ne(t.apiKey,"MKTG"),this.webExpStorageKey=Ne(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=A,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,(function(){var e,t;return u(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=c.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||be(this.sessionTimeout,this.lastEventTime),Es(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new lt).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,o,s=(t=this.currentCampaign,n=this.options,r=i(i({},A),t),o=Object.entries(r).reduce((function(e,t){var r,i=c(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)}),new U),z(o));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Ts=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.init=function(e,t,n){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=n):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),W(this._init(i(i({},o),{userId:r,apiKey:e})))},n.prototype._init=function(t){var n,r,o;return s(this,void 0,void 0,(function(){var s,a,c,l,d,f,p,v=this;return u(this,(function(u){switch(u.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Qt(t.apiKey,t,this)]);case 1:return(s=u.sent()).fetchRemoteConfig?(this.remoteConfigClient=new J(s.apiKey,s.loggerProvider,s.serverZone),[4,new Promise((function(e){var t;null===(t=v.remoteConfigClient)||void 0===t||t.subscribe("configs.analyticsSDK.browserSDK","all",(function(t,n,r){s.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&Nn(t,s),e()}))}))]):[3,3];case 2:u.sent(),u.label=3;case 3:return[4,e.prototype._init.call(this,s)];case 4:return u.sent(),this.logBrowserOptions(s),ft(this.config.defaultTracking)?(a=function(e){return ft(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?i({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new Ss(a,this.config),[4,this.webAttribution.init()]):[3,6];case 5:u.sent(),u.label=6;case 6:return c=_e(),l=c.ampTimestamp?Number(c.ampTimestamp):void 0,d=!l||Date.now()<l,f=d&&!Number.isNaN(Number(c.ampSessionId))?Number(c.ampSessionId):void 0,this.setSessionId(null!==(o=null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:f)&&void 0!==r?r:this.config.sessionId)&&void 0!==o?o:Date.now()),(p=ye(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,8]:[4,this.add(An()).promise];case 7:u.sent(),u.label=8;case 8:return[4,this.add(new oe).promise];case 9:return u.sent(),[4,this.add(new kt).promise];case 10:return u.sent(),[4,this.add(new me).promise];case 11:return u.sent(),function(e){Pn||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Pn=!0)}(this.config),h=this.config.defaultTracking,dt(h,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(On()).promise]):[3,13];case 12:u.sent(),u.label=13;case 13:return function(e){return dt(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(In()).promise]):[3,15];case 14:u.sent(),u.label=15;case 15:return pt(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(En(Et(this.config))).promise]):[3,17];case 16:u.sent(),u.label=17;case 17:return gt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(mo(mt(this.config))).promise]):[3,19];case 18:u.sent(),u.label=19;case 19:return yt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(So(bt(this.config))).promise]):[3,21];case 20:u.sent(),u.label=21;case 21:return ht(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(No(wt(this.config))).promise]):[3,23];case 22:u.sent(),u.label=23;case 23:return function(e){return"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(bs()).promise]):[3,25];case 24:u.sent(),u.label=25;case 25:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 26:return u.sent(),p.eventBridge.setEventReceiver((function(e){v.track(e.eventType,e.eventProperties)})),[2]}var h}))}))},n.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},n.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){ye(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},n.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},n.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){ye(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},n.prototype.reset=function(){this.setDeviceId($()),this.setUserId(void 0)},n.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},n.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},n.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},n.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),W(Promise.resolve());if(e===this.config.sessionId)return W(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,vt(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Ft,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return vt(this.config.defaultTracking)&&n.push(this.track(Mt,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,W(Promise.all(n))},n.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},n.prototype.setTransport=function(e){this.config?this.config.transportProvider=Zt(e):this.q.push(this.setTransport.bind(this,e))},n.prototype.identify=function(t,n){if(Tt(t)){var r=t._q;t._q=[],t=St(new U,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},n.prototype.groupIdentify=function(t,n,r,i){if(Tt(r)){var o=r._q;r._q=[],r=St(new U,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},n.prototype.revenue=function(t,n){if(Tt(t)){var r=t._q;t._q=[],t=St(new X,r)}return e.prototype.revenue.call(this,t,n)},n.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},n.prototype.process=function(t){return s(this,void 0,void 0,(function(){var n,i,o;return u(this,(function(s){return n=Date.now(),i=be(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Mt||t.event_type===Ft||t.session_id&&t.session_id!==this.getSessionId()||(i||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),t.event_type===r.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]}))}))},n.prototype.logBrowserOptions=function(e){try{var t=i(i({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},n}(K),Is=function(){var e=new Ts;return{init:xe(e.init.bind(e),"init",Te(e),ke(e,["config"])),add:xe(e.add.bind(e),"add",Te(e),ke(e,["config.apiKey","timeline.plugins"])),remove:xe(e.remove.bind(e),"remove",Te(e),ke(e,["config.apiKey","timeline.plugins"])),track:xe(e.track.bind(e),"track",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),logEvent:xe(e.logEvent.bind(e),"logEvent",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),identify:xe(e.identify.bind(e),"identify",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),groupIdentify:xe(e.groupIdentify.bind(e),"groupIdentify",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),setGroup:xe(e.setGroup.bind(e),"setGroup",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),revenue:xe(e.revenue.bind(e),"revenue",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),flush:xe(e.flush.bind(e),"flush",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),getUserId:xe(e.getUserId.bind(e),"getUserId",Te(e),ke(e,["config","config.userId"])),setUserId:xe(e.setUserId.bind(e),"setUserId",Te(e),ke(e,["config","config.userId"])),getDeviceId:xe(e.getDeviceId.bind(e),"getDeviceId",Te(e),ke(e,["config","config.deviceId"])),setDeviceId:xe(e.setDeviceId.bind(e),"setDeviceId",Te(e),ke(e,["config","config.deviceId"])),reset:xe(e.reset.bind(e),"reset",Te(e),ke(e,["config","config.userId","config.deviceId"])),getSessionId:xe(e.getSessionId.bind(e),"getSessionId",Te(e),ke(e,["config"])),setSessionId:xe(e.setSessionId.bind(e),"setSessionId",Te(e),ke(e,["config"])),extendSession:xe(e.extendSession.bind(e),"extendSession",Te(e),ke(e,["config"])),setOptOut:xe(e.setOptOut.bind(e),"setOptOut",Te(e),ke(e,["config"])),setTransport:xe(e.setTransport.bind(e),"setTransport",Te(e),ke(e,["config"])),getIdentity:xe(e.getIdentity.bind(e),"getIdentity",Te(e),ke(e,["config"])),getOptOut:xe(e.getOptOut.bind(e),"getOptOut",Te(e),ke(e,["config"]))}},ks=Is(),xs=Object.freeze({__proto__:null,get IdentifyOperation(){return n},get SpecialEventType(){return r},get RevenueProperty(){return Y},get LogLevel(){return D},get ServerZone(){return pe},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:je,DEFAULT_DATA_ATTRIBUTE_PREFIX:De,DEFAULT_ACTION_CLICK_ALLOWLIST:Me}),Os=ks.add,Ps=ks.extendSession,As=ks.flush,Rs=ks.getDeviceId,Cs=ks.getIdentity,Ns=ks.getOptOut,Ls=ks.getSessionId,Us=ks.getUserId,qs=ks.groupIdentify,js=ks.identify,Ds=ks.init,Ms=ks.logEvent,Fs=ks.remove,Vs=ks.reset,$s=ks.revenue,Bs=ks.setDeviceId,zs=ks.setGroup,Ws=ks.setOptOut,Ks=ks.setSessionId,Hs=ks.setTransport,Js=ks.setUserId,Ys=ks.track,Gs=Object.freeze({__proto__:null,add:Os,extendSession:Ps,flush:As,getDeviceId:Rs,getIdentity:Cs,getOptOut:Ns,getSessionId:Ls,getUserId:Us,groupIdentify:qs,identify:js,init:Ds,logEvent:Ms,remove:Fs,reset:Vs,revenue:$s,setDeviceId:Bs,setGroup:zs,setOptOut:Ws,setSessionId:Ks,setTransport:Hs,setUserId:Js,track:Ys,createInstance:Is,AmplitudeBrowser:Ts,runQueuedFunctions:_t,Revenue:X,Identify:U,Types:xs});!function(){var e=F();if(e){var t=function(e){var t=Is(),n=F();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Gs,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],_t(Gs,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i<r.length;i++){var o=r[i],s=Object.assign(e.amplitude._iq[o],t(o)),u=s._q;s._q=[],_t(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
1
+ !function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var n,r,i=function(){return i=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},i.apply(this,arguments)};function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{a(r.next(e))}catch(e){o(e)}}function u(e){try{a(r.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((r=r.apply(e,t||[])).next())}))}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function d(e){return this instanceof d?(this.v=e,this):new d(e)}function f(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r=Object.create(("function"==typeof AsyncIterator?AsyncIterator:Object).prototype),s("next"),s("throw"),s("return",(function(e){return function(t){return Promise.resolve(t).then(e,c)}})),r[Symbol.asyncIterator]=function(){return this},r;function s(e,t){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||u(e,t)}))},t&&(r[e]=t(r[e])))}function u(e,t){try{!function(e){e.value instanceof d?Promise.resolve(e.value.v).then(a,c):l(o[0][2],e)}(i[e](t))}catch(e){l(o[0][3],e)}}function a(e){u("next",e)}function c(e){u("throw",e)}function l(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=a(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(n||(n={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(r||(r={}));var v,h="AMP",g="".concat(h,"_unsent"),y="$default_instance",m="https://api2.amplitude.com/2/httpapi",b="dclid",w="fbclid",E="gbraid",_="gclid",S="ko_click_id",T="li_fat_id",I="msclkid",k="rdt_cid",x="ttclid",P="twclid",O="wbraid",A={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],C=["authorization","cookie","set-cookie"],N=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!L(t,n))return!1}return!0},L=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=a(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)i=i&&N(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return N(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},U=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return i({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(v.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(v.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(v.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(v.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(v.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(v.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(v.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(v.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(v.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[v.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[v.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===v.ADD?"number"==typeof n:e===v.UNSET||e===v.REMOVE||L(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(v||(v={}));var q,j=[v.CLEAR_ALL,v.UNSET,v.SET,v.SET_ONCE,v.ADD,v.APPEND,v.PREPEND,v.PREINSERT,v.POSTINSERT,v.REMOVE];!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(q||(q={}));var D,M=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=q.Unknown),{event:e,code:t,message:n}},F=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},V=l([],c(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),$=function(e){var t,n=F();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,$)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,l([],c(r.entries()),!1).map((function(e){var t=c(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(V[r]):V[r]})).join("")},B=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=$(),this.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,(function(){var r,i;return u(this,(function(o){switch(o.label){case 0:return r=this.plugins.findIndex((function(t){return t.name===e})),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}}))}))},e.prototype.reset=function(e){this.applying=!1,this.plugins.map((function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)})),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return s(this,void 0,void 0,(function(){var t,n,r,o,s,l,d,f,p,v,h,g,y,m,b,w,E,_,S,T;return u(this,(function(u){switch(u.label){case 0:if(!e)return[2];t=c(e,1),n=t[0],r=c(e,2),o=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),s=this.plugins.filter((function(e){return"before"===e.type})),u.label=1;case 1:u.trys.push([1,6,7,8]),l=a(s),d=l.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(i({},n))]:[3,4];case 3:if(null===(y=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=y,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(_=l.return)&&_.call(l)}finally{if(E)throw E.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),u.label=9;case 9:u.trys.push([9,14,15,16]),v=a(p),h=v.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(i({},n))]:[3,12];case 11:if(null===(y=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=y,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=u.sent(),S={error:m},[3,16];case 15:try{h&&!h.done&&(T=v.return)&&T.call(v)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),w=b.map((function(e){var t=i({},n);return e.execute(t).catch((function(e){return M(t,0,String(e))}))})),Promise.all(w).then((function(e){var t=c(e,1)[0]||M(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return s(this,void 0,void 0,(function(){var e,t,n,r=this;return u(this,(function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return r.apply(e)})))];case 1:return i.sent(),t=this.plugins.filter((function(e){return"destination"===e.type})),n=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(n)];case 2:return i.sent(),[2]}}))}))},e.prototype.onIdentityChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)}))},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)}))},e.prototype.onOptOutChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}))},e}(),z=function(e,t){return i(i({},t),{event_type:r.IDENTIFY,user_properties:e.getUserProperties()})},W=function(e){return{promise:e||Promise.resolve()}},H=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new B(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return s(this,void 0,void 0,(function(){var t,n,r,i,o,s,c,l;return u(this,(function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),n=a(t),r=n.next(),u.label=2;case 2:return r.done?[3,7]:(i=r.value,(o=i())&&"promise"in o?[4,o.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,o];case 5:u.sent(),u.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),c={error:s},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:u.sent(),u.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return i(i(i({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return W(this.dispatch(r))},e.prototype.identify=function(e,t){var n=z(e,t);return W(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,o){var s=function(e,t,n,o){var s;return i(i({},o),{event_type:r.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(s={},s[e]=t,s)})}(e,t,n,o);return W(this.dispatch(s))},e.prototype.setGroup=function(e,t,n){var o=function(e,t,n){var o,s=new U;return s.set(e,t),i(i({},n),{event_type:r.IDENTIFY,user_properties:s.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n);return W(this.dispatch(o))},e.prototype.revenue=function(e,t){var n=function(e,t){return i(i({},t),{event_type:r.REVENUE,event_properties:e.getEventProperties()})}(e,t);return W(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),W())},e.prototype._addPlugin=function(e){return W(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),W())},e.prototype._removePlugin=function(e){return W(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(M(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,(function(){var t=this;return u(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.getOperationAppliedUserProperties=function(e){var t={};if(void 0===e)return t;var r={};return Object.keys(e).forEach((function(t){Object.values(n).includes(t)||(r[t]=e[t])})),j.forEach((function(r){if(Object.keys(e).includes(r)){var i=e[r];switch(r){case n.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case n.UNSET:Object.keys(i).forEach((function(e){delete t[e]}));break;case n.SET:Object.assign(t,i)}}})),Object.assign(t,r),t},e.prototype.process=function(e){return s(this,void 0,void 0,(function(){var t,n,i,o;return u(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,M(e,0,"Event skipped due to optOut config")]:(e.event_type===r.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)]);case 1:return 200===(o=s.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=s.sent(),i=String(n),this.config.loggerProvider.error(i),[2,o=M(e,0,i)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=Boolean(e))},e.prototype.flush=function(){return W(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find((function(t){return t.name===e}));if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter((function(t){return t instanceof e}))},e}(),K=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),J=function(){function e(e,t,n){void 0===n&&(n="US"),this.callbackInfos=[],this.apiKey=e,this.serverUrl="US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config",this.logger=t,this.storage=new K(e,t)}return e.prototype.subscribe=function(e,t,n){var r=$(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex((function(t){return t.id===e}));return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,(function(){var e,t=this;return u(this,(function(n){switch(n.label){case 0:return[4,this.fetch()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach((function(n){t.sendCallback(n,e,"remote")})),[2]}}))}))},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,(function(){var t,n,r,i=this;return u(this,(function(o){switch(o.label){case 0:return t=this.fetch().then((function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)})),n=this.storage.fetchConfig().then((function(e){return e})),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),this.sendCallback(e,r,"cache")),[4,t];case 2:return o.sent(),[2]}}))}))},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:n=new Promise((function(e,n){setTimeout((function(){n("Timeout exceeded")}),t)})),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.fetch(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}}))}))},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce((function(e,t){return null===e?e:t in e?e[t]:null}),t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,(function(){var n,r,i,o,s,a,c=this;return u(this,(function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,l,d;return u(this,(function(u){switch(u.label){case 0:i=new AbortController,s=setTimeout((function(){return i.abort()}),t),u.label=1;case 1:return u.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:return(a=u.sent()).ok?[3,4]:[4,a.text()];case 3:return l=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(a.status,": ").concat(l)),[3,6];case 4:return[4,a.json()];case 5:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=u.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(s),[7];case 9:return r<e-1?[4,new Promise((function(e){return setTimeout(e,c.getJitterDelay(n))}))]:[3,11];case 10:u.sent(),u.label=11;case 11:return[2]}}))},o=this,s=0,l.label=1;case 1:return s<e?[5,i(s)]:[3,4];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];l.label=3;case 3:return s++,[3,1];case 4:return[2,r]}}))}))},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}();!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(D||(D={}));var Y,G="Amplitude Logger ",Q=function(){function e(){this.logLevel=D.None}return e.prototype.disable=function(){this.logLevel=D.None},e.prototype.enable=function(e){void 0===e&&(e=D.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Verbose||console.log("".concat(G,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Warn||console.warn("".concat(G,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Error||console.error("".concat(G,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<D.Debug||console.log("".concat(G,"[Debug]: ").concat(e.join(" ")))},e}(),X=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){return N(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?i({},this.properties):{};return e[Y.REVENUE_PRODUCT_ID]=this.productId,e[Y.REVENUE_QUANTITY]=this.quantity,e[Y.REVENUE_PRICE]=this.price,e[Y.REVENUE_TYPE]=this.revenueType,e[Y.REVENUE_CURRENCY]=this.currency,e[Y.REVENUE]=this.revenue,e[Y.RECEIPT]=this.receipt,e[Y.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(Y||(Y={}));var Z=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:y,logLevel:D.Warn,loggerProvider:new Q,offline:!1,optOut:!1,serverUrl:m,serverZone:"US",useBatch:!1}},ee=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=Z();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=ne(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),te=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":m},ne=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=Z().serverZone),void 0===n&&(n=Z().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:Z().serverZone;return{serverZone:r,serverUrl:te(r,n)}},re=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function ie(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var oe=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,(function(){var n,r=this;return u(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(g,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map((function(e){return r.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=$()),new Promise((function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()}))},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter((function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)}))},e.prototype.scheduleEvents=function(e){var t=this;e.forEach((function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)}))},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout((function(){t.queue=t.queue.map((function(e){return e.timeout=0,e})),t.flush(!0)}),e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t,n,r=this;return u(this,(function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce((function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e}),[]).reduce((function(t,n){return s(r,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}}))}))}),Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),s(this,void 0,void 0,(function(){var n,r,i,s,a;return u(this,(function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,o(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new re,u.label=1;case 1:return u.trys.push([1,3,,4]),r=ne(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(i=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(i,e),[3,4]):("body"in i?this.fulfillRequest(e,i.statusCode,"".concat(i.status,": ").concat(ie(i))):this.fulfillRequest(e,i.statusCode,i.status),[2]);case 3:return s=u.sent(),a=(c=s)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.handleResponse({status:q.Failed,statusCode:0},e),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case q.Success:this.handleSuccessResponse(e,t);break;case q.Invalid:this.handleInvalidResponse(e,t);break;case q.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case q.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=l(l(l(l([],c(Object.values(e.body.eventsWithInvalidFields)),!1),c(Object.values(e.body.eventsWithMissingFields)),!1),c(Object.values(e.body.eventsWithInvalidIdLengths)),!1),c(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter((function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(ie(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(ie(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),u=new Set(i),a=new Set(o),c=t.filter((function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(ie(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(M(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map((function(e){return e.event}));this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter((function(t){return!e.some((function(e){return e.event.insert_id===t.event.insert_id}))})),this.saveEvents()},e}(),se=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ue(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ue=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ae=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}(),ce=function(){return ce=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ce.apply(this,arguments)};function le(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function de(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var fe=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=le(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var u=Array.isArray(e),a=Array.isArray(t);if(u!==a)return!1;if(!u||!a){var c=Object.keys(e).sort(),l=Object.keys(t).sort();if(!fe(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){fe(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!fe(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var pe,ve=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ce({},this.identity.userProperties),n=ce(ce({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,u,a=n.userProperties||{};try{for(var c=le(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=de(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var v=(i=void 0,le(Object.entries(p))),h=v.next();!h.done;h=v.next()){var g=de(h.value,2),y=g[0],m=g[1];a[y]=m}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,le(Object.keys(p))),w=b.next();!w.done;w=b.next()){delete a[y=w.value]}}catch(e){s={error:e}}finally{try{w&&!w.done&&(u=b.return)&&u.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":a={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return n.userProperties=a,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ce({},this.identity)},e.prototype.setIdentity=function(e){var t=ce({},this.identity);this.identity=ce({},e),fe(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),he="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,ge=function(){function e(){this.identityStore=new ve,this.eventBridge=new ae,this.applicationContextProvider=new se}return e.getInstance=function(t){return he.analyticsConnectorInstances||(he.analyticsConnectorInstances={}),he.analyticsConnectorInstances[t]||(he.analyticsConnectorInstances[t]=new e),he.analyticsConnectorInstances[t]},e}(),ye=function(e){return void 0===e&&(e=y),ge.getInstance(e)},me=function(){function e(){this.name="identity",this.type="before",this.identityStore=ye().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,(function(){var t;return u(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){return e.instanceName&&(this.identityStore=ye(e.instanceName).identityStore),[2]}))}))},e}(),be=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},we=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[h,t,e.substring(0,n)].filter(Boolean).join("_")},Ee=function(){var e,t,n,r;if("undefined"==typeof navigator)return"";var i=navigator.userLanguage;return null!==(r=null!==(n=null!==(t=null===(e=navigator.languages)||void 0===e?void 0:e[0])&&void 0!==t?t:navigator.language)&&void 0!==n?n:i)&&void 0!==r?r:""},_e=function(){var e,t=F();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=Se(n[0]),i=Se(n[1]);return i?(e[r]=i,e):e}),{}):{}},Se=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Te=function(e){return function(){var t=i({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},Ie=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=a(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ke=function(e,t){return function(){var n,r,i={};try{for(var o=a(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Ie(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},xe=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),a=u.logger,c=u.logLevel;if(c&&c<D.Debug||!c||!a)return e.apply(i,o);var l,d={type:"invoke public method",name:t,args:o,stacktrace:(l=1,void 0===l&&(l=0),((new Error).stack||"").split("\n").slice(2+l).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};r&&d.states&&(d.states.before=r());var f=e.apply(i,o);return f&&f.promise?f.promise.then((function(){r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=(new Date).toISOString()),a.debug(JSON.stringify(d,null,2))})):(r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=(new Date).toISOString()),a.debug(JSON.stringify(d,null,2))),f}},Pe=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},Oe=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Ae=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return s(this,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return s(this,void 0,void 0,(function(){return u(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Re=function(){function e(e){this.options=i({},e)}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,(function(){var t,n;return u(this,(function(r){switch(r.label){case 0:if(!F())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return r.sent(),[4,t.get(n)];case 3:return[2,r.sent()===e.testValue];case 4:return r.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){var t;return s(this,void 0,void 0,(function(){var n,r;return u(this,(function(i){switch(i.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=i.sent()))return[2,void 0];try{return void 0===(r=null!==(t=Ce(n))&&void 0!==t?t:Ne(n))?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(r)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,(function(){var r,i,o;return u(this,(function(s){return r=F(),i=null!==(n=null===(t=null==r?void 0:r.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],o=i.find((function(t){return 0===t.indexOf(e+"=")})),o?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,(function(){var r,i,o,s,a,c,l;return u(this,(function(u){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(i=null!==t?r:-1)&&((s=new Date).setTime(s.getTime()+24*i*60*60*1e3),o=s),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=F())&&(c.document.cookie=a)}catch(t){l=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}return[2]}))}))},e.prototype.remove=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}}))}))},e.prototype.reset=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2]}))}))},e}(),Ce=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},Ne=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},Le=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[h,t,e.substring(0,n)].filter(Boolean).join("_")},Ue=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return s(this,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,(function(){return u(this,(function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,(function(){return u(this,(function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,(function(){return u(this,(function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return s(this,void 0,void 0,(function(){return u(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),qe=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,u,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case q.Success:return{status:T,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case q.Invalid:return{status:T,statusCode:S,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case q.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case q.RateLimit:return{status:T,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(_=e.throttled_events)&&void 0!==_?_:[]}};case q.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?q.Success:429===e?q.RateLimit:413===e?q.PayloadTooLarge:408===e?q.Timeout:e>=400&&e<500?q.Invalid:e>=500?q.Failed:q.Unknown},e}(),je=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n,r,i;return u(this,(function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},n}(qe);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(pe||(pe={}));var De=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Me="data-amp-track-",Fe=["div","span","h1","h2","h3","h4","h5","h6"],Ve=l(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],c(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),$e=["*"];function Be(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function ze(e,t,n){e&&We({json:e,allowlist:t.map(He),excludelist:n.map(He),ancestors:[]})}function We(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,s=e.excludelist,u=e.ancestors,d=e.parentObject,f=e.targetKey;i||(i=r);var p=Object.keys(i);try{for(var v=a(p),h=v.next();!h.done;h=v.next()){var g=h.value,y=l(l([],c(u),!1),[g],!1);Be(i[g])?Je(y,o)&&!Je(y,s)||delete i[g]:We({json:r,targetObject:i[g],allowlist:o,excludelist:s,ancestors:y,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=v.return)&&n.call(v)}finally{if(t)throw t.error}}0===Object.keys(i).length&&d&&f&&delete d[f]}function He(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map((function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")}))}function Ke(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Ke(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Ke(e,t,n+1,r+1)}function Je(e,t){return t.some((function(t){return Ke(e,t)}))}var Ye=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach((function(e){var t=c(e,2),n=t[0],r=t[1];i[n]=r}));else if(r instanceof Headers)r.forEach((function(e,t){i[t]=e}));else if("object"==typeof r&&null!==r)try{for(var o=a(Object.entries(r)),s=o.next();!s.done;s=o.next()){var u=c(s.value,2),l=u[0],d=u[1];i[l]=d}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return rt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=F();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=Qe(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){return u(this,(function(n){return 0===e.length?[2,null]:[2,tt(this.body,e,t)]}))}))},e}(),Ge=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),rt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Qe(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){return u(this,(function(n){return 0===e.length?[2,null]:[2,tt(this.body,e,t)]}))}))},e}();function Qe(e,t){var n,r,i,o=F(),s=null==o?void 0:o.TextEncoder;if(s){var u;if("string"==typeof e)u=e,i=(new s).encode(u).length;else if(e instanceof Blob)i=(u=e).size;else if(e instanceof URLSearchParams)u=e,i=(new s).encode(u.toString()).length;else if(ArrayBuffer.isView(e))i=(u=e).byteLength;else if(e instanceof ArrayBuffer)i=(u=e).byteLength;else if(e instanceof FormData){var l=e,d=0,f=0;try{for(var p=a(l.entries()),v=p.next();!v.done;v=p.next()){var h=c(v.value,2),g=h[0],y=h[1];if(d+=g.length,"string"==typeof y)d+=(new s).encode(y).length;else{if(!(y instanceof Blob))return;d+=y.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}i=d}else if(e instanceof ReadableStream)return void(u=e);return i}}var Xe,Ze=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,(function(e,t){r[t]=e})),rt(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,(function(){var e,t;return u(this,(function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}}))}))},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){return u(this,(function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,tt(n.sent(),e,t)]}}))}))},e}(),et=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=a(i),s=o.next();!s.done;s=o.next()){var u=c(s.value.split(": "),2),l=u[0],d=u[1];l&&d&&(r[l]=d)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return rt(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,(function(){var n;return u(this,(function(r){return 0===e.length?[2,null]:(n=this.getJson())?(ze(n,e,t),[2,n]):[2,null]}))}))},e}();function tt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return ze(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Xe||(Xe={}));var nt="[REDACTED]",rt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,u=void 0===s?Xe.REMOVE:s,d=l([],c(C),!1),f={},p=function(t){var n=t.toLowerCase();d.find((function(e){return e.toLowerCase()===n}))?u===Xe.REDACT&&(f[t]=nt):o.find((function(e){return e.toLowerCase()===n}))?f[t]=e[t]:u===Xe.REDACT&&(f[t]=nt)};try{for(var v=a(Object.keys(e)),h=v.next();!h.done;h=v.next()){p(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}return f},it=function(){function e(e,t,n,r,i,o,s,u,a,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=s,this.duration=u,this.responseWrapper=a,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(l([],c(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(l([],c(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter((function(e){var t=c(e,2);return t[0],void 0!==t[1]})))},e}();var ot,st,ut,at=function(e,t){void 0===t&&(t=$()),this.callback=e,this.id=t},ct=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=F();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=F();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,u,a,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,p=null===(u=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send,v=null===(l=null===(c=null===(a=this.globalScope)||void 0===a?void 0:a.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&p&&v&&this.observeXhr(f,p,v);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(n){var r;try{n.callback(e)}catch(e){null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){var u,a;if(void 0!==o&&void 0!==s){var c,l,d,f="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?c=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(c=t.url,f=t.method),c)try{var p=new URL(c);c="".concat(p.protocol,"//").concat(p.host).concat(p.pathname).concat(p.search).concat(p.hash)}catch(e){null===(a=this.logger)||void 0===a||a.error("an unexpected error occurred while parsing the URL",e)}f=(null==n?void 0:n.method)||f,r&&(l=r.status),i&&(d={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var v=Math.floor(performance.now()-s),h=Math.floor(o+v),g=new it(e,f,o,o,c,n,l,v,r,d,h);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,(function(){var t,i,o,s,a,c;return u(this,(function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while retrieving timestamps",e)}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return s=u.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Ye(r):void 0,i?new Ze(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",e)}if(i)return[2,i];throw o}}))}))})},e.createXhrJsonParser=function(e,t){return function(){var n,r;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&(null===(r=t.logger)||void 0===r||r.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var o=this.globalScope.XMLHttpRequest.prototype,s=this;o.open=function(){for(var e,n,r=[],o=0;o<arguments.length;o++)r[o]=arguments[o];var u=c(r,2),a=u[0],l=u[1];try{this.$$AmplitudeAnalyticsEvent=i({method:a,url:null===(e=null==l?void 0:l.toString)||void 0===e?void 0:e.call(l),headers:{}},s.getTimestamps())}catch(e){null===(n=s.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr open",e)}return t.apply(this,r)},o.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,s),u=t[0],a=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",(function(){var e;try{var t=i.getAllResponseHeaders(),n=i.getResponseHeader("content-length"),r=new et(i.status,t,n?parseInt(n,10):void 0,o),c=i.$$AmplitudeAnalyticsEvent.headers,l=new Ge(u,c);a.status=i.status,s.handleNetworkRequestEvent("xhr",{url:a.url,method:a.method},l,r,void 0,a.startTime,a.durationStart)}catch(t){null===(e=s.logger)||void 0===e||e.error("an unexpected error occurred while handling xhr send",t)}})),n.apply(i,t)},o.setRequestHeader=function(e,t){var n;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(n=s.logger)||void 0===n||n.error("an unexpected error occurred while calling xhr setRequestHeader",e)}r.apply(this,[e,t])}}},e}(),lt=new ct,dt=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,i(i(i(i({},A),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=_e();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=_e();return(e={})[b]=t[b],e[w]=t[w],e[E]=t[E],e[_]=t[_],e[S]=t[S],e[T]=t[T],e[I]=t[I],e[k]=t[k],e[x]=t[x],e[P]=t[P],e[O]=t[O],e},e}(),ft=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},pt=function(e){return ft(e,"attribution")},vt=function(e){return ft(e,"pageViews")},ht=function(e){return ft(e,"sessions")},gt=function(e){return"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},yt=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},mt=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},bt=function(e){if(yt(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},wt=function(e){if(mt(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},Et=function(e){var t;if(gt(e.autocapture)){var n=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),i(i({},n),{captureRules:null===(t=null==n?void 0:n.captureRules)||void 0===t?void 0:t.map((function(t){var n;if(t.urls&&t.hosts){var r=JSON.stringify(t.hosts),o=JSON.stringify(t.urls);return null===(n=e.loggerProvider)||void 0===n||n.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(r,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),i(i({},t),{hosts:void 0})}return t}))})}},_t=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return vt(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},St=function(e,t){Tt(e,t)},Tt=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.resolve,u=e&&e[i];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},It=function(e){return e&&void 0!==e._q},kt="2.24.2",xt=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts-sdk-script","/").concat(kt),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,(function(){var r,o,s;return u(this,(function(u){return r=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,s=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=r),[2,i(i(i(i(i(i(i(i({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Ee()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:$(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Pt=1e3,Ot=function(e){function n(t){var n,r,i,o=this;try{i=null===(n=F())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return t(n,e),n.prototype.set=function(t,n){var r;return s(this,void 0,void 0,(function(){var i;return u(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>Pt?(i=n.length-Pt,[4,e.prototype.set.call(this,t,n.slice(0,Pt))]):[3,2];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(Pt,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},n}(Ue),At=function(e){function n(){var t;return e.call(this,null===(t=F())||void 0===t?void 0:t.sessionStorage)||this}return t(n,e),n}(Ue),Rt=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n=this;return u(this,(function(r){return[2,new Promise((function(r,i){"undefined"==typeof XMLHttpRequest&&i(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{r(n.buildResponse(JSON.parse(e)))}catch(e){r(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},n}(qe),Ct=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n=this;return u(this,(function(r){return[2,new Promise((function(r,i){var o=F();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return r(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}}))]}))}))},n}(qe),Nt=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,(function(){var r,i,o,s,a,l,d,f,p;return u(this,(function(u){switch(u.label){case 0:return r=function(e){return"".concat(h.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=c(i.split("."),6),s=o[0],a=o[1],l=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:s,userId:Ut(a),sessionId:Lt(d),lastEventId:Lt(p),lastEventTime:Lt(f),optOut:Boolean(l)}]}}))}))},Lt=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ut=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},qt="[Amplitude]",jt="".concat(qt," Form Started"),Dt="".concat(qt," Form Submitted"),Mt="".concat(qt," File Downloaded"),Ft="session_start",Vt="session_end",$t="".concat(qt," File Extension"),Bt="".concat(qt," File Name"),zt="".concat(qt," Link ID"),Wt="".concat(qt," Link Text"),Ht="".concat(qt," Link URL"),Kt="".concat(qt," Form ID"),Jt="".concat(qt," Form Name"),Yt="".concat(qt," Form Destination"),Gt="cookie",Qt=function(e){function n(t,n,r,i,o,s,u,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_,S,T,I,k,x,P,O,A,R,C,N,L,U){void 0===r&&(r=new Ae),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Gt),void 0===g&&(g=new Q),void 0===y&&(y=D.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===S&&(S=""),void 0===T&&(T="US"),void 0===k&&(k=18e5),void 0===x&&(x=new Ot({loggerProvider:g})),void 0===P&&(P={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!0);var q=e.call(this,{apiKey:t,storageProvider:x,transportProvider:en(O)})||this;return q.apiKey=t,q.appVersion=n,q.cookieOptions=i,q.defaultTracking=o,q.autocapture=s,q.flushIntervalMillis=a,q.flushMaxRetries=c,q.flushQueueSize=l,q.identityStorage=d,q.ingestionMetadata=f,q.instanceName=p,q.loggerProvider=g,q.logLevel=y,q.minIdLength=m,q.offline=b,q.partnerId=E,q.plan=_,q.serverUrl=S,q.serverZone=T,q.sessionTimeout=k,q.storageProvider=x,q.trackingOptions=P,q.transport=O,q.useBatch=A,q.fetchRemoteConfig=R,q.networkTrackingOptions=U,q.version=kt,q._optOut=!1,q._cookieStorage=r,q.deviceId=u,q.lastEventId=v,q.lastEventTime=h,q.optOut=w,q.sessionId=I,q.pageCounter=N,q.userId=C,q.debugLogsEnabled=L,q.loggerProvider.enable(L?D.Debug:q.logLevel),q.networkTrackingOptions=U,q}return t(n,e),Object.defineProperty(n.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),n.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(we(this.apiKey),e)},n}(ee),Xt=function(e,t,n){return void 0===t&&(t={}),s(void 0,void 0,void 0,(function(){var r,o,s,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_,S,T,I,k,x,P,O,A,R,C,N,L,U,q,j,D,M,F,V,B,z,W,H,K,J,Y,G;return u(this,(function(u){switch(u.label){case 0:return r=t.identityStorage||Gt,I={},r===Gt?[3,1]:(s="",[3,5]);case 1:return null===(x=null===(k=t.cookieOptions)||void 0===k?void 0:k.domain)||void 0===x?[3,2]:(a=x,[3,4]);case 2:return[4,tn()];case 3:a=u.sent(),u.label=4;case 4:s=a,u.label=5;case 5:return o=i.apply(void 0,[(I.domain=s,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=Zt(t.identityStorage,o),[4,Nt(e,c,null===(O=null===(P=t.cookieOptions)||void 0===P?void 0:P.upgrade)||void 0===O||O)];case 6:return l=u.sent(),[4,c.get(we(e))];case 7:return d=u.sent(),f=_e(),p=f.ampTimestamp?Number(f.ampTimestamp):void 0,v=!p||Date.now()<p,h=null!==(L=null!==(N=null!==(C=null!==(A=t.deviceId)&&void 0!==A?A:v?null!==(R=f.ampDeviceId)&&void 0!==R?R:f.deviceId:void 0)&&void 0!==C?C:null==d?void 0:d.deviceId)&&void 0!==N?N:l.deviceId)&&void 0!==L?L:$(),g=null!==(U=null==d?void 0:d.lastEventId)&&void 0!==U?U:l.lastEventId,y=null!==(q=null==d?void 0:d.lastEventTime)&&void 0!==q?q:l.lastEventTime,m=null!==(D=null!==(j=t.optOut)&&void 0!==j?j:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,b=null!==(M=null==d?void 0:d.sessionId)&&void 0!==M?M:l.sessionId,w=null!==(V=null!==(F=t.userId)&&void 0!==F?F:null==d?void 0:d.userId)&&void 0!==V?V:l.userId,n.previousSessionDeviceId=null!==(B=null==d?void 0:d.deviceId)&&void 0!==B?B:l.deviceId,n.previousSessionUserId=null!==(z=null==d?void 0:d.userId)&&void 0!==z?z:l.userId,E={ipAddress:null===(H=null===(W=t.trackingOptions)||void 0===W?void 0:W.ipAddress)||void 0===H||H,language:null===(J=null===(K=t.trackingOptions)||void 0===K?void 0:K.language)||void 0===J||J,platform:null===(G=null===(Y=t.trackingOptions)||void 0===Y?void 0:Y.platform)||void 0===G||G},_=null==d?void 0:d.pageCounter,S=null==d?void 0:d.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(T=new Qt(e,t.appVersion,c,o,t.defaultTracking,t.autocapture,h,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,r,t.ingestionMetadata,t.instanceName,g,y,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,m,t.partnerId,t.plan,t.serverUrl,t.serverZone,b,t.sessionTimeout,t.storageProvider,E,t.transport,t.useBatch,t.fetchRemoteConfig,w,_,S,t.networkTrackingOptions)).storageProvider.isEnabled()];case 8:return u.sent()||(T.loggerProvider.warn("Storage provider ".concat(T.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),T.storageProvider=new Ae),[2,T]}}))}))},Zt=function(e,t){switch(void 0===e&&(e=Gt),void 0===t&&(t={}),e){case"localStorage":return new Ot;case"sessionStorage":return new At;case"none":return new Ae;default:return new Re(i(i({},t),{expirationDays:t.expiration}))}},en=function(e){return"xhr"===e?new Rt:"beacon"===e?new Ct:new je},tn=function(e){return s(void 0,void 0,void 0,(function(){var t,n,r,i,o,s,a;return u(this,(function(u){switch(u.label){case 0:return[4,(new Re).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),r=[],i="AMP_TLDTEST",o=n.length-2;o>=0;--o)r.push(n.slice(o).join("."));o=0,u.label=2;case 2:return o<r.length?(s=r[o],[4,(a=new Re({domain:"."+s})).set(i,1)]):[3,7];case 3:return u.sent(),[4,a.get(i)];case 4:return u.sent()?[4,a.remove(i)]:[3,6];case 5:return u.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},nn=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},rn=function(){var e,t=nn();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=on(n[0]),i=on(n[1]);return i?(e[r]=i,e):e}),{}):{}},on=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},sn="dclid",un="fbclid",an="gbraid",cn="gclid",ln="ko_click_id",dn="li_fat_id",fn="msclkid",pn="rdt_cid",vn="ttclid",hn="twclid",gn="wbraid",yn={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},mn="data-amp-mask",bn="*****",wn=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,i(i(i(i({},yn),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=rn();return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!==(t=null===(e=n.referrer)||void 0===e?void 0:e.split("/")[2])&&void 0!==t?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=rn();return(e={})[sn]=t[sn],e[un]=t[un],e[an]=t[an],e[cn]=t[cn],e[ln]=t[ln],e[dn]=t[dn],e[fn]=t[fn],e[pn]=t[pn],e[vn]=t[vn],e[hn]=t[hn],e[gn]=t[gn],e},e}(),En=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(mn)?bn:e?e(document.title):document.title};!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(ot||(ot={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(st||(st={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(ut||(ut={}));var _n,Sn,Tn=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},In=function(e){var t;void 0===e&&(e={});var n,r=nn(),o=void 0,a=!1,l=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,p=void 0===f?"[Amplitude] Page Viewed":f,v=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},h=function(){return s(void 0,void 0,void 0,(function(){var e,t,n;return u(this,(function(r){switch(r.label){case 0:return e=v("undefined"!=typeof location&&location.href||""),n={event_type:p},t=[{}],[4,kn()];case 1:return[2,(n.event_properties=i.apply(void 0,[i.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&v(location.pathname)||"","[Amplitude] Page Title":En(),"[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===l||"function"==typeof l&&l()},y="undefined"!=typeof location?location.href:null,m=function(){return s(void 0,void 0,void 0,(function(){var e,n,r,i;return u(this,(function(s){switch(s.label){case 0:return e=location.href,n=Pn(d,e,y||"")&&g(),y=e,n?(null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return i=(r=t).track,[4,h()];case 2:i.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}}))}))},b=function(){m()},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,i){return s(void 0,void 0,void 0,(function(){var s,l;return u(this,(function(u){switch(u.label){case 0:return t=i,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),a=!0,r&&(r.addEventListener("popstate",b),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=c(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),a&&m()}})),g()?(o.log("Tracking page view event"),l=(s=t).track,[4,h()]):[3,2];case 1:l.apply(s,[u.sent()]),u.label=2;case 2:return[2]}}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){var t;return u(this,(function(r){switch(r.label){case 0:return"attribution"===l&&xn(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,h()]):[3,2];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=i(i({},e.event_properties),t.event_properties),r.label=2;case 2:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=i(i({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(e){return r&&(r.removeEventListener("popstate",b),a=!1),[2]}))}))}};return w},kn=function(){return s(void 0,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return e=Tn,[4,(new wn).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},xn=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[ot.SET]||{},r=t[ot.UNSET]||{},i=l(l([],c(Object.keys(n)),!1),c(Object.keys(r)),!1);return Object.keys(yn).every((function(e){return i.includes(e)}))}return!1},Pn=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},On=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,r){return s(void 0,void 0,void 0,(function(){var i,o;return u(this,(function(s){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n,i=Rn(e);t||r.track(jt,((n={})[Kt]=An(e.id),n[Jt]=An(e.name),n[Yt]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=Rn(e);t||r.track(jt,((n={})[Kt]=An(e.id),n[Jt]=An(e.name),n[Yt]=o,n)),r.track(Dt,((i={})[Kt]=An(e.id),i[Jt]=An(e.name),i[Yt]=o,i)),t=!1}))};Array.from(document.getElementsByTagName("form")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?i():(o=F())?o.addEventListener("load",i):t.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},An=function(e){if("string"==typeof e)return e},Rn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Cn=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,(function(){var i,o;return u(this,(function(s){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),s=null==i?void 0:i[1];s&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",(function(){var t;s&&r.track(Mt,((t={})[$t]=s,t[Bt]=n.pathname,t[zt]=e.id,t[Wt]=e.text,t[Ht]=e.href,t))}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=F())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)})),t=[],[2]}))}))}}},Nn=!1,Ln=function(){var e=F(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,(function(){return u(this,(function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",(function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout((function(){t.flush()}),e.flushIntervalMillis)})),n("offline",(function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2])}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)})),t=[],[2]}))}))}}};function Un(e){var t,n,r,i,o,s,u,d,f,p;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var v=Object.keys(e);try{for(var h=a(v),g=h.next();!g.done;g=h.next()){var y=g.value;try{var m=e[y];"boolean"==typeof(null==m?void 0:m.enabled)&&(m.enabled?(delete m.enabled,0===Object.keys(m).length&&(e[y]=!0)):e[y]=!1),Un(m)}catch(e){}}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=h.return)&&n.call(h)}finally{if(t)throw t.error}}try{if(null===(f=null===(d=null===(u=e.autocapture)||void 0===u?void 0:u.networkTracking)||void 0===d?void 0:d.captureRules)||void 0===f?void 0:f.length)try{for(var b=a(e.autocapture.networkTracking.captureRules),w=b.next();!w.done;w=b.next()){var E=w.value;try{for(var _=(o=void 0,a(["responseHeaders","requestHeaders"])),S=_.next();!S.done;S=_.next()){var T=S.value,I=null!==(p=E[T])&&void 0!==p?p:{},k=I.captureSafeHeaders,x=I.allowlist;(k||x)&&(void 0===x||Array.isArray(x)?E[T]=l(l([],c(k?R:[]),!1),c(null!=x?x:[]),!1):delete E[T])}}catch(e){o={error:e}}finally{try{S&&!S.done&&(s=_.return)&&s.call(_)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}}catch(e){}}}function qn(e,t,n){var r,i,o=[];try{for(var s=a(null!=t?t:[]),u=s.next();!u.done;u=s.next()){var c=u.value;try{o.push(new RegExp(c))}catch(e){n.loggerProvider.warn("Invalid regex pattern: ".concat(c),e)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(o)}function jn(e,t){var n,r,o,s,u,c,l;if(e){Un(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e));var d=e;if(d&&"autocapture"in d){if("boolean"==typeof d.autocapture&&(t.autocapture=d.autocapture),"object"==typeof d.autocapture&&null!==d.autocapture){var f=i({},d.autocapture);if(void 0===t.autocapture&&(t.autocapture=d.autocapture),"object"==typeof d.autocapture.elementInteractions&&null!==d.autocapture.elementInteractions&&(null===(o=d.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===o?void 0:o.length)){f.elementInteractions=i({},d.autocapture.elementInteractions);var p=f.elementInteractions,v=null!==(s=p.pageUrlAllowlist)&&void 0!==s?s:[],h=d.autocapture.elementInteractions.pageUrlAllowlistRegex;p.pageUrlAllowlist=qn(v,h,t),delete p.pageUrlAllowlistRegex}if("object"==typeof d.autocapture.networkTracking&&null!==d.autocapture.networkTracking&&(null===(u=d.autocapture.networkTracking.captureRules)||void 0===u?void 0:u.length)){f.networkTracking=i({},d.autocapture.networkTracking);var g=null!==(c=f.networkTracking.captureRules)&&void 0!==c?c:[];try{for(var y=a(g),m=y.next();!m.done;m=y.next()){var b=m.value;b.urls=qn(null!==(l=b.urls)&&void 0!==l?l:[],b.urlsRegex,t),delete b.urlsRegex}}catch(e){n={error:e}}finally{try{m&&!m.done&&(r=y.return)&&r.call(y)}finally{if(n)throw n.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=i({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},f)),"object"==typeof t.autocapture&&(t.autocapture=i(i({},t.autocapture),f))}t.defaultTracking=t.autocapture}t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(_n||(_n={})),function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(Sn||(Sn={}));var Dn=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,s,u,a,c,l,d,f,p,v,h,g,y,m,b,w,E,_;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case Sn.Success:return{status:T,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case Sn.Invalid:return{status:T,statusCode:S,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case Sn.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case Sn.RateLimit:return{status:T,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(m=e.throttled_devices)&&void 0!==m?m:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(_=e.throttled_events)&&void 0!==_?_:[]}};case Sn.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?Sn.Success:429===e?Sn.RateLimit:413===e?Sn.PayloadTooLarge:408===e?Sn.Timeout:e>=400&&e<500?Sn.Invalid:e>=500?Sn.Failed:Sn.Unknown},e}(),Mn="Remote config fetch rejected due to timeout after 5 seconds",Fn="Unexpected error occurred",Vn=function(){function e(e){var t=e.localConfig,n=e.configKeys,r=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteNamespaceConfig=function(e,t){return s(r,void 0,void 0,(function(){var n,r,i;return u(this,(function(o){switch(o.label){case 0:return n=Date.now(),[4,this.fetchWithTimeout(t)];case 1:return(r=o.sent())&&(i=r.configs&&r.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-n,[2,i]):(this.metrics.fetchTimeAPIFail=Date.now()-n,[2,void 0])}}))}))},this.getRemoteConfig=function(e,t,n){return s(r,void 0,void 0,(function(){var r;return u(this,(function(i){switch(i.label){case 0:return[4,this.getRemoteNamespaceConfig(e,n)];case 1:return[2,null==(r=i.sent())?void 0:r[t]]}}))}))},this.fetchWithTimeout=function(e){return s(r,void 0,void 0,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:return t=new AbortController,n=setTimeout((function(){return t.abort()}),5e3),[4,this.fetchRemoteConfig(t.signal,e)];case 1:return r=i.sent(),clearTimeout(n),[2,r]}}))}))},this.fetchRemoteConfig=function(e,t){return s(r,void 0,void 0,(function(){var n,r,o,s,c,l,d,f,p,v,h,g;return u(this,(function(u){switch(u.label){case 0:if(t===this.lastFetchedSessionId&&this.attempts>=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:Mn})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),u.label=1;case 1:u.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(r=a(this.configKeys),o=r.next();!o.done;o=r.next())s=o.value,n.append("config_keys",s)}catch(e){v={error:e}}finally{try{o&&!o.done&&(h=r.return)&&h.call(r)}finally{if(v)throw v.error}}return t&&n.set("session_id",String(t)),c={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,i(i({},c),{signal:e}))];case 2:if(null===(d=u.sent()))return[2,this.completeRequest({err:Fn})];switch((new Dn).buildStatus(d.status)){case Sn.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case Sn.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=u.sent(),p=f,e.aborted?[2,this.completeRequest({err:Mn})]:[2,this.completeRequest({err:null!==(g=p.message)&&void 0!==g?g:Fn})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return s(r,void 0,void 0,(function(){var n=this;return u(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,n.attempts*n.retryTimeout)}))];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}}))}))},this.parseAndStoreConfig=function(e){return s(r,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}}))}))},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.configServerUrl?this.localConfig.configServerUrl:this.localConfig.serverZone===_n.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===_n.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw new Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),$n=function(e){var t=e.localConfig,n=e.configKeys;return s(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,new Vn({localConfig:t,configKeys:n})]}))}))},Bn="[Amplitude] Element Clicked",zn="[Amplitude] Rage Click",Wn="[Amplitude] Element Tag",Hn="[Amplitude] Element Text",Kn="[Amplitude] Page URL",Jn="https://app.amplitude.com",Yn={US:Jn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},Gn="data-amp-mask-attributes";function Qn(e){return"function"==typeof e}function Xn(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var Zn=Xn((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function er(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var tr=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=a(o),u=s.next();!u.done;u=s.next()){u.value.remove(this)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(Qn(d))try{d()}catch(e){i=e instanceof Zn?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=a(f),v=p.next();!v.done;v=p.next()){var h=v.value;try{ir(h)}catch(e){i=null!=i?i:[],e instanceof Zn?i=l(l([],c(i)),c(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new Zn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)ir(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&er(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&er(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),nr=tr.EMPTY;function rr(e){return e instanceof tr||e&&"closed"in e&&Qn(e.remove)&&Qn(e.add)&&Qn(e.unsubscribe)}function ir(e){Qn(e)?e():e.unsubscribe()}var or={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},sr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,l([e,t],c(n)))};function ur(e){sr((function(){throw e}))}function ar(){}function cr(e){e()}var lr=function(e){function n(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,rr(t)&&t.add(n)):n.destination=gr,n}return t(n,e),n.create=function(e,t,n){return new vr(e,t,n)},n.prototype.next=function(e){this.isStopped||this._next(e)},n.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},n.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},n.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},n.prototype._next=function(e){this.destination.next(e)},n.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},n.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},n}(tr),dr=Function.prototype.bind;function fr(e,t){return dr.call(e,t)}var pr=function(){function e(e){this.partialObserver=e}return e.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(e){hr(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){hr(e)}else hr(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){hr(e)}},e}(),vr=function(e){function n(t,n,r){var i,o,s=e.call(this)||this;Qn(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&or.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&fr(t.next,o),error:t.error&&fr(t.error,o),complete:t.complete&&fr(t.complete,o)}):i=t;return s.destination=new pr(i),s}return t(n,e),n}(lr);function hr(e){ur(e)}var gr={closed:!0,next:ar,error:function(e){throw e},complete:ar},yr="function"==typeof Symbol&&Symbol.observable||"@@observable";function mr(e){return e}var br=function(){function e(e){e&&(this._subscribe=e)}return e.prototype.lift=function(t){var n=new e;return n.source=this,n.operator=t,n},e.prototype.subscribe=function(e,t,n){var r,i=this,o=(r=e)&&r instanceof lr||function(e){return e&&Qn(e.next)&&Qn(e.error)&&Qn(e.complete)}(r)&&rr(r)?e:new vr(e,t,n);return cr((function(){var e=i,t=e.operator,n=e.source;o.add(t?t.call(o,n):n?i._subscribe(o):i._trySubscribe(o))})),o},e.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},e.prototype.forEach=function(e,t){var n=this;return new(t=wr(t))((function(t,r){var i=new vr({next:function(t){try{e(t)}catch(e){r(e),i.unsubscribe()}},error:r,complete:t});n.subscribe(i)}))},e.prototype._subscribe=function(e){var t;return null===(t=this.source)||void 0===t?void 0:t.subscribe(e)},e.prototype[yr]=function(){return this},e.prototype.pipe=function(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return(0===(e=t).length?mr:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)})(this)},e.prototype.toPromise=function(e){var t=this;return new(e=wr(e))((function(e,n){var r;t.subscribe((function(e){return r=e}),(function(e){return n(e)}),(function(){return e(r)}))}))},e.create=function(t){return new e(t)},e}();function wr(e){var t;return null!==(t=null!=e?e:or.Promise)&&void 0!==t?t:Promise}function Er(e){return Qn(null==e?void 0:e.lift)}function _r(e){return function(t){if(Er(t))return t.lift((function(t){try{return e(t,this)}catch(e){this.error(e)}}));throw new TypeError("Unable to lift unknown Observable type")}}function Sr(e,t,n,r,i){return new Tr(e,t,n,r,i)}var Tr=function(e){function n(t,n,r,i,o,s){var u=e.call(this,t)||this;return u.onFinalize=o,u.shouldUnsubscribe=s,u._next=n?function(e){try{n(e)}catch(e){t.error(e)}}:e.prototype._next,u._error=i?function(e){try{i(e)}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._error,u._complete=r?function(){try{r()}catch(e){t.error(e)}finally{this.unsubscribe()}}:e.prototype._complete,u}return t(n,e),n.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;e.prototype.unsubscribe.call(this),!n&&(null===(t=this.onFinalize)||void 0===t||t.call(this))}},n}(lr);!function(e){function n(t,n){var r=e.call(this)||this;return r.source=t,r.subjectFactory=n,r._subject=null,r._refCount=0,r._connection=null,Er(t)&&(r.lift=t.lift),r}t(n,e),n.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},n.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},n.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},n.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new tr;var n=this.getSubject();t.add(this.source.subscribe(Sr(n,void 0,(function(){e._teardown(),n.complete()}),(function(t){e._teardown(),n.error(t)}),(function(){return e._teardown()})))),t.closed&&(this._connection=null,t=tr.EMPTY)}return t},n.prototype.refCount=function(){return _r((function(e,t){var n=null;e._refCount++;var r=Sr(t,void 0,void 0,void 0,(function(){if(!e||e._refCount<=0||0<--e._refCount)n=null;else{var r=e._connection,i=n;n=null,!r||i&&r!==i||r.unsubscribe(),t.unsubscribe()}}));e.subscribe(r),r.closed||(n=e.connect())}))(this)}}(br);var Ir,kr={now:function(){return(kr.delegate||performance).now()},delegate:void 0},xr={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new tr((function(){return null==n?void 0:n(r)}))},requestAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=xr.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,l([],c(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,l([],c(e)))},delegate:void 0};new br((function(e){var t=Ir||kr,n=t.now(),r=0,i=function(){e.closed||(r=xr.requestAnimationFrame((function(o){r=0;var s=t.now();e.next({timestamp:Ir?s:o,elapsed:s-n}),i()})))};return i(),function(){r&&xr.cancelAnimationFrame(r)}}));var Pr=Xn((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Or=function(e){function n(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return t(n,e),n.prototype.lift=function(e){var t=new Ar(this,this);return t.operator=e,t},n.prototype._throwIfClosed=function(){if(this.closed)throw new Pr},n.prototype.next=function(e){var t=this;cr((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=a(t.currentObservers),o=i.next();!o.done;o=i.next()){o.value.next(e)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}}))},n.prototype.error=function(e){var t=this;cr((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},n.prototype.complete=function(){var e=this;cr((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},n.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(n.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},n.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},n.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?nr:(this.currentObservers=null,o.push(e),new tr((function(){t.currentObservers=null,er(o,e)})))},n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},n.prototype.asObservable=function(){var e=new br;return e.source=this,e},n.create=function(e,t){return new Ar(e,t)},n}(br),Ar=function(e){function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t(n,e),n.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},n.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},n.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},n.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:nr},n}(Or);!function(e){function n(t){var n=e.call(this)||this;return n._value=t,n}t(n,e),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(Or);var Rr={now:function(){return(Rr.delegate||Date).now()},delegate:void 0};!function(e){function n(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=Rr);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}t(n,e),n.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,u=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,t)},n.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i<r.length&&!e.closed;i+=n?1:2)e.next(r[i]);return this._checkFinalizedStatuses(e),t},n.prototype._trimBuffer=function(){var e=this,t=e._bufferSize,n=e._timestampProvider,r=e._buffer,i=e._infiniteTimeWindow,o=(i?1:2)*t;if(t<1/0&&o<r.length&&r.splice(0,r.length-o),!i){for(var s=n.now(),u=0,a=1;a<r.length&&r[a]<=s;a+=2)u=a;u&&r.splice(0,u+1)}}}(Or),function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}t(n,e),n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t._hasValue,i=t._value,o=t.thrownError,s=t.isStopped,u=t._isComplete;n?e.error(o):(s||u)&&(r&&e.next(i),e.complete())},n.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},n.prototype.complete=function(){var t=this,n=t._hasValue,r=t._value;t._isComplete||(this._isComplete=!0,n&&e.prototype.next.call(this,r),e.prototype.complete.call(this))}}(Or);var Cr,Nr=function(e){function n(t,n){return e.call(this)||this}return t(n,e),n.prototype.schedule=function(e,t){return this},n}(tr),Lr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,l([e,t],c(n)))},Ur=function(e){return clearInterval(e)},qr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return t(n,e),n.prototype.schedule=function(e,t){var n;if(void 0===t&&(t=0),this.closed)return this;this.state=e;var r=this.id,i=this.scheduler;return null!=r&&(this.id=this.recycleAsyncId(i,r,t)),this.pending=!0,this.delay=t,this.id=null!==(n=this.id)&&void 0!==n?n:this.requestAsyncId(i,this.id,t),this},n.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),Lr(e.flush.bind(e,this),n)},n.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&Ur(t)},n.prototype.execute=function(e,t){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var n=this._execute(e,t);if(n)return n;!1===this.pending&&null!=this.id&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},n.prototype._execute=function(e,t){var n,r=!1;try{this.work(e)}catch(e){r=!0,n=e||new Error("Scheduled action threw falsy error")}if(r)return this.unsubscribe(),n},n.prototype.unsubscribe=function(){if(!this.closed){var t=this.id,n=this.scheduler,r=n.actions;this.work=this.state=this.scheduler=null,this.pending=!1,er(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},n}(Nr),jr=1,Dr={};function Mr(e){return e in Dr&&(delete Dr[e],!0)}var Fr=function(e){var t=jr++;return Dr[t]=!0,Cr||(Cr=Promise.resolve()),Cr.then((function(){return Mr(t)&&e()})),t},Vr=function(e){Mr(e)},$r={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=$r.delegate;return((null==n?void 0:n.setImmediate)||Fr).apply(void 0,l([],c(e)))},clearImmediate:function(e){return Vr(e)},delegate:void 0},Br=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=$r.setImmediate(t.flush.bind(t,void 0))))},n.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&($r.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},n}(qr),zr=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=Rr.now,e}(),Wr=function(e){function n(t,n){void 0===n&&(n=zr.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return t(n,e),n.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},n}(zr),Hr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},n}(Wr);new Hr(Br);var Kr=new Wr(qr),Jr=Kr,Yr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.schedule=function(t,n){return void 0===n&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},n.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},n}(qr),Gr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(Wr);new Gr(Yr);var Qr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=xr.requestAnimationFrame((function(){return t.flush(void 0)}))))},n.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&n===t._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(xr.cancelAnimationFrame(n),t._scheduled=void 0)},n}(qr),Xr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},n}(Wr);new Xr(Qr),function(e){function n(t,n){void 0===t&&(t=Zr),void 0===n&&(n=1/0);var r=e.call(this,t,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}t(n,e),n.prototype.flush=function(){for(var e,t,n=this.actions,r=this.maxFrames;(t=n[0])&&t.delay<=r&&(n.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=n.shift();)t.unsubscribe();throw e}},n.frameTimeFactor=10}(Wr);var Zr=function(e){function n(t,n,r){void 0===r&&(r=t.index+=1);var i=e.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.index=r,i.active=!0,i.index=t.index=r,i}return t(n,e),n.prototype.schedule=function(t,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,t,r);this.active=!1;var i=new n(this.scheduler,this.work);return this.add(i),i.schedule(t,r)}return tr.EMPTY},n.prototype.requestAsyncId=function(e,t,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(n.sortActions),1},n.prototype.recycleAsyncId=function(e,t,n){},n.prototype._execute=function(t,n){if(!0===this.active)return e.prototype._execute.call(this,t,n)},n.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},n}(qr),ei=new br((function(e){return e.complete()}));function ti(e){return e&&Qn(e.schedule)}function ni(e){return e[e.length-1]}function ri(e){return ti(ni(e))?e.pop():void 0}var ii=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function oi(e){return Qn(null==e?void 0:e.then)}function si(e){return Qn(e[yr])}function ui(e){return Symbol.asyncIterator&&Qn(null==e?void 0:e[Symbol.asyncIterator])}function ai(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var ci,li="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function di(e){return Qn(null==e?void 0:e[li])}function fi(e){return f(this,arguments,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,d(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,d(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,d(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function pi(e){return Qn(null==e?void 0:e.getReader)}function vi(e){if(e instanceof br)return e;if(null!=e){if(si(e))return i=e,new br((function(e){var t=i[yr]();if(Qn(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(ii(e))return r=e,new br((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(oi(e))return n=e,new br((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,ur)}));if(ui(e))return hi(e);if(di(e))return t=e,new br((function(e){var n,r;try{for(var i=a(t),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.next(s),e.closed)return}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}e.complete()}));if(pi(e))return hi(fi(e))}var t,n,r,i;throw ai(e)}function hi(e){return new br((function(t){(function(e,t){var n,r,i,o;return s(this,void 0,void 0,(function(){var s,a;return u(this,(function(u){switch(u.label){case 0:u.trys.push([0,5,6,11]),n=p(e),u.label=1;case 1:return[4,n.next()];case 2:if((r=u.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];u.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=u.sent(),i={error:a},[3,11];case 6:return u.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:u.sent(),u.label=8;case 8:return[3,10];case 9:if(i)throw i.error;return[7];case 10:return[7];case 11:return t.complete(),[2]}}))}))})(e,t).catch((function(e){return t.error(e)}))}))}function gi(e,t,n,r,i){void 0===r&&(r=0),void 0===i&&(i=!1);var o=t.schedule((function(){n(),i?e.add(this.schedule(null,r)):this.unsubscribe()}),r);if(e.add(o),!i)return o}function yi(e,t){return void 0===t&&(t=0),_r((function(n,r){n.subscribe(Sr(r,(function(n){return gi(r,e,(function(){return r.next(n)}),t)}),(function(){return gi(r,e,(function(){return r.complete()}),t)}),(function(n){return gi(r,e,(function(){return r.error(n)}),t)})))}))}function mi(e,t){return void 0===t&&(t=0),_r((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function bi(e,t){if(!e)throw new Error("Iterable cannot be null");return new br((function(n){gi(n,t,(function(){var r=e[Symbol.asyncIterator]();gi(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function wi(e,t){if(null!=e){if(si(e))return function(e,t){return vi(e).pipe(mi(t),yi(t))}(e,t);if(ii(e))return function(e,t){return new br((function(n){var r=0;return t.schedule((function(){r===e.length?n.complete():(n.next(e[r++]),n.closed||this.schedule())}))}))}(e,t);if(oi(e))return function(e,t){return vi(e).pipe(mi(t),yi(t))}(e,t);if(ui(e))return bi(e,t);if(di(e))return function(e,t){return new br((function(n){var r;return gi(n,t,(function(){r=e[li](),gi(n,t,(function(){var e,t,i;try{t=(e=r.next()).value,i=e.done}catch(e){return void n.error(e)}i?n.complete():n.next(t)}),0,!0)})),function(){return Qn(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(pi(e))return function(e,t){return bi(fi(e),t)}(e,t)}throw ai(e)}function Ei(e,t){return t?wi(e,t):vi(e)}function _i(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(ci||(ci={})),Xn((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),Xn((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Xn((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Xn((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var Si=Xn((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function Ti(e){throw new Si(e)}function Ii(e,t){return _r((function(n,r){var i=0;n.subscribe(Sr(r,(function(n){r.next(e.call(t,n,i++))})))}))}var ki=Array.isArray;function xi(e){return Ii((function(t){return function(e,t){return ki(t)?e.apply(void 0,l([],c(t))):e(t)}(e,t)}))}function Pi(e,t,n){return void 0===n&&(n=1/0),Qn(t)?Pi((function(n,r){return Ii((function(e,i){return t(n,e,r,i)}))(vi(e(n,r)))}),n):("number"==typeof t&&(n=t),_r((function(t,r){return function(e,t,n,r,i,o,s,u){var a=[],c=0,l=0,d=!1,f=function(){!d||a.length||c||t.complete()},p=function(e){return c<r?v(e):a.push(e)},v=function(e){o&&t.next(e),c++;var u=!1;vi(n(e,l++)).subscribe(Sr(t,(function(e){null==i||i(e),o?p(e):t.next(e)}),(function(){u=!0}),void 0,(function(){if(u)try{c--;for(var e=function(){var e=a.shift();s?gi(t,s,(function(){return v(e)})):v(e)};a.length&&c<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(Sr(t,p,(function(){d=!0,f()}))),function(){null==u||u()}}(t,r,e,n)})))}function Oi(e){return void 0===e&&(e=1/0),Pi(mr,e)}function Ai(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Oi(1)(Ei(e,ri(e)))}var Ri=["addListener","removeListener"],Ci=["addEventListener","removeEventListener"],Ni=["on","off"];function Li(e,t,n,r){if(Qn(n)&&(r=n,n=void 0),r)return Li(e,t,n).pipe(xi(r));var i=c(function(e){return Qn(e.addEventListener)&&Qn(e.removeEventListener)}(e)?Ci.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return Qn(e.addListener)&&Qn(e.removeListener)}(e)?Ri.map(Ui(e,t)):function(e){return Qn(e.on)&&Qn(e.off)}(e)?Ni.map(Ui(e,t)):[],2),o=i[0],s=i[1];if(!o&&ii(e))return Pi((function(e){return Li(e,t,n)}))(vi(e));if(!o)throw new TypeError("Invalid event target");return new br((function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return e.next(1<t.length?t:t[0])};return o(t),function(){return s(t)}}))}function Ui(e,t){return function(n){return function(r){return e[n](t,r)}}}function qi(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Jr);var r=-1;return null!=t&&(ti(t)?n=t:r=t),new br((function(t){var i=_i(e)?+e-n.now():e;i<0&&(i=0);var o=0;return n.schedule((function(){t.closed||(t.next(o++),0<=r?this.schedule(void 0,r):t.complete())}),i)}))}function ji(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=ri(e),r=function(e,t){return"number"==typeof ni(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?vi(i[0]):Oi(r)(Ei(i,n)):ei}new br(ar);var Di=Array.isArray;function Mi(e,t){return _r((function(n,r){var i=0;n.subscribe(Sr(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function Fi(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&Di(e[0])?e[0]:e).length?vi(t[0]):new br(function(e){return function(t){for(var n=[],r=function(r){n.push(vi(e[r]).subscribe(Sr(t,(function(e){if(n){for(var i=0;i<n.length;i++)i!==r&&n[i].unsubscribe();n=null}t.next(e)}))))},i=0;n&&!t.closed&&i<e.length;i++)r(i)}}(t))}function Vi(e){return e<=0?function(){return ei}:_r((function(t,n){var r=0;t.subscribe(Sr(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function $i(e,t){return t?function(n){return Ai(t.pipe(Vi(1),_r((function(e,t){e.subscribe(Sr(t,ar))}))),n.pipe($i(e)))}:Pi((function(t,n){return vi(e(t,n)).pipe(Vi(1),function(e){return Ii((function(){return e}))}(t))}))}function Bi(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new Or}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,u=e.resetOnRefCountZero,a=void 0===u||u;return function(e){var t,r,o,u=0,c=!1,l=!1,d=function(){null==r||r.unsubscribe(),r=void 0},f=function(){d(),t=o=void 0,c=l=!1},p=function(){var e=t;f(),null==e||e.unsubscribe()};return _r((function(e,v){u++,l||c||d();var h=o=null!=o?o:n();v.add((function(){0!==--u||l||c||(r=zi(p,a))})),h.subscribe(v),!t&&u>0&&(t=new vr({next:function(e){return h.next(e)},error:function(e){l=!0,d(),r=zi(f,i,e),h.error(e)},complete:function(){c=!0,d(),r=zi(f,s),h.complete()}}),vi(e).subscribe(t))}))(e)}}function zi(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!0!==t){if(!1!==t){var i=new vr({next:function(){i.unsubscribe(),e()}});return vi(t.apply(void 0,l([],c(n)))).subscribe(i)}}else e()}function Wi(e,t,n){void 0===t&&(t=Kr);var r=qi(e,t);return function(e,t){return _r((function(n,r){var i=null!=t?t:{},o=i.leading,s=void 0===o||o,u=i.trailing,a=void 0!==u&&u,c=!1,l=null,d=null,f=!1,p=function(){null==d||d.unsubscribe(),d=null,a&&(g(),f&&r.complete())},v=function(){d=null,f&&r.complete()},h=function(t){return d=vi(e(t)).subscribe(Sr(r,p,v))},g=function(){if(c){c=!1;var e=l;l=null,r.next(e),!f&&h(e)}};n.subscribe(Sr(r,(function(e){c=!0,l=e,(!d||d.closed)&&(s?g():h(e))}),(function(){f=!0,(!(a&&c&&d)||d.closed)&&r.complete()})))}))}((function(){return r}),n)}var Hi=["input","select","textarea"],Ki=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t},Ji=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,u=e.pageUrlAllowlist,a=e.pageUrlExcludelist,c=e.shouldTrackEventResolver,l=null===(s=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===s?void 0:s.call(o);if(!l)return!1;if(c)return c(r,i);if(!Pe(window.location.href,u))return!1;if(a&&a.length>0&&Pe(window.location.href,a))return!1;var d=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof d)switch(d.toLowerCase()){case"hidden":case"password":return!1}var f=Ki(i,r);if(n&&f)return!0;if(t){var p=t.some((function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}));if(!p)return!1}switch(l){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!f||"click"===r}}},Yi=function(e){return Object.keys(e).reduce((function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t}),{})},Gi=function(e,t){return e?t.some((function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))?e:Gi(null==e?void 0:e.parentElement,t):null};var Qi=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};var Xi=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Gn,mn]),Zi=["type"],eo=["svg","path","g"],to=["password","hidden"];function no(e,t){var n,r,i,o,s,u;if(null===e)return null;var c=String(e.tagName).toLowerCase(),l={tag:c},d=Array.from(null!==(o=null===(i=e.parentElement)||void 0===i?void 0:i.children)&&void 0!==o?o:[]);d.length&&(l.index=d.indexOf(e),l.indexOfType=d.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var f=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();f&&(l.prevSib=String(f));var p=e.getAttribute("id");p&&(l.id=String(p));var v=Array.from(e.classList);v.length&&(l.classes=v);var h={},g=Array.from(e.attributes).filter((function(e){return!Xi.has(e.name)})),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Hi.includes(i)&&!o}(e);if(!to.includes(String(e.getAttribute("type")))&&!eo.includes(c))try{for(var m=a(g),b=m.next();!b.done;b=m.next()){var w=b.value;y&&!Zi.includes(w.name)||(t.has(w.name)?h[w.name]=bn:h[w.name]=String(w.value).substring(0,128))}}catch(e){n={error:e}}finally{try{b&&!b.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(h).length&&(l.attrs=h),l}var ro=function(e,t,n){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}}))},io=/\b(?:\d[ -]*?){13,16}\b/,oo=/(\d{3}-?\d{2}-?\d{4})/g,so=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,uo=function(e){var t,n,r,i=this;this.replaceSensitiveString=function(e){var t,n;if("string"!=typeof e)return"";var r=e;r=(r=(r=r.replace(io,bn)).replace(oo,bn)).replace(so,bn);try{for(var o=a(i.additionalMaskTextPatterns),s=o.next();!s.done;s=o.next()){var u=s.value;try{r=r.replace(u,bn)}catch(e){}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return r},this.getHierarchy=function(e){var t,n,r,o;if(!e)return[];for(var s,u=function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),d=new Map,f=u.length-1;f>=0;f--){var p=u[f];if(p){var v=(s=p.getAttribute(Gn))?s.split(",").map((function(e){return e.trim()})).filter((function(e){return e.length>0&&"id"!==e&&"class"!==e})):[],h=f===u.length-1?[]:null!==(r=d.get(u[f+1]))&&void 0!==r?r:new Set,g=new Set(l(l([],c(h),!1),c(v),!1));d.set(p,g)}}o=u.map((function(e){var t;return no(e,null!==(t=d.get(e))&&void 0!==t?t:new Set)}));var y=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach((function(t){var n=c(t,2),r=n[0],o=n[1];e.attrs&&(e.attrs[r]=i.replaceSensitiveString(o))}))};try{for(var m=a(o),b=m.next();!b.done;b=m.next())y(b.value)}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}return o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?i.getText(t):i.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,o,s,u,a,l,d=null===(s=null===(o=null==t?void 0:t.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===s?void 0:s.call(o),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},p=i.getHierarchy(t),v=null===(u=p[0])||void 0===u?void 0:u.attrs,h=i.getNearestLabel(t),g=(a=null!=v?v:{},l=n,Object.entries(a).reduce((function(e,t){var n=c(t,2),r=n[0],i=n[1];if(r.startsWith(l)){var o=r.replace(l,"");o&&(e[o]=i||"")}return e}),{})),y=((r={})["[Amplitude] Element Hierarchy"]=p,r[Wn]=d,r[Hn]=i.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Parent Label"]=h,r[Kn]=Oe(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=En(i.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return y["[Amplitude] Element ID"]=t.getAttribute("id")||"",y["[Amplitude] Element Class"]=t.getAttribute("class"),y["[Amplitude] Element Aria Label"]=null==v?void 0:v["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement&&(y["[Amplitude] Element Href"]=i.replaceSensitiveString(t.href)),Yi(y)},this.addAdditionalEventProperties=function(e,t,n,r,o){void 0===o&&(o=!1);var s={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(s)&&null!==s.event.target){if(o&&Ki(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=i.getEventProperties(s.type,s.closestTrackedAncestor,r),s;var u=Gi(s.event.target,n);return u&&(s.closestTrackedAncestor=u,s.targetElementProperties=i.getEventProperties(s.type,u,r)),s}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?i.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getText=function(e){if(null!==e.closest("[".concat(mn,"]")))return bn;var t="";if(e.querySelector("[".concat(mn,"], [contenteditable]"))){var n=e.cloneNode(!0);n.querySelectorAll("[".concat(mn,"], [contenteditable]")).forEach((function(e){e.innerText=bn})),t=n.innerText||""}else t=e.innerText||"";return i.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){var t,n,r;if(!e)return{};var o=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n),s=((t={})[Wn]=o,t[Hn]=i.getText(e),t[Kn]=window.location.href.split("?")[0],t);return Yi(s)};var o=null!==(r=e.maskTextRegex)&&void 0!==r?r:[],s=[];try{for(var u=a(o),d=u.next();!d.done;d=u.next()){var f=d.value;if(s.length>=25)break;if(f instanceof RegExp)s.push(f);else if("pattern"in f&&"string"==typeof f.pattern)try{s.push(new RegExp(f.pattern,"i"))}catch(e){}}}catch(e){t={error:e}}finally{try{d&&!d.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}this.additionalMaskTextPatterns=s},ao=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Jn:t,r=this;this.endpoint=Jn,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{dataExtractor:new uo({})}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist,a=n.dataExtractor;this.logger=r,i&&this.endpoint===Jn&&(this.endpoint=i);var c=null;window.addEventListener("message",(function(e){var n,r,i,l,d;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var f,p=null==e?void 0:e.data,v=null==p?void 0:p.action;if(v)if("id"in p)null===(l=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===l||l.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(p);else if("ping"===v)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===v){var h=null==p?void 0:p.data;(f="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=f,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(f)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;c=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:a.getEventTagProps,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u,extractDataFromDataSource:a.extractDataFromDataSource,dataExtractor:a,diagnostics:{autocapture:{version:"1.14.0"}}}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===v&&(null===(d=null==c?void 0:c.close)||void 0===d||d.call(c))}})),this.notify({action:"page-loaded"})},e}();function co(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,u=e.shouldTrackEvent,l=e.evaluateTriggers,d=o.clickObservable,f=d.pipe(_r((function(e,t){var n,r=!1;e.subscribe(Sr(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),Mi((function(e){var t=c(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),p=ji(f,d.pipe((t=s.debounceTime,void 0===n&&(n=Kr),_r((function(e,r){var i=null,o=null,s=null,u=function(){if(i){i.unsubscribe(),i=null;var e=o;o=null,r.next(e)}};function a(){var e=s+t,o=n.now();if(o<e)return i=this.schedule(void 0,e-o),void r.add(i);u()}e.subscribe(Sr(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(a,t),r.add(i))}),(function(){u(),r.complete()}),void 0,(function(){o=i=null})))}))),Ii((function(){return"timeout"})))),v=d.pipe(function(e,t){void 0===t&&(t=Kr);var n=qi(e,t);return $i((function(){return n}))}(0),Mi(Qi),Mi((function(e){return u("click",e.closestTrackedAncestor)})),Ii((function(e){return l(e)})),(r=p,_r((function(e,t){var n=[];return e.subscribe(Sr(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),vi(r).subscribe(Sr(t,(function(){var e=n;n=[],t.next(e)}),ar)),function(){n=null}}))));return v.subscribe((function(e){var t,n,r=(e.length,Bn);try{for(var o=a(e),s=o.next();!s.done;s=o.next()){var u=s.value;null==i||i.track(r,u.targetElementProperties)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}))}function lo(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,u=n.clickObservable,a=n.mutationObservable,d=n.navigateObservable,f=u.pipe(Mi((function(e){return!o("click",e.closestTrackedAncestor)})),Ii((function(e){var t=Gi(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),Mi(Qi),Mi((function(e){return s("click",e.closestTrackedAncestor)}))),p=[a];d&&p.push(d);var v,h,g=ji.apply(void 0,l([],c(p),!1)),y=f.pipe((v=function(e){return g.pipe(Vi(1),function(e,t){var n=_i(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?Ti:o,u=n.scheduler,a=void 0===u?null!=t?t:Kr:u,c=n.meta,l=void 0===c?null:c;if(null==r&&null==i)throw new TypeError("No timeout provided.");return _r((function(e,t){var n,o,u=null,c=0,d=function(e){o=gi(t,a,(function(){try{n.unsubscribe(),vi(s({meta:l,lastValue:u,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(Sr(t,(function(e){null==o||o.unsubscribe(),c++,t.next(u=e),i>0&&d(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),u=null}))),!c&&d(null!=r?"number"==typeof r?r:+r-a.now():i)}))}({first:500,with:function(){return ei}}),Ii((function(){return e})))},_r((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(Sr(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;vi(v(e,s)).subscribe(n=Sr(t,(function(n){return t.next(h?h(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return y.subscribe((function(e){null==t||t.track(Bn,i("click",e.closestTrackedAncestor))}))}var fo,po=function(){return new br((function(e){var t=new MutationObserver((function(t){e.next(t)}));return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}}))},vo=function(e){return void 0===e&&(e="click"),Li(document,e,{capture:!0})},ho={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},go=function(e){var t,n,r,i,o=Object.values(ho).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return o;try{for(var s=a(e),u=s.next();!u.done;u=s.next()){var c=u.value;try{try{for(var l=(r=void 0,a(c.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,p=ho[f.event_type];p&&o[p].add(c.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==c?void 0:c.id,e)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},yo=function(e){var t,n,r,i,o=new Map;try{for(var s=a(e),u=s.next();!u.done;u=s.next()){var c=u.value;try{for(var l=(r=void 0,a(c.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var p=f.match.eventId,v=o.get(p);v||(v=[],o.set(p,v)),v.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},mo=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return ho[t.event_type]===e.type&&t.filters.every((function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)}))}))}))},bo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,s=new Set;try{for(var u=a(e),c=u.next();!c.done;c=u.next()){var l=c.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,a(d)),p=f.next();!p.done;p=f.next()){var v=p.value;s.add(v)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(s)}(mo(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var o=a(i),s=o.next();!s.done;s=o.next()){var u=s.value;ro(u.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}();!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(fo||(fo={}));var wo=function(e){var t,n,r,o,d,f,p,v;void 0===e&&(e={});var h=e.dataAttributePrefix,g=void 0===h?Me:h,y=e.visualTaggingOptions,m=void 0===y?{enabled:!0,messenger:new ao}:y;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:De,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:Fe,e.debounceTime=null!==(r=e.debounceTime)&&void 0!==r?r:0,e.pageUrlExcludelist=null===(o=e.pageUrlExcludelist)||void 0===o?void 0:o.reduce((function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e}),[]);var b="@amplitude/plugin-autocapture-browser",w=[],E=new uo(e),_=go(Object.values(null!==(f=null===(d=e.pageActions)||void 0===d?void 0:d.labeledEvents)&&void 0!==f?f:{})),S=yo(null!==(v=null===(p=e.pageActions)||void 0===p?void 0:p.triggers)&&void 0!==v?v:[]),T=function(e,t,n,r){return new bo(e,t,n,r)}(_,S,E,e);return{name:b,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,(function(){var r,o,a,d,f,p,v,h,y,I;return u(this,(function(k){return"undefined"==typeof document||(t.fetchRemoteConfig&&$n({localConfig:t,configKeys:["analyticsSDK.pageActions"]}).then((function(n){return s(void 0,void 0,void 0,(function(){var r,o;return u(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,n.getRemoteConfig("analyticsSDK","pageActions")];case 1:return function(t){var n,r;t&&(e.pageActions=i(i({},e.pageActions),t),_=go(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),S=yo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),T.update(_,S,e))}(s.sent()),[3,3];case 2:return r=s.sent(),null===(o=null==t?void 0:t.loggerProvider)||void 0===o||o.error("Failed to fetch remote config: ".concat(String(r))),[3,3];case 3:return[2]}}))}))})).catch((function(e){var n;null===(n=null==t?void 0:t.loggerProvider)||void 0===n||n.error("Failed to create remote config fetch: ".concat(String(e)))})),r=Ji(e,e.cssSelectorAllowlist),o=Ji(e,e.actionClickAllowlist),a=function(){var t,n,r=vo().pipe(Ii((function(t){return E.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,g)})),Bi()),i=Li(document,"change",{capture:!0}).pipe(Ii((function(t){return E.addAdditionalEventProperties(t,"change",e.cssSelectorAllowlist,g)})),Bi());window.navigation&&(n=Li(window.navigation,"navigate").pipe(Ii((function(t){return E.addAdditionalEventProperties(t,"navigate",e.cssSelectorAllowlist,g)})),Bi()));var o=po().pipe(Ii((function(t){return E.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,g)})),Bi());return(t={})[fo.ClickObservable]=r,t[fo.ChangeObservable]=i,t[fo.NavigateObservable]=n,t[fo.MutationObservable]=o,t}(),d=co({allObservables:a,options:e,amplitude:n,shouldTrackEvent:r,evaluateTriggers:T.evaluate.bind(T)}),w.push(d),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(Mi(Qi),Mi((function(e){return i("change",e.closestTrackedAncestor)})),Ii((function(e){return o(e)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,l(l([],c(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:T.evaluate.bind(T)}),w.push(f),p=lo({allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return E.getEventProperties.apply(E,l(l([],c(e),!1),[g],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:o}),w.push(p),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(b," has been successfully added.")),window.opener&&m.enabled&&(v=e.cssSelectorAllowlist,h=e.actionClickAllowlist,null===(I=m.messenger)||void 0===I||I.setup(i(i({dataExtractor:E,logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Yn[t.serverZone]}),{isElementSelectable:Ji(e,l(l([],c(v),!1),c(h),!1)),cssSelectorAllowlist:v,actionClickAllowlist:h})))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,r;return u(this,(function(i){try{for(e=a(w),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};function Eo(e,t){var n,r,i,o,s=t.event,u=s.clientX,a=s.clientY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:a,a),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:a,a),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:u,u),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:u,u),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function _o(e){var t=e[0],n=e[e.length-1];return{rageClickEvent:i({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function So(e){var t,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,s=[],u={};function a(e){s=[],u={},e&&(Eo(u,e),s.push(e))}return o.pipe(Mi(Qi),Mi((function(e){return i("click",e.closestTrackedAncestor)})),Ii((function(e){if(t&&clearTimeout(t),Eo(u,e),0===s.length)return s.push(e),null;if(function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(s,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(s,e)||u.isOutOfBounds){var r=s.length>=4?_o(s):null;return a(e),r}return s.push(e),s.length>=4&&(t=setTimeout((function(){var e=_o(s),t=e.rageClickEvent,r=e.time;n.track(zn,t,{time:r}),a()}),1e3)),null})),Mi((function(e){return null!==e}))).subscribe((function(e){null!==e&&n.track(zn,e.rageClickEvent,{time:e.time})}))}var To,Io=function(e){var t,n,r,o,d;void 0===e&&(e={});var f="@amplitude/plugin-frustration-browser",p=[],v=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:$e,h=null!==(o=null===(r=e.deadClicks)||void 0===r?void 0:r.cssSelectorAllowlist)&&void 0!==o?o:Ve,g=null!==(d=e.dataAttributePrefix)&&void 0!==d?d:Me,y=new uo(e),m=l([],c(new Set(l(l([],c(v),!1),c(h),!1))),!1);return{name:f,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,(function(){var r,o,s,a,d,b;return u(this,(function(u){return"undefined"==typeof document||(r=Ji(e,v),o=Ji(e,h),s=function(){var e,t,n=vo("pointerdown").pipe(Ii((function(e){return y.addAdditionalEventProperties(e,"click",m,g,!0)})),Bi());window.navigation&&(t=Li(window.navigation,"navigate").pipe(Ii((function(e){return y.addAdditionalEventProperties(e,"navigate",m,g)})),Bi()));var r=po().pipe(Ii((function(e){return y.addAdditionalEventProperties(e,"mutation",m,g)})),Bi());return(e={})[fo.ClickObservable]=n,e[fo.ChangeObservable]=new br,e[fo.NavigateObservable]=t,e[fo.MutationObservable]=r,e}(),a=So({allObservables:s,amplitude:n,shouldTrackRageClick:r}),p.push(a),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,o=e.shouldTrackDeadClick,s=n.clickObservable,u=n.mutationObservable,a=n.navigateObservable,d=s.pipe(Mi(Qi),Mi((function(e){return o("click",e.closestTrackedAncestor)})),Mi((function(e){return null===e.event.target.closest('a[target="_blank"]')}))),f=[u];a&&f.push(a);var p=ji.apply(void 0,l([],c(f),!1));return d.pipe(Pi((function(e){var t;return Fi(new br((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),p.pipe(Vi(1),Ii((function(){return null})))).pipe(Mi((function(e){return null!==e})))})),Wi(3e3)).subscribe((function(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",i(i({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}))}({amplitude:n,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,g)},shouldTrackDeadClick:o}),p.push(d),null===(b=null==t?void 0:t.loggerProvider)||void 0===b||b.log("".concat(f," has been successfully added."))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,r;return u(this,(function(i){try{for(e=a(p),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},ko="[Amplitude] Network Request",xo="500-599";function Po(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function Oo(e,t){var n,r,i=t.split(",");try{for(var o=a(i),s=o.next();!s.done;s=o.next()){var u=c(s.value.split("-").map(Number),2),l=u[0],d=u[1];if(e===l&&void 0===d)return!0;if(e>=l&&e<=d)return!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function Ao(e){var t;if(e)try{var n=null===(t=F())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,u=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:r.href,host:u}}catch(e){return}}function Ro(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return l([],c(R),!1);if(void 0===e){return}}}function Co(e){var t,n;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)}function No(e,t){var n;void 0===t&&(t={});var r=Ao(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(Po(o,"*.amplitude.com")||Po(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return Po(o,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!Oo(e.status,xo))return!1;if(t.captureRules&&(l([],c(t.captureRules),!1).reverse().find((function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find((function(e){return Po(t,e)})))&&(!r||!e.urls||Pe(r,e.urls))&&(!i||!e.methods||e.methods.find((function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e}))))return!((n||0===n)&&!Oo(n,e.statusCodeRange||xo))}(t,o,e.status,e.url,e.method),i){var n=Ro(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var s=Ro(t.requestHeaders);if(e.requestWrapper&&s){var u=e.requestWrapper.headers(s);u&&(e.requestHeaders=u)}e.responseWrapper&&t.responseBody&&!Co(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!Co(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==i})),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find((function(e){return e.event_type===ko})))return!0}catch(e){}return!1}(o,e.requestWrapper)}function Lo(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.pipe(Mi((function(e){return No(e.event,n)}))).subscribe((function(e){var t,n,o,a=e.event,l=Ao(a.url);if(l){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){s(this,void 0,void 0,(function(){var i,o,s;return u(this,(function(u){switch(u.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=c.apply(void 0,[u.sent(),2]),o=i[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==r||r.debug("Failed to stringify response body")}u.label=2;case 2:return null==n||n.track(ko,e),[2]}}))}))}(((t={})["[Amplitude] URL"]=l.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=l.query,t["[Amplitude] URL Fragment"]=l.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}}))}!function(e){e.NetworkObservable="networkObservable"}(To||(To={}));var Uo=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],i=function(){var e,n=new br((function(e){var n=new at((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return lt.subscribe(n,t),function(){lt.unsubscribe(n)}}));return(e={})[To.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(o,a){return s(void 0,void 0,void 0,(function(){var s,c;return u(this,(function(u){return"undefined"==typeof document||(s=i(),t=null==o?void 0:o.loggerProvider,c=Lo({allObservables:s,networkTrackingOptions:e,amplitude:a,loggerProvider:t}),r.push(c),null==t||t.log("".concat(n," has been successfully added."))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,i;return u(this,(function(o){try{for(e=a(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}};let qo=-1;const jo=e=>{addEventListener("pageshow",(t=>{t.persisted&&(qo=t.timeStamp,e(t))}),!0)},Do=(e,t,n,r)=>{let i,o;return s=>{t.value>=0&&(s||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},Mo=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},Fo=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},Vo=()=>{const e=Fo();return e?.activationStart??0},$o=(e,t=-1)=>{const n=Fo();let r="navigate";return qo>=0?r="back-forward-cache":n&&(document.prerendering||Vo()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},Bo=new WeakMap;function zo(e,t){return Bo.get(e)||Bo.set(e,new t),Bo.get(e)}class Wo{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const Ho=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver((e=>{Promise.resolve().then((()=>{t(e.getEntries())}))}));return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Ko=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Jo=-1;const Yo=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Go=e=>{"hidden"===document.visibilityState&&Jo>-1&&(Jo="visibilitychange"===e.type?e.timeStamp:0,Xo())},Qo=()=>{addEventListener("visibilitychange",Go,!0),addEventListener("prerenderingchange",Go,!0)},Xo=()=>{removeEventListener("visibilitychange",Go,!0),removeEventListener("prerenderingchange",Go,!0)},Zo=()=>{if(Jo<0){const e=Vo(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;Jo=t??Yo(),Qo(),jo((()=>{setTimeout((()=>{Jo=Yo(),Qo()}))}))}return{get firstHiddenTime(){return Jo}}},es=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},ts=[1800,3e3],ns=(e,t={})=>{es((()=>{const n=Zo();let r,i=$o("FCP");const o=Ho("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Vo(),0),i.entries.push(t),r(!0)))}));o&&(r=Do(e,i,ts,t.reportAllChanges),jo((n=>{i=$o("FCP"),r=Do(e,i,ts,t.reportAllChanges),Mo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},rs=[.1,.25];let is=0,os=1/0,ss=0;const us=e=>{for(const t of e)t.interactionId&&(os=Math.min(os,t.interactionId),ss=Math.max(ss,t.interactionId),is=ss?(ss-os)/7+1:0)};let as;const cs=()=>as?is:performance.interactionCount??0;let ls=0;class ds{u=[];l=new Map;m;p;v(){ls=cs(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor((cs()-ls)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.T){if(n?e.duration>n.T?(n.entries=[e],n.T=e.duration):e.duration===n.T&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],T:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((e,t)=>t.T-e.T)),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const fs=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(t(e=Ko(e)),document.addEventListener("visibilitychange",e,{once:!0}))},ps=[200,500],vs=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&es((()=>{"interactionCount"in performance||as||(as=Ho("event",us,{type:"event",buffered:!0,durationThreshold:0}));let n,r=$o("INP");const i=zo(t,ds),o=e=>{fs((()=>{for(const t of e)i.h(t);const t=i.P();t&&t.T!==r.value&&(r.value=t.T,r.entries=t.entries,n())}))},s=Ho("event",o,{durationThreshold:t.durationThreshold??40});n=Do(e,r,ps,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),jo((()=>{i.v(),r=$o("INP"),n=Do(e,r,ps,t.reportAllChanges)})))}))};class hs{m;h(e){this.m?.(e)}}const gs=[2500,4e3],ys=[800,1800],ms=e=>{document.prerendering?es((()=>ms(e))):"complete"!==document.readyState?addEventListener("load",(()=>ms(e)),!0):setTimeout(e)};function bs(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function ws(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(bs(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Es=function(){var e=null,t=F(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,(function(){var o,s;return u(this,(function(u){return void 0===n||(o=Oe((null==r?void 0:r.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Oe((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Oe(o.split("?")[0],t.loggerProvider)},((e,t={})=>{es((()=>{const n=Zo();let r,i=$o("LCP");const o=zo(t,hs),s=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-Vo(),0),i.entries=[t],r())},u=Ho("largest-contentful-paint",s);if(u){r=Do(e,i,gs,t.reportAllChanges);const n=Ko((()=>{s(u.takeRecords()),u.disconnect(),r(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>fs(n)),{capture:!0,once:!0});jo((n=>{i=$o("LCP"),r=Do(e,i,gs,t.reportAllChanges),Mo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((function(e){s["[Amplitude] LCP"]=ws(e)})),ns((function(e){s["[Amplitude] FCP"]=ws(e)})),vs((function(e){s["[Amplitude] INP"]=ws(e)})),((e,t={})=>{ns(Ko((()=>{let n,r=$o("CLS",0);const i=zo(t,Wo),o=e=>{for(const t of e)i.h(t);i.i>r.value&&(r.value=i.i,r.entries=i.o,n())},s=Ho("layout-shift",o);s&&(n=Do(e,r,rs,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),jo((()=>{i.i=0,r=$o("CLS",0),n=Do(e,r,rs,t.reportAllChanges),Mo((()=>n()))})),setTimeout(n))})))})((function(e){s["[Amplitude] CLS"]=ws(e)})),((e,t={})=>{let n=$o("TTFB"),r=Do(e,n,ys,t.reportAllChanges);ms((()=>{const i=Fo();i&&(n.value=Math.max(i.responseStart-Vo(),0),n.entries=[i],r(!0),jo((()=>{n=$o("TTFB",0),r=Do(e,n,ys,t.reportAllChanges),r(!0)})))}))})((function(e){s["[Amplitude] TTFB"]=ws(e)})),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",s),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]}))}))}}},_s=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Ss=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,u=o(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=o(a,["referrer","referring_domain"]);if(Ts(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(u)!==JSON.stringify(l),f=_s(s||"")!==_s(c||""),p=!t||d||f;return p?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),p},Ts=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=""),e.some((function(e){return e instanceof RegExp?e.test(t):e===t}))},Is=function(){function e(e,t){var n,r,o;this.shouldTrackNewCampaign=!1,this.options=i({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,o=r,o?(o.startsWith(".")&&(o=o.substring(1)),[new RegExp("".concat(o.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=Le(t.apiKey,"MKTG"),this.webExpStorageKey=Le(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=A,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,(function(){var e,t;return u(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=c.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||be(this.sessionTimeout,this.lastEventTime),Ss(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new dt).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,o,s=(t=this.currentCampaign,n=this.options,r=i(i({},A),t),o=Object.entries(r).reduce((function(e,t){var r,i=c(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)}),new U),z(o));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ks=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.init=function(e,t,n){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=n):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),W(this._init(i(i({},o),{userId:r,apiKey:e})))},n.prototype._init=function(t){var n,r,o;return s(this,void 0,void 0,(function(){var s,a,c,l,d,f,p,v=this;return u(this,(function(u){switch(u.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Xt(t.apiKey,t,this)]);case 1:return(s=u.sent()).fetchRemoteConfig?(this.remoteConfigClient=new J(s.apiKey,s.loggerProvider,s.serverZone),[4,new Promise((function(e){var t;null===(t=v.remoteConfigClient)||void 0===t||t.subscribe("configs.analyticsSDK.browserSDK","all",(function(t,n,r){s.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&jn(t,s),e()}))}))]):[3,3];case 2:u.sent(),u.label=3;case 3:return[4,e.prototype._init.call(this,s)];case 4:return u.sent(),this.logBrowserOptions(s),pt(this.config.defaultTracking)?(a=function(e){return pt(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?i({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new Is(a,this.config),[4,this.webAttribution.init()]):[3,6];case 5:u.sent(),u.label=6;case 6:return c=_e(),l=c.ampTimestamp?Number(c.ampTimestamp):void 0,d=!l||Date.now()<l,f=d&&!Number.isNaN(Number(c.ampSessionId))?Number(c.ampSessionId):void 0,this.setSessionId(null!==(o=null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:f)&&void 0!==r?r:this.config.sessionId)&&void 0!==o?o:Date.now()),(p=ye(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,8]:[4,this.add(Ln()).promise];case 7:u.sent(),u.label=8;case 8:return[4,this.add(new oe).promise];case 9:return u.sent(),[4,this.add(new xt).promise];case 10:return u.sent(),[4,this.add(new me).promise];case 11:return u.sent(),function(e){Nn||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Nn=!0)}(this.config),h=this.config.defaultTracking,ft(h,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Cn()).promise]):[3,13];case 12:u.sent(),u.label=13;case 13:return function(e){return ft(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(On()).promise]):[3,15];case 14:u.sent(),u.label=15;case 15:return vt(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(In(_t(this.config))).promise]):[3,17];case 16:u.sent(),u.label=17;case 17:return yt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(wo(bt(this.config))).promise]):[3,19];case 18:u.sent(),u.label=19;case 19:return mt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Io(wt(this.config))).promise]):[3,21];case 20:u.sent(),u.label=21;case 21:return gt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Uo(Et(this.config))).promise]):[3,23];case 22:u.sent(),u.label=23;case 23:return function(e){return"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Es()).promise]):[3,25];case 24:u.sent(),u.label=25;case 25:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 26:return u.sent(),p.eventBridge.setEventReceiver((function(e){v.track(e.eventType,e.eventProperties)})),[2]}var h}))}))},n.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},n.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){ye(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},n.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},n.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){ye(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},n.prototype.reset=function(){this.setDeviceId($()),this.setUserId(void 0)},n.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},n.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},n.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},n.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),W(Promise.resolve());if(e===this.config.sessionId)return W(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,ht(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Vt,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return ht(this.config.defaultTracking)&&n.push(this.track(Ft,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,W(Promise.all(n))},n.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},n.prototype.setTransport=function(e){this.config?this.config.transportProvider=en(e):this.q.push(this.setTransport.bind(this,e))},n.prototype.identify=function(t,n){if(It(t)){var r=t._q;t._q=[],t=Tt(new U,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},n.prototype.groupIdentify=function(t,n,r,i){if(It(r)){var o=r._q;r._q=[],r=Tt(new U,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},n.prototype.revenue=function(t,n){if(It(t)){var r=t._q;t._q=[],t=Tt(new X,r)}return e.prototype.revenue.call(this,t,n)},n.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},n.prototype.process=function(t){return s(this,void 0,void 0,(function(){var n,i,o;return u(this,(function(s){return n=Date.now(),i=be(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Ft||t.event_type===Vt||t.session_id&&t.session_id!==this.getSessionId()||(i||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),t.event_type===r.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]}))}))},n.prototype.logBrowserOptions=function(e){try{var t=i(i({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},n}(H),xs=function(){var e=new ks;return{init:xe(e.init.bind(e),"init",Te(e),ke(e,["config"])),add:xe(e.add.bind(e),"add",Te(e),ke(e,["config.apiKey","timeline.plugins"])),remove:xe(e.remove.bind(e),"remove",Te(e),ke(e,["config.apiKey","timeline.plugins"])),track:xe(e.track.bind(e),"track",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),logEvent:xe(e.logEvent.bind(e),"logEvent",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),identify:xe(e.identify.bind(e),"identify",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),groupIdentify:xe(e.groupIdentify.bind(e),"groupIdentify",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),setGroup:xe(e.setGroup.bind(e),"setGroup",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),revenue:xe(e.revenue.bind(e),"revenue",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),flush:xe(e.flush.bind(e),"flush",Te(e),ke(e,["config.apiKey","timeline.queue.length"])),getUserId:xe(e.getUserId.bind(e),"getUserId",Te(e),ke(e,["config","config.userId"])),setUserId:xe(e.setUserId.bind(e),"setUserId",Te(e),ke(e,["config","config.userId"])),getDeviceId:xe(e.getDeviceId.bind(e),"getDeviceId",Te(e),ke(e,["config","config.deviceId"])),setDeviceId:xe(e.setDeviceId.bind(e),"setDeviceId",Te(e),ke(e,["config","config.deviceId"])),reset:xe(e.reset.bind(e),"reset",Te(e),ke(e,["config","config.userId","config.deviceId"])),getSessionId:xe(e.getSessionId.bind(e),"getSessionId",Te(e),ke(e,["config"])),setSessionId:xe(e.setSessionId.bind(e),"setSessionId",Te(e),ke(e,["config"])),extendSession:xe(e.extendSession.bind(e),"extendSession",Te(e),ke(e,["config"])),setOptOut:xe(e.setOptOut.bind(e),"setOptOut",Te(e),ke(e,["config"])),setTransport:xe(e.setTransport.bind(e),"setTransport",Te(e),ke(e,["config"])),getIdentity:xe(e.getIdentity.bind(e),"getIdentity",Te(e),ke(e,["config"])),getOptOut:xe(e.getOptOut.bind(e),"getOptOut",Te(e),ke(e,["config"]))}},Ps=xs(),Os=Object.freeze({__proto__:null,get IdentifyOperation(){return n},get SpecialEventType(){return r},get RevenueProperty(){return Y},get LogLevel(){return D},get ServerZone(){return pe},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:De,DEFAULT_DATA_ATTRIBUTE_PREFIX:Me,DEFAULT_ACTION_CLICK_ALLOWLIST:Fe}),As=Ps.add,Rs=Ps.extendSession,Cs=Ps.flush,Ns=Ps.getDeviceId,Ls=Ps.getIdentity,Us=Ps.getOptOut,qs=Ps.getSessionId,js=Ps.getUserId,Ds=Ps.groupIdentify,Ms=Ps.identify,Fs=Ps.init,Vs=Ps.logEvent,$s=Ps.remove,Bs=Ps.reset,zs=Ps.revenue,Ws=Ps.setDeviceId,Hs=Ps.setGroup,Ks=Ps.setOptOut,Js=Ps.setSessionId,Ys=Ps.setTransport,Gs=Ps.setUserId,Qs=Ps.track,Xs=Object.freeze({__proto__:null,add:As,extendSession:Rs,flush:Cs,getDeviceId:Ns,getIdentity:Ls,getOptOut:Us,getSessionId:qs,getUserId:js,groupIdentify:Ds,identify:Ms,init:Fs,logEvent:Vs,remove:$s,reset:Bs,revenue:zs,setDeviceId:Ws,setGroup:Hs,setOptOut:Ks,setSessionId:Js,setTransport:Ys,setUserId:Gs,track:Qs,createInstance:xs,AmplitudeBrowser:ks,runQueuedFunctions:St,Revenue:X,Identify:U,Types:Os});!function(){var e=F();if(e){var t=function(e){var t=xs(),n=F();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Xs,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],St(Xs,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i<r.length;i++){var o=r[i],s=Object.assign(e.amplitude._iq[o],t(o)),u=s._q;s._q=[],St(s,u)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
2
2
  //# sourceMappingURL=amplitude-min.js.map