@amplitude/analytics-browser 2.22.1 → 2.22.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.
- package/README.md +1 -1
- package/lib/cjs/config.d.ts +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/config.d.ts +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.js +1 -1
- package/lib/esm/version.js.map +1 -1
- package/lib/scripts/amplitude-bookmarklet-snippet-min.js +1 -1
- package/lib/scripts/amplitude-bookmarklet.html +1 -1
- package/lib/scripts/amplitude-gtm-min.js +1 -1
- package/lib/scripts/amplitude-gtm-min.js.gz +0 -0
- package/lib/scripts/amplitude-gtm-min.js.map +1 -1
- package/lib/scripts/amplitude-gtm-snippet-min.js +1 -1
- package/lib/scripts/amplitude-min.js +1 -1
- package/lib/scripts/amplitude-min.js.gz +0 -0
- package/lib/scripts/amplitude-min.js.map +1 -1
- package/lib/scripts/amplitude-min.umd.js +1 -1
- package/lib/scripts/amplitude-min.umd.js.gz +0 -0
- package/lib/scripts/amplitude-snippet-instructions.html +1 -1
- package/lib/scripts/amplitude-snippet-min.js +1 -1
- package/lib/scripts/config.d.ts +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(e,n){return t=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])},t(e,n)};function n(e,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=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=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},o.apply(this,arguments)};function s(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 u(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 a(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 c(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 l(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 d(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 f(e){return this instanceof f?(this.v=e,this):new f(e)}function p(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 f?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 h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=c(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"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var v,g="AMP",y="".concat(g,"_unsent"),m="$default_instance",b="https://api2.amplitude.com/2/httpapi",w="dclid",_="fbclid",E="gbraid",S="gclid",T="ko_click_id",I="li_fat_id",k="msclkid",P="rtd_cid",A="ttclid",O="twclid",x="wbraid",C={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(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&&R(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 R(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},L=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},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||N(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 U,D=[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"}(U||(U={}));var j,q=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=U.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},M=d([],l(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),V=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,V)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],l(r.entries()),!1).map((function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(M[r]):M[r]})).join("")},$=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 u(this,void 0,void 0,(function(){return a(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=V(),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 u(this,void 0,void 0,(function(){var r,i;return a(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 u(this,void 0,void 0,(function(){var t,n,r,i,s,u,d,f,p,h,v,g,y,m,b,w,_,E,S,T;return a(this,(function(a){switch(a.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),s=this.plugins.filter((function(e){return"before"===e.type})),a.label=1;case 1:a.trys.push([1,6,7,8]),u=c(s),d=u.next(),a.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(y=a.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),i({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))),a.label=4;case 4:return d=u.next(),[3,2];case 5:return[3,8];case 6:return f=a.sent(),_={error:f},[3,8];case 7:try{d&&!d.done&&(E=u.return)&&E.call(u)}finally{if(_)throw _.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),a.label=9;case 9:a.trys.push([9,14,15,16]),h=c(p),v=h.next(),a.label=10;case 10:return v.done?[3,13]:(g=v.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(y=a.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),i({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))),a.label=12;case 12:return v=h.next(),[3,10];case 13:return[3,16];case 14:return m=a.sent(),S={error:m},[3,16];case 15:try{v&&!v.done&&(T=h.return)&&T.call(h)}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=o({},n);return e.execute(t).catch((function(e){return q(t,0,String(e))}))})),Promise.all(w).then((function(e){var t=l(e,1)[0]||q(n,100,"Event not tracked, no destination plugins on the instance");i(t)})),[2]}}))}))},e.prototype.flush=function(){return u(this,void 0,void 0,(function(){var e,t,n,r=this;return a(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 o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},B=function(e){return{promise:e||Promise.resolve()}},W=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 $(this),this.name=e}return e.prototype._init=function(e){return u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,l;return a(this,(function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),n=c(t),r=n.next(),a.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 a.sent(),[3,6];case 4:return[4,o];case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return s=a.sent(),u={error:s},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(u)throw u.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:a.sent(),a.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return B(this.dispatch(r))},e.prototype.identify=function(e,t){var n=z(e,t);return B(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var s=function(e,t,n,r){var s;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(s={},s[e]=t,s)})}(e,t,n,r);return B(this.dispatch(s))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,s=new L;return s.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:s.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return B(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return B(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),B())},e.prototype._addPlugin=function(e){return B(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)),B())},e.prototype._removePlugin=function(e){return B(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(q(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return u(this,void 0,void 0,(function(){var t=this;return a(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 n={};return Object.keys(e).forEach((function(t){Object.values(r).includes(t)||(n[t]=e[t])})),D.forEach((function(n){if(Object.keys(e).includes(n)){var i=e[n];switch(n){case r.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case r.UNSET:Object.keys(i).forEach((function(e){delete t[e]}));break;case r.SET:Object.assign(t,i)}}})),Object.assign(t,n),t},e.prototype.process=function(e){return u(this,void 0,void 0,(function(){var t,n,r,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,q(e,0,"Event skipped due to optOut config")]:(e.event_type===i.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(),r=String(n),this.config.loggerProvider.error(r),[2,o=q(e,0,r)];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 B(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=V(),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 u(this,void 0,void 0,(function(){var e,t=this;return a(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 u(this,void 0,void 0,(function(){var t,n,r,i=this;return a(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 u(this,void 0,void 0,(function(){var n,r;return a(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),u(this,void 0,void 0,(function(){var n,r,i,o,s,u,c=this;return a(this,(function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,u,l,d;return a(this,(function(a){switch(a.label){case 0:i=new AbortController,s=setTimeout((function(){return i.abort()}),t),a.label=1;case 1:return a.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:return(u=a.sent()).ok?[3,4]:[4,u.text()];case 3:return l=a.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(u.status,": ").concat(l)),[3,6];case 4:return[4,u.json()];case 5:return[2,{value:{remoteConfig:a.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=a.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:a.sent(),a.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(u=l.sent()))return[2,u.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"}(j||(j={}));var H,Y="Amplitude Logger ",G=function(){function e(){this.logLevel=j.None}return e.prototype.disable=function(){this.logLevel=j.None},e.prototype.enable=function(e){void 0===e&&(e=j.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<j.Verbose||console.log("".concat(Y,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<j.Warn||console.warn("".concat(Y,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<j.Error||console.error("".concat(Y,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<j.Debug||console.log("".concat(Y,"[Debug]: ").concat(e.join(" ")))},e}(),Q=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 R(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[H.REVENUE_PRODUCT_ID]=this.productId,e[H.REVENUE_QUANTITY]=this.quantity,e[H.REVENUE_PRICE]=this.price,e[H.REVENUE_TYPE]=this.revenueType,e[H.REVENUE_CURRENCY]=this.currency,e[H.REVENUE]=this.revenue,e[H.RECEIPT]=this.receipt,e[H.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"}(H||(H={}));var Z=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:m,logLevel:j.Warn,loggerProvider:new G,offline:!1,optOut:!1,serverUrl:b,serverZone:"US",useBatch:!1}},X=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=te(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}(),ee=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":b},te=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:ee(r,n)}},ne=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function re(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var ie=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 u(this,void 0,void 0,(function(){var n,r=this;return a(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(y,"_").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=V()),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),u(this,void 0,void 0,(function(){var t,n,r=this;return a(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,s=this.config.flushQueueSize,c=Math.max(s,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 u(r,void 0,void 0,(function(){return a(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,s,c}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),u(this,void 0,void 0,(function(){var n,r,i,o,u;return a(this,(function(a){switch(a.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,s(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new ne,a.label=1;case 1:return a.trys.push([1,3,,4]),r=te(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(i=a.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(re(i))):this.fulfillRequest(e,i.statusCode,i.status),[2]);case 3:return o=a.sent(),u=(c=o)instanceof Error?c.message:String(c),this.config.loggerProvider.error(u),this.handleResponse({status:U.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 U.Success:this.handleSuccessResponse(e,t);break;case U.Invalid:this.handleInvalidResponse(e,t);break;case U.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case U.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=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(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(re(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(re(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(re(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(q(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}(),oe=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:se(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),se=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ue=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}(),ae=function(){return ae=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},ae.apply(this,arguments)};function ce(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 le(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 de=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=ce(["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(!de(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){de(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!de(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 fe,pe=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ae({},this.identity.userProperties),n=ae(ae({},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=ce(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=le(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var h=(i=void 0,ce(Object.entries(p))),v=h.next();!v.done;v=h.next()){var g=le(v.value,2),y=g[0],m=g[1];a[y]=m}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,ce(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 ae({},this.identity)},e.prototype.setIdentity=function(e){var t=ae({},this.identity);this.identity=ae({},e),de(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,ve=function(){function e(){this.identityStore=new pe,this.eventBridge=new ue,this.applicationContextProvider=new oe}return e.getInstance=function(t){return he.analyticsConnectorInstances||(he.analyticsConnectorInstances={}),he.analyticsConnectorInstances[t]||(he.analyticsConnectorInstances[t]=new e),he.analyticsConnectorInstances[t]},e}(),ge=function(e){return void 0===e&&(e=m),ve.getInstance(e)},ye=function(){function e(){this.name="identity",this.type="before",this.identityStore=ge().identityStore}return e.prototype.execute=function(e){return u(this,void 0,void 0,(function(){var t;return a(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return u(this,void 0,void 0,(function(){return a(this,(function(t){return e.instanceName&&(this.identityStore=ge(e.instanceName).identityStore),[2]}))}))},e}(),me=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},be=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[g,t,e.substring(0,n)].filter(Boolean).join("_")},we=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=Ee(n[0]),i=Ee(n[1]);return i?(e[r]=i,e):e}),{}):{}},Ee=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Se=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},Te=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(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},Ie=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Te(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}},ke=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<j.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(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return u(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return u(this,void 0,void 0,(function(){var t;return a(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 u(this,void 0,void 0,(function(){return a(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return u(this,void 0,void 0,(function(){return a(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Ae=function(){function e(e){this.options=o({},e)}return e.prototype.isEnabled=function(){return u(this,void 0,void 0,(function(){var t,n;return a(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 u(this,void 0,void 0,(function(){var n,r;return a(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=Oe(n))&&void 0!==t?t:xe(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 u(this,void 0,void 0,(function(){var r,i,o;return a(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 u(this,void 0,void 0,(function(){var r,i,o,s,u,c,l;return a(this,(function(a){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),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(c=F())&&(c.document.cookie=u)}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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(this,(function(e){return[2]}))}))},e}(),Oe=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},xe=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},Ce=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return u(this,void 0,void 0,(function(){var t,n,r;return a(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 u(this,void 0,void 0,(function(){var t;return a(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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),Re=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,h,v,g,y,m,b,w,_,E;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case U.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 U.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!==(h=e.throttled_events)&&void 0!==h?h:[]}};case U.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case U.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.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case U.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?U.Success:429===e?U.RateLimit:413===e?U.PayloadTooLarge:408===e?U.Timeout:e>=400&&e<500?U.Invalid:e>=500?U.Failed:U.Unknown},e}(),Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i;return a(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]}}))}))},t}(Re);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(fe||(fe={}));var Le=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Ue="data-amp-track-",De=["div","span","h1","h2","h3","h4","h5","h6"],je=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),qe=["*"],Fe=function(){function e(e){this.request=e}return Object.defineProperty(e.prototype,"headers",{get:function(){if(this._headers)return this._headers;var e=this.request.headers;if(Array.isArray(e)){var t=e;this._headers=t.reduce((function(e,t){var n=l(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}else if(e instanceof Headers){var n={};e.forEach((function(e,t){n[t]=e})),this._headers=n}else"object"==typeof e&&(this._headers=e);return this._headers},enumerable:!1,configurable:!0}),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=Ve(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}(),Me=function(){function e(e){this.body=e}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return Ve(this.body,100)},enumerable:!1,configurable:!0}),e}();function Ve(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 a=e,d=0,f=0;try{for(var p=c(a.entries()),h=p.next();!h.done;h=p.next()){var v=l(h.value,2),g=v[0],y=v[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{h&&!h.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 $e=function(){function e(e){this.response=e}return Object.defineProperty(e.prototype,"headers",{get:function(){var e;if(this._headers)return this._headers;if(this.response.headers instanceof Headers){var t=this.response.headers,n={};return null===(e=null==t?void 0:t.forEach)||void 0===e||e.call(t,(function(e,t){n[t]=e})),this._headers=n,n}},enumerable:!1,configurable:!0}),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}(),ze=function(){function e(e,t,n){this.statusCode=e,this.headersString=t,this.size=n}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}),Object.defineProperty(e.prototype,"headers",{get:function(){var e,t;if(this.headersString){var n={},r=this.headersString.split("\r\n");try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var s=l(o.value.split(": "),2),u=s[0],a=s[1];u&&a&&(n[u]=a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n}},enumerable:!1,configurable:!0}),e}(),Be=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,requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers,responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter((function(e){var t=l(e,2);return t[0],void 0!==t[1]})))},e}();var We,Ke,Je,He=function(e,t){void 0===t&&(t=V()),this.callback=e,this.id=t},Ye=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;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var c=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,l=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;c&&l&&this.observeXhr(c,l);var d=null===(a=this.globalScope)||void 0===a?void 0:a.fetch;d&&this.observeFetch(d),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;if(void 0!==o&&void 0!==s){var a,c,l,d="GET";!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?a=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(a=t.url,d=t.method),d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var f=Math.floor(performance.now()-s),p=Math.floor(o+f),h=new Be(e,d,o,o,a,n,c,f,r,l,p);this.triggerEventCallbacks(h)}},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 u(t,void 0,void 0,(function(){var t,i,o,s,u,c;return a(this,(function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){null===(u=this.logger)||void 0===u||u.debug("an unexpected error occurred while retrieving timestamps",e)}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=a.sent(),[3,4];case 3:return s=a.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Fe(r):void 0,i?new $e(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.prototype.observeXhr=function(e,t){if(this.globalScope&&e&&t){var n=this.globalScope.XMLHttpRequest.prototype,r=this;n.open=function(){for(var t,n,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var u=l(i,2),a=u[0],c=u[1];try{this.$$AmplitudeAnalyticsEvent=o({method:a,url:null===(t=null==c?void 0:c.toString)||void 0===t?void 0:t.call(c)},r.getTimestamps())}catch(e){null===(n=r.logger)||void 0===n||n.debug("an unexpected error occurred while calling xhr open",e)}return e.apply(this,i)},n.send=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var i=this,o=e[0],s=i.$$AmplitudeAnalyticsEvent;return i.addEventListener("loadend",(function(){var e;try{var t=i.getAllResponseHeaders(),n=i.getResponseHeader("content-length"),u=new ze(i.status,t,n?parseInt(n,10):void 0),a=new Me(o);s.status=i.status,r.handleNetworkRequestEvent("xhr",{url:s.url,method:s.method},a,u,void 0,s.startTime,s.durationStart)}catch(t){null===(e=r.logger)||void 0===e||e.debug("an unexpected error occurred while handling xhr send",t)}})),t.apply(i,e)}}},e}(),Ge=new Ye,Qe=function(){function e(){}return e.prototype.parse=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,o(o(o(o({},C),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={})[w]=t[w],e[_]=t[_],e[E]=t[E],e[S]=t[S],e[T]=t[T],e[I]=t[I],e[k]=t[k],e[P]=t[P],e[A]=t[A],e[O]=t[O],e[x]=t[x],e},e}(),Ze=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Xe=function(e){return Ze(e,"attribution")},et=function(e){return Ze(e,"pageViews")},tt=function(e){return Ze(e,"sessions")},nt=function(e){return"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},rt=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},it=function(e){return"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},ot=function(e){if(rt(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},st=function(e){if(it(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},ut=function(e){if(nt(e.autocapture)){if("object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking)return e.autocapture.networkTracking;if(e.networkTrackingOptions)return e.networkTrackingOptions}},at=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return et(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}},ct=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},lt=function(e){return e&&void 0!==e._q},dt="2.22.1",ft=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts","/").concat(dt),"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 u(this,void 0,void 0,(function(){var r,i,s;return a(this,(function(u){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,s=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({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:we()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:V(),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,ht=function(e){function t(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 n(t,e),t.prototype.set=function(t,n){var r;return u(this,void 0,void 0,(function(){var i;return a(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]}}))}))},t}(Ce),vt=function(e){function t(){var t;return e.call(this,null===(t=F())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Ce),gt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return n(t,e),t.prototype.send=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return a(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))}))]}))}))},t}(Re),yt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return a(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)}}))]}))}))},t}(Re),mt=function(e,t,n){return void 0===n&&(n=!0),u(void 0,void 0,void 0,(function(){var r,i,o,s,u,c,d,f,p;return a(this,(function(a){switch(a.label){case 0:return r=function(e){return"".concat(g.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=a.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:a.sent(),a.label=3;case 3:return o=l(i.split("."),6),s=o[0],u=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:s,userId:wt(u),sessionId:bt(d),lastEventId:bt(p),lastEventTime:bt(f),optOut:Boolean(c)}]}}))}))},bt=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},wt=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},_t="[Amplitude]",Et="".concat(_t," Form Started"),St="".concat(_t," Form Submitted"),Tt="".concat(_t," File Downloaded"),It="session_start",kt="session_end",Pt="".concat(_t," File Extension"),At="".concat(_t," File Name"),Ot="".concat(_t," Link ID"),xt="".concat(_t," Link Text"),Ct="".concat(_t," Link URL"),Rt="".concat(_t," Form ID"),Nt="".concat(_t," Form Name"),Lt="".concat(_t," Form Destination"),Ut="cookie",Dt=function(e){function t(t,n,r,i,o,s,u,a,c,l,d,f,p,h,v,g,y,m,b,w,_,E,S,T,I,k,P,A,O,x,C,R,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=Ut),void 0===g&&(g=new G),void 0===y&&(y=j.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===P&&(P=new ht({loggerProvider:g})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===x&&(x=!1),void 0===C&&(C=!0);var D=e.call(this,{apiKey:t,storageProvider:P,transportProvider:Ft(O)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=i,D.defaultTracking=o,D.autocapture=s,D.flushIntervalMillis=a,D.flushMaxRetries=c,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=f,D.instanceName=p,D.loggerProvider=g,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=_,D.plan=E,D.serverUrl=S,D.serverZone=T,D.sessionTimeout=k,D.storageProvider=P,D.trackingOptions=A,D.transport=O,D.useBatch=x,D.fetchRemoteConfig=C,D.networkTrackingOptions=U,D.version=dt,D._optOut=!1,D._cookieStorage=r,D.deviceId=u,D.lastEventId=h,D.lastEventTime=v,D.optOut=w,D.sessionId=I,D.pageCounter=N,D.userId=R,D.debugLogsEnabled=L,D.loggerProvider.enable(L?j.Debug:D.logLevel),D.networkTrackingOptions=U,D}return n(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.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(be(this.apiKey),e)},t}(X),jt=function(e,t,n){return void 0===t&&(t={}),u(void 0,void 0,void 0,(function(){var r,i,s,u,c,l,d,f,p,h,v,g,y,m,b,w,_,E,S,T,I,k,P,A,O,x,C,R,N,L,U,D,j,q,F,M,$,z,B,W,K,J,H,Y,G;return a(this,(function(a){switch(a.label){case 0:return r=t.identityStorage||Ut,I={},r===Ut?[3,1]:(s="",[3,5]);case 1:return null===(P=null===(k=t.cookieOptions)||void 0===k?void 0:k.domain)||void 0===P?[3,2]:(u=P,[3,4]);case 2:return[4,Mt()];case 3:u=a.sent(),a.label=4;case 4:s=u,a.label=5;case 5:return i=o.apply(void 0,[(I.domain=s,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=qt(t.identityStorage,i),[4,mt(e,c,null===(O=null===(A=t.cookieOptions)||void 0===A?void 0:A.upgrade)||void 0===O||O)];case 6:return l=a.sent(),[4,c.get(be(e))];case 7:return d=a.sent(),f=_e(),p=f.ampTimestamp?Number(f.ampTimestamp):void 0,h=!p||Date.now()<p,v=null!==(L=null!==(N=null!==(R=null!==(x=t.deviceId)&&void 0!==x?x:h?null!==(C=f.ampDeviceId)&&void 0!==C?C:f.deviceId:void 0)&&void 0!==R?R:null==d?void 0:d.deviceId)&&void 0!==N?N:l.deviceId)&&void 0!==L?L:V(),g=null!==(U=null==d?void 0:d.lastEventId)&&void 0!==U?U:l.lastEventId,y=null!==(D=null==d?void 0:d.lastEventTime)&&void 0!==D?D:l.lastEventTime,m=null!==(q=null!==(j=t.optOut)&&void 0!==j?j:null==d?void 0:d.optOut)&&void 0!==q?q:l.optOut,b=null!==(F=null==d?void 0:d.sessionId)&&void 0!==F?F:l.sessionId,w=null!==($=null!==(M=t.userId)&&void 0!==M?M:null==d?void 0:d.userId)&&void 0!==$?$:l.userId,n.previousSessionDeviceId=null!==(z=null==d?void 0:d.deviceId)&&void 0!==z?z:l.deviceId,n.previousSessionUserId=null!==(B=null==d?void 0:d.userId)&&void 0!==B?B:l.userId,_={ipAddress:null===(K=null===(W=t.trackingOptions)||void 0===W?void 0:W.ipAddress)||void 0===K||K,language:null===(H=null===(J=t.trackingOptions)||void 0===J?void 0:J.language)||void 0===H||H,platform:null===(G=null===(Y=t.trackingOptions)||void 0===Y?void 0:Y.platform)||void 0===G||G},E=null==d?void 0:d.pageCounter,S=null==d?void 0:d.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(T=new Dt(e,t.appVersion,c,i,t.defaultTracking,t.autocapture,v,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,_,t.transport,t.useBatch,t.fetchRemoteConfig,w,E,S,t.networkTrackingOptions)).storageProvider.isEnabled()];case 8:return a.sent()||(T.loggerProvider.warn("Storage provider ".concat(T.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),T.storageProvider=new Pe),[2,T]}}))}))},qt=function(e,t){switch(void 0===e&&(e=Ut),void 0===t&&(t={}),e){case"localStorage":return new ht;case"sessionStorage":return new vt;case"none":return new Pe;default:return new Ae(o(o({},t),{expirationDays:t.expiration}))}},Ft=function(e){return"xhr"===e?new gt:"beacon"===e?new yt:new Ne},Mt=function(e){return u(void 0,void 0,void 0,(function(){var t,n,r,i,o,s,u;return a(this,(function(a){switch(a.label){case 0:return[4,(new Ae).isEnabled()];case 1:if(!a.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,a.label=2;case 2:return o<r.length?(s=r[o],[4,(u=new Ae({domain:"."+s})).set(i,1)]):[3,7];case 3:return a.sent(),[4,u.get(i)];case 4:return a.sent()?[4,u.remove(i)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},Vt=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},$t=function(){var e,t=Vt();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=zt(n[0]),i=zt(n[1]);return i?(e[r]=i,e):e}),{}):{}},zt=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Bt="dclid",Wt="fbclid",Kt="gbraid",Jt="gclid",Ht="ko_click_id",Yt="li_fat_id",Gt="msclkid",Qt="rtd_cid",Zt="ttclid",Xt="twclid",en="wbraid",tn={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},nn=function(){function e(){}return e.prototype.parse=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,o(o(o(o({},tn),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=$t();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=$t();return(e={})[Bt]=t[Bt],e[Wt]=t[Wt],e[Kt]=t[Kt],e[Jt]=t[Jt],e[Ht]=t[Ht],e[Yt]=t[Yt],e[Gt]=t[Gt],e[Qt]=t[Qt],e[Zt]=t[Zt],e[Xt]=t[Xt],e[en]=t[en],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"}(We||(We={})),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"}(Ke||(Ke={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(Je||(Je={}));var rn,on,sn=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},un=function(e){var t;void 0===e&&(e={});var n,r=Vt(),i=void 0,s=!1,c=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,p=void 0===f?"[Amplitude] Page Viewed":f,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},v=function(){return u(void 0,void 0,void 0,(function(){var e,t,n;return a(this,(function(r){switch(r.label){case 0:return e=h("undefined"!=typeof location&&location.href||""),n={event_type:p},t=[{}],[4,an()];case 1:return[2,(n.event_properties=o.apply(void 0,[o.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&&h(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===c||"function"==typeof c&&c()},y="undefined"!=typeof location?location.href:null,m=function(){return u(void 0,void 0,void 0,(function(){var e,n,r,o;return a(this,(function(s){switch(s.label){case 0:return e=location.href,n=ln(d,e,y||"")&&g(),y=e,n?(null==i||i.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return o=(r=t).track,[4,v()];case 2:o.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,o){return u(void 0,void 0,void 0,(function(){var u,c;return a(this,(function(a){switch(a.label){case 0:return t=o,n=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,r&&(r.addEventListener("popstate",b),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],u=r[2];e.apply(t,[i,o,u]),s&&m()}})),g()?(i.log("Tracking page view event"),c=(u=t).track,[4,v()]):[3,2];case 1:c.apply(u,[a.sent()]),a.label=2;case 2:return[2]}}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){var t;return a(this,(function(r){switch(r.label){case 0:return"attribution"===c&&cn(e)?(null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,v()]):[3,2];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=o(o({},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=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(this,(function(e){return r&&(r.removeEventListener("popstate",b),s=!1),[2]}))}))}};return w},an=function(){return u(void 0,void 0,void 0,(function(){var e;return a(this,(function(t){switch(t.label){case 0:return e=sn,[4,(new nn).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},cn=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[We.SET]||{},r=t[We.UNSET]||{},i=d(d([],l(Object.keys(n)),!1),l(Object.keys(r)),!1);return Object.keys(tn).every((function(e){return i.includes(e)}))}return!1},ln=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},dn=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 u(void 0,void 0,void 0,(function(){var i,o;return a(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=pn(e);t||r.track(Et,((n={})[Rt]=fn(e.id),n[Nt]=fn(e.name),n[Lt]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=pn(e);t||r.track(Et,((n={})[Rt]=fn(e.id),n[Nt]=fn(e.name),n[Lt]=o,n)),r.track(St,((i={})[Rt]=fn(e.id),i[Nt]=fn(e.name),i[Lt]=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 u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(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]}))}))}}},fn=function(e){if("string"==typeof e)return e},pn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},hn=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return u(void 0,void 0,void 0,(function(){var i,o;return a(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(Tt,((t={})[Pt]=s,t[At]=n.pathname,t[Ot]=e.id,t[xt]=e.text,t[Ct]=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 u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(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]}))}))}}},vn=!1,gn=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 u(void 0,void 0,void 0,(function(){return a(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 u(void 0,void 0,void 0,(function(){return a(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)})),t=[],[2]}))}))}}};function yn(e){var t,n;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var r=Object.keys(e);try{for(var i=c(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),yn(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 mn(e,t){var n,r,i,s;if(e){yn(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e));var u=e;if(u&&"autocapture"in u){if("boolean"==typeof u.autocapture&&(t.autocapture=u.autocapture),"object"==typeof u.autocapture&&null!==u.autocapture){var a=o({},u.autocapture);if(void 0===t.autocapture&&(t.autocapture=u.autocapture),"object"==typeof u.autocapture.elementInteractions&&null!==u.autocapture.elementInteractions&&(null===(i=u.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===i?void 0:i.length)){a.elementInteractions=o({},u.autocapture.elementInteractions);var l=a.elementInteractions,d=null!==(s=l.pageUrlAllowlist)&&void 0!==s?s:[],f=[];try{for(var p=c(u.autocapture.elementInteractions.pageUrlAllowlistRegex),h=p.next();!h.done;h=p.next()){var v=h.value;try{f.push(new RegExp(v))}catch(e){t.loggerProvider.warn("Invalid regex pattern: ".concat(v),e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}var g=d.concat(f);l.pageUrlAllowlist=g,delete l.pageUrlAllowlistRegex}"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}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"}(rn||(rn={})),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"}(on||(on={}));var bn=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,h,v,g,y,m,b,w,_,E;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case on.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 on.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!==(h=e.throttled_events)&&void 0!==h?h:[]}};case on.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case on.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.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case on.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?on.Success:429===e?on.RateLimit:413===e?on.PayloadTooLarge:408===e?on.Timeout:e>=400&&e<500?on.Invalid:e>=500?on.Failed:on.Unknown},e}(),wn="Remote config fetch rejected due to timeout after 5 seconds",_n="Unexpected error occurred",En=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 u(r,void 0,void 0,(function(){var n,r,i;return a(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 u(r,void 0,void 0,(function(){var r;return a(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 u(r,void 0,void 0,(function(){var t,n,r;return a(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 u(r,void 0,void 0,(function(){var n,r,i,s,u,l,d,f,p,h,v,g;return a(this,(function(a){switch(a.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:wn})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),a.label=1;case 1:a.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(r=c(this.configKeys),i=r.next();!i.done;i=r.next())s=i.value,n.append("config_keys",s)}catch(e){h={error:e}}finally{try{i&&!i.done&&(v=r.return)&&v.call(r)}finally{if(h)throw h.error}}return t&&n.set("session_id",String(t)),u={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,o(o({},u),{signal:e}))];case 2:if(null===(d=a.sent()))return[2,this.completeRequest({err:_n})];switch((new bn).buildStatus(d.status)){case on.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case on.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=a.sent(),p=f,e.aborted?[2,this.completeRequest({err:wn})]:[2,this.completeRequest({err:null!==(g=p.message)&&void 0!==g?g:_n})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return u(r,void 0,void 0,(function(){var n=this;return a(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 u(r,void 0,void 0,(function(){var t;return a(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===rn.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===rn.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}(),Sn=function(e){var t=e.localConfig,n=e.configKeys;return u(void 0,void 0,void 0,(function(){return a(this,(function(e){return[2,new En({localConfig:t,configKeys:n})]}))}))},Tn="[Amplitude] Element Clicked",In="[Amplitude] Element Tag",kn="[Amplitude] Element Text",Pn="[Amplitude] Page URL",An="https://app.amplitude.com",On={US:An,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};function xn(e){return"function"==typeof e}function Cn(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 Rn=Cn((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 Nn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ln=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=c(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 a=this.initialTeardown;if(xn(a))try{a()}catch(e){i=e instanceof Rn?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=c(f),h=p.next();!h.done;h=p.next()){var v=h.value;try{jn(v)}catch(e){i=null!=i?i:[],e instanceof Rn?i=d(d([],l(i)),l(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new Rn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)jn(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)&&Nn(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Nn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Un=Ln.EMPTY;function Dn(e){return e instanceof Ln||e&&"closed"in e&&xn(e.remove)&&xn(e.add)&&xn(e.unsubscribe)}function jn(e){xn(e)?e():e.unsubscribe()}var qn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Fn=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,d([e,t],l(n)))};function Mn(e){Fn((function(){throw e}))}function Vn(){}function $n(e){e()}var zn=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Dn(t)&&t.add(n)):n.destination=Yn,n}return n(t,e),t.create=function(e,t,n){return new Jn(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ln),Bn=Function.prototype.bind;function Wn(e,t){return Bn.call(e,t)}var Kn=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){Hn(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Hn(e)}else Hn(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Hn(e)}},e}(),Jn=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;xn(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&qn.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&Wn(t.next,o),error:t.error&&Wn(t.error,o),complete:t.complete&&Wn(t.complete,o)}):i=t;return s.destination=new Kn(i),s}return n(t,e),t}(zn);function Hn(e){Mn(e)}var Yn={closed:!0,next:Vn,error:function(e){throw e},complete:Vn},Gn="function"==typeof Symbol&&Symbol.observable||"@@observable";function Qn(e){return e}var Zn=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 zn||function(e){return e&&xn(e.next)&&xn(e.error)&&xn(e.complete)}(r)&&Dn(r)?e:new Jn(e,t,n);return $n((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=Xn(t))((function(t,r){var i=new Jn({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[Gn]=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?Qn: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=Xn(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 Xn(e){var t;return null!==(t=null!=e?e:qn.Promise)&&void 0!==t?t:Promise}function er(e){return xn(null==e?void 0:e.lift)}function tr(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 nr(e,t,n,r,i){return new rr(e,t,n,r,i)}var rr=function(e){function t(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 n(t,e),t.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))}},t}(zn);!function(e){function t(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}n(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new Ln;var n=this.getSubject();t.add(this.source.subscribe(nr(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=Ln.EMPTY)}return t},t.prototype.refCount=function(){return tr((function(e,t){var n=null;e._refCount++;var r=nr(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)}}(Zn);var ir,or={now:function(){return(or.delegate||performance).now()},delegate:void 0},sr={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new Ln((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=sr.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,d([],l(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,d([],l(e)))},delegate:void 0};new Zn((function(e){var t=ir||or,n=t.now(),r=0,i=function(){e.closed||(r=sr.requestAnimationFrame((function(o){r=0;var s=t.now();e.next({timestamp:ir?s:o,elapsed:s-n}),i()})))};return i(),function(){r&&sr.cancelAnimationFrame(r)}}));var ur=Cn((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),ar=function(e){function t(){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 n(t,e),t.prototype.lift=function(e){var t=new cr(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new ur},t.prototype.next=function(e){var t=this;$n((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=c(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}}}}))},t.prototype.error=function(e){var t=this;$n((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)}}))},t.prototype.complete=function(){var e=this;$n((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?Un:(this.currentObservers=null,o.push(e),new Ln((function(){t.currentObservers=null,Nn(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Zn;return e.source=this,e},t.create=function(e,t){return new cr(e,t)},t}(Zn),cr=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n(t,e),t.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)},t.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)},t.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)},t.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:Un},t}(ar);!function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(ar);var lr={now:function(){return(lr.delegate||Date).now()},delegate:void 0};!function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=lr);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}n(t,e),t.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)},t.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},t.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)}}}(ar),function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}n(t,e),t.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())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.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))}}(ar);var dr,fr=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(Ln),pr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,d([e,t],l(n)))},hr=function(e){return clearInterval(e)},vr=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n(t,e),t.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},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),pr(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&hr(t)},t.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))},t.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},t.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,Nn(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(fr),gr=1,yr={};function mr(e){return e in yr&&(delete yr[e],!0)}var br=function(e){var t=gr++;return yr[t]=!0,dr||(dr=Promise.resolve()),dr.then((function(){return mr(t)&&e()})),t},wr=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)||br).apply(void 0,d([],l(e)))},clearImmediate:function(e){return wr(e)},delegate:void 0},Er=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.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))))},t.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))},t}(vr),Sr=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=lr.now,e}(),Tr=function(e){function t(t,n){void 0===n&&(n=Sr.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return n(t,e),t.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}}},t}(Sr),Ir=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.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}},t}(Tr);new Ir(Er);var kr=new Tr(vr),Pr=kr,Ar=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.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)},t.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},t.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)},t}(vr),Or=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Tr);new Or(Ar);var xr=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.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=sr.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.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&&(sr.cancelAnimationFrame(n),t._scheduled=void 0)},t}(vr),Cr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.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}},t}(Tr);new Cr(xr),function(e){function t(t,n){void 0===t&&(t=Rr),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}n(t,e),t.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}},t.frameTimeFactor=10}(Tr);var Rr=function(e){function t(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 n(t,e),t.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,n,r);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return Ln.EMPTY},t.prototype.requestAsyncId=function(e,n,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,n){},t.prototype._execute=function(t,n){if(!0===this.active)return e.prototype._execute.call(this,t,n)},t.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},t}(vr),Nr=new Zn((function(e){return e.complete()}));function Lr(e){return e&&xn(e.schedule)}function Ur(e){return e[e.length-1]}function Dr(e){return Lr(Ur(e))?e.pop():void 0}var jr=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function qr(e){return xn(null==e?void 0:e.then)}function Fr(e){return xn(e[Gn])}function Mr(e){return Symbol.asyncIterator&&xn(null==e?void 0:e[Symbol.asyncIterator])}function Vr(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 $r,zr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Br(e){return xn(null==e?void 0:e[zr])}function Wr(e){return p(this,arguments,(function(){var t,n,r;return a(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,f(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,f(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,f(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 Kr(e){return xn(null==e?void 0:e.getReader)}function Jr(e){if(e instanceof Zn)return e;if(null!=e){if(Fr(e))return i=e,new Zn((function(e){var t=i[Gn]();if(xn(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(jr(e))return r=e,new Zn((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(qr(e))return n=e,new Zn((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Mn)}));if(Mr(e))return Hr(e);if(Br(e))return t=e,new Zn((function(e){var n,r;try{for(var i=c(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(Kr(e))return Hr(Wr(e))}var t,n,r,i;throw Vr(e)}function Hr(e){return new Zn((function(t){(function(e,t){var n,r,i,o;return u(this,void 0,void 0,(function(){var s,u;return a(this,(function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=h(e),a.label=1;case 1:return[4,n.next()];case 2:if((r=a.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=a.sent(),i={error:u},[3,11];case 6:return a.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:a.sent(),a.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 Yr(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 Gr(e,t){return void 0===t&&(t=0),tr((function(n,r){n.subscribe(nr(r,(function(n){return Yr(r,e,(function(){return r.next(n)}),t)}),(function(){return Yr(r,e,(function(){return r.complete()}),t)}),(function(n){return Yr(r,e,(function(){return r.error(n)}),t)})))}))}function Qr(e,t){return void 0===t&&(t=0),tr((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function Zr(e,t){if(!e)throw new Error("Iterable cannot be null");return new Zn((function(n){Yr(n,t,(function(){var r=e[Symbol.asyncIterator]();Yr(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function Xr(e,t){if(null!=e){if(Fr(e))return function(e,t){return Jr(e).pipe(Qr(t),Gr(t))}(e,t);if(jr(e))return function(e,t){return new Zn((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(qr(e))return function(e,t){return Jr(e).pipe(Qr(t),Gr(t))}(e,t);if(Mr(e))return Zr(e,t);if(Br(e))return function(e,t){return new Zn((function(n){var r;return Yr(n,t,(function(){r=e[zr](),Yr(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 xn(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(Kr(e))return function(e,t){return Zr(Wr(e),t)}(e,t)}throw Vr(e)}function ei(e,t){return t?Xr(e,t):Jr(e)}function ti(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}($r||($r={})),Cn((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),Cn((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Cn((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Cn((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var ni=Cn((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function ri(e){throw new ni(e)}function ii(e,t){return tr((function(n,r){var i=0;n.subscribe(nr(r,(function(n){r.next(e.call(t,n,i++))})))}))}var oi=Array.isArray;function si(e){return ii((function(t){return function(e,t){return oi(t)?e.apply(void 0,d([],l(t))):e(t)}(e,t)}))}function ui(e,t,n){return void 0===n&&(n=1/0),xn(t)?ui((function(n,r){return ii((function(e,i){return t(n,e,r,i)}))(Jr(e(n,r)))}),n):("number"==typeof t&&(n=t),tr((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?h(e):a.push(e)},h=function(e){o&&t.next(e),c++;var u=!1;Jr(n(e,l++)).subscribe(nr(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?Yr(t,s,(function(){return h(e)})):h(e)};a.length&&c<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(nr(t,p,(function(){d=!0,f()}))),function(){null==u||u()}}(t,r,e,n)})))}function ai(e){return void 0===e&&(e=1/0),ui(Qn,e)}function ci(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ai(1)(ei(e,Dr(e)))}var li=["addListener","removeListener"],di=["addEventListener","removeEventListener"],fi=["on","off"];function pi(e,t,n,r){if(xn(n)&&(r=n,n=void 0),r)return pi(e,t,n).pipe(si(r));var i=l(function(e){return xn(e.addEventListener)&&xn(e.removeEventListener)}(e)?di.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return xn(e.addListener)&&xn(e.removeListener)}(e)?li.map(hi(e,t)):function(e){return xn(e.on)&&xn(e.off)}(e)?fi.map(hi(e,t)):[],2),o=i[0],s=i[1];if(!o&&jr(e))return ui((function(e){return pi(e,t,n)}))(Jr(e));if(!o)throw new TypeError("Invalid event target");return new Zn((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 hi(e,t){return function(n){return function(r){return e[n](t,r)}}}function vi(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Pr);var r=-1;return null!=t&&(Lr(t)?n=t:r=t),new Zn((function(t){var i=ti(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 gi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Dr(e),r=function(e,t){return"number"==typeof Ur(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Jr(i[0]):ai(r)(ei(i,n)):Nr}new Zn(Vn);var yi=Array.isArray;function mi(e,t){return tr((function(n,r){var i=0;n.subscribe(nr(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function bi(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&yi(e[0])?e[0]:e).length?Jr(t[0]):new Zn(function(e){return function(t){for(var n=[],r=function(r){n.push(Jr(e[r]).subscribe(nr(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 wi(e){return e<=0?function(){return Nr}:tr((function(t,n){var r=0;t.subscribe(nr(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function _i(e,t){return t?function(n){return ci(t.pipe(wi(1),tr((function(e,t){e.subscribe(nr(t,Vn))}))),n.pipe(_i(e)))}:ui((function(t,n){return Jr(e(t,n)).pipe(wi(1),function(e){return ii((function(){return e}))}(t))}))}function Ei(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new ar}: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 tr((function(e,h){u++,l||c||d();var v=o=null!=o?o:n();h.add((function(){0!==--u||l||c||(r=Si(p,a))})),v.subscribe(h),!t&&u>0&&(t=new Jn({next:function(e){return v.next(e)},error:function(e){l=!0,d(),r=Si(f,i,e),v.error(e)},complete:function(){c=!0,d(),r=Si(f,s),v.complete()}}),Jr(e).subscribe(t))}))(e)}}function Si(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 Jn({next:function(){i.unsubscribe(),e()}});return Jr(t.apply(void 0,d([],l(n)))).subscribe(i)}}else e()}function Ti(e,t,n){void 0===t&&(t=kr);var r=vi(e,t);return function(e,t){return tr((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())},h=function(){d=null,f&&r.complete()},v=function(t){return d=Jr(e(t)).subscribe(nr(r,p,h))},g=function(){if(c){c=!1;var e=l;l=null,r.next(e),!f&&v(e)}};n.subscribe(nr(r,(function(e){c=!0,l=e,(!d||d.closed)&&(s?g():v(e))}),(function(){f=!0,(!(a&&c&&d)||d.closed)&&r.complete()})))}))}((function(){return r}),n)}var Ii=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],ki=["type"],Pi=["svg","path","g"],Ai=["password","hidden"];var Oi=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(null===i)n+=4;else{var o=xi(i);n+=o?Array.from(o).length:4}if(n>t)return e.slice(0,r)}return e}(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).map((function(e){return function(e){var t,n,r,i,o,s;if(null===e)return null;var u=String(e.tagName).toLowerCase(),a={tag:u},l=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);l.length&&(a.index=l.indexOf(e),a.indexOfType=l.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(s=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===s?void 0:s.toLowerCase();d&&(a.prevSib=String(d));var f=e.getAttribute("id");f&&(a.id=String(f));var p=Array.from(e.classList);p.length&&(a.classes=p);var h={},v=Array.from(e.attributes).filter((function(e){return!Ii.includes(e.name)})),g=!Ui(e);if(!Ai.includes(String(e.getAttribute("type")))&&!Pi.includes(u))try{for(var y=c(v),m=y.next();!m.done;m=y.next()){var b=m.value;g&&!ki.includes(b.name)||(h[b.name]=String(b.value).substring(0,128))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}return Object.keys(h).length&&(a.attrs=h),a}(e)})),1024),t):[]};function xi(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return xi(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=l(e,1)[0]})).map((function(e){var t=l(e,2),n=t[0],r=t[1];return"".concat(String(xi(n,!0)),": ").concat(String(xi(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var Ci=["input","select","textarea"],Ri=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},Ni=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,u=e.pageUrlAllowlist,a=e.shouldTrackEventResolver,c=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(!c)return!1;if(a)return a(r,i);if(!ji(window.location.href,u))return!1;var l=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}var d=Ri(i,r);if(n&&d)return!0;if(t){var f=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(!f)return!1}switch(c){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!d||"click"===r}}},Li=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},Ui=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!Ci.includes(i)&&!o},Di=function(e){var t="";return Ui(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=Di(e),t+=r.split(/(\s+)/).filter(Li).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},ji=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},qi=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}),{})},Fi=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}if(t){var r=t.textContent||"";return Li(r)?r:""}return Fi(n)},Mi=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:Mi(null==e?void 0:e.parentElement,t):null},Vi=function(e){var t,n,r;if(!e)return{};var i=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),o=((t={})[In]=i,t[kn]=Di(e),t[Pn]=window.location.href.split("?")[0],t);return qi(o)};var $i=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},zi=function(e,t,n){var r,i,o,s=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),u="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),c=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var i=r.replace(t,""),o=e.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(t,n),l=Fi(t),d=((r={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",r["[Amplitude] Element Class"]=t.getAttribute("class"),r["[Amplitude] Element Hierarchy"]=Oi(t),r[In]=s,r[kn]=Di(t),r["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),r["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),r["[Amplitude] Element Aria Label"]=a,r["[Amplitude] Element Attributes"]=c,r["[Amplitude] Element Parent Label"]=l,r[Pn]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return"a"===s&&"click"===e&&t instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=t.href),qi(d)},Bi=function(e,t,n,r,i){void 0===i&&(i=!1);var o={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i)if(Ri(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=zi(o.type,o.closestTrackedAncestor,r),o;var s=Mi(o.event.target,n);return s&&(o.closestTrackedAncestor=s,o.targetElementProperties=zi(o.type,s,r)),o}return o};var Wi=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){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}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?n.textContent:"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},Ki=function(e,t){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=Wi(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}}))},Ji=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?An:t,r=this;this.endpoint=An,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?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===An&&(this.endpoint=i);var a=null;window.addEventListener("message",(function(e){var n,r,i,c,l;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 d,f=null==e?void 0:e.data,p=null==f?void 0:f.action;if(p)if("id"in f)null===(c=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===c||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===p)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===p){var h=null==f?void 0:f.data;(d="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=d,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(d)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;a=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:Vi,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:Wi}),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"===p&&(null===(l=null==a?void 0:a.close)||void 0===l||l.call(a))}})),this.notify({action:"page-loaded"})},e}();function Hi(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,u=e.shouldTrackEvent,a=e.evaluateTriggers,d=o.clickObservable,f=d.pipe(tr((function(e,t){var n,r=!1;e.subscribe(nr(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),mi((function(e){var t=l(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=gi(f,d.pipe((t=s.debounceTime,void 0===n&&(n=kr),tr((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(nr(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"})))),h=d.pipe(function(e,t){void 0===t&&(t=kr);var n=vi(e,t);return _i((function(){return n}))}(0),mi($i),mi((function(e){return u("click",e.closestTrackedAncestor)})),ii((function(e){return a(e)})),(r=p,tr((function(e,t){var n=[];return e.subscribe(nr(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Jr(r).subscribe(nr(t,(function(){var e=n;n=[],t.next(e)}),Vn)),function(){n=null}}))));return h.subscribe((function(e){var t,n,r=(e.length,Tn);try{for(var o=c(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 Yi(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,c=n.navigateObservable,f=u.pipe(mi((function(e){return!o("click",e.closestTrackedAncestor)})),ii((function(e){var t=Mi(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),mi($i),mi((function(e){return s("click",e.closestTrackedAncestor)}))),p=[a];c&&p.push(c);var h,v,g=gi.apply(void 0,d([],l(p),!1)),y=f.pipe((h=function(e){return g.pipe(wi(1),function(e,t){var n=ti(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?ri: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 tr((function(e,t){var n,o,u=null,c=0,d=function(e){o=Yr(t,a,(function(){try{n.unsubscribe(),Jr(s({meta:l,lastValue:u,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(nr(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 Nr}}),ii((function(){return e})))},tr((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(nr(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;Jr(h(e,s)).subscribe(n=nr(t,(function(n){return t.next(v?v(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return y.subscribe((function(e){null==t||t.track(Tn,i("click",e.closestTrackedAncestor))}))}var Gi,Qi=function(){return new Zn((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()}}))},Zi=function(e){return void 0===e&&(e="click"),pi(document,e,{capture:!0})},Xi={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},eo=function(e){var t,n,r,i,o=Object.values(Xi).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return o;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var a=u.value;try{try{for(var l=(r=void 0,c(a.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,p=Xi[f.event_type];p&&o[p].add(a.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==a?void 0:a.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},to=function(e){var t,n,r,i,o=new Map;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var a=u.value;try{for(var l=(r=void 0,c(a.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var p=f.match.eventId,h=o.get(p);h||(h=[],o.set(p,h)),h.push(a)}}}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},no=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return Xi[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)}))}))}))},ro=function(){function e(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n}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=c(e),a=u.next();!a.done;a=u.next()){var l=a.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),p=f.next();!p.done;p=f.next()){var h=p.value;s.add(h)}}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{a&&!a.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(s)}(no(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var u=s.value;Ki(u.actions,e)}}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"}(Gi||(Gi={}));var io=function(e){var t,n,r,i,s,f,p;void 0===e&&(e={});var h=e.dataAttributePrefix,v=void 0===h?Ue:h,g=e.visualTaggingOptions,y=void 0===g?{enabled:!0,messenger:new Ji}:g;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:Le,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:De,e.debounceTime=null!==(r=e.debounceTime)&&void 0!==r?r:0;var m="@amplitude/plugin-autocapture-browser",b=[],w=eo(Object.values(null!==(s=null===(i=e.pageActions)||void 0===i?void 0:i.labeledEvents)&&void 0!==s?s:{})),_=to(null!==(p=null===(f=e.pageActions)||void 0===f?void 0:f.triggers)&&void 0!==p?p:[]),E=function(e,t,n){return new ro(e,t,n)}(w,_,e);return{name:m,type:"enrichment",setup:function(t,n){return u(void 0,void 0,void 0,(function(){var r,i,s,c,f,p,h,g,S,T;return a(this,(function(I){return"undefined"==typeof document||(t.fetchRemoteConfig&&Sn({localConfig:t,configKeys:["analyticsSDK.pageActions"]}).then((function(n){return u(void 0,void 0,void 0,(function(){var r,i;return a(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=o(o({},e.pageActions),t),w=eo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),_=to(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),E.update(w,_,e))}(s.sent()),[3,3];case 2:return r=s.sent(),null===(i=null==t?void 0:t.loggerProvider)||void 0===i||i.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=Ni(e,e.cssSelectorAllowlist),i=Ni(e,e.actionClickAllowlist),s=function(){var t,n,r=Zi().pipe(ii((function(t){return Bi(t,"click",e.cssSelectorAllowlist,v)})),Ei()),i=pi(document,"change",{capture:!0}).pipe(ii((function(t){return Bi(t,"change",e.cssSelectorAllowlist,v)})),Ei());window.navigation&&(n=pi(window.navigation,"navigate").pipe(ii((function(t){return Bi(t,"navigate",e.cssSelectorAllowlist,v)})),Ei()));var o=Qi().pipe(ii((function(t){return Bi(t,"mutation",e.cssSelectorAllowlist,v)})),Ei());return(t={})[Gi.ClickObservable]=r,t[Gi.ChangeObservable]=i,t[Gi.NavigateObservable]=n,t[Gi.MutationObservable]=o,t}(),c=Hi({allObservables:s,options:e,amplitude:n,shouldTrackEvent:r,evaluateTriggers:E.evaluate.bind(E)}),b.push(c),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(mi($i),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:s,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return zi.apply(void 0,d(d([],l(e),!1),[v],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:E.evaluate.bind(E)}),b.push(f),p=Yi({allObservables:s,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return zi.apply(void 0,d(d([],l(e),!1),[v],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:i}),b.push(p),null===(S=null==t?void 0:t.loggerProvider)||void 0===S||S.log("".concat(m," has been successfully added.")),window.opener&&y.enabled&&(h=e.cssSelectorAllowlist,g=e.actionClickAllowlist,null===(T=y.messenger)||void 0===T||T.setup(o(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:On[t.serverZone]}),{isElementSelectable:Ni(e,d(d([],l(h),!1),l(g),!1)),cssSelectorAllowlist:h,actionClickAllowlist:g})))),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){var e,t,n,r;return a(this,(function(i){try{for(e=c(b),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]}))}))}}};var oo,so=function(e){var t,n,r,i,s;void 0===e&&(e={});var f="@amplitude/plugin-frustration-browser",p=[],h=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:qe,v=null!==(i=null===(r=e.deadClicks)||void 0===r?void 0:r.cssSelectorAllowlist)&&void 0!==i?i:je,g=null!==(s=e.dataAttributePrefix)&&void 0!==s?s:Ue,y=d([],l(new Set(d(d([],l(h),!1),l(v),!1))),!1);return{name:f,type:"enrichment",setup:function(t,n){return u(void 0,void 0,void 0,(function(){var r,i,s,u,c,m;return a(this,(function(a){return"undefined"==typeof document||(r=Ni(e,h),i=Ni(e,v),s=function(){var e,t,n=Zi("pointerdown").pipe(ii((function(e){return Bi(e,"click",y,g,!0)})),Ei());window.navigation&&(t=pi(window.navigation,"navigate").pipe(ii((function(e){return Bi(e,"navigate",y,g)})),Ei()));var r=Qi().pipe(ii((function(e){return Bi(e,"mutation",y,g)})),Ei());return(e={})[Gi.ClickObservable]=n,e[Gi.ChangeObservable]=new Zn,e[Gi.NavigateObservable]=t,e[Gi.MutationObservable]=r,e}(),u=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackRageClick,i=n.clickObservable,s=[];return i.pipe(mi($i),mi((function(e){return r("click",e.closestTrackedAncestor)})),ii((function(e){var t=e.timestamp;s.length>0&&s[s.length-1].closestTrackedAncestor!==e.closestTrackedAncestor&&s.splice(0,s.length);for(var n=0;n<s.length&&!(t-s[n].timestamp<1e3);n++);if(s.splice(0,n),s.push(e),s.length<4)return null;var r=s[0],i=s[s.length-1],u=o({"[Amplitude] Begin Time":new Date(r.timestamp).toISOString(),"[Amplitude] End Time":new Date(i.timestamp).toISOString(),"[Amplitude] Duration":i.timestamp-r.timestamp,"[Amplitude] Clicks":s.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":s.length},r.targetElementProperties);return s.splice(0,s.length),{rageClickEvent:u,time:r.timestamp}})),mi((function(e){return null!==e}))).subscribe((function(e){null!==e&&t.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})}))}({allObservables:s,amplitude:n,shouldTrackRageClick:r}),p.push(u),c=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,s=n.clickObservable,u=n.mutationObservable,a=n.navigateObservable,c=s.pipe(mi($i),mi((function(e){return i("click",e.closestTrackedAncestor)}))),f=[u];a&&f.push(a);var p=gi.apply(void 0,d([],l(f),!1));return c.pipe(ui((function(e){var t;return bi(new Zn((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),p.pipe(wi(1),ii((function(){return null})))).pipe(mi((function(e){return null!==e})))})),Ti(3e3)).subscribe((function(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}))}({amplitude:n,allObservables:s,getEventProperties:function(e,t){return zi(e,t,g)},shouldTrackDeadClick:i}),p.push(c),null===(m=null==t?void 0:t.loggerProvider)||void 0===m||m.log("".concat(f," has been successfully added."))),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){var e,t,n,r;return a(this,(function(i){try{for(e=c(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]}))}))}}},uo="[Amplitude] Network Request",ao="500-599";function co(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function lo(e,t){var n,r,i=t.split(",");try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var u=l(s.value.split("-").map(Number),2),a=u[0],d=u[1];if(e===a&&void 0===d)return!0;if(e>=a&&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 fo(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,t){var n;void 0===t&&(t={});var r=fo(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(co(o,"*.amplitude.com")||co(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return co(o,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!lo(e.status,ao))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find((function(t){return i=function(e,t,n){if(!e.hosts||e.hosts.find((function(e){return co(t,e)})))return!((n||0===n)&&!lo(n,e.statusCodeRange||ao))}(t,o,e.status),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===uo})))return!0}catch(e){}return!1}(o,e.requestWrapper)}!function(e){e.NetworkObservable="networkObservable"}(oo||(oo={}));var ho=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],i=function(){var e,n=new Zn((function(e){var n=new He((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return Ge.subscribe(n,t),function(){Ge.unsubscribe(n)}}));return(e={})[oo.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(o,s){return u(void 0,void 0,void 0,(function(){var u,c;return a(this,(function(a){return"undefined"==typeof document||(u=i(),c=function(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude;return t.networkObservable.pipe(mi((function(e){return po(e.event,n)}))).subscribe((function(e){var t,n,i,o=e.event,s=fo(o.url);if(s){var u=null===(n=o.responseWrapper)||void 0===n?void 0:n.bodySize,a=null===(i=o.requestWrapper)||void 0===i?void 0:i.bodySize,c=((t={})["[Amplitude] URL"]=s.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=s.query,t["[Amplitude] URL Fragment"]=s.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"]=a,t["[Amplitude] Response Body Size"]=u,t["[Amplitude] Request Type"]=o.type,t);null==r||r.track(uo,c)}}))}({allObservables:u,networkTrackingOptions:e,amplitude:s}),r.push(c),null==(t=null==o?void 0:o.loggerProvider)||t.log("".concat(n," has been successfully added."))),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){var e,t,n,i;return a(this,(function(o){try{for(e=c(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 vo=-1;const go=e=>{addEventListener("pageshow",(t=>{t.persisted&&(vo=t.timeStamp,e(t))}),!0)},yo=(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()))))},bo=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},wo=()=>{const e=bo();return e?.activationStart??0},_o=(e,t=-1)=>{const n=bo();let r="navigate";return vo>=0?r="back-forward-cache":n&&(document.prerendering||wo()>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}},Eo=new WeakMap;function So(e,t){return Eo.get(e)||Eo.set(e,new t),Eo.get(e)}class To{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 Io=(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 Po=-1;const Ao=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Oo=e=>{"hidden"===document.visibilityState&&Po>-1&&(Po="visibilitychange"===e.type?e.timeStamp:0,Co())},xo=()=>{addEventListener("visibilitychange",Oo,!0),addEventListener("prerenderingchange",Oo,!0)},Co=()=>{removeEventListener("visibilitychange",Oo,!0),removeEventListener("prerenderingchange",Oo,!0)},Ro=()=>{if(Po<0){const e=wo(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;Po=t??Ao(),xo(),go((()=>{setTimeout((()=>{Po=Ao(),xo()}))}))}return{get firstHiddenTime(){return Po}}},No=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},Lo=[1800,3e3],Uo=(e,t={})=>{No((()=>{const n=Ro();let r,i=_o("FCP");const o=Io("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-wo(),0),i.entries.push(t),r(!0)))}));o&&(r=yo(e,i,Lo,t.reportAllChanges),go((n=>{i=_o("FCP"),r=yo(e,i,Lo,t.reportAllChanges),mo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},Do=[.1,.25];let jo=0,qo=1/0,Fo=0;const Mo=e=>{for(const t of e)t.interactionId&&(qo=Math.min(qo,t.interactionId),Fo=Math.max(Fo,t.interactionId),jo=Fo?(Fo-qo)/7+1:0)};let Vo;const $o=()=>Vo?jo:performance.interactionCount??0;let zo=0;class Bo{u=[];l=new Map;m;p;v(){zo=$o(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor(($o()-zo)/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 Wo=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(t(e=ko(e)),document.addEventListener("visibilitychange",e,{once:!0}))},Ko=[200,500],Jo=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&No((()=>{"interactionCount"in performance||Vo||(Vo=Io("event",Mo,{type:"event",buffered:!0,durationThreshold:0}));let n,r=_o("INP");const i=So(t,Bo),o=e=>{Wo((()=>{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=Io("event",o,{durationThreshold:t.durationThreshold??40});n=yo(e,r,Ko,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),go((()=>{i.v(),r=_o("INP"),n=yo(e,r,Ko,t.reportAllChanges)})))}))};class Ho{m;h(e){this.m?.(e)}}const Yo=[2500,4e3],Go=[800,1800],Qo=e=>{document.prerendering?No((()=>Qo(e))):"complete"!==document.readyState?addEventListener("load",(()=>Qo(e)),!0):setTimeout(e)};function Zo(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Xo(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Zo(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 u(void 0,void 0,void 0,(function(){var o,s,u;return a(this,(function(a){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),u={"[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={})=>{No((()=>{const n=Ro();let r,i=_o("LCP");const o=So(t,Ho),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-wo(),0),i.entries=[t],r())},u=Io("largest-contentful-paint",s);if(u){r=yo(e,i,Yo,t.reportAllChanges);const n=ko((()=>{s(u.takeRecords()),u.disconnect(),r(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>Wo(n)),{capture:!0,once:!0});go((n=>{i=_o("LCP"),r=yo(e,i,Yo,t.reportAllChanges),mo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((function(e){u["[Amplitude] LCP"]=Xo(e)})),Uo((function(e){u["[Amplitude] FCP"]=Xo(e)})),Jo((function(e){u["[Amplitude] INP"]=Xo(e)})),((e,t={})=>{Uo(ko((()=>{let n,r=_o("CLS",0);const i=So(t,To),o=e=>{for(const t of e)i.h(t);i.i>r.value&&(r.value=i.i,r.entries=i.o,n())},s=Io("layout-shift",o);s&&(n=yo(e,r,Do,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),go((()=>{i.i=0,r=_o("CLS",0),n=yo(e,r,Do,t.reportAllChanges),mo((()=>n()))})),setTimeout(n))})))})((function(e){u["[Amplitude] CLS"]=Xo(e)})),((e,t={})=>{let n=_o("TTFB"),r=yo(e,n,Go,t.reportAllChanges);Qo((()=>{const i=bo();i&&(n.value=Math.max(i.responseStart-wo(),0),n.entries=[i],r(!0),go((()=>{n=_o("TTFB",0),r=yo(e,n,Go,t.reportAllChanges),r(!0)})))}))})((function(e){u["[Amplitude] TTFB"]=Xo(e)})),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",u),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]}))}))}}},ts=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ns=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,u=s(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=s(a,["referrer","referring_domain"]);if(rs(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=ts(o||"")!==ts(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},rs=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,i,s,u,a;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(s=t.apiKey,void 0===(u="MKTG")&&(u=""),void 0===a&&(a=10),[g,u,s.substring(0,a)].filter(Boolean).join("_")),this.currentCampaign=C,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 u(this,void 0,void 0,(function(){var e,t;return a(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||me(this.sessionTimeout,this.lastEventTime),ns(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 u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new Qe).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,s=(t=this.currentCampaign,n=this.options,r=o(o({},C),t),i=Object.entries(r).reduce((function(e,t){var r,i=l(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 L),z(i));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),os=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),B(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i;return u(this,void 0,void 0,(function(){var s,u,c,l,d,f,p,h=this;return a(this,(function(a){switch(a.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,jt(t.apiKey,t,this)]);case 1:return(s=a.sent()).fetchRemoteConfig?(this.remoteConfigClient=new J(s.apiKey,s.loggerProvider,s.serverZone),[4,new Promise((function(e){var t;null===(t=h.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&&mn(t,s),e()}))}))]):[3,3];case 2:a.sent(),a.label=3;case 3:return[4,e.prototype._init.call(this,s)];case 4:return a.sent(),this.logBrowserOptions(s),Xe(this.config.defaultTracking)?(u=function(e){return Xe(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?o({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new is(u,this.config),[4,this.webAttribution.init()]):[3,6];case 5:a.sent(),a.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!==(i=null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:f)&&void 0!==r?r:this.config.sessionId)&&void 0!==i?i:Date.now()),(p=ge(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,8]:[4,this.add(gn()).promise];case 7:a.sent(),a.label=8;case 8:return[4,this.add(new ie).promise];case 9:return a.sent(),[4,this.add(new ft).promise];case 10:return a.sent(),[4,this.add(new ye).promise];case 11:return a.sent(),function(e){vn||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."),vn=!0)}(this.config),v=this.config.defaultTracking,Ze(v,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(hn()).promise]):[3,13];case 12:a.sent(),a.label=13;case 13:return function(e){return Ze(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(dn()).promise]):[3,15];case 14:a.sent(),a.label=15;case 15:return et(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(un(at(this.config))).promise]):[3,17];case 16:a.sent(),a.label=17;case 17:return rt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(io(ot(this.config))).promise]):[3,19];case 18:a.sent(),a.label=19;case 19:return it(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(so(st(this.config))).promise]):[3,21];case 20:a.sent(),a.label=21;case 21:return nt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ho(ut(this.config))).promise]):[3,23];case 22:a.sent(),a.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:a.sent(),a.label=25;case 25:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 26:return a.sent(),p.eventBridge.setEventReceiver((function(e){h.track(e.eventType,e.eventProperties)})),[2]}var v}))}))},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.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){ge(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.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){ge(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(V()),this.setUserId(void 0)},t.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}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),B(Promise.resolve());if(e===this.config.sessionId)return B(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,tt(this.config.defaultTracking)&&(r&&i&&n.push(this.track(kt,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 tt(this.config.defaultTracking)&&n.push(this.track(It,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,B(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ft(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(lt(t)){var r=t._q;t._q=[],t=ct(new L,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)},t.prototype.groupIdentify=function(t,n,r,i){if(lt(r)){var o=r._q;r._q=[],r=ct(new L,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(lt(t)){var r=t._q;t._q=[],t=ct(new Q,r)}return e.prototype.revenue.call(this,t,n)},t.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},t.prototype.process=function(t){return u(this,void 0,void 0,(function(){var n,r,o;return a(this,(function(s){return n=Date.now(),r=me(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===It||t.event_type===kt||t.session_id&&t.session_id!==this.getSessionId()||(r||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),t.event_type===i.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=o(o({},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)}},t}(W),ss=function(){var e=new os;return{init:ke(e.init.bind(e),"init",Se(e),Ie(e,["config"])),add:ke(e.add.bind(e),"add",Se(e),Ie(e,["config.apiKey","timeline.plugins"])),remove:ke(e.remove.bind(e),"remove",Se(e),Ie(e,["config.apiKey","timeline.plugins"])),track:ke(e.track.bind(e),"track",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),logEvent:ke(e.logEvent.bind(e),"logEvent",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),identify:ke(e.identify.bind(e),"identify",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ke(e.groupIdentify.bind(e),"groupIdentify",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),setGroup:ke(e.setGroup.bind(e),"setGroup",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),revenue:ke(e.revenue.bind(e),"revenue",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),flush:ke(e.flush.bind(e),"flush",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),getUserId:ke(e.getUserId.bind(e),"getUserId",Se(e),Ie(e,["config","config.userId"])),setUserId:ke(e.setUserId.bind(e),"setUserId",Se(e),Ie(e,["config","config.userId"])),getDeviceId:ke(e.getDeviceId.bind(e),"getDeviceId",Se(e),Ie(e,["config","config.deviceId"])),setDeviceId:ke(e.setDeviceId.bind(e),"setDeviceId",Se(e),Ie(e,["config","config.deviceId"])),reset:ke(e.reset.bind(e),"reset",Se(e),Ie(e,["config","config.userId","config.deviceId"])),getSessionId:ke(e.getSessionId.bind(e),"getSessionId",Se(e),Ie(e,["config"])),setSessionId:ke(e.setSessionId.bind(e),"setSessionId",Se(e),Ie(e,["config"])),extendSession:ke(e.extendSession.bind(e),"extendSession",Se(e),Ie(e,["config"])),setOptOut:ke(e.setOptOut.bind(e),"setOptOut",Se(e),Ie(e,["config"])),setTransport:ke(e.setTransport.bind(e),"setTransport",Se(e),Ie(e,["config"])),getIdentity:ke(e.getIdentity.bind(e),"getIdentity",Se(e),Ie(e,["config"])),getOptOut:ke(e.getOptOut.bind(e),"getOptOut",Se(e),Ie(e,["config"]))}},us=ss(),as=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return H},get LogLevel(){return j},get ServerZone(){return fe},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Le,DEFAULT_DATA_ATTRIBUTE_PREFIX:Ue,DEFAULT_ACTION_CLICK_ALLOWLIST:De}),cs=us.add,ls=us.extendSession,ds=us.flush,fs=us.getDeviceId,ps=us.getSessionId,hs=us.getUserId,vs=us.groupIdentify,gs=us.identify,ys=us.init,ms=us.logEvent,bs=us.remove,ws=us.reset,_s=us.revenue,Es=us.setDeviceId,Ss=us.setGroup,Ts=us.setOptOut,Is=us.setSessionId,ks=us.setTransport,Ps=us.setUserId,As=us.track;e.AmplitudeBrowser=os,e.Identify=L,e.Revenue=Q,e.Types=as,e.add=cs,e.createInstance=ss,e.extendSession=ls,e.flush=ds,e.getDeviceId=fs,e.getSessionId=ps,e.getUserId=hs,e.groupIdentify=vs,e.identify=gs,e.init=ys,e.logEvent=ms,e.remove=bs,e.reset=ws,e.revenue=_s,e.runQueuedFunctions=function(e,t){ct(e,t)},e.setDeviceId=Es,e.setGroup=Ss,e.setOptOut=Ts,e.setSessionId=Is,e.setTransport=ks,e.setUserId=Ps,e.track=As,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).amplitude={})}(this,(function(e){"use strict";var t=function(e,n){return t=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])},t(e,n)};function n(e,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=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=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},o.apply(this,arguments)};function s(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 u(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 a(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 c(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 l(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 d(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 f(e){return this instanceof f?(this.v=e,this):new f(e)}function p(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 f?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 h(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=c(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"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var v,g="AMP",y="".concat(g,"_unsent"),m="$default_instance",b="https://api2.amplitude.com/2/httpapi",w="dclid",_="fbclid",E="gbraid",S="gclid",T="ko_click_id",I="li_fat_id",k="msclkid",P="rtd_cid",A="ttclid",O="twclid",x="wbraid",C={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(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&&R(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 R(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},L=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},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||N(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 U,D=[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"}(U||(U={}));var q,j=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=U.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},M=d([],l(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,d([],l(r.entries()),!1).map((function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(M[r]):M[r]})).join("")},V=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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){var r,i;return a(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 u(this,void 0,void 0,(function(){var t,n,r,i,s,u,d,f,p,h,v,g,y,m,b,w,_,E,S,T;return a(this,(function(a){switch(a.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),s=this.plugins.filter((function(e){return"before"===e.type})),a.label=1;case 1:a.trys.push([1,6,7,8]),u=c(s),d=u.next(),a.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(y=a.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),i({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))),a.label=4;case 4:return d=u.next(),[3,2];case 5:return[3,8];case 6:return f=a.sent(),_={error:f},[3,8];case 7:try{d&&!d.done&&(E=u.return)&&E.call(u)}finally{if(_)throw _.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),a.label=9;case 9:a.trys.push([9,14,15,16]),h=c(p),v=h.next(),a.label=10;case 10:return v.done?[3,13]:(g=v.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(y=a.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),i({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))),a.label=12;case 12:return v=h.next(),[3,10];case 13:return[3,16];case 14:return m=a.sent(),S={error:m},[3,16];case 15:try{v&&!v.done&&(T=h.return)&&T.call(h)}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=o({},n);return e.execute(t).catch((function(e){return j(t,0,String(e))}))})),Promise.all(w).then((function(e){var t=l(e,1)[0]||j(n,100,"Event not tracked, no destination plugins on the instance");i(t)})),[2]}}))}))},e.prototype.flush=function(){return u(this,void 0,void 0,(function(){var e,t,n,r=this;return a(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 o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},B=function(e){return{promise:e||Promise.resolve()}},W=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 V(this),this.name=e}return e.prototype._init=function(e){return u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,l;return a(this,(function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),n=c(t),r=n.next(),a.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 a.sent(),[3,6];case 4:return[4,o];case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return s=a.sent(),u={error:s},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(u)throw u.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:a.sent(),a.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return B(this.dispatch(r))},e.prototype.identify=function(e,t){var n=z(e,t);return B(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var s=function(e,t,n,r){var s;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(s={},s[e]=t,s)})}(e,t,n,r);return B(this.dispatch(s))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,s=new L;return s.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:s.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return B(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return B(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),B())},e.prototype._addPlugin=function(e){return B(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)),B())},e.prototype._removePlugin=function(e){return B(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(j(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return u(this,void 0,void 0,(function(){var t=this;return a(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 n={};return Object.keys(e).forEach((function(t){Object.values(r).includes(t)||(n[t]=e[t])})),D.forEach((function(n){if(Object.keys(e).includes(n)){var i=e[n];switch(n){case r.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case r.UNSET:Object.keys(i).forEach((function(e){delete t[e]}));break;case r.SET:Object.assign(t,i)}}})),Object.assign(t,n),t},e.prototype.process=function(e){return u(this,void 0,void 0,(function(){var t,n,r,o;return a(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,j(e,0,"Event skipped due to optOut config")]:(e.event_type===i.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(),r=String(n),this.config.loggerProvider.error(r),[2,o=j(e,0,r)];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 B(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}(),H=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 u(this,void 0,void 0,(function(){var e,t=this;return a(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 u(this,void 0,void 0,(function(){var t,n,r,i=this;return a(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 u(this,void 0,void 0,(function(){var n,r;return a(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),u(this,void 0,void 0,(function(){var n,r,i,o,s,u,c=this;return a(this,(function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,u,l,d;return a(this,(function(a){switch(a.label){case 0:i=new AbortController,s=setTimeout((function(){return i.abort()}),t),a.label=1;case 1:return a.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:i.signal})];case 2:return(u=a.sent()).ok?[3,4]:[4,u.text()];case 3:return l=a.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(u.status,": ").concat(l)),[3,6];case 4:return[4,u.json()];case 5:return[2,{value:{remoteConfig:a.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=a.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:a.sent(),a.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(u=l.sent()))return[2,u.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"}(q||(q={}));var J,Y="Amplitude Logger ",G=function(){function e(){this.logLevel=q.None}return e.prototype.disable=function(){this.logLevel=q.None},e.prototype.enable=function(e){void 0===e&&(e=q.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<q.Verbose||console.log("".concat(Y,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<q.Warn||console.warn("".concat(Y,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<q.Error||console.error("".concat(Y,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<q.Debug||console.log("".concat(Y,"[Debug]: ").concat(e.join(" ")))},e}(),Q=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 R(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[J.REVENUE_PRODUCT_ID]=this.productId,e[J.REVENUE_QUANTITY]=this.quantity,e[J.REVENUE_PRICE]=this.price,e[J.REVENUE_TYPE]=this.revenueType,e[J.REVENUE_CURRENCY]=this.currency,e[J.REVENUE]=this.revenue,e[J.RECEIPT]=this.receipt,e[J.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"}(J||(J={}));var Z=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:m,logLevel:q.Warn,loggerProvider:new G,offline:!1,optOut:!1,serverUrl:b,serverZone:"US",useBatch:!1}},X=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=te(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}(),ee=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":b},te=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:ee(r,n)}},ne=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function re(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var ie=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 u(this,void 0,void 0,(function(){var n,r=this;return a(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(y,"_").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),u(this,void 0,void 0,(function(){var t,n,r=this;return a(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,s=this.config.flushQueueSize,c=Math.max(s,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 u(r,void 0,void 0,(function(){return a(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,s,c}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),u(this,void 0,void 0,(function(){var n,r,i,o,u;return a(this,(function(a){switch(a.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,s(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new ne,a.label=1;case 1:return a.trys.push([1,3,,4]),r=te(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(i=a.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(re(i))):this.fulfillRequest(e,i.statusCode,i.status),[2]);case 3:return o=a.sent(),u=(c=o)instanceof Error?c.message:String(c),this.config.loggerProvider.error(u),this.handleResponse({status:U.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 U.Success:this.handleSuccessResponse(e,t);break;case U.Invalid:this.handleInvalidResponse(e,t);break;case U.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case U.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=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(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(re(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(re(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(re(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(j(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}(),oe=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:se(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),se=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ue=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}(),ae=function(){return ae=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},ae.apply(this,arguments)};function ce(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 le(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 de=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=ce(["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(!de(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){de(e[n],t[n])||(d=!1)})),d}for(var f=0;f<e.length;f++)if(!de(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 fe,pe=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ae({},this.identity.userProperties),n=ae(ae({},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=ce(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=le(l.value,2),f=d[0],p=d[1];switch(f){case"$set":try{for(var h=(i=void 0,ce(Object.entries(p))),v=h.next();!v.done;v=h.next()){var g=le(v.value,2),y=g[0],m=g[1];a[y]=m}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=h.return)&&o.call(h)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,ce(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 ae({},this.identity)},e.prototype.setIdentity=function(e){var t=ae({},this.identity);this.identity=ae({},e),de(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,ve=function(){function e(){this.identityStore=new pe,this.eventBridge=new ue,this.applicationContextProvider=new oe}return e.getInstance=function(t){return he.analyticsConnectorInstances||(he.analyticsConnectorInstances={}),he.analyticsConnectorInstances[t]||(he.analyticsConnectorInstances[t]=new e),he.analyticsConnectorInstances[t]},e}(),ge=function(e){return void 0===e&&(e=m),ve.getInstance(e)},ye=function(){function e(){this.name="identity",this.type="before",this.identityStore=ge().identityStore}return e.prototype.execute=function(e){return u(this,void 0,void 0,(function(){var t;return a(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return u(this,void 0,void 0,(function(){return a(this,(function(t){return e.instanceName&&(this.identityStore=ge(e.instanceName).identityStore),[2]}))}))},e}(),me=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},be=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[g,t,e.substring(0,n)].filter(Boolean).join("_")},we=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=Ee(n[0]),i=Ee(n[1]);return i?(e[r]=i,e):e}),{}):{}},Ee=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Se=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},Te=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(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},Ie=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Te(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}},ke=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<q.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(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return u(this,void 0,void 0,(function(){return a(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return u(this,void 0,void 0,(function(){var t;return a(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 u(this,void 0,void 0,(function(){return a(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return u(this,void 0,void 0,(function(){return a(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Ae=function(){function e(e){this.options=o({},e)}return e.prototype.isEnabled=function(){return u(this,void 0,void 0,(function(){var t,n;return a(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 u(this,void 0,void 0,(function(){var n,r;return a(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=Oe(n))&&void 0!==t?t:xe(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 u(this,void 0,void 0,(function(){var r,i,o;return a(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 u(this,void 0,void 0,(function(){var r,i,o,s,u,c,l;return a(this,(function(a){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),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(c=F())&&(c.document.cookie=u)}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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(this,(function(e){return[2]}))}))},e}(),Oe=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},xe=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},Ce=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return u(this,void 0,void 0,(function(){var t,n,r;return a(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 u(this,void 0,void 0,(function(){var t;return a(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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(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 u(this,void 0,void 0,(function(){return a(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),Re=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,h,v,g,y,m,b,w,_,E;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case U.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 U.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!==(h=e.throttled_events)&&void 0!==h?h:[]}};case U.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case U.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.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case U.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?U.Success:429===e?U.RateLimit:413===e?U.PayloadTooLarge:408===e?U.Timeout:e>=400&&e<500?U.Invalid:e>=500?U.Failed:U.Unknown},e}(),Ne=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return u(this,void 0,void 0,(function(){var n,r,i;return a(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]}}))}))},t}(Re);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(fe||(fe={}));var Le=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Ue="data-amp-track-",De=["div","span","h1","h2","h3","h4","h5","h6"],qe=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),je=["*"],Fe=function(){function e(e){this.request=e}return Object.defineProperty(e.prototype,"headers",{get:function(){if(this._headers)return this._headers;var e=this.request.headers;if(Array.isArray(e)){var t=e;this._headers=t.reduce((function(e,t){var n=l(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}else if(e instanceof Headers){var n={};e.forEach((function(e,t){n[t]=e})),this._headers=n}else"object"==typeof e&&(this._headers=e);return this._headers},enumerable:!1,configurable:!0}),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=$e(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}(),Me=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return Object.defineProperty(e.prototype,"headers",{get:function(){return this.requestHeaders},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodySize",{get:function(){return $e(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}();function $e(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 a=e,d=0,f=0;try{for(var p=c(a.entries()),h=p.next();!h.done;h=p.next()){var v=l(h.value,2),g=v[0],y=v[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{h&&!h.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 Ve=function(){function e(e){this.response=e}return Object.defineProperty(e.prototype,"headers",{get:function(){var e;if(this._headers)return this._headers;if(this.response.headers instanceof Headers){var t=this.response.headers,n={};return null===(e=null==t?void 0:t.forEach)||void 0===e||e.call(t,(function(e,t){n[t]=e})),this._headers=n,n}},enumerable:!1,configurable:!0}),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 u(this,void 0,void 0,(function(){var e,t,n;return a(this,(function(r){switch(r.label){case 0:e=this.response.clone(),r.label=1;case 1:return r.trys.push([1,3,,4]),t=e.text(),n=new Promise((function(e){return setTimeout((function(){return e(null)}),500)})),[4,Promise.race([t,n])];case 2:return[2,r.sent()];case 3:return r.sent(),[2,null];case 4:return[2]}}))}))},e}(),ze=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.responseText=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.text=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,this.responseText]}))}))},Object.defineProperty(e.prototype,"headers",{get:function(){var e,t;if(this.headersString){var n={},r=this.headersString.split("\r\n");try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var s=l(o.value.split(": "),2),u=s[0],a=s[1];u&&a&&(n[u]=a)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n}},enumerable:!1,configurable:!0}),e}(),Be=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,requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers,responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter((function(e){var t=l(e,2);return t[0],void 0!==t[1]})))},e}();var We,Ke,He,Je=function(e,t){void 0===t&&(t=$()),this.callback=e,this.id=t},Ye=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,h=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&&h&&this.observeXhr(f,p,h);var v=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;v&&this.observeFetch(v),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;if(void 0!==o&&void 0!==s){var a,c,l,d="GET";!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?a=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(a=t.url,d=t.method),d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var f=Math.floor(performance.now()-s),p=Math.floor(o+f),h=new Be(e,d,o,o,a,n,c,f,r,l,p);this.triggerEventCallbacks(h)}},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 u(t,void 0,void 0,(function(){var t,i,o,s,u,c;return a(this,(function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){null===(u=this.logger)||void 0===u||u.debug("an unexpected error occurred while retrieving timestamps",e)}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=a.sent(),[3,4];case 3:return s=a.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Fe(r):void 0,i?new Ve(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.prototype.observeXhr=function(e,t,n){if(this.globalScope&&e&&t){var r=this.globalScope.XMLHttpRequest.prototype,i=this;r.open=function(){for(var t,n,r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];var u=l(r,2),a=u[0],c=u[1];try{this.$$AmplitudeAnalyticsEvent=o({method:a,url:null===(t=null==c?void 0:c.toString)||void 0===t?void 0:t.call(c),headers:{}},i.getTimestamps())}catch(e){null===(n=i.logger)||void 0===n||n.debug("an unexpected error occurred while calling xhr open",e)}return e.apply(this,r)},r.send=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];var r=this,o=e[0],s=r.$$AmplitudeAnalyticsEvent;return r.addEventListener("loadend",(function(){var e;try{var t=r.getAllResponseHeaders(),n=r.getResponseHeader("content-length"),u=new ze(r.status,t,n?parseInt(n,10):void 0,r.responseText),a=r.$$AmplitudeAnalyticsEvent.headers,c=new Me(o,a);s.status=r.status,i.handleNetworkRequestEvent("xhr",{url:s.url,method:s.method},c,u,void 0,s.startTime,s.durationStart)}catch(t){null===(e=i.logger)||void 0===e||e.debug("an unexpected error occurred while handling xhr send",t)}})),t.apply(r,e)},r.setRequestHeader=function(e,t){var r;try{this.$$AmplitudeAnalyticsEvent.headers[e]=t}catch(e){null===(r=i.logger)||void 0===r||r.debug("an unexpected error occurred while calling xhr setRequestHeader",e)}n.apply(this,[e,t])}}},e}(),Ge=new Ye,Qe=function(){function e(){}return e.prototype.parse=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,o(o(o(o({},C),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={})[w]=t[w],e[_]=t[_],e[E]=t[E],e[S]=t[S],e[T]=t[T],e[I]=t[I],e[k]=t[k],e[P]=t[P],e[A]=t[A],e[O]=t[O],e[x]=t[x],e},e}(),Ze=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Xe=function(e){return Ze(e,"attribution")},et=function(e){return Ze(e,"pageViews")},tt=function(e){return Ze(e,"sessions")},nt=function(e){return"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},rt=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},it=function(e){return"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},ot=function(e){if(rt(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},st=function(e){if(it(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},ut=function(e){if(nt(e.autocapture)){if("object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking)return e.autocapture.networkTracking;if(e.networkTrackingOptions)return e.networkTrackingOptions}},at=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return et(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}},ct=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},lt=function(e){return e&&void 0!==e._q},dt="2.22.2",ft=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts","/").concat(dt),"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 u(this,void 0,void 0,(function(){var r,i,s;return a(this,(function(u){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,s=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({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:we()}),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,ht=function(e){function t(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 n(t,e),t.prototype.set=function(t,n){var r;return u(this,void 0,void 0,(function(){var i;return a(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]}}))}))},t}(Ce),vt=function(e){function t(){var t;return e.call(this,null===(t=F())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Ce),gt=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return n(t,e),t.prototype.send=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return a(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))}))]}))}))},t}(Re),yt=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return u(this,void 0,void 0,(function(){var n=this;return a(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)}}))]}))}))},t}(Re),mt=function(e,t,n){return void 0===n&&(n=!0),u(void 0,void 0,void 0,(function(){var r,i,o,s,u,c,d,f,p;return a(this,(function(a){switch(a.label){case 0:return r=function(e){return"".concat(g.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=a.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:a.sent(),a.label=3;case 3:return o=l(i.split("."),6),s=o[0],u=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:s,userId:wt(u),sessionId:bt(d),lastEventId:bt(p),lastEventTime:bt(f),optOut:Boolean(c)}]}}))}))},bt=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},wt=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},_t="[Amplitude]",Et="".concat(_t," Form Started"),St="".concat(_t," Form Submitted"),Tt="".concat(_t," File Downloaded"),It="session_start",kt="session_end",Pt="".concat(_t," File Extension"),At="".concat(_t," File Name"),Ot="".concat(_t," Link ID"),xt="".concat(_t," Link Text"),Ct="".concat(_t," Link URL"),Rt="".concat(_t," Form ID"),Nt="".concat(_t," Form Name"),Lt="".concat(_t," Form Destination"),Ut="cookie",Dt=function(e){function t(t,n,r,i,o,s,u,a,c,l,d,f,p,h,v,g,y,m,b,w,_,E,S,T,I,k,P,A,O,x,C,R,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=Ut),void 0===g&&(g=new G),void 0===y&&(y=q.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===P&&(P=new ht({loggerProvider:g})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===x&&(x=!1),void 0===C&&(C=!0);var D=e.call(this,{apiKey:t,storageProvider:P,transportProvider:Ft(O)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=i,D.defaultTracking=o,D.autocapture=s,D.flushIntervalMillis=a,D.flushMaxRetries=c,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=f,D.instanceName=p,D.loggerProvider=g,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=_,D.plan=E,D.serverUrl=S,D.serverZone=T,D.sessionTimeout=k,D.storageProvider=P,D.trackingOptions=A,D.transport=O,D.useBatch=x,D.fetchRemoteConfig=C,D.networkTrackingOptions=U,D.version=dt,D._optOut=!1,D._cookieStorage=r,D.deviceId=u,D.lastEventId=h,D.lastEventTime=v,D.optOut=w,D.sessionId=I,D.pageCounter=N,D.userId=R,D.debugLogsEnabled=L,D.loggerProvider.enable(L?q.Debug:D.logLevel),D.networkTrackingOptions=U,D}return n(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.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(be(this.apiKey),e)},t}(X),qt=function(e,t,n){return void 0===t&&(t={}),u(void 0,void 0,void 0,(function(){var r,i,s,u,c,l,d,f,p,h,v,g,y,m,b,w,_,E,S,T,I,k,P,A,O,x,C,R,N,L,U,D,q,j,F,M,V,z,B,W,K,H,J,Y,G;return a(this,(function(a){switch(a.label){case 0:return r=t.identityStorage||Ut,I={},r===Ut?[3,1]:(s="",[3,5]);case 1:return null===(P=null===(k=t.cookieOptions)||void 0===k?void 0:k.domain)||void 0===P?[3,2]:(u=P,[3,4]);case 2:return[4,Mt()];case 3:u=a.sent(),a.label=4;case 4:s=u,a.label=5;case 5:return i=o.apply(void 0,[(I.domain=s,I.expiration=365,I.sameSite="Lax",I.secure=!1,I.upgrade=!0,I),t.cookieOptions]),c=jt(t.identityStorage,i),[4,mt(e,c,null===(O=null===(A=t.cookieOptions)||void 0===A?void 0:A.upgrade)||void 0===O||O)];case 6:return l=a.sent(),[4,c.get(be(e))];case 7:return d=a.sent(),f=_e(),p=f.ampTimestamp?Number(f.ampTimestamp):void 0,h=!p||Date.now()<p,v=null!==(L=null!==(N=null!==(R=null!==(x=t.deviceId)&&void 0!==x?x:h?null!==(C=f.ampDeviceId)&&void 0!==C?C:f.deviceId:void 0)&&void 0!==R?R: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!==(D=null==d?void 0:d.lastEventTime)&&void 0!==D?D:l.lastEventTime,m=null!==(j=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==j?j:l.optOut,b=null!==(F=null==d?void 0:d.sessionId)&&void 0!==F?F:l.sessionId,w=null!==(V=null!==(M=t.userId)&&void 0!==M?M:null==d?void 0:d.userId)&&void 0!==V?V:l.userId,n.previousSessionDeviceId=null!==(z=null==d?void 0:d.deviceId)&&void 0!==z?z:l.deviceId,n.previousSessionUserId=null!==(B=null==d?void 0:d.userId)&&void 0!==B?B:l.userId,_={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},E=null==d?void 0:d.pageCounter,S=null==d?void 0:d.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(T=new Dt(e,t.appVersion,c,i,t.defaultTracking,t.autocapture,v,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,_,t.transport,t.useBatch,t.fetchRemoteConfig,w,E,S,t.networkTrackingOptions)).storageProvider.isEnabled()];case 8:return a.sent()||(T.loggerProvider.warn("Storage provider ".concat(T.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),T.storageProvider=new Pe),[2,T]}}))}))},jt=function(e,t){switch(void 0===e&&(e=Ut),void 0===t&&(t={}),e){case"localStorage":return new ht;case"sessionStorage":return new vt;case"none":return new Pe;default:return new Ae(o(o({},t),{expirationDays:t.expiration}))}},Ft=function(e){return"xhr"===e?new gt:"beacon"===e?new yt:new Ne},Mt=function(e){return u(void 0,void 0,void 0,(function(){var t,n,r,i,o,s,u;return a(this,(function(a){switch(a.label){case 0:return[4,(new Ae).isEnabled()];case 1:if(!a.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,a.label=2;case 2:return o<r.length?(s=r[o],[4,(u=new Ae({domain:"."+s})).set(i,1)]):[3,7];case 3:return a.sent(),[4,u.get(i)];case 4:return a.sent()?[4,u.remove(i)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},$t=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},Vt=function(){var e,t=$t();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=zt(n[0]),i=zt(n[1]);return i?(e[r]=i,e):e}),{}):{}},zt=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Bt="dclid",Wt="fbclid",Kt="gbraid",Ht="gclid",Jt="ko_click_id",Yt="li_fat_id",Gt="msclkid",Qt="rtd_cid",Zt="ttclid",Xt="twclid",en="wbraid",tn={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,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},nn=function(){function e(){}return e.prototype.parse=function(){return u(this,void 0,void 0,(function(){return a(this,(function(e){return[2,o(o(o(o({},tn),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=Vt();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=Vt();return(e={})[Bt]=t[Bt],e[Wt]=t[Wt],e[Kt]=t[Kt],e[Ht]=t[Ht],e[Jt]=t[Jt],e[Yt]=t[Yt],e[Gt]=t[Gt],e[Qt]=t[Qt],e[Zt]=t[Zt],e[Xt]=t[Xt],e[en]=t[en],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"}(We||(We={})),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"}(Ke||(Ke={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(He||(He={}));var rn,on,sn=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},un=function(e){var t;void 0===e&&(e={});var n,r=$t(),i=void 0,s=!1,c=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,p=void 0===f?"[Amplitude] Page Viewed":f,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},v=function(){return u(void 0,void 0,void 0,(function(){var e,t,n;return a(this,(function(r){switch(r.label){case 0:return e=h("undefined"!=typeof location&&location.href||""),n={event_type:p},t=[{}],[4,an()];case 1:return[2,(n.event_properties=o.apply(void 0,[o.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&&h(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===c||"function"==typeof c&&c()},y="undefined"!=typeof location?location.href:null,m=function(){return u(void 0,void 0,void 0,(function(){var e,n,r,o;return a(this,(function(s){switch(s.label){case 0:return e=location.href,n=ln(d,e,y||"")&&g(),y=e,n?(null==i||i.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return o=(r=t).track,[4,v()];case 2:o.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,o){return u(void 0,void 0,void 0,(function(){var u,c;return a(this,(function(a){switch(a.label){case 0:return t=o,n=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,r&&(r.addEventListener("popstate",b),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],u=r[2];e.apply(t,[i,o,u]),s&&m()}})),g()?(i.log("Tracking page view event"),c=(u=t).track,[4,v()]):[3,2];case 1:c.apply(u,[a.sent()]),a.label=2;case 2:return[2]}}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){var t;return a(this,(function(r){switch(r.label){case 0:return"attribution"===c&&cn(e)?(null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,v()]):[3,2];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=o(o({},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=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(this,(function(e){return r&&(r.removeEventListener("popstate",b),s=!1),[2]}))}))}};return w},an=function(){return u(void 0,void 0,void 0,(function(){var e;return a(this,(function(t){switch(t.label){case 0:return e=sn,[4,(new nn).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},cn=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[We.SET]||{},r=t[We.UNSET]||{},i=d(d([],l(Object.keys(n)),!1),l(Object.keys(r)),!1);return Object.keys(tn).every((function(e){return i.includes(e)}))}return!1},ln=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},dn=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 u(void 0,void 0,void 0,(function(){var i,o;return a(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=pn(e);t||r.track(Et,((n={})[Rt]=fn(e.id),n[Nt]=fn(e.name),n[Lt]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=pn(e);t||r.track(Et,((n={})[Rt]=fn(e.id),n[Nt]=fn(e.name),n[Lt]=o,n)),r.track(St,((i={})[Rt]=fn(e.id),i[Nt]=fn(e.name),i[Lt]=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 u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(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]}))}))}}},fn=function(e){if("string"==typeof e)return e},pn=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},hn=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return u(void 0,void 0,void 0,(function(){var i,o;return a(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(Tt,((t={})[Pt]=s,t[At]=n.pathname,t[Ot]=e.id,t[xt]=e.text,t[Ct]=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 u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(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]}))}))}}},vn=!1,gn=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 u(void 0,void 0,void 0,(function(){return a(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 u(void 0,void 0,void 0,(function(){return a(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)})),t=[],[2]}))}))}}};function yn(e){var t,n;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var r=Object.keys(e);try{for(var i=c(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),yn(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 mn(e,t){var n,r,i,s;if(e){yn(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e));var u=e;if(u&&"autocapture"in u){if("boolean"==typeof u.autocapture&&(t.autocapture=u.autocapture),"object"==typeof u.autocapture&&null!==u.autocapture){var a=o({},u.autocapture);if(void 0===t.autocapture&&(t.autocapture=u.autocapture),"object"==typeof u.autocapture.elementInteractions&&null!==u.autocapture.elementInteractions&&(null===(i=u.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===i?void 0:i.length)){a.elementInteractions=o({},u.autocapture.elementInteractions);var l=a.elementInteractions,d=null!==(s=l.pageUrlAllowlist)&&void 0!==s?s:[],f=[];try{for(var p=c(u.autocapture.elementInteractions.pageUrlAllowlistRegex),h=p.next();!h.done;h=p.next()){var v=h.value;try{f.push(new RegExp(v))}catch(e){t.loggerProvider.warn("Invalid regex pattern: ".concat(v),e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}var g=d.concat(f);l.pageUrlAllowlist=g,delete l.pageUrlAllowlistRegex}"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}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"}(rn||(rn={})),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"}(on||(on={}));var bn=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,h,v,g,y,m,b,w,_,E;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case on.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 on.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!==(h=e.throttled_events)&&void 0!==h?h:[]}};case on.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case on.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.exceeded_daily_quota_users)&&void 0!==_?_:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case on.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?on.Success:429===e?on.RateLimit:413===e?on.PayloadTooLarge:408===e?on.Timeout:e>=400&&e<500?on.Invalid:e>=500?on.Failed:on.Unknown},e}(),wn="Remote config fetch rejected due to timeout after 5 seconds",_n="Unexpected error occurred",En=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 u(r,void 0,void 0,(function(){var n,r,i;return a(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 u(r,void 0,void 0,(function(){var r;return a(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 u(r,void 0,void 0,(function(){var t,n,r;return a(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 u(r,void 0,void 0,(function(){var n,r,i,s,u,l,d,f,p,h,v,g;return a(this,(function(a){switch(a.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:wn})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),a.label=1;case 1:a.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(r=c(this.configKeys),i=r.next();!i.done;i=r.next())s=i.value,n.append("config_keys",s)}catch(e){h={error:e}}finally{try{i&&!i.done&&(v=r.return)&&v.call(r)}finally{if(h)throw h.error}}return t&&n.set("session_id",String(t)),u={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,o(o({},u),{signal:e}))];case 2:if(null===(d=a.sent()))return[2,this.completeRequest({err:_n})];switch((new bn).buildStatus(d.status)){case on.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case on.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=a.sent(),p=f,e.aborted?[2,this.completeRequest({err:wn})]:[2,this.completeRequest({err:null!==(g=p.message)&&void 0!==g?g:_n})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return u(r,void 0,void 0,(function(){var n=this;return a(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 u(r,void 0,void 0,(function(){var t;return a(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===rn.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===rn.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}(),Sn=function(e){var t=e.localConfig,n=e.configKeys;return u(void 0,void 0,void 0,(function(){return a(this,(function(e){return[2,new En({localConfig:t,configKeys:n})]}))}))},Tn="[Amplitude] Element Clicked",In="[Amplitude] Element Tag",kn="[Amplitude] Element Text",Pn="[Amplitude] Page URL",An="https://app.amplitude.com",On={US:An,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};function xn(e){return"function"==typeof e}function Cn(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 Rn=Cn((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 Nn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Ln=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=c(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 a=this.initialTeardown;if(xn(a))try{a()}catch(e){i=e instanceof Rn?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=c(f),h=p.next();!h.done;h=p.next()){var v=h.value;try{qn(v)}catch(e){i=null!=i?i:[],e instanceof Rn?i=d(d([],l(i)),l(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new Rn(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)qn(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)&&Nn(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Nn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Un=Ln.EMPTY;function Dn(e){return e instanceof Ln||e&&"closed"in e&&xn(e.remove)&&xn(e.add)&&xn(e.unsubscribe)}function qn(e){xn(e)?e():e.unsubscribe()}var jn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Fn=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,d([e,t],l(n)))};function Mn(e){Fn((function(){throw e}))}function $n(){}function Vn(e){e()}var zn=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Dn(t)&&t.add(n)):n.destination=Yn,n}return n(t,e),t.create=function(e,t,n){return new Hn(e,t,n)},t.prototype.next=function(e){this.isStopped||this._next(e)},t.prototype.error=function(e){this.isStopped||(this.isStopped=!0,this._error(e))},t.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},t.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,e.prototype.unsubscribe.call(this),this.destination=null)},t.prototype._next=function(e){this.destination.next(e)},t.prototype._error=function(e){try{this.destination.error(e)}finally{this.unsubscribe()}},t.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},t}(Ln),Bn=Function.prototype.bind;function Wn(e,t){return Bn.call(e,t)}var Kn=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){Jn(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){Jn(e)}else Jn(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){Jn(e)}},e}(),Hn=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;xn(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&jn.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&Wn(t.next,o),error:t.error&&Wn(t.error,o),complete:t.complete&&Wn(t.complete,o)}):i=t;return s.destination=new Kn(i),s}return n(t,e),t}(zn);function Jn(e){Mn(e)}var Yn={closed:!0,next:$n,error:function(e){throw e},complete:$n},Gn="function"==typeof Symbol&&Symbol.observable||"@@observable";function Qn(e){return e}var Zn=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 zn||function(e){return e&&xn(e.next)&&xn(e.error)&&xn(e.complete)}(r)&&Dn(r)?e:new Hn(e,t,n);return Vn((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=Xn(t))((function(t,r){var i=new Hn({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[Gn]=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?Qn: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=Xn(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 Xn(e){var t;return null!==(t=null!=e?e:jn.Promise)&&void 0!==t?t:Promise}function er(e){return xn(null==e?void 0:e.lift)}function tr(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 nr(e,t,n,r,i){return new rr(e,t,n,r,i)}var rr=function(e){function t(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 n(t,e),t.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))}},t}(zn);!function(e){function t(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}n(t,e),t.prototype._subscribe=function(e){return this.getSubject().subscribe(e)},t.prototype.getSubject=function(){var e=this._subject;return e&&!e.isStopped||(this._subject=this.subjectFactory()),this._subject},t.prototype._teardown=function(){this._refCount=0;var e=this._connection;this._subject=this._connection=null,null==e||e.unsubscribe()},t.prototype.connect=function(){var e=this,t=this._connection;if(!t){t=this._connection=new Ln;var n=this.getSubject();t.add(this.source.subscribe(nr(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=Ln.EMPTY)}return t},t.prototype.refCount=function(){return tr((function(e,t){var n=null;e._refCount++;var r=nr(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)}}(Zn);var ir,or={now:function(){return(or.delegate||performance).now()},delegate:void 0},sr={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new Ln((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=sr.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,d([],l(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,d([],l(e)))},delegate:void 0};new Zn((function(e){var t=ir||or,n=t.now(),r=0,i=function(){e.closed||(r=sr.requestAnimationFrame((function(o){r=0;var s=t.now();e.next({timestamp:ir?s:o,elapsed:s-n}),i()})))};return i(),function(){r&&sr.cancelAnimationFrame(r)}}));var ur=Cn((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),ar=function(e){function t(){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 n(t,e),t.prototype.lift=function(e){var t=new cr(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new ur},t.prototype.next=function(e){var t=this;Vn((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=c(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}}}}))},t.prototype.error=function(e){var t=this;Vn((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)}}))},t.prototype.complete=function(){var e=this;Vn((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?Un:(this.currentObservers=null,o.push(e),new Ln((function(){t.currentObservers=null,Nn(o,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},t.prototype.asObservable=function(){var e=new Zn;return e.source=this,e},t.create=function(e,t){return new cr(e,t)},t}(Zn),cr=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return n(t,e),t.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)},t.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)},t.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)},t.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:Un},t}(ar);!function(e){function t(t){var n=e.call(this)||this;return n._value=t,n}n(t,e),Object.defineProperty(t.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),t.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},t.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},t.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(ar);var lr={now:function(){return(lr.delegate||Date).now()},delegate:void 0};!function(e){function t(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=lr);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}n(t,e),t.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)},t.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},t.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)}}}(ar),function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._value=null,t._hasValue=!1,t._isComplete=!1,t}n(t,e),t.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())},t.prototype.next=function(e){this.isStopped||(this._value=e,this._hasValue=!0)},t.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))}}(ar);var dr,fr=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(Ln),pr=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,d([e,t],l(n)))},hr=function(e){return clearInterval(e)},vr=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r.pending=!1,r}return n(t,e),t.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},t.prototype.requestAsyncId=function(e,t,n){return void 0===n&&(n=0),pr(e.flush.bind(e,this),n)},t.prototype.recycleAsyncId=function(e,t,n){if(void 0===n&&(n=0),null!=n&&this.delay===n&&!1===this.pending)return t;null!=t&&hr(t)},t.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))},t.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},t.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,Nn(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(fr),gr=1,yr={};function mr(e){return e in yr&&(delete yr[e],!0)}var br=function(e){var t=gr++;return yr[t]=!0,dr||(dr=Promise.resolve()),dr.then((function(){return mr(t)&&e()})),t},wr=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)||br).apply(void 0,d([],l(e)))},clearImmediate:function(e){return wr(e)},delegate:void 0},Er=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.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))))},t.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))},t}(vr),Sr=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=lr.now,e}(),Tr=function(e){function t(t,n){void 0===n&&(n=Sr.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return n(t,e),t.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}}},t}(Sr),Ir=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.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}},t}(Tr);new Ir(Er);var kr=new Tr(vr),Pr=kr,Ar=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.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)},t.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},t.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)},t}(vr),Or=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Tr);new Or(Ar);var xr=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return n(t,e),t.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=sr.requestAnimationFrame((function(){return t.flush(void 0)}))))},t.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&&(sr.cancelAnimationFrame(n),t._scheduled=void 0)},t}(vr),Cr=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.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}},t}(Tr);new Cr(xr),function(e){function t(t,n){void 0===t&&(t=Rr),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}n(t,e),t.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}},t.frameTimeFactor=10}(Tr);var Rr=function(e){function t(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 n(t,e),t.prototype.schedule=function(n,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,n,r);this.active=!1;var i=new t(this.scheduler,this.work);return this.add(i),i.schedule(n,r)}return Ln.EMPTY},t.prototype.requestAsyncId=function(e,n,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(t.sortActions),1},t.prototype.recycleAsyncId=function(e,t,n){},t.prototype._execute=function(t,n){if(!0===this.active)return e.prototype._execute.call(this,t,n)},t.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},t}(vr),Nr=new Zn((function(e){return e.complete()}));function Lr(e){return e&&xn(e.schedule)}function Ur(e){return e[e.length-1]}function Dr(e){return Lr(Ur(e))?e.pop():void 0}var qr=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function jr(e){return xn(null==e?void 0:e.then)}function Fr(e){return xn(e[Gn])}function Mr(e){return Symbol.asyncIterator&&xn(null==e?void 0:e[Symbol.asyncIterator])}function $r(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 Vr,zr="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Br(e){return xn(null==e?void 0:e[zr])}function Wr(e){return p(this,arguments,(function(){var t,n,r;return a(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,f(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,f(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,f(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 Kr(e){return xn(null==e?void 0:e.getReader)}function Hr(e){if(e instanceof Zn)return e;if(null!=e){if(Fr(e))return i=e,new Zn((function(e){var t=i[Gn]();if(xn(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(qr(e))return r=e,new Zn((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(jr(e))return n=e,new Zn((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Mn)}));if(Mr(e))return Jr(e);if(Br(e))return t=e,new Zn((function(e){var n,r;try{for(var i=c(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(Kr(e))return Jr(Wr(e))}var t,n,r,i;throw $r(e)}function Jr(e){return new Zn((function(t){(function(e,t){var n,r,i,o;return u(this,void 0,void 0,(function(){var s,u;return a(this,(function(a){switch(a.label){case 0:a.trys.push([0,5,6,11]),n=h(e),a.label=1;case 1:return[4,n.next()];case 2:if((r=a.sent()).done)return[3,4];if(s=r.value,t.next(s),t.closed)return[2];a.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return u=a.sent(),i={error:u},[3,11];case 6:return a.trys.push([6,,9,10]),r&&!r.done&&(o=n.return)?[4,o.call(n)]:[3,8];case 7:a.sent(),a.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 Yr(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 Gr(e,t){return void 0===t&&(t=0),tr((function(n,r){n.subscribe(nr(r,(function(n){return Yr(r,e,(function(){return r.next(n)}),t)}),(function(){return Yr(r,e,(function(){return r.complete()}),t)}),(function(n){return Yr(r,e,(function(){return r.error(n)}),t)})))}))}function Qr(e,t){return void 0===t&&(t=0),tr((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function Zr(e,t){if(!e)throw new Error("Iterable cannot be null");return new Zn((function(n){Yr(n,t,(function(){var r=e[Symbol.asyncIterator]();Yr(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function Xr(e,t){if(null!=e){if(Fr(e))return function(e,t){return Hr(e).pipe(Qr(t),Gr(t))}(e,t);if(qr(e))return function(e,t){return new Zn((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(jr(e))return function(e,t){return Hr(e).pipe(Qr(t),Gr(t))}(e,t);if(Mr(e))return Zr(e,t);if(Br(e))return function(e,t){return new Zn((function(n){var r;return Yr(n,t,(function(){r=e[zr](),Yr(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 xn(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(Kr(e))return function(e,t){return Zr(Wr(e),t)}(e,t)}throw $r(e)}function ei(e,t){return t?Xr(e,t):Hr(e)}function ti(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(Vr||(Vr={})),Cn((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),Cn((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Cn((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Cn((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var ni=Cn((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function ri(e){throw new ni(e)}function ii(e,t){return tr((function(n,r){var i=0;n.subscribe(nr(r,(function(n){r.next(e.call(t,n,i++))})))}))}var oi=Array.isArray;function si(e){return ii((function(t){return function(e,t){return oi(t)?e.apply(void 0,d([],l(t))):e(t)}(e,t)}))}function ui(e,t,n){return void 0===n&&(n=1/0),xn(t)?ui((function(n,r){return ii((function(e,i){return t(n,e,r,i)}))(Hr(e(n,r)))}),n):("number"==typeof t&&(n=t),tr((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?h(e):a.push(e)},h=function(e){o&&t.next(e),c++;var u=!1;Hr(n(e,l++)).subscribe(nr(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?Yr(t,s,(function(){return h(e)})):h(e)};a.length&&c<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(nr(t,p,(function(){d=!0,f()}))),function(){null==u||u()}}(t,r,e,n)})))}function ai(e){return void 0===e&&(e=1/0),ui(Qn,e)}function ci(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ai(1)(ei(e,Dr(e)))}var li=["addListener","removeListener"],di=["addEventListener","removeEventListener"],fi=["on","off"];function pi(e,t,n,r){if(xn(n)&&(r=n,n=void 0),r)return pi(e,t,n).pipe(si(r));var i=l(function(e){return xn(e.addEventListener)&&xn(e.removeEventListener)}(e)?di.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return xn(e.addListener)&&xn(e.removeListener)}(e)?li.map(hi(e,t)):function(e){return xn(e.on)&&xn(e.off)}(e)?fi.map(hi(e,t)):[],2),o=i[0],s=i[1];if(!o&&qr(e))return ui((function(e){return pi(e,t,n)}))(Hr(e));if(!o)throw new TypeError("Invalid event target");return new Zn((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 hi(e,t){return function(n){return function(r){return e[n](t,r)}}}function vi(e,t,n){void 0===e&&(e=0),void 0===n&&(n=Pr);var r=-1;return null!=t&&(Lr(t)?n=t:r=t),new Zn((function(t){var i=ti(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 gi(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Dr(e),r=function(e,t){return"number"==typeof Ur(e)?e.pop():t}(e,1/0),i=e;return i.length?1===i.length?Hr(i[0]):ai(r)(ei(i,n)):Nr}new Zn($n);var yi=Array.isArray;function mi(e,t){return tr((function(n,r){var i=0;n.subscribe(nr(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function bi(){for(var e,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return 1===(t=1===(e=t).length&&yi(e[0])?e[0]:e).length?Hr(t[0]):new Zn(function(e){return function(t){for(var n=[],r=function(r){n.push(Hr(e[r]).subscribe(nr(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 wi(e){return e<=0?function(){return Nr}:tr((function(t,n){var r=0;t.subscribe(nr(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function _i(e,t){return t?function(n){return ci(t.pipe(wi(1),tr((function(e,t){e.subscribe(nr(t,$n))}))),n.pipe(_i(e)))}:ui((function(t,n){return Hr(e(t,n)).pipe(wi(1),function(e){return ii((function(){return e}))}(t))}))}function Ei(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new ar}: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 tr((function(e,h){u++,l||c||d();var v=o=null!=o?o:n();h.add((function(){0!==--u||l||c||(r=Si(p,a))})),v.subscribe(h),!t&&u>0&&(t=new Hn({next:function(e){return v.next(e)},error:function(e){l=!0,d(),r=Si(f,i,e),v.error(e)},complete:function(){c=!0,d(),r=Si(f,s),v.complete()}}),Hr(e).subscribe(t))}))(e)}}function Si(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 Hn({next:function(){i.unsubscribe(),e()}});return Hr(t.apply(void 0,d([],l(n)))).subscribe(i)}}else e()}function Ti(e,t,n){void 0===t&&(t=kr);var r=vi(e,t);return function(e,t){return tr((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())},h=function(){d=null,f&&r.complete()},v=function(t){return d=Hr(e(t)).subscribe(nr(r,p,h))},g=function(){if(c){c=!1;var e=l;l=null,r.next(e),!f&&v(e)}};n.subscribe(nr(r,(function(e){c=!0,l=e,(!d||d.closed)&&(s?g():v(e))}),(function(){f=!0,(!(a&&c&&d)||d.closed)&&r.complete()})))}))}((function(){return r}),n)}var Ii=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],ki=["type"],Pi=["svg","path","g"],Ai=["password","hidden"];var Oi=function(e){var t;return e?(t=function(e,t){for(var n=0,r=0;r<e.length;r++){var i=e[r];if(null===i)n+=4;else{var o=xi(i);n+=o?Array.from(o).length:4}if(n>t)return e.slice(0,r)}return e}(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).map((function(e){return function(e){var t,n,r,i,o,s;if(null===e)return null;var u=String(e.tagName).toLowerCase(),a={tag:u},l=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);l.length&&(a.index=l.indexOf(e),a.indexOfType=l.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(s=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===s?void 0:s.toLowerCase();d&&(a.prevSib=String(d));var f=e.getAttribute("id");f&&(a.id=String(f));var p=Array.from(e.classList);p.length&&(a.classes=p);var h={},v=Array.from(e.attributes).filter((function(e){return!Ii.includes(e.name)})),g=!Ui(e);if(!Ai.includes(String(e.getAttribute("type")))&&!Pi.includes(u))try{for(var y=c(v),m=y.next();!m.done;m=y.next()){var b=m.value;g&&!ki.includes(b.name)||(h[b.name]=String(b.value).substring(0,128))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}return Object.keys(h).length&&(a.attrs=h),a}(e)})),1024),t):[]};function xi(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return xi(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=l(e,1)[0]})).map((function(e){var t=l(e,2),n=t[0],r=t[1];return"".concat(String(xi(n,!0)),": ").concat(String(xi(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var Ci=["input","select","textarea"],Ri=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},Ni=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,u=e.pageUrlAllowlist,a=e.shouldTrackEventResolver,c=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(!c)return!1;if(a)return a(r,i);if(!function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))}(window.location.href,u))return!1;var l=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}var d=Ri(i,r);if(n&&d)return!0;if(t){var f=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(!f)return!1}switch(c){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!d||"click"===r}}},Li=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},Ui=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!Ci.includes(i)&&!o},Di=function(e){var t="";return Ui(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=Di(e),t+=r.split(/(\s+)/).filter(Li).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},qi=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){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}if(t){var r=t.textContent||"";return Li(r)?r:""}return ji(n)},Fi=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:Fi(null==e?void 0:e.parentElement,t):null},Mi=function(e){var t,n,r;if(!e)return{};var i=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),o=((t={})[In]=i,t[kn]=Di(e),t[Pn]=window.location.href.split("?")[0],t);return qi(o)};var $i=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},Vi=function(e,t,n){var r,i,o,s=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),u="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),c=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var i=r.replace(t,""),o=e.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(t,n),l=ji(t),d=((r={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",r["[Amplitude] Element Class"]=t.getAttribute("class"),r["[Amplitude] Element Hierarchy"]=Oi(t),r[In]=s,r[kn]=Di(t),r["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),r["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),r["[Amplitude] Element Aria Label"]=a,r["[Amplitude] Element Attributes"]=c,r["[Amplitude] Element Parent Label"]=l,r[Pn]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return"a"===s&&"click"===e&&t instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=t.href),qi(d)},zi=function(e,t,n,r,i){void 0===i&&(i=!1);var o={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i)if(Ri(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=Vi(o.type,o.closestTrackedAncestor,r),o;var s=Fi(o.event.target,n);return s&&(o.closestTrackedAncestor=s,o.targetElementProperties=Vi(o.type,s,r)),o}return o};var Bi=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?n.textContent:"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},Wi=function(e,t){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=Bi(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}}))},Ki=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?An:t,r=this;this.endpoint=An,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?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===An&&(this.endpoint=i);var a=null;window.addEventListener("message",(function(e){var n,r,i,c,l;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 d,f=null==e?void 0:e.data,p=null==f?void 0:f.action;if(p)if("id"in f)null===(c=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===c||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===p)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===p){var h=null==f?void 0:f.data;(d="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=d,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(d)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;a=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:Mi,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:Bi,diagnostics:{autocapture:{version:"1.9.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"===p&&(null===(l=null==a?void 0:a.close)||void 0===l||l.call(a))}})),this.notify({action:"page-loaded"})},e}();function Hi(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,u=e.shouldTrackEvent,a=e.evaluateTriggers,d=o.clickObservable,f=d.pipe(tr((function(e,t){var n,r=!1;e.subscribe(nr(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),mi((function(e){var t=l(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=gi(f,d.pipe((t=s.debounceTime,void 0===n&&(n=kr),tr((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(nr(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"})))),h=d.pipe(function(e,t){void 0===t&&(t=kr);var n=vi(e,t);return _i((function(){return n}))}(0),mi($i),mi((function(e){return u("click",e.closestTrackedAncestor)})),ii((function(e){return a(e)})),(r=p,tr((function(e,t){var n=[];return e.subscribe(nr(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),Hr(r).subscribe(nr(t,(function(){var e=n;n=[],t.next(e)}),$n)),function(){n=null}}))));return h.subscribe((function(e){var t,n,r=(e.length,Tn);try{for(var o=c(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 Ji(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,c=n.navigateObservable,f=u.pipe(mi((function(e){return!o("click",e.closestTrackedAncestor)})),ii((function(e){var t=Fi(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),mi($i),mi((function(e){return s("click",e.closestTrackedAncestor)}))),p=[a];c&&p.push(c);var h,v,g=gi.apply(void 0,d([],l(p),!1)),y=f.pipe((h=function(e){return g.pipe(wi(1),function(e,t){var n=ti(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?ri: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 tr((function(e,t){var n,o,u=null,c=0,d=function(e){o=Yr(t,a,(function(){try{n.unsubscribe(),Hr(s({meta:l,lastValue:u,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(nr(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 Nr}}),ii((function(){return e})))},tr((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(nr(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;Hr(h(e,s)).subscribe(n=nr(t,(function(n){return t.next(v?v(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return y.subscribe((function(e){null==t||t.track(Tn,i("click",e.closestTrackedAncestor))}))}var Yi,Gi=function(){return new Zn((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()}}))},Qi=function(e){return void 0===e&&(e="click"),pi(document,e,{capture:!0})},Zi={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Xi=function(e){var t,n,r,i,o=Object.values(Zi).reduce((function(e,t){return e[t]=new Set,e}),{});if(!e)return o;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var a=u.value;try{try{for(var l=(r=void 0,c(a.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,p=Zi[f.event_type];p&&o[p].add(a.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==a?void 0:a.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},eo=function(e){var t,n,r,i,o=new Map;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var a=u.value;try{for(var l=(r=void 0,c(a.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var p=f.match.eventId,h=o.get(p);h||(h=[],o.set(p,h)),h.push(a)}}}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},to=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return Zi[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)}))}))}))},no=function(){function e(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n}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=c(e),a=u.next();!a.done;a=u.next()){var l=a.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),p=f.next();!p.done;p=f.next()){var h=p.value;s.add(h)}}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{a&&!a.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return Array.from(s)}(to(e,Array.from(this.groupedLabeledEvents[e.type]).map((function(e){return r.labeledEvents[e]}))),this.labeledEventToTriggerMap);try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var u=s.value;Wi(u.actions,e)}}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"}(Yi||(Yi={}));var ro=function(e){var t,n,r,i,s,f,p;void 0===e&&(e={});var h=e.dataAttributePrefix,v=void 0===h?Ue:h,g=e.visualTaggingOptions,y=void 0===g?{enabled:!0,messenger:new Ki}:g;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:Le,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:De,e.debounceTime=null!==(r=e.debounceTime)&&void 0!==r?r:0;var m="@amplitude/plugin-autocapture-browser",b=[],w=Xi(Object.values(null!==(s=null===(i=e.pageActions)||void 0===i?void 0:i.labeledEvents)&&void 0!==s?s:{})),_=eo(null!==(p=null===(f=e.pageActions)||void 0===f?void 0:f.triggers)&&void 0!==p?p:[]),E=function(e,t,n){return new no(e,t,n)}(w,_,e);return{name:m,type:"enrichment",setup:function(t,n){return u(void 0,void 0,void 0,(function(){var r,i,s,c,f,p,h,g,S,T;return a(this,(function(I){return"undefined"==typeof document||(t.fetchRemoteConfig&&Sn({localConfig:t,configKeys:["analyticsSDK.pageActions"]}).then((function(n){return u(void 0,void 0,void 0,(function(){var r,i;return a(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=o(o({},e.pageActions),t),w=Xi(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),_=eo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),E.update(w,_,e))}(s.sent()),[3,3];case 2:return r=s.sent(),null===(i=null==t?void 0:t.loggerProvider)||void 0===i||i.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=Ni(e,e.cssSelectorAllowlist),i=Ni(e,e.actionClickAllowlist),s=function(){var t,n,r=Qi().pipe(ii((function(t){return zi(t,"click",e.cssSelectorAllowlist,v)})),Ei()),i=pi(document,"change",{capture:!0}).pipe(ii((function(t){return zi(t,"change",e.cssSelectorAllowlist,v)})),Ei());window.navigation&&(n=pi(window.navigation,"navigate").pipe(ii((function(t){return zi(t,"navigate",e.cssSelectorAllowlist,v)})),Ei()));var o=Gi().pipe(ii((function(t){return zi(t,"mutation",e.cssSelectorAllowlist,v)})),Ei());return(t={})[Yi.ClickObservable]=r,t[Yi.ChangeObservable]=i,t[Yi.NavigateObservable]=n,t[Yi.MutationObservable]=o,t}(),c=Hi({allObservables:s,options:e,amplitude:n,shouldTrackEvent:r,evaluateTriggers:E.evaluate.bind(E)}),b.push(c),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(mi($i),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:s,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vi.apply(void 0,d(d([],l(e),!1),[v],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:E.evaluate.bind(E)}),b.push(f),p=Ji({allObservables:s,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Vi.apply(void 0,d(d([],l(e),!1),[v],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:i}),b.push(p),null===(S=null==t?void 0:t.loggerProvider)||void 0===S||S.log("".concat(m," has been successfully added.")),window.opener&&y.enabled&&(h=e.cssSelectorAllowlist,g=e.actionClickAllowlist,null===(T=y.messenger)||void 0===T||T.setup(o(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:On[t.serverZone]}),{isElementSelectable:Ni(e,d(d([],l(h),!1),l(g),!1)),cssSelectorAllowlist:h,actionClickAllowlist:g})))),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){var e,t,n,r;return a(this,(function(i){try{for(e=c(b),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]}))}))}}};var io,oo=function(e){var t,n,r,i,s;void 0===e&&(e={});var f="@amplitude/plugin-frustration-browser",p=[],h=null!==(n=null===(t=e.rageClicks)||void 0===t?void 0:t.cssSelectorAllowlist)&&void 0!==n?n:je,v=null!==(i=null===(r=e.deadClicks)||void 0===r?void 0:r.cssSelectorAllowlist)&&void 0!==i?i:qe,g=null!==(s=e.dataAttributePrefix)&&void 0!==s?s:Ue,y=d([],l(new Set(d(d([],l(h),!1),l(v),!1))),!1);return{name:f,type:"enrichment",setup:function(t,n){return u(void 0,void 0,void 0,(function(){var r,i,s,u,c,m;return a(this,(function(a){return"undefined"==typeof document||(r=Ni(e,h),i=Ni(e,v),s=function(){var e,t,n=Qi("pointerdown").pipe(ii((function(e){return zi(e,"click",y,g,!0)})),Ei());window.navigation&&(t=pi(window.navigation,"navigate").pipe(ii((function(e){return zi(e,"navigate",y,g)})),Ei()));var r=Gi().pipe(ii((function(e){return zi(e,"mutation",y,g)})),Ei());return(e={})[Yi.ClickObservable]=n,e[Yi.ChangeObservable]=new Zn,e[Yi.NavigateObservable]=t,e[Yi.MutationObservable]=r,e}(),u=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackRageClick,i=n.clickObservable,s=[];return i.pipe(mi($i),mi((function(e){return r("click",e.closestTrackedAncestor)})),ii((function(e){var t=e.timestamp;s.length>0&&s[s.length-1].closestTrackedAncestor!==e.closestTrackedAncestor&&s.splice(0,s.length);for(var n=0;n<s.length&&!(t-s[n].timestamp<1e3);n++);if(s.splice(0,n),s.push(e),s.length<4)return null;var r=s[0],i=s[s.length-1],u=o({"[Amplitude] Begin Time":new Date(r.timestamp).toISOString(),"[Amplitude] End Time":new Date(i.timestamp).toISOString(),"[Amplitude] Duration":i.timestamp-r.timestamp,"[Amplitude] Clicks":s.map((function(e){return{X:e.event.clientX,Y:e.event.clientY,Time:e.timestamp}})),"[Amplitude] Click Count":s.length},r.targetElementProperties);return s.splice(0,s.length),{rageClickEvent:u,time:r.timestamp}})),mi((function(e){return null!==e}))).subscribe((function(e){null!==e&&t.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})}))}({allObservables:s,amplitude:n,shouldTrackRageClick:r}),p.push(u),c=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,s=n.clickObservable,u=n.mutationObservable,a=n.navigateObservable,c=s.pipe(mi($i),mi((function(e){return i("click",e.closestTrackedAncestor)}))),f=[u];a&&f.push(a);var p=gi.apply(void 0,d([],l(f),!1));return c.pipe(ui((function(e){var t;return bi(new Zn((function(n){return t=setTimeout((function(){return n.next(e)}),3e3),function(){clearTimeout(t)}})),p.pipe(wi(1),ii((function(){return null})))).pipe(mi((function(e){return null!==e})))})),Ti(3e3)).subscribe((function(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}))}({amplitude:n,allObservables:s,getEventProperties:function(e,t){return Vi(e,t,g)},shouldTrackDeadClick:i}),p.push(c),null===(m=null==t?void 0:t.loggerProvider)||void 0===m||m.log("".concat(f," has been successfully added."))),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){var e,t,n,r;return a(this,(function(i){try{for(e=c(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]}))}))}}},so="[Amplitude] Network Request",uo="500-599";function ao(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function co(e,t){var n,r,i=t.split(",");try{for(var o=c(i),s=o.next();!s.done;s=o.next()){var u=l(s.value.split("-").map(Number),2),a=u[0],d=u[1];if(e===a&&void 0===d)return!0;if(e>=a&&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 lo(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 fo(e,t){var n;void 0===t&&(t={});var r=lo(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(ao(o,"*.amplitude.com")||ao(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return ao(o,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!co(e.status,uo))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find((function(t){return i=function(e,t,n){if(!e.hosts||e.hosts.find((function(e){return ao(t,e)})))return!((n||0===n)&&!co(n,e.statusCodeRange||uo))}(t,o,e.status),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===so})))return!0}catch(e){}return!1}(o,e.requestWrapper)}!function(e){e.NetworkObservable="networkObservable"}(io||(io={}));var po=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],i=function(){var e,n=new Zn((function(e){var n=new Je((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return Ge.subscribe(n,t),function(){Ge.unsubscribe(n)}}));return(e={})[io.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(o,s){return u(void 0,void 0,void 0,(function(){var u,c;return a(this,(function(a){return"undefined"==typeof document||(u=i(),c=function(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude;return t.networkObservable.pipe(mi((function(e){return fo(e.event,n)}))).subscribe((function(e){var t,n,i,o=e.event,s=lo(o.url);if(s){var u=null===(n=o.responseWrapper)||void 0===n?void 0:n.bodySize,a=null===(i=o.requestWrapper)||void 0===i?void 0:i.bodySize,c=((t={})["[Amplitude] URL"]=s.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=s.query,t["[Amplitude] URL Fragment"]=s.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"]=a,t["[Amplitude] Response Body Size"]=u,t["[Amplitude] Request Type"]=o.type,t);null==r||r.track(so,c)}}))}({allObservables:u,networkTrackingOptions:e,amplitude:s}),r.push(c),null==(t=null==o?void 0:o.loggerProvider)||t.log("".concat(n," has been successfully added."))),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){var e,t,n,i;return a(this,(function(o){try{for(e=c(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 ho=-1;const vo=e=>{addEventListener("pageshow",(t=>{t.persisted&&(ho=t.timeStamp,e(t))}),!0)},go=(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)))}},yo=e=>{requestAnimationFrame((()=>requestAnimationFrame((()=>e()))))},mo=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},bo=()=>{const e=mo();return e?.activationStart??0},wo=(e,t=-1)=>{const n=mo();let r="navigate";return ho>=0?r="back-forward-cache":n&&(document.prerendering||bo()>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}},_o=new WeakMap;function Eo(e,t){return _o.get(e)||_o.set(e,new t),_o.get(e)}class So{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 To=(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{}},Io=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let ko=-1;const Po=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Ao=e=>{"hidden"===document.visibilityState&&ko>-1&&(ko="visibilitychange"===e.type?e.timeStamp:0,xo())},Oo=()=>{addEventListener("visibilitychange",Ao,!0),addEventListener("prerenderingchange",Ao,!0)},xo=()=>{removeEventListener("visibilitychange",Ao,!0),removeEventListener("prerenderingchange",Ao,!0)},Co=()=>{if(ko<0){const e=bo(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter((t=>"hidden"===t.name&&t.startTime>e))[0]?.startTime;ko=t??Po(),Oo(),vo((()=>{setTimeout((()=>{ko=Po(),Oo()}))}))}return{get firstHiddenTime(){return ko}}},Ro=e=>{document.prerendering?addEventListener("prerenderingchange",(()=>e()),!0):e()},No=[1800,3e3],Lo=(e,t={})=>{Ro((()=>{const n=Co();let r,i=wo("FCP");const o=To("paint",(e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-bo(),0),i.entries.push(t),r(!0)))}));o&&(r=go(e,i,No,t.reportAllChanges),vo((n=>{i=wo("FCP"),r=go(e,i,No,t.reportAllChanges),yo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))})))}))},Uo=[.1,.25];let Do=0,qo=1/0,jo=0;const Fo=e=>{for(const t of e)t.interactionId&&(qo=Math.min(qo,t.interactionId),jo=Math.max(jo,t.interactionId),Do=jo?(jo-qo)/7+1:0)};let Mo;const $o=()=>Mo?Do:performance.interactionCount??0;let Vo=0;class zo{u=[];l=new Map;m;p;v(){Vo=$o(),this.u.length=0,this.l.clear()}P(){const e=Math.min(this.u.length-1,Math.floor(($o()-Vo)/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 Bo=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(t(e=Io(e)),document.addEventListener("visibilitychange",e,{once:!0}))},Wo=[200,500],Ko=(e,t={})=>{globalThis.PerformanceEventTiming&&"interactionId"in PerformanceEventTiming.prototype&&Ro((()=>{"interactionCount"in performance||Mo||(Mo=To("event",Fo,{type:"event",buffered:!0,durationThreshold:0}));let n,r=wo("INP");const i=Eo(t,zo),o=e=>{Bo((()=>{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=To("event",o,{durationThreshold:t.durationThreshold??40});n=go(e,r,Wo,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),vo((()=>{i.v(),r=wo("INP"),n=go(e,r,Wo,t.reportAllChanges)})))}))};class Ho{m;h(e){this.m?.(e)}}const Jo=[2500,4e3],Yo=[800,1800],Go=e=>{document.prerendering?Ro((()=>Go(e))):"complete"!==document.readyState?addEventListener("load",(()=>Go(e)),!0):setTimeout(e)};function Qo(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Zo(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Qo(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Xo=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 u(void 0,void 0,void 0,(function(){var o,s,u;return a(this,(function(a){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),u={"[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={})=>{Ro((()=>{const n=Co();let r,i=wo("LCP");const o=Eo(t,Ho),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-bo(),0),i.entries=[t],r())},u=To("largest-contentful-paint",s);if(u){r=go(e,i,Jo,t.reportAllChanges);const n=Io((()=>{s(u.takeRecords()),u.disconnect(),r(!0)}));for(const e of["keydown","click","visibilitychange"])addEventListener(e,(()=>Bo(n)),{capture:!0,once:!0});vo((n=>{i=wo("LCP"),r=go(e,i,Jo,t.reportAllChanges),yo((()=>{i.value=performance.now()-n.timeStamp,r(!0)}))}))}}))})((function(e){u["[Amplitude] LCP"]=Zo(e)})),Lo((function(e){u["[Amplitude] FCP"]=Zo(e)})),Ko((function(e){u["[Amplitude] INP"]=Zo(e)})),((e,t={})=>{Lo(Io((()=>{let n,r=wo("CLS",0);const i=Eo(t,So),o=e=>{for(const t of e)i.h(t);i.i>r.value&&(r.value=i.i,r.entries=i.o,n())},s=To("layout-shift",o);s&&(n=go(e,r,Uo,t.reportAllChanges),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState&&(o(s.takeRecords()),n(!0))})),vo((()=>{i.i=0,r=wo("CLS",0),n=go(e,r,Uo,t.reportAllChanges),yo((()=>n()))})),setTimeout(n))})))})((function(e){u["[Amplitude] CLS"]=Zo(e)})),((e,t={})=>{let n=wo("TTFB"),r=go(e,n,Yo,t.reportAllChanges);Go((()=>{const i=mo();i&&(n.value=Math.max(i.responseStart-bo(),0),n.entries=[i],r(!0),vo((()=>{n=wo("TTFB",0),r=go(e,n,Yo,t.reportAllChanges),r(!0)})))}))})((function(e){u["[Amplitude] TTFB"]=Zo(e)})),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",u),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]}))}))},execute:function(e){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return[2,e]}))}))},teardown:function(){return u(void 0,void 0,void 0,(function(){return a(this,(function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]}))}))}}},es=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ts=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var o=e.referring_domain,u=s(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=s(a,["referrer","referring_domain"]);if(ns(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=es(o||"")!==es(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},ns=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}))},rs=function(){function e(e,t){var n,r,i,s,u,a;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(s=t.apiKey,void 0===(u="MKTG")&&(u=""),void 0===a&&(a=10),[g,u,s.substring(0,a)].filter(Boolean).join("_")),this.currentCampaign=C,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 u(this,void 0,void 0,(function(){var e,t;return a(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||me(this.sessionTimeout,this.lastEventTime),ts(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 u(this,void 0,void 0,(function(){return a(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new Qe).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,s=(t=this.currentCampaign,n=this.options,r=o(o({},C),t),i=Object.entries(r).reduce((function(e,t){var r,i=l(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 L),z(i));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),is=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),B(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i;return u(this,void 0,void 0,(function(){var s,u,c,l,d,f,p,h=this;return a(this,(function(a){switch(a.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,qt(t.apiKey,t,this)]);case 1:return(s=a.sent()).fetchRemoteConfig?(this.remoteConfigClient=new H(s.apiKey,s.loggerProvider,s.serverZone),[4,new Promise((function(e){var t;null===(t=h.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&&mn(t,s),e()}))}))]):[3,3];case 2:a.sent(),a.label=3;case 3:return[4,e.prototype._init.call(this,s)];case 4:return a.sent(),this.logBrowserOptions(s),Xe(this.config.defaultTracking)?(u=function(e){return Xe(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?o({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new rs(u,this.config),[4,this.webAttribution.init()]):[3,6];case 5:a.sent(),a.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!==(i=null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:f)&&void 0!==r?r:this.config.sessionId)&&void 0!==i?i:Date.now()),(p=ge(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,8]:[4,this.add(gn()).promise];case 7:a.sent(),a.label=8;case 8:return[4,this.add(new ie).promise];case 9:return a.sent(),[4,this.add(new ft).promise];case 10:return a.sent(),[4,this.add(new ye).promise];case 11:return a.sent(),function(e){vn||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."),vn=!0)}(this.config),v=this.config.defaultTracking,Ze(v,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(hn()).promise]):[3,13];case 12:a.sent(),a.label=13;case 13:return function(e){return Ze(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(dn()).promise]):[3,15];case 14:a.sent(),a.label=15;case 15:return et(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(un(at(this.config))).promise]):[3,17];case 16:a.sent(),a.label=17;case 17:return rt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(ro(ot(this.config))).promise]):[3,19];case 18:a.sent(),a.label=19;case 19:return it(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(oo(st(this.config))).promise]):[3,21];case 20:a.sent(),a.label=21;case 21:return nt(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(po(ut(this.config))).promise]):[3,23];case 22:a.sent(),a.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(Xo()).promise]):[3,25];case 24:a.sent(),a.label=25;case 25:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 26:return a.sent(),p.eventBridge.setEventReceiver((function(e){h.track(e.eventType,e.eventProperties)})),[2]}var v}))}))},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.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){ge(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.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){ge(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId($()),this.setUserId(void 0)},t.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}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),B(Promise.resolve());if(e===this.config.sessionId)return B(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,tt(this.config.defaultTracking)&&(r&&i&&n.push(this.track(kt,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 tt(this.config.defaultTracking)&&n.push(this.track(It,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,B(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=Ft(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(lt(t)){var r=t._q;t._q=[],t=ct(new L,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)},t.prototype.groupIdentify=function(t,n,r,i){if(lt(r)){var o=r._q;r._q=[],r=ct(new L,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(lt(t)){var r=t._q;t._q=[],t=ct(new Q,r)}return e.prototype.revenue.call(this,t,n)},t.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},t.prototype.process=function(t){return u(this,void 0,void 0,(function(){var n,r,o;return a(this,(function(s){return n=Date.now(),r=me(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===It||t.event_type===kt||t.session_id&&t.session_id!==this.getSessionId()||(r||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),t.event_type===i.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=o(o({},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)}},t}(W),os=function(){var e=new is;return{init:ke(e.init.bind(e),"init",Se(e),Ie(e,["config"])),add:ke(e.add.bind(e),"add",Se(e),Ie(e,["config.apiKey","timeline.plugins"])),remove:ke(e.remove.bind(e),"remove",Se(e),Ie(e,["config.apiKey","timeline.plugins"])),track:ke(e.track.bind(e),"track",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),logEvent:ke(e.logEvent.bind(e),"logEvent",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),identify:ke(e.identify.bind(e),"identify",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ke(e.groupIdentify.bind(e),"groupIdentify",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),setGroup:ke(e.setGroup.bind(e),"setGroup",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),revenue:ke(e.revenue.bind(e),"revenue",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),flush:ke(e.flush.bind(e),"flush",Se(e),Ie(e,["config.apiKey","timeline.queue.length"])),getUserId:ke(e.getUserId.bind(e),"getUserId",Se(e),Ie(e,["config","config.userId"])),setUserId:ke(e.setUserId.bind(e),"setUserId",Se(e),Ie(e,["config","config.userId"])),getDeviceId:ke(e.getDeviceId.bind(e),"getDeviceId",Se(e),Ie(e,["config","config.deviceId"])),setDeviceId:ke(e.setDeviceId.bind(e),"setDeviceId",Se(e),Ie(e,["config","config.deviceId"])),reset:ke(e.reset.bind(e),"reset",Se(e),Ie(e,["config","config.userId","config.deviceId"])),getSessionId:ke(e.getSessionId.bind(e),"getSessionId",Se(e),Ie(e,["config"])),setSessionId:ke(e.setSessionId.bind(e),"setSessionId",Se(e),Ie(e,["config"])),extendSession:ke(e.extendSession.bind(e),"extendSession",Se(e),Ie(e,["config"])),setOptOut:ke(e.setOptOut.bind(e),"setOptOut",Se(e),Ie(e,["config"])),setTransport:ke(e.setTransport.bind(e),"setTransport",Se(e),Ie(e,["config"])),getIdentity:ke(e.getIdentity.bind(e),"getIdentity",Se(e),Ie(e,["config"])),getOptOut:ke(e.getOptOut.bind(e),"getOptOut",Se(e),Ie(e,["config"]))}},ss=os(),us=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return J},get LogLevel(){return q},get ServerZone(){return fe},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:Le,DEFAULT_DATA_ATTRIBUTE_PREFIX:Ue,DEFAULT_ACTION_CLICK_ALLOWLIST:De}),as=ss.add,cs=ss.extendSession,ls=ss.flush,ds=ss.getDeviceId,fs=ss.getSessionId,ps=ss.getUserId,hs=ss.groupIdentify,vs=ss.identify,gs=ss.init,ys=ss.logEvent,ms=ss.remove,bs=ss.reset,ws=ss.revenue,_s=ss.setDeviceId,Es=ss.setGroup,Ss=ss.setOptOut,Ts=ss.setSessionId,Is=ss.setTransport,ks=ss.setUserId,Ps=ss.track;e.AmplitudeBrowser=is,e.Identify=L,e.Revenue=Q,e.Types=us,e.add=as,e.createInstance=os,e.extendSession=cs,e.flush=ls,e.getDeviceId=ds,e.getSessionId=fs,e.getUserId=ps,e.groupIdentify=hs,e.identify=vs,e.init=gs,e.logEvent=ys,e.remove=ms,e.reset=bs,e.revenue=ws,e.runQueuedFunctions=function(e,t){ct(e,t)},e.setDeviceId=_s,e.setGroup=Es,e.setOptOut=Ss,e.setSessionId=Ts,e.setTransport=Is,e.setUserId=ks,e.track=Ps,Object.defineProperty(e,"__esModule",{value:!0})}));
|