@amplitude/analytics-browser 2.11.13 → 2.12.1
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/attribution/campaign-parser.d.ts +8 -0
- package/lib/cjs/attribution/campaign-parser.d.ts.map +1 -0
- package/lib/cjs/attribution/campaign-parser.js +69 -0
- package/lib/cjs/attribution/campaign-parser.js.map +1 -0
- package/lib/cjs/attribution/campaign.d.ts +31 -0
- package/lib/cjs/attribution/campaign.d.ts.map +1 -0
- package/lib/cjs/attribution/campaign.js +3 -0
- package/lib/cjs/attribution/campaign.js.map +1 -0
- package/lib/cjs/attribution/constants.d.ts +22 -0
- package/lib/cjs/attribution/constants.d.ts.map +1 -0
- package/lib/cjs/attribution/constants.js +44 -0
- package/lib/cjs/attribution/constants.js.map +1 -0
- package/lib/cjs/attribution/helpers.d.ts +12 -0
- package/lib/cjs/attribution/helpers.d.ts.map +1 -0
- package/lib/cjs/attribution/helpers.js +77 -0
- package/lib/cjs/attribution/helpers.js.map +1 -0
- package/lib/cjs/attribution/web-attribution.d.ts +25 -0
- package/lib/cjs/attribution/web-attribution.d.ts.map +1 -0
- package/lib/cjs/attribution/web-attribution.js +73 -0
- package/lib/cjs/attribution/web-attribution.js.map +1 -0
- package/lib/cjs/browser-client-factory.d.ts +1 -1
- package/lib/cjs/browser-client-factory.d.ts.map +1 -1
- package/lib/cjs/browser-client-factory.js.map +1 -1
- package/lib/cjs/browser-client.d.ts +7 -8
- package/lib/cjs/browser-client.d.ts.map +1 -1
- package/lib/cjs/browser-client.js +21 -21
- package/lib/cjs/browser-client.js.map +1 -1
- package/lib/cjs/config/joined-config.d.ts +6 -1
- package/lib/cjs/config/joined-config.d.ts.map +1 -1
- package/lib/cjs/config/joined-config.js +10 -10
- package/lib/cjs/config/joined-config.js.map +1 -1
- package/lib/cjs/config.d.ts +5 -7
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +14 -18
- package/lib/cjs/config.js.map +1 -1
- package/lib/cjs/constants.d.ts +13 -13
- package/lib/cjs/constants.d.ts.map +1 -1
- package/lib/cjs/constants.js.map +1 -1
- package/lib/cjs/cookie-migration/index.d.ts +1 -1
- package/lib/cjs/cookie-migration/index.d.ts.map +1 -1
- package/lib/cjs/cookie-migration/index.js +5 -9
- package/lib/cjs/cookie-migration/index.js.map +1 -1
- package/lib/cjs/default-tracking.d.ts +18 -0
- package/lib/cjs/default-tracking.d.ts.map +1 -0
- package/lib/cjs/default-tracking.js +108 -0
- package/lib/cjs/default-tracking.js.map +1 -0
- package/lib/cjs/det-notification.d.ts +1 -1
- package/lib/cjs/det-notification.d.ts.map +1 -1
- package/lib/cjs/det-notification.js.map +1 -1
- package/lib/cjs/gtm-snippet-index.js +3 -3
- package/lib/cjs/gtm-snippet-index.js.map +1 -1
- package/lib/cjs/index.d.ts +46 -5
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +11 -1
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/plugins/context.d.ts +1 -1
- package/lib/cjs/plugins/context.d.ts.map +1 -1
- package/lib/cjs/plugins/context.js +2 -3
- package/lib/cjs/plugins/context.js.map +1 -1
- package/lib/cjs/plugins/file-download-tracking.d.ts +1 -1
- package/lib/cjs/plugins/file-download-tracking.d.ts.map +1 -1
- package/lib/cjs/plugins/file-download-tracking.js +2 -2
- package/lib/cjs/plugins/file-download-tracking.js.map +1 -1
- package/lib/cjs/plugins/form-interaction-tracking.d.ts +1 -1
- package/lib/cjs/plugins/form-interaction-tracking.d.ts.map +1 -1
- package/lib/cjs/plugins/form-interaction-tracking.js +2 -2
- package/lib/cjs/plugins/form-interaction-tracking.js.map +1 -1
- package/lib/cjs/plugins/network-connectivity-checker.d.ts +1 -1
- package/lib/cjs/plugins/network-connectivity-checker.d.ts.map +1 -1
- package/lib/cjs/plugins/network-connectivity-checker.js +2 -2
- package/lib/cjs/plugins/network-connectivity-checker.js.map +1 -1
- package/lib/cjs/snippet-index.js +3 -3
- package/lib/cjs/snippet-index.js.map +1 -1
- package/lib/cjs/storage/browser-storage.d.ts +1 -1
- package/lib/cjs/storage/browser-storage.d.ts.map +1 -1
- package/lib/cjs/storage/browser-storage.js +4 -4
- package/lib/cjs/storage/browser-storage.js.map +1 -1
- package/lib/cjs/storage/local-storage.d.ts +3 -3
- package/lib/cjs/storage/local-storage.d.ts.map +1 -1
- package/lib/cjs/storage/local-storage.js +4 -3
- package/lib/cjs/storage/local-storage.js.map +1 -1
- package/lib/cjs/storage/session-storage.js +2 -2
- package/lib/cjs/storage/session-storage.js.map +1 -1
- package/lib/cjs/transports/send-beacon.d.ts +1 -2
- package/lib/cjs/transports/send-beacon.d.ts.map +1 -1
- package/lib/cjs/transports/send-beacon.js +1 -2
- package/lib/cjs/transports/send-beacon.js.map +1 -1
- package/lib/cjs/transports/xhr.d.ts +1 -2
- package/lib/cjs/transports/xhr.d.ts.map +1 -1
- package/lib/cjs/transports/xhr.js +1 -1
- package/lib/cjs/transports/xhr.js.map +1 -1
- package/lib/cjs/utils/snippet-helper.d.ts +12 -1
- package/lib/cjs/utils/snippet-helper.d.ts.map +1 -1
- package/lib/cjs/utils/snippet-helper.js.map +1 -1
- package/lib/cjs/version.d.ts +1 -1
- package/lib/cjs/version.d.ts.map +1 -1
- package/lib/cjs/version.js +1 -1
- package/lib/cjs/version.js.map +1 -1
- package/lib/esm/attribution/campaign-parser.d.ts +8 -0
- package/lib/esm/attribution/campaign-parser.d.ts.map +1 -0
- package/lib/esm/attribution/campaign-parser.js +66 -0
- package/lib/esm/attribution/campaign-parser.js.map +1 -0
- package/lib/esm/attribution/campaign.d.ts +31 -0
- package/lib/esm/attribution/campaign.d.ts.map +1 -0
- package/lib/esm/attribution/campaign.js +2 -0
- package/lib/esm/attribution/campaign.js.map +1 -0
- package/lib/esm/attribution/constants.d.ts +22 -0
- package/lib/esm/attribution/constants.d.ts.map +1 -0
- package/lib/esm/attribution/constants.js +41 -0
- package/lib/esm/attribution/constants.js.map +1 -0
- package/lib/esm/attribution/helpers.d.ts +12 -0
- package/lib/esm/attribution/helpers.d.ts.map +1 -0
- package/lib/esm/attribution/helpers.js +70 -0
- package/lib/esm/attribution/helpers.js.map +1 -0
- package/lib/esm/attribution/web-attribution.d.ts +25 -0
- package/lib/esm/attribution/web-attribution.d.ts.map +1 -0
- package/lib/esm/attribution/web-attribution.js +70 -0
- package/lib/esm/attribution/web-attribution.js.map +1 -0
- package/lib/esm/browser-client-factory.d.ts +1 -1
- package/lib/esm/browser-client-factory.d.ts.map +1 -1
- package/lib/esm/browser-client-factory.js.map +1 -1
- package/lib/esm/browser-client.d.ts +7 -8
- package/lib/esm/browser-client.d.ts.map +1 -1
- package/lib/esm/browser-client.js +4 -4
- package/lib/esm/browser-client.js.map +1 -1
- package/lib/esm/config/joined-config.d.ts +6 -1
- package/lib/esm/config/joined-config.d.ts.map +1 -1
- package/lib/esm/config/joined-config.js +10 -10
- package/lib/esm/config/joined-config.js.map +1 -1
- package/lib/esm/config.d.ts +5 -7
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +7 -11
- package/lib/esm/config.js.map +1 -1
- package/lib/esm/constants.d.ts +13 -13
- package/lib/esm/constants.d.ts.map +1 -1
- package/lib/esm/constants.js.map +1 -1
- package/lib/esm/cookie-migration/index.d.ts +1 -1
- package/lib/esm/cookie-migration/index.d.ts.map +1 -1
- package/lib/esm/cookie-migration/index.js +5 -9
- package/lib/esm/cookie-migration/index.js.map +1 -1
- package/lib/esm/default-tracking.d.ts +18 -0
- package/lib/esm/default-tracking.d.ts.map +1 -0
- package/lib/esm/default-tracking.js +96 -0
- package/lib/esm/default-tracking.js.map +1 -0
- package/lib/esm/det-notification.d.ts +1 -1
- package/lib/esm/det-notification.d.ts.map +1 -1
- package/lib/esm/det-notification.js.map +1 -1
- package/lib/esm/gtm-snippet-index.js +1 -1
- package/lib/esm/gtm-snippet-index.js.map +1 -1
- package/lib/esm/index.d.ts +46 -5
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js +11 -2
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/plugins/context.d.ts +1 -1
- package/lib/esm/plugins/context.d.ts.map +1 -1
- package/lib/esm/plugins/context.js +2 -3
- package/lib/esm/plugins/context.js.map +1 -1
- package/lib/esm/plugins/file-download-tracking.d.ts +1 -1
- package/lib/esm/plugins/file-download-tracking.d.ts.map +1 -1
- package/lib/esm/plugins/file-download-tracking.js +1 -1
- package/lib/esm/plugins/file-download-tracking.js.map +1 -1
- package/lib/esm/plugins/form-interaction-tracking.d.ts +1 -1
- package/lib/esm/plugins/form-interaction-tracking.d.ts.map +1 -1
- package/lib/esm/plugins/form-interaction-tracking.js +1 -1
- package/lib/esm/plugins/form-interaction-tracking.js.map +1 -1
- package/lib/esm/plugins/network-connectivity-checker.d.ts +1 -1
- package/lib/esm/plugins/network-connectivity-checker.d.ts.map +1 -1
- package/lib/esm/plugins/network-connectivity-checker.js +1 -1
- package/lib/esm/plugins/network-connectivity-checker.js.map +1 -1
- package/lib/esm/snippet-index.js +1 -1
- package/lib/esm/snippet-index.js.map +1 -1
- package/lib/esm/storage/browser-storage.d.ts +1 -1
- package/lib/esm/storage/browser-storage.d.ts.map +1 -1
- package/lib/esm/storage/browser-storage.js +4 -4
- package/lib/esm/storage/browser-storage.js.map +1 -1
- package/lib/esm/storage/local-storage.d.ts +3 -3
- package/lib/esm/storage/local-storage.d.ts.map +1 -1
- package/lib/esm/storage/local-storage.js +4 -3
- package/lib/esm/storage/local-storage.js.map +1 -1
- package/lib/esm/storage/session-storage.js +1 -1
- package/lib/esm/storage/session-storage.js.map +1 -1
- package/lib/esm/transports/send-beacon.d.ts +1 -2
- package/lib/esm/transports/send-beacon.d.ts.map +1 -1
- package/lib/esm/transports/send-beacon.js +1 -2
- package/lib/esm/transports/send-beacon.js.map +1 -1
- package/lib/esm/transports/xhr.d.ts +1 -2
- package/lib/esm/transports/xhr.d.ts.map +1 -1
- package/lib/esm/transports/xhr.js +2 -2
- package/lib/esm/transports/xhr.js.map +1 -1
- package/lib/esm/utils/snippet-helper.d.ts +12 -1
- package/lib/esm/utils/snippet-helper.d.ts.map +1 -1
- package/lib/esm/utils/snippet-helper.js.map +1 -1
- package/lib/esm/version.d.ts +1 -1
- package/lib/esm/version.d.ts.map +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/attribution/campaign-parser.d.ts +8 -0
- package/lib/scripts/attribution/campaign-parser.d.ts.map +1 -0
- package/lib/scripts/attribution/campaign.d.ts +31 -0
- package/lib/scripts/attribution/campaign.d.ts.map +1 -0
- package/lib/scripts/attribution/constants.d.ts +22 -0
- package/lib/scripts/attribution/constants.d.ts.map +1 -0
- package/lib/scripts/attribution/helpers.d.ts +12 -0
- package/lib/scripts/attribution/helpers.d.ts.map +1 -0
- package/lib/scripts/attribution/web-attribution.d.ts +25 -0
- package/lib/scripts/attribution/web-attribution.d.ts.map +1 -0
- package/lib/scripts/browser-client-factory.d.ts +1 -1
- package/lib/scripts/browser-client-factory.d.ts.map +1 -1
- package/lib/scripts/browser-client.d.ts +7 -8
- package/lib/scripts/browser-client.d.ts.map +1 -1
- package/lib/scripts/config/joined-config.d.ts +6 -1
- package/lib/scripts/config/joined-config.d.ts.map +1 -1
- package/lib/scripts/config.d.ts +2 -4
- package/lib/scripts/config.d.ts.map +1 -1
- package/lib/scripts/constants.d.ts +1 -1
- package/lib/scripts/constants.d.ts.map +1 -1
- package/lib/scripts/cookie-migration/index.d.ts +1 -1
- package/lib/scripts/cookie-migration/index.d.ts.map +1 -1
- package/lib/scripts/default-tracking.d.ts +18 -0
- package/lib/scripts/default-tracking.d.ts.map +1 -0
- package/lib/scripts/det-notification.d.ts +1 -1
- package/lib/scripts/det-notification.d.ts.map +1 -1
- package/lib/scripts/index.d.ts +46 -5
- package/lib/scripts/index.d.ts.map +1 -1
- package/lib/scripts/plugins/context.d.ts +1 -1
- package/lib/scripts/plugins/context.d.ts.map +1 -1
- package/lib/scripts/plugins/file-download-tracking.d.ts +1 -1
- package/lib/scripts/plugins/file-download-tracking.d.ts.map +1 -1
- package/lib/scripts/plugins/form-interaction-tracking.d.ts +1 -1
- package/lib/scripts/plugins/form-interaction-tracking.d.ts.map +1 -1
- package/lib/scripts/plugins/network-connectivity-checker.d.ts +1 -1
- package/lib/scripts/plugins/network-connectivity-checker.d.ts.map +1 -1
- package/lib/scripts/storage/browser-storage.d.ts +1 -1
- package/lib/scripts/storage/browser-storage.d.ts.map +1 -1
- package/lib/scripts/storage/local-storage.d.ts +3 -3
- package/lib/scripts/storage/local-storage.d.ts.map +1 -1
- package/lib/scripts/transports/send-beacon.d.ts +1 -2
- package/lib/scripts/transports/send-beacon.d.ts.map +1 -1
- package/lib/scripts/transports/xhr.d.ts +1 -2
- package/lib/scripts/transports/xhr.d.ts.map +1 -1
- package/lib/scripts/utils/snippet-helper.d.ts +12 -1
- package/lib/scripts/utils/snippet-helper.d.ts.map +1 -1
- package/lib/scripts/version.d.ts +1 -1
- package/lib/scripts/version.d.ts.map +1 -1
- package/package.json +5 -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=function(){return r=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},r.apply(this,arguments)};function i(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 o(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 s(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)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 s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){s.label=u[1];break}if(6===u[0]&&s.label<i[1]){s.label=i[1],i=u;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(u);break}i[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}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 u(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 a(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 c(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 l(e){return this instanceof l?(this.v=e,this):new l(e)}function d(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||u(e,t)}))})}function u(e,t){try{(n=i[e](t)).value instanceof l?Promise.resolve(n.value.v).then(a,c):d(o[0][2],n)}catch(e){d(o[0][3],e)}var n}function a(e){u("next",e)}function c(e){u("throw",e)}function d(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function f(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=u(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)}))}}}var h,p,v,g,y,m;!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"}(h||(h={})),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"}(p||(p={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(v||(v={})),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"}(g||(g={})),function(e){e.US="US",e.EU="EU"}(y||(y={})),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"}(m||(m={}));var b=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],w="data-amp-track-",_=["div","span","h1","h2","h3","h4","h5","h6"],E=Object.freeze({__proto__:null,get SpecialEventType(){return v},get IdentifyOperation(){return h},get RevenueProperty(){return p},get LogLevel(){return g},get ServerZone(){return y},get Status(){return m},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:b,DEFAULT_DATA_ATTRIBUTE_PREFIX:w,DEFAULT_ACTION_CLICK_ALLOWLIST:_}),S=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=m.Unknown),{event:e,code:t,message:n}},I=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,I)},T=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 o(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(t.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=I(),t.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 o(this,void 0,void 0,(function(){var r,i;return s(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 o(this,void 0,void 0,(function(){var t,n,i,o,c,l,d,f,h,p,v,g,y,m,b,w,_,E,I,T;return s(this,(function(s){switch(s.label){case 0:if(!e)return[2];t=a(e,1),n=t[0],i=a(e,2),o=i[1],c=this.plugins.filter((function(e){return"before"===e.type})),s.label=1;case 1:s.trys.push([1,6,7,8]),l=u(c),d=l.next(),s.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(r({},n))]:[3,4];case 3:if(null===(y=s.sent()))return o({event:n,code:0,message:""}),[2];n=y,s.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=s.sent(),_={error:f},[3,8];case 7:try{d&&!d.done&&(E=l.return)&&E.call(l)}finally{if(_)throw _.error}return[7];case 8:h=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),s.label=9;case 9:s.trys.push([9,14,15,16]),p=u(h),v=p.next(),s.label=10;case 10:return v.done?[3,13]:(g=v.value).execute?[4,g.execute(r({},n))]:[3,12];case 11:if(null===(y=s.sent()))return o({event:n,code:0,message:""}),[2];n=y,s.label=12;case 12:return v=p.next(),[3,10];case 13:return[3,16];case 14:return m=s.sent(),I={error:m},[3,16];case 15:try{v&&!v.done&&(T=p.return)&&T.call(p)}finally{if(I)throw I.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),w=b.map((function(e){var t=r({},n);return e.execute(t).catch((function(e){return S(t,0,String(e))}))})),Promise.all(w).then((function(e){var t=a(e,1)[0]||S(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return o(this,void 0,void 0,(function(){var e,t,n,r=this;return s(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}(),k="AMP",x="".concat(k,"_unsent"),P="https://api2.amplitude.com/2/httpapi",O=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!A(t,n))return!1}return!0},A=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&O(a);else if(!["number","string"].includes(typeof a))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 O(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},C=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return r({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(h.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(h.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(h.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(h.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(h.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(h.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(h.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(h.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(h.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[h.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[h.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===h.ADD?"number"==typeof n:e===h.UNSET||e===h.REMOVE||A(t,n)))},e}(),R=function(e,t){return r(r({},t),{event_type:v.IDENTIFY,user_properties:e.getUserProperties()})},N=function(e){return{promise:e||Promise.resolve()}},L=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 T(this),this.name=e}return e.prototype._init=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return o(this,void 0,void 0,(function(){var t,n,r,i,o,a,c,l;return s(this,(function(s){switch(s.label){case 0:t=this[e],this[e]=[],s.label=1;case 1:s.trys.push([1,8,9,10]),n=u(t),r=n.next(),s.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 s.sent(),[3,6];case 4:return[4,o];case 5:s.sent(),s.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return a=s.sent(),c={error:a},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:s.sent(),s.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var i=function(e,t,n){return r(r(r({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return N(this.dispatch(i))},e.prototype.identify=function(e,t){var n=R(e,t);return N(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var o=function(e,t,n,i){var o;return r(r({},i),{event_type:v.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n,i);return N(this.dispatch(o))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,o=new C;return o.set(e,t),r(r({},n),{event_type:v.IDENTIFY,user_properties:o.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return N(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return r(r({},t),{event_type:v.REVENUE,event_properties:e.getEventProperties()})}(e,t);return N(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),N())},e.prototype._addPlugin=function(e){return N(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)),N())},e.prototype._removePlugin=function(e){return N(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(S(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return o(this,void 0,void 0,(function(){var t=this;return s(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.process=function(e){return o(this,void 0,void 0,(function(){var t,n,r;return s(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,S(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(r=i.sent()).code?this.config.loggerProvider.log(r.message):100===r.code?this.config.loggerProvider.warn(r.message):this.config.loggerProvider.error(r.message),[2,r];case 2:return t=i.sent(),n=String(t),this.config.loggerProvider.error(n),[2,r=S(e,0,n)];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=Boolean(e)},e.prototype.flush=function(){return N(this.timeline.flush())},e}(),U=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.setEventProperties=function(e){return O(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?r({},this.properties):{};return e[p.REVENUE_PRODUCT_ID]=this.productId,e[p.REVENUE_QUANTITY]=this.quantity,e[p.REVENUE_PRICE]=this.price,e[p.REVENUE_TYPE]=this.revenueType,e[p.REVENUE_CURRENCY]=this.currency,e[p.REVENUE]=this.revenue,e},e}(),q="Amplitude Logger ",D=function(){function e(){this.logLevel=g.None}return e.prototype.disable=function(){this.logLevel=g.None},e.prototype.enable=function(e){void 0===e&&(e=g.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<g.Verbose||console.log("".concat(q,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<g.Warn||console.warn("".concat(q,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<g.Error||console.error("".concat(q,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<g.Debug||console.log("".concat(q,"[Debug]: ").concat(e.join(" ")))},e}(),j=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:g.Warn,loggerProvider:new D,offline:!1,optOut:!1,serverUrl:P,serverZone:"US",useBatch:!1}},F=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=j();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=V(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}(),M=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":P},V=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=j().serverZone),void 0===n&&(n=j().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:j().serverZone;return{serverZone:r,serverUrl:M(r,n)}},z=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function K(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var B=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 o(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(x,"_").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=I()),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),o(this,void 0,void 0,(function(){var t,n,r,i=this;return s(this,(function(u){switch(u.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)})),a=t,c=this.config.flushQueueSize,l=Math.max(c,1),r=a.reduce((function(e,t,n){var r=Math.floor(n/l);return e[r]||(e[r]=[]),e[r].push(t),e}),[]),[4,r.reduce((function(t,n){return o(i,void 0,void 0,(function(){return s(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 u.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var a,c,l}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),o(this,void 0,void 0,(function(){var n,r,o,u,a;return s(this,(function(s){switch(s.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,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new z,s.label=1;case 1:return s.trys.push([1,3,,4]),r=V(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(o=s.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(K(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return u=s.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.handleResponse({status:m.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 m.Success:this.handleSuccessResponse(e,t);break;case m.Invalid:this.handleInvalidResponse(e,t);break;case m.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case m.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=c(c(c(c([],a(Object.values(e.body.eventsWithInvalidFields)),!1),a(Object.values(e.body.eventsWithMissingFields)),!1),a(Object.values(e.body.eventsWithInvalidIdLengths)),!1),a(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(K(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(K(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(K(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(S(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}(),W=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},$=function(e){return function(){var t=r({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},J=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=u(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},Q=function(e,t){return function(){var n,r,i={};try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=J(e,a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},Y=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<g.Debug||!c||!a)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:W(1),time:{start:(new Date).toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then((function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))})):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),a.debug(JSON.stringify(l,null,2))),d}},H=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Z=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,h,p,v,g,y,b,w,_,E,S;if("object"!=typeof e)return null;var I=e.code||0,T=this.buildStatus(I);switch(T){case m.Success:return{status:T,statusCode:I,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 m.Invalid:return{status:T,statusCode:I,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!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case m.PayloadTooLarge:return{status:T,statusCode:I,body:{error:null!==(v=e.error)&&void 0!==v?v:""}};case m.RateLimit:return{status:T,statusCode:I,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(_=e.exceeded_daily_quota_devices)&&void 0!==_?_:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case m.Timeout:default:return{status:T,statusCode:I}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?m.Success:429===e?m.RateLimit:413===e?m.PayloadTooLarge:408===e?m.Timeout:e>=400&&e<500?m.Invalid:e>=500?m.Failed:m.Unknown},e}(),G=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},X=function(){var e,t=G();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""}},te="dclid",ne="fbclid",re="gbraid",ie="gclid",oe="ko_click_id",se="li_fat_id",ue="msclkid",ae="rtd_cid",ce="ttclid",le="twclid",de="wbraid",fe={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},he=function(){function e(){}return e.prototype.parse=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,r(r(r(r({},fe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=X();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=X();return(e={})[te]=t[te],e[ne]=t[ne],e[re]=t[re],e[ie]=t[ie],e[oe]=t[oe],e[se]=t[se],e[ue]=t[ue],e[ae]=t[ae],e[ce]=t[ce],e[le]=t[le],e[de]=t[de],e},e}(),pe=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[k,t,e.substring(0,n)].filter(Boolean).join("_")},ve=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ge=function(e,t,n,r,o){void 0===o&&(o=!0),e.referrer;var s=e.referring_domain,u=i(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=i(a,["referrer","referring_domain"]);if(ye(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(!o&&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=ve(s||"")!==ve(c||""),h=!t||d||f;return h?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."),h},ye=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}))},me=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},be=function(){function e(e,t){var n,i,o,s,u,a;this.shouldTrackNewCampaign=!1,this.options=r({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(i=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,o=i,o?(o.startsWith(".")&&(o=o.substring(1)),[new RegExp("".concat(o.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(s=t.apiKey,void 0===(u="MKTG")&&(u=""),void 0===a&&(a=10),[k,u,s.substring(0,a)].filter(Boolean).join("_")),this.currentCampaign=fe,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 o(this,void 0,void 0,(function(){var e,t;return s(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=a.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||me(this.sessionTimeout,this.lastEventTime),ge(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 o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new he).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,i,o,s=(t=this.currentCampaign,n=this.options,i=r(r({},fe),t),o=Object.entries(i).reduce((function(e,t){var r,i=a(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 C),R(o));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),we=function(){function e(e){this.options=r({},e)}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n;return s(this,(function(r){switch(r.label){case 0:if(!G())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 o(this,void 0,void 0,(function(){var n,r;return s(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=_e(n))&&void 0!==t?t:Ee(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 o(this,void 0,void 0,(function(){var r,i,o;return s(this,(function(s){return r=G(),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+"=")})))?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return o(this,void 0,void 0,(function(){var r,i,o,u,a,c,l;return s(this,(function(s){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(i=null!==t?r:-1)&&((u=new Date).setTime(u.getTime()+24*i*60*60*1e3),o=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=G())&&(c.document.cookie=a)}catch(t){l=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}return[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(e){return[2]}))}))},e}(),_e=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},Ee=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},Se=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n,r,i;return s(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}(Z),Ie=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Te(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Te=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ke=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}(),xe=function(){return xe=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},xe.apply(this,arguments)},Pe=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var r=0,i=["string","number","boolean","undefined"];r<i.length;r++){if(i[r]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),a=Object.keys(t).sort();if(!Pe(u,a))return!1;var c=!0;return Object.keys(e).forEach((function(n){Pe(e[n],t[n])||(c=!1)})),c}for(var l=0;l<e.length;l++)if(!Pe(e[l],t[l]))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 Oe=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=xe({},this.identity.userProperties),n=xe(xe({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},r=0,i=Object.entries(e);r<i.length;r++){var o=i[r],s=o[0],u=o[1];switch(s){case"$set":for(var a=0,c=Object.entries(u);a<c.length;a++){var l=c[a],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var h=0,p=Object.keys(u);h<p.length;h++){delete t[d=p[h]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return xe({},this.identity)},e.prototype.setIdentity=function(e){var t=xe({},this.identity);this.identity=xe({},e),Pe(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}(),Ae="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Ce=function(){function e(){this.identityStore=new Oe,this.eventBridge=new ke,this.applicationContextProvider=new Ie}return e.getInstance=function(t){return Ae.analyticsConnectorInstances||(Ae.analyticsConnectorInstances={}),Ae.analyticsConnectorInstances[t]||(Ae.analyticsConnectorInstances[t]=new e),Ae.analyticsConnectorInstances[t]},e}(),Re=function(e){return void 0===e&&(e="$default_instance"),Ce.getInstance(e)},Ne=function(){function e(){this.name="identity",this.type="before",this.identityStore=Re().identityStore}return e.prototype.execute=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return e.instanceName&&(this.identityStore=Re(e.instanceName).identityStore),[2]}))}))},e}(),Le=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:""},Ue=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},qe=function(e){return Ue(e,"attribution")},De=function(e){return Ue(e,"pageViews")},je=function(e){return Ue(e,"sessions")},Fe=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Me=function(e){if(Fe(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},Ve=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return De(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}},ze=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},Ke=function(e){return e&&void 0!==e._q},Be=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts","/").concat("2.11.13"),"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 o(this,void 0,void 0,(function(){var i,o,u;return s(this,(function(s){return i=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=i),[2,r(r(r(r(r(r(r(r({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Le()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:I(),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:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),We=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n,r;return s(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 o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),$e=1e3,Je=function(e){function t(t){var n,r=this;return(r=e.call(this,null===(n=G())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,r}return n(t,e),t.prototype.set=function(t,n){var r;return o(this,void 0,void 0,(function(){var i;return s(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>$e?(i=n.length-$e,[4,e.prototype.set.call(this,t,n.slice(0,$e))]):[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($e,".")),[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}(We),Qe=function(e){function t(){var t;return e.call(this,null===(t=G())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(We),Ye=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 o(this,void 0,void 0,(function(){var n=this;return s(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}(Z),He=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(r){return[2,new Promise((function(r,i){var o=G();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}(Z),Ze=function(e,t,n){return void 0===n&&(n=!0),o(void 0,void 0,void 0,(function(){var r,i,o,u,c,l,d,f,h;return s(this,(function(s){switch(s.label){case 0:return r=function(e){return"".concat(k.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=s.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:s.sent(),s.label=3;case 3:return o=a(i.split("."),6),u=o[0],c=o[1],l=o[2],d=o[3],f=o[4],h=o[5],[2,{deviceId:u,userId:Xe(c),sessionId:Ge(d),lastEventId:Ge(h),lastEventTime:Ge(f),optOut:Boolean(l)}]}}))}))},Ge=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Xe=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},et="[Amplitude]",tt="".concat(et," Form Started"),nt="".concat(et," Form Submitted"),rt="".concat(et," File Downloaded"),it="session_start",ot="session_end",st="".concat(et," File Extension"),ut="".concat(et," File Name"),at="".concat(et," Link ID"),ct="".concat(et," Link Text"),lt="".concat(et," Link URL"),dt="".concat(et," Form ID"),ft="".concat(et," Form Name"),ht="".concat(et," Form Destination"),pt="cookie",vt=function(e){function t(t,n,r,i,o,s,u,a,c,l,d,f,h,p,v,y,m,b,w,_,E,S,I,T,k,x,P,O,A,C,R,N,L,U){void 0===r&&(r=new H),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=pt),void 0===y&&(y=new D),void 0===m&&(m=g.Warn),void 0===w&&(w=!1),void 0===_&&(_=!1),void 0===I&&(I=""),void 0===T&&(T="US"),void 0===x&&(x=18e5),void 0===P&&(P=new Je({loggerProvider:y})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===A&&(A="fetch"),void 0===C&&(C=!1),void 0===R&&(R=!1);var q=e.call(this,{apiKey:t,storageProvider:P,transportProvider:mt(A)})||this;return q.apiKey=t,q.appVersion=n,q.cookieOptions=i,q.defaultTracking=o,q.autocapture=s,q.flushIntervalMillis=a,q.flushMaxRetries=c,q.flushQueueSize=l,q.identityStorage=d,q.ingestionMetadata=f,q.instanceName=h,q.loggerProvider=y,q.logLevel=m,q.minIdLength=b,q.offline=w,q.partnerId=E,q.plan=S,q.serverUrl=I,q.serverZone=T,q.sessionTimeout=x,q.storageProvider=P,q.trackingOptions=O,q.transport=A,q.useBatch=C,q.fetchRemoteConfig=R,q._optOut=!1,q._cookieStorage=r,q.deviceId=u,q.lastEventId=p,q.lastEventTime=v,q.optOut=_,q.sessionId=k,q.pageCounter=L,q.userId=N,q.debugLogsEnabled=U,q.loggerProvider.enable(U?g.Debug:q.logLevel),q}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(pe(this.apiKey),e)},t}(F),gt=function(e,t,n){return void 0===t&&(t={}),o(void 0,void 0,void 0,(function(){var i,o,u,a,c,l,d,f,h,p,v,g,y,m,b,w,_,E,S,T,k,x,P,O,A,C,R,N,L,U,q,D,j,F,M,V,z,K,B,W,$,J,Q;return s(this,(function(s){switch(s.label){case 0:return i=t.identityStorage||pt,S={},i===pt?[3,1]:(u="",[3,5]);case 1:return null===(k=null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)||void 0===k?[3,2]:(a=k,[3,4]);case 2:return[4,bt()];case 3:a=s.sent(),s.label=4;case 4:u=a,s.label=5;case 5:return o=r.apply(void 0,[(S.domain=u,S.expiration=365,S.sameSite="Lax",S.secure=!1,S.upgrade=!0,S),t.cookieOptions]),c=yt(t.identityStorage,o),[4,Ze(e,c,null===(P=null===(x=t.cookieOptions)||void 0===x?void 0:x.upgrade)||void 0===P||P)];case 6:return l=s.sent(),[4,c.get(pe(e))];case 7:return d=s.sent(),f=X(),h=null!==(N=null!==(R=null!==(C=null!==(A=null!==(O=t.deviceId)&&void 0!==O?O:f.ampDeviceId)&&void 0!==A?A:f.deviceId)&&void 0!==C?C:null==d?void 0:d.deviceId)&&void 0!==R?R:l.deviceId)&&void 0!==N?N:I(),p=null!==(L=null==d?void 0:d.lastEventId)&&void 0!==L?L:l.lastEventId,v=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,g=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,y=null!==(j=null==d?void 0:d.sessionId)&&void 0!==j?j:l.sessionId,m=null!==(M=null!==(F=t.userId)&&void 0!==F?F:null==d?void 0:d.userId)&&void 0!==M?M:l.userId,n.previousSessionDeviceId=null!==(V=null==d?void 0:d.deviceId)&&void 0!==V?V:l.deviceId,n.previousSessionUserId=null!==(z=null==d?void 0:d.userId)&&void 0!==z?z:l.userId,b={ipAddress:null===(B=null===(K=t.trackingOptions)||void 0===K?void 0:K.ipAddress)||void 0===B||B,language:null===($=null===(W=t.trackingOptions)||void 0===W?void 0:W.language)||void 0===$||$,platform:null===(Q=null===(J=t.trackingOptions)||void 0===J?void 0:J.platform)||void 0===Q||Q},w=null==d?void 0:d.pageCounter,_=null==d?void 0:d.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(E=new vt(e,t.appVersion,c,o,t.defaultTracking,t.autocapture,h,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,t.instanceName,p,v,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,b,t.transport,t.useBatch,t.fetchRemoteConfig,m,w,_)).storageProvider.isEnabled()];case 8:return s.sent()||(E.loggerProvider.warn("Storage provider ".concat(E.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),E.storageProvider=new H),[2,E]}}))}))},yt=function(e,t){switch(void 0===e&&(e=pt),void 0===t&&(t={}),e){case"localStorage":return new Je;case"sessionStorage":return new Qe;case"none":return new H;default:return new we(r(r({},t),{expirationDays:t.expiration}))}},mt=function(e){return"xhr"===e?new Ye:"beacon"===e?new He:new Se},bt=function(e){return o(void 0,void 0,void 0,(function(){var t,n,r,i,o,u,a;return s(this,(function(s){switch(s.label){case 0:return[4,(new we).isEnabled()];case 1:if(!s.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,s.label=2;case 2:return o<r.length?(u=r[o],[4,(a=new we({domain:"."+u})).set(i,1)]):[3,7];case 3:return s.sent(),[4,a.get(i)];case 4:return s.sent()?[4,a.remove(i)]:[3,6];case 5:return s.sent(),[2,"."+u];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},wt=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},_t=function(e){var t;void 0===e&&(e={});var n,i,u=G(),c=void 0,l=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,h=void 0===f?"[Amplitude] Page Viewed":f,p=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==c||c.error("Malformed URI sequence: ",e)}return t},v=function(){return o(void 0,void 0,void 0,(function(){var e,t,n;return s(this,(function(i){switch(i.label){case 0:return e=p("undefined"!=typeof location&&location.href||""),n={event_type:h},t=[{}],[4,Et()];case 1:return[2,(n.event_properties=r.apply(void 0,[r.apply(void 0,t.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&p(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===l||"function"==typeof l&&l()},y="undefined"!=typeof location?location.href:null,m=function(){return o(void 0,void 0,void 0,(function(){var e,n,r,i;return s(this,(function(o){switch(o.label){case 0:return e=location.href,n=It(d,e,y||"")&&g(),y=e,n?(null==c||c.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return i=(r=t).track,[4,v()];case 2:i.apply(r,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return[2]}}))}))},b=function(){m()},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,r){return o(void 0,void 0,void 0,(function(){var o,l;return s(this,(function(s){switch(s.label){case 0:return t=r,i=e,(c=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),u&&(u.addEventListener("popstate",b),n=u.history.pushState,u.history.pushState=new Proxy(u.history.pushState,{apply:function(e,t,n){var r=a(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),m()}})),g()?(c.log("Tracking page view event"),l=(o=t).track,[4,v()]):[3,2];case 1:l.apply(o,[s.sent()]),s.label=2;case 2:return[2]}}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return"attribution"===l&&St(e)?(null==c||c.log("Enriching campaign event to page view event with campaign parameters"),[4,v()]):[3,2];case 1:t=n.sent(),e.event_type=t.event_type,e.event_properties=r(r({},e.event_properties),t.event_properties),n.label=2;case 2:return i&&e.event_type===h&&(i.pageCounter=i.pageCounter?i.pageCounter+1:1,e.event_properties=r(r({},e.event_properties),{"[Amplitude] Page Counter":i.pageCounter})),[2,e]}}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(e){return u&&(u.removeEventListener("popstate",b),n&&(u.history.pushState=n)),[2]}))}))}};return w},Et=function(){return o(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=wt,[4,(new he).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},St=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[h.SET]||{},r=t[h.UNSET]||{},i=c(c([],a(Object.keys(n)),!1),a(Object.keys(r)),!1);return Object.keys(fe).every((function(e){return i.includes(e)}))}return!1},It=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},Tt=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 o(void 0,void 0,void 0,(function(){var i;return s(this,(function(o){return null===(i=G())||void 0===i||i.addEventListener("load",(function(){if(r){if("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n,i=xt(e);t||r.track(tt,((n={})[dt]=kt(e.id),n[ft]=kt(e.name),n[ht]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=xt(e);t||r.track(tt,((n={})[dt]=kt(e.id),n[ft]=kt(e.name),n[ht]=o,n)),r.track(nt,((i={})[dt]=kt(e.id),i[ft]=kt(e.name),i[ht]=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.")})),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(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]}))}))}}},kt=function(e){if("string"==typeof e)return e},xt=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Pt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return o(void 0,void 0,void 0,(function(){var i;return s(this,(function(o){return null===(i=G())||void 0===i||i.addEventListener("load",(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(rt,((t={})[st]=s,t[ut]=n.pathname,t[at]=e.id,t[ct]=e.text,t[lt]=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.")})),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(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]}))}))}}},Ot=!1,At=function(){var e=G(),t=[],n=function(n,r){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 o(void 0,void 0,void 0,(function(){return s(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 o(void 0,void 0,void 0,(function(){return s(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;e&&e.removeEventListener(n,r)})),t=[],[2]}))}))}}},Ct="Remote config fetch rejected due to timeout after 5 seconds",Rt=function(){function e(e){var t=e.localConfig,n=e.configKeys,i=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(e,t,n){return o(i,void 0,void 0,(function(){var r,i,o;return s(this,(function(s){switch(s.label){case 0:return r=Date.now(),[4,this.fetchWithTimeout(n)];case 1:return(i=s.sent())&&(o=i.configs&&i.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-r,[2,o[t]]):(this.metrics.fetchTimeAPIFail=Date.now()-r,[2,void 0])}}))}))},this.fetchWithTimeout=function(e){return o(i,void 0,void 0,(function(){var t,n,r;return s(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 o(i,void 0,void 0,(function(){var n,i,o,a,c,l,d,f,h,p,v;return s(this,(function(s){switch(s.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:Ct})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),s.label=1;case 1:s.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(i=u(this.configKeys),o=i.next();!o.done;o=i.next())a=o.value,n.append("config_keys",a)}catch(e){p={error:e}}finally{try{o&&!o.done&&(v=i.return)&&v.call(i)}finally{if(p)throw p.error}}return t&&n.set("session_id",String(t)),c={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,r(r({},c),{signal:e}))];case 2:if(null===(d=s.sent()))return[2,this.completeRequest({err:"Unexpected error occurred"})];switch((new Z).buildStatus(d.status)){case m.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case m.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=s.sent(),h=f,e.aborted?[2,this.completeRequest({err:Ct})]:[2,this.completeRequest({err:h.message})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return o(i,void 0,void 0,(function(){var n=this;return s(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 o(i,void 0,void 0,(function(){var t;return s(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.serverZone===y.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===y.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}(),Nt=function(e){var t=e.localConfig,n=e.configKeys;return o(void 0,void 0,void 0,(function(){return s(this,(function(e){return[2,new Rt({localConfig:t,configKeys:n})]}))}))},Lt=function(){function e(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return o(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=this,[4,Nt({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=t.sent(),[2]}}))}))},e.prototype.generateJoinedConfig=function(){var e,t,n,i;return o(this,void 0,void 0,(function(){var o,u,a;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),(u=this.remoteConfigFetch)?[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)]:[3,2];case 1:u=s.sent(),s.label=2;case 2:return o=u,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(o,null,2)),o&&"autocapture"in o&&("boolean"==typeof o.autocapture&&(this.config.autocapture=o.autocapture),"object"==typeof o.autocapture&&(void 0===this.config.autocapture&&(this.config.autocapture=o.autocapture),"boolean"==typeof this.config.autocapture&&(this.config.autocapture=r({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},o.autocapture)),"object"==typeof this.config.autocapture&&(this.config.autocapture=r(r({},this.config.autocapture),o.autocapture))),this.config.defaultTracking=this.config.autocapture),this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),null!==(e=(i=this.config).requestMetadata)&&void 0!==e||(i.requestMetadata=new z),(null===(t=this.remoteConfigFetch)||void 0===t?void 0:t.metrics.fetchTimeAPISuccess)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),(null===(n=this.remoteConfigFetch)||void 0===n?void 0:n.metrics.fetchTimeAPIFail)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return a=s.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",a),[3,4];case 4:return[2,this.config]}}))}))},e}(),Ut="[Amplitude] Element Clicked",qt="[Amplitude] Element Tag",Dt="[Amplitude] Element Text",jt="[Amplitude] Element Selector",Ft="[Amplitude] Page URL",Mt="https://app.amplitude.com",Vt={US:Mt,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},zt="amp-visual-tagging-selector-highlight";function Kt(e){return"function"==typeof e}function Bt(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 Wt=Bt((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 $t(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Jt=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=u(o),l=s.next();!l.done;l=s.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(Kt(d))try{d()}catch(e){i=e instanceof Wt?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var h=u(f),p=h.next();!p.done;p=h.next()){var v=p.value;try{Ht(v)}catch(e){i=null!=i?i:[],e instanceof Wt?i=c(c([],a(i)),a(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(i)throw new Wt(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Ht(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)&&$t(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&$t(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Qt=Jt.EMPTY;function Yt(e){return e instanceof Jt||e&&"closed"in e&&Kt(e.remove)&&Kt(e.add)&&Kt(e.unsubscribe)}function Ht(e){Kt(e)?e():e.unsubscribe()}var Zt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},Gt=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,c([e,t],a(n)))};function Xt(e){Gt((function(){throw e}))}function en(){}function tn(e){e()}var nn=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Yt(t)&&t.add(n)):n.destination=cn,n}return n(t,e),t.create=function(e,t,n){return new un(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}(Jt),rn=Function.prototype.bind;function on(e,t){return rn.call(e,t)}var sn=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){an(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){an(e)}else an(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){an(e)}},e}(),un=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;Kt(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&Zt.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&on(t.next,o),error:t.error&&on(t.error,o),complete:t.complete&&on(t.complete,o)}):i=t;return s.destination=new sn(i),s}return n(t,e),t}(nn);function an(e){Xt(e)}var cn={closed:!0,next:en,error:function(e){throw e},complete:en},ln="function"==typeof Symbol&&Symbol.observable||"@@observable";function dn(e){return e}function fn(e){return 0===e.length?dn:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var hn=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 nn||function(e){return e&&Kt(e.next)&&Kt(e.error)&&Kt(e.complete)}(r)&&Yt(r)?e:new un(e,t,n);return tn((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=pn(t))((function(t,r){var i=new un({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[ln]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return fn(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=pn(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 pn(e){var t;return null!==(t=null!=e?e:Zt.Promise)&&void 0!==t?t:Promise}function vn(e){return Kt(null==e?void 0:e.lift)}function gn(e){return function(t){if(vn(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 yn(e,t,n,r,i){return new mn(e,t,n,r,i)}var mn=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}(nn);!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,vn(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 Jt;var n=this.getSubject();t.add(this.source.subscribe(yn(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=Jt.EMPTY)}return t},t.prototype.refCount=function(){return gn((function(e,t){var n=null;e._refCount++;var r=yn(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)}}(hn);var bn,wn={now:function(){return(wn.delegate||performance).now()},delegate:void 0},_n={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new Jt((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=_n.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,c([],a(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,c([],a(e)))},delegate:void 0};new hn((function(e){var t=bn||wn,n=t.now(),r=0,i=function(){e.closed||(r=_n.requestAnimationFrame((function(o){r=0;var s=t.now();e.next({timestamp:bn?s:o,elapsed:s-n}),i()})))};return i(),function(){r&&_n.cancelAnimationFrame(r)}}));var En=Bt((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Sn=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 In(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new En},t.prototype.next=function(e){var t=this;tn((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=u(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;tn((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;tn((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?Qt:(this.currentObservers=null,o.push(e),new Jt((function(){t.currentObservers=null,$t(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 hn;return e.source=this,e},t.create=function(e,t){return new In(e,t)},t}(hn),In=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:Qt},t}(Sn);!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)}}(Sn);var Tn={now:function(){return(Tn.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=Tn);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)}}}(Sn),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))}}(Sn);var kn,xn=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(Jt),Pn=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,c([e,t],a(n)))},On=function(e){return clearInterval(e)},An=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),Pn(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&&On(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,$t(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(xn),Cn=1,Rn={};function Nn(e){return e in Rn&&(delete Rn[e],!0)}var Ln=function(e){var t=Cn++;return Rn[t]=!0,kn||(kn=Promise.resolve()),kn.then((function(){return Nn(t)&&e()})),t},Un=function(e){Nn(e)},qn={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=qn.delegate;return((null==n?void 0:n.setImmediate)||Ln).apply(void 0,c([],a(e)))},clearImmediate:function(e){return Un(e)},delegate:void 0},Dn=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=qn.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&&(qn.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},t}(An),jn=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=Tn.now,e}(),Fn=function(e){function t(t,n){void 0===n&&(n=jn.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}(jn),Mn=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}(Fn);new Mn(Dn);var Vn=new Fn(An),zn=Vn,Kn=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}(An),Bn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Fn);new Bn(Kn);var Wn=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=_n.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&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(_n.cancelAnimationFrame(n),t._scheduled=void 0)},t}(An),$n=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}(Fn);new $n(Wn),function(e){function t(t,n){void 0===t&&(t=Jn),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}(Fn);var Jn=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 Jt.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}(An),Qn=new hn((function(e){return e.complete()}));function Yn(e){return e&&Kt(e.schedule)}function Hn(e){return e[e.length-1]}function Zn(e){return Yn(Hn(e))?e.pop():void 0}function Gn(e,t){return"number"==typeof Hn(e)?e.pop():t}var Xn=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function er(e){return Kt(null==e?void 0:e.then)}function tr(e){return Kt(e[ln])}function nr(e){return Symbol.asyncIterator&&Kt(null==e?void 0:e[Symbol.asyncIterator])}function rr(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 ir,or="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function sr(e){return Kt(null==e?void 0:e[or])}function ur(e){return d(this,arguments,(function(){var t,n,r;return s(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,l(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,l(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,l(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 ar(e){return Kt(null==e?void 0:e.getReader)}function cr(e){if(e instanceof hn)return e;if(null!=e){if(tr(e))return i=e,new hn((function(e){var t=i[ln]();if(Kt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(Xn(e))return r=e,new hn((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(er(e))return n=e,new hn((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,Xt)}));if(nr(e))return lr(e);if(sr(e))return t=e,new hn((function(e){var n,r;try{for(var i=u(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(ar(e))return lr(ur(e))}var t,n,r,i;throw rr(e)}function lr(e){return new hn((function(t){(function(e,t){var n,r,i,u;return o(this,void 0,void 0,(function(){var o,a;return s(this,(function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),n=f(e),s.label=1;case 1:return[4,n.next()];case 2:if((r=s.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=s.sent(),i={error:a},[3,11];case 6:return s.trys.push([6,,9,10]),r&&!r.done&&(u=n.return)?[4,u.call(n)]:[3,8];case 7:s.sent(),s.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 dr(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 fr(e,t){return void 0===t&&(t=0),gn((function(n,r){n.subscribe(yn(r,(function(n){return dr(r,e,(function(){return r.next(n)}),t)}),(function(){return dr(r,e,(function(){return r.complete()}),t)}),(function(n){return dr(r,e,(function(){return r.error(n)}),t)})))}))}function hr(e,t){return void 0===t&&(t=0),gn((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function pr(e,t){if(!e)throw new Error("Iterable cannot be null");return new hn((function(n){dr(n,t,(function(){var r=e[Symbol.asyncIterator]();dr(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function vr(e,t){if(null!=e){if(tr(e))return function(e,t){return cr(e).pipe(hr(t),fr(t))}(e,t);if(Xn(e))return function(e,t){return new hn((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(er(e))return function(e,t){return cr(e).pipe(hr(t),fr(t))}(e,t);if(nr(e))return pr(e,t);if(sr(e))return function(e,t){return new hn((function(n){var r;return dr(n,t,(function(){r=e[or](),dr(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 Kt(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(ar(e))return function(e,t){return pr(ur(e),t)}(e,t)}throw rr(e)}function gr(e,t){return t?vr(e,t):cr(e)}function yr(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(ir||(ir={})),Bt((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),Bt((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Bt((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Bt((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var mr=Bt((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function br(e){throw new mr(e)}function wr(e,t){return gn((function(n,r){var i=0;n.subscribe(yn(r,(function(n){r.next(e.call(t,n,i++))})))}))}var _r=Array.isArray;function Er(e){return wr((function(t){return function(e,t){return _r(t)?e.apply(void 0,c([],a(t))):e(t)}(e,t)}))}function Sr(e,t,n){return void 0===n&&(n=1/0),Kt(t)?Sr((function(n,r){return wr((function(e,i){return t(n,e,r,i)}))(cr(e(n,r)))}),n):("number"==typeof t&&(n=t),gn((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()},h=function(e){return c<r?p(e):a.push(e)},p=function(e){o&&t.next(e),c++;var u=!1;cr(n(e,l++)).subscribe(yn(t,(function(e){null==i||i(e),o?h(e):t.next(e)}),(function(){u=!0}),void 0,(function(){if(u)try{c--;for(var e=function(){var e=a.shift();s?dr(t,s,(function(){return p(e)})):p(e)};a.length&&c<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(yn(t,h,(function(){d=!0,f()}))),function(){null==u||u()}}(t,r,e,n)})))}function Ir(e){return void 0===e&&(e=1/0),Sr(dn,e)}function Tr(){return Ir(1)}var kr,xr,Pr=["addListener","removeListener"],Or=["addEventListener","removeEventListener"],Ar=["on","off"];function Cr(e,t,n,r){if(Kt(n)&&(r=n,n=void 0),r)return Cr(e,t,n).pipe(Er(r));var i=a(function(e){return Kt(e.addEventListener)&&Kt(e.removeEventListener)}(e)?Or.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return Kt(e.addListener)&&Kt(e.removeListener)}(e)?Pr.map(Rr(e,t)):function(e){return Kt(e.on)&&Kt(e.off)}(e)?Ar.map(Rr(e,t)):[],2),o=i[0],s=i[1];if(!o&&Xn(e))return Sr((function(e){return Cr(e,t,n)}))(cr(e));if(!o)throw new TypeError("Invalid event target");return new hn((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 Rr(e,t){return function(n){return function(r){return e[n](t,r)}}}function Nr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Zn(e),r=Gn(e,1/0),i=e;return i.length?1===i.length?cr(i[0]):Ir(r)(gr(i,n)):Qn}function Lr(e,t){return gn((function(n,r){var i=0;n.subscribe(yn(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function Ur(e){return e<=0?function(){return Qn}:gn((function(t,n){var r=0;t.subscribe(yn(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function qr(e,t){return t?function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Tr()(gr(e,Zn(e)))}(t.pipe(Ur(1),gn((function(e,t){e.subscribe(yn(t,en))}))),n.pipe(qr(e)))}:Sr((function(t,n){return cr(e(t,n)).pipe(Ur(1),function(e){return wr((function(){return e}))}(t))}))}function Dr(e,t){void 0===t&&(t=Vn);var n=function(e,t,n){void 0===e&&(e=0),void 0===n&&(n=zn);var r=-1;return null!=t&&(Yn(t)?n=t:r=t),new hn((function(t){var i=yr(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)}))}(e,t);return qr((function(){return n}))}function jr(e,t){if(e.nodeType!==Node.ELEMENT_NODE)throw new Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4};kr=r(r({},n),t),xr=function(e,t){if(e.nodeType===Node.DOCUMENT_NODE)return e;if(e===t.root)return e.ownerDocument;return e}(kr.root,n);var i=Fr(e,"all",(function(){return Fr(e,"two",(function(){return Fr(e,"one",(function(){return Fr(e,"none")}))}))}));if(i){var o=Yr(Hr(i,e));return o.length>0&&(i=o[0]),Vr(i)}throw new Error("Selector was not found.")}function Fr(e,t,n){for(var r=null,i=[],o=e,s=0,l=function(){var e,l,d=$r(function(e){var t=e.getAttribute("id");if(t&&kr.idName(t))return{name:"#"+CSS.escape(t),penalty:0};return null}(o))||$r.apply(void 0,c([],a(function(e){var t=Array.from(e.attributes).filter((function(e){return kr.attr(e.name,e.value)}));return t.map((function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}}))}(o)),!1))||$r.apply(void 0,c([],a(function(e){var t=Array.from(e.classList).filter(kr.className);return t.map((function(e){return{name:"."+CSS.escape(e),penalty:1}}))}(o)),!1))||$r(function(e){var t=e.tagName.toLowerCase();if(kr.tagName(t))return{name:t,penalty:2};return null}(o))||[{name:"*",penalty:3}],f=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;var r=0;for(;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)f&&(d=d.concat(d.filter(Wr).map((function(e){return Br(e,f)}))));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(Wr).map((function(e){return Br(e,f)}))));else if("one"==t){var h=a(d=d.slice(0,1),1)[0];f&&Wr(h)&&(d=[Br(h,f)])}else"none"==t&&(d=[{name:"*",penalty:3}],f&&(d=[Br(d[0],f)]));try{for(var p=(e=void 0,u(d)),v=p.next();!v.done;v=p.next()){(h=v.value).level=s}}catch(t){e={error:t}}finally{try{v&&!v.done&&(l=p.return)&&l.call(p)}finally{if(e)throw e.error}}if(i.push(d),i.length>=kr.seedMinLength&&(r=Mr(i,n)))return"break";o=o.parentElement,s++};o;){if("break"===l())break}return r||(r=Mr(i,n)),!r&&n?n():r}function Mr(e,t){var n,r;if(e.reduce((function(e,t){return e*t.length}),1)>kr.threshold)return t?t():null;var i=Yr(Qr(e));try{for(var o=u(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(Kr(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function Vr(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function zr(e){return e.map((function(e){return e.penalty})).reduce((function(e,t){return e+t}),0)}function Kr(e){var t=Vr(e);switch(xr.querySelectorAll(t).length){case 0:throw new Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function Br(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function Wr(e){return"html"!==e.name&&!e.name.startsWith("#")}function $r(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(Jr);return n.length>0?n:null}function Jr(e){return null!=e}function Qr(e,t){var n,r,i,o,a,c;return void 0===t&&(t=[]),s(this,(function(s){switch(s.label){case 0:if(!(e.length>0))return[3,9];s.label=1;case 1:s.trys.push([1,6,7,8]),n=u(e[0]),r=n.next(),s.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,u(Qr(e.slice(1,e.length),t.concat(i)))]);case 3:s.sent(),s.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o=s.sent(),a={error:o},[3,8];case 7:try{r&&!r.done&&(c=n.return)&&c.call(n)}finally{if(a)throw a.error}return[7];case 8:return[3,11];case 9:return[4,t];case 10:s.sent(),s.label=11;case 11:return[2]}}))}function Yr(e){return c([],a(e),!1).sort((function(e,t){return zr(e)-zr(t)}))}function Hr(e,t,n){var r,i,o;return void 0===n&&(n={counter:0,visited:new Map}),s(this,(function(s){switch(s.label){case 0:if(!(e.length>2&&e.length>kr.optimizedMinLength))return[3,5];r=1,s.label=1;case 1:return r<e.length-1?n.counter>kr.maxNumberOfTries?[2]:(n.counter+=1,(i=c([],a(e),!1)).splice(r,1),o=Vr(i),n.visited.has(o)?[2]:Kr(i)&&function(e,t){return xr.querySelector(Vr(e))===t}(i,t)?[4,i]:[3,4]):[3,5];case 2:return s.sent(),n.visited.set(o,!0),[5,u(Hr(i,t,n))];case 3:s.sent(),s.label=4;case 4:return r++,[3,1];case 5:return[2]}}))}new hn(en);var Zr=["input","select","textarea"],Gr=function(e,t){return function(n,r){var i,o,s,u=e.pageUrlAllowlist,a=e.shouldTrackEventResolver,c=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!c)return!1;if(a)return a(n,r);if(!ri(window.location.href,u))return!1;var l=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t){var d=t.some((function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))}));if(!d)return!1}switch(c){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var f=null===(s=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===s?void 0:s.call(window,r);return!(!f||"pointer"!==f.getPropertyValue("cursor")||"click"!==n)||"click"===n}}},Xr=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},ei=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!Zr.includes(i)&&!o},ti=function(e){var t="";return ei(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=ti(e),t+=r.split(/(\s+)/).filter(Xr).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},ni=function(e,t){var n,r,i="";try{return i=jr(e,{className:function(e){return e!==zt},maxNumberOfTries:1e3})}catch(e){if(t){var o=e;t.warn("Failed to get selector with finder, use fallback strategy instead: ".concat(o.toString()))}}var s=null===(r=null===(n=null==e?void 0:e.tagName)||void 0===n?void 0:n.toLowerCase)||void 0===r?void 0:r.call(n);s&&(i=s);var u=e.getAttribute("id"),a=e.getAttribute("class");if(u)i="#".concat(u);else if(a){var c=a.split(" ").filter((function(e){return e!==zt})).join(".");c&&(i="".concat(i,".").concat(c))}return i},ri=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},ii=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}),{})},oi=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 Xr(r)?r:""}return oi(n)},si=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:si(null==e?void 0:e.parentElement,t):null},ui=function(e,t){var n,r,i;if(!e)return{};var o=null===(i=null===(r=null==e?void 0:e.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),s=ni(e,t),u=((n={})[qt]=o,n[Dt]=ti(e),n[jt]=s,n[Ft]=window.location.href.split("?")[0],n);return ii(u)};var ai=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},ci=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Mt:t,r=this;this.endpoint=Mt,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===Mt&&(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,h=null==f?void 0:f.action;if(h)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"===h)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=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:ui,isElementSelectable:function(e){return!o||o((null==p?void 0:p.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:zt,messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u}),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"===h&&(null===(l=null==a?void 0:a.close)||void 0===l||l.call(a))}})),this.notify({action:"page-loaded"})},e}(),li=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],di=["type"],fi=["svg","path","g"],hi=["password","hidden"];var pi=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=vi(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 a=String(e.tagName).toLowerCase(),c={tag:a},l=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);l.length&&(c.index=l.indexOf(e),c.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&&(c.prevSib=String(d));var f=e.getAttribute("id");f&&(c.id=String(f));var h=Array.from(e.classList);h.length&&(c.classes=h);var p={},v=Array.from(e.attributes).filter((function(e){return!li.includes(e.name)})),g=!ei(e);if(!hi.includes(String(e.getAttribute("type")))&&!fi.includes(a))try{for(var y=u(v),m=y.next();!m.done;m=y.next()){var b=m.value;g&&!di.includes(b.name)||(p[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(p).length&&(c.attrs=p),c}(e)})),1024),t):[]};function vi(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 vi(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=a(e,1)[0]})).map((function(e){var t=a(e,2),n=t[0],r=t[1];return"".concat(String(vi(n,!0)),": ").concat(String(vi(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var gi;function yi(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,c=e.shouldTrackEvent,l=o.clickObservable,d=l.pipe(gn((function(e,t){var n,r=!1;e.subscribe(yn(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),Lr((function(e){var t=a(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}))),f=Nr(d,l.pipe((t=s.debounceTime,void 0===n&&(n=Vn),gn((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(yn(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})))}))),wr((function(){return"timeout"}))));return l.pipe(Dr(0),Lr(ai),Lr((function(e){return c("click",e.closestTrackedAncestor)})),(r=f,gn((function(e,t){var n=[];return e.subscribe(yn(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),cr(r).subscribe(yn(t,(function(){var e=n;n=[],t.next(e)}),en)),function(){n=null}})))).subscribe((function(e){var t,n,r=(e.length,Ut);try{for(var o=u(e),s=o.next();!s.done;s=o.next()){var a=s.value;null==i||i.track(r,a.targetElementProperties,{time:a.timestamp})}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}))}function mi(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,u=n.clickObservable,l=n.mutationObservable,d=n.navigateObservable,f=u.pipe(Lr((function(e){return!o("click",e.closestTrackedAncestor)})),wr((function(e){var t=si(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),Lr(ai),Lr((function(e){return s("click",e.closestTrackedAncestor)}))),h=[l];d&&h.push(d);var p,v,g=Nr.apply(void 0,c([],a(h),!1)),y=f.pipe((p=function(e){return g.pipe(Ur(1),function(e,t){var n=yr(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?br:o,u=n.scheduler,a=void 0===u?null!=t?t:Vn:u,c=n.meta,l=void 0===c?null:c;if(null==r&&null==i)throw new TypeError("No timeout provided.");return gn((function(e,t){var n,o,u=null,c=0,d=function(e){o=dr(t,a,(function(){try{n.unsubscribe(),cr(s({meta:l,lastValue:u,seen:c})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(yn(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 Qn}}),wr((function(){return e})))},gn((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(yn(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;cr(p(e,s)).subscribe(n=yn(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(Ut,i("click",e.closestTrackedAncestor),{time:e.timestamp})}))}!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(gi||(gi={}));var bi=function(e){var t,n,i;void 0===e&&(e={});var l=e.dataAttributePrefix,d=void 0===l?w:l,f=e.visualTaggingOptions,h=void 0===f?{enabled:!0,messenger:new ci}:f;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:b,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:_,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var p="@amplitude/plugin-autocapture-browser",v=[],g=void 0,y=function(e,t){var n,r,i,o=null===(i=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),s="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},u=t.getAttribute("aria-label"),a=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,d),c=oi(t),l=ni(t,g),f=((n={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",n["[Amplitude] Element Class"]=t.getAttribute("class"),n["[Amplitude] Element Hierarchy"]=pi(t),n[qt]=o,n[Dt]=ti(t),n["[Amplitude] Element Position Left"]=null==s.left?null:Math.round(s.left),n["[Amplitude] Element Position Top"]=null==s.top?null:Math.round(s.top),n["[Amplitude] Element Aria Label"]=u,n["[Amplitude] Element Attributes"]=a,n[jt]=l,n["[Amplitude] Element Parent Label"]=c,n[Ft]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===o&&"click"===e&&t instanceof HTMLAnchorElement&&(f["[Amplitude] Element Href"]=t.href),ii(f)},m=function(t,n){var r={event:t,timestamp:Date.now(),type:n};if(function(e){return"click"===e.type||"change"===e.type}(r)&&null!==r.event.target){var i=si(r.event.target,e.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=y(r.type,i)),r}return r};return{name:p,type:"enrichment",setup:function(t,n){return o(void 0,void 0,void 0,(function(){var i,o,u,l,d,f,b,w,_,E;return s(this,(function(s){return g=t.loggerProvider,"undefined"==typeof document||(i=Gr(e,e.cssSelectorAllowlist),o=Gr(e,e.actionClickAllowlist),u=function(){var e,t,n=Cr(document,"click",{capture:!0}).pipe(wr((function(e){return m(e,"click")}))),r=Cr(document,"change",{capture:!0}).pipe(wr((function(e){return m(e,"change")})));window.navigation&&(t=Cr(window.navigation,"navigate").pipe(wr((function(e){return m(e,"navigate")}))));var i=new hn((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()}})).pipe(wr((function(e){return m(e,"mutation")})));return(e={})[gi.ClickObservable]=n,e[gi.ChangeObservable]=r,e[gi.NavigateObservable]=t,e[gi.MutationObservable]=i,e}(),l=yi({allObservables:u,options:e,amplitude:n,shouldTrackEvent:i}),v.push(l),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent;return n.changeObservable.pipe(Lr(ai),Lr((function(e){return i("change",e.closestTrackedAncestor)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:u,getEventProperties:y,amplitude:n,shouldTrackEvent:i}),v.push(d),f=mi({allObservables:u,options:e,getEventProperties:y,amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:o}),v.push(f),null===(_=null==t?void 0:t.loggerProvider)||void 0===_||_.log("".concat(p," has been successfully added.")),window.opener&&h.enabled&&(b=e.cssSelectorAllowlist,w=e.actionClickAllowlist,null===(E=h.messenger)||void 0===E||E.setup(r(r({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Vt[t.serverZone]}),{isElementSelectable:Gr(e,c(c([],a(b),!1),a(w),!1)),cssSelectorAllowlist:b,actionClickAllowlist:w})))),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r;return s(this,(function(i){try{for(e=u(v),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]}))}))}}},wi=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){var i,o;return void 0===e&&(e=""),arguments.length>2?(i=t,o=n):"string"==typeof t?(i=t,o=void 0):(i=null==t?void 0:t.userId,o=t),N(this._init(r(r({},o),{userId:i,apiKey:e})))},t.prototype._init=function(t){var n,i,u;return o(this,void 0,void 0,(function(){var a,c,l,d,f,h=this;return s(this,(function(p){switch(p.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,gt(t.apiKey,t,this)]);case 1:return a=p.sent(),t.fetchRemoteConfig?[4,(g=a,o(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,(e=new Lt(g)).initialize()];case 1:return t.sent(),[2,e]}}))})))]:[3,4];case 2:return[4,p.sent().generateJoinedConfig()];case 3:a=p.sent(),p.label=4;case 4:return[4,e.prototype._init.call(this,a)];case 5:return p.sent(),this.logBrowserOptions(a),qe(this.config.defaultTracking)?(c=function(e){return qe(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?r({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new be(c,this.config),[4,this.webAttribution.init()]):[3,7];case 6:p.sent(),p.label=7;case 7:return l=X(),d=Number.isNaN(Number(l.ampSessionId))?void 0:Number(l.ampSessionId),this.setSessionId(null!==(u=null!==(i=null!==(n=t.sessionId)&&void 0!==n?n:d)&&void 0!==i?i:this.config.sessionId)&&void 0!==u?u:Date.now()),(f=Re(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,9]:[4,this.add(At()).promise];case 8:p.sent(),p.label=9;case 9:return[4,this.add(new B).promise];case 10:return p.sent(),[4,this.add(new Be).promise];case 11:return p.sent(),[4,this.add(new Ne).promise];case 12:return p.sent(),function(e){Ot||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."),Ot=!0)}(this.config),v=this.config.defaultTracking,Ue(v,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Pt()).promise]):[3,14];case 13:p.sent(),p.label=14;case 14:return function(e){return Ue(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Tt()).promise]):[3,16];case 15:p.sent(),p.label=16;case 16:return De(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(_t(Ve(this.config))).promise]):[3,18];case 17:p.sent(),p.label=18;case 18:return Fe(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(bi(Me(this.config))).promise]):[3,20];case 19:p.sent(),p.label=20;case 20:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 21:return p.sent(),f.eventBridge.setEventReceiver((function(e){h.track(e.eventType,e.eventProperties)})),[2]}var v,g}))}))},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,function(e,t){Re(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),this.config.deviceId=e,function(e,t){Re(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(I()),this.setUserId(void 0)},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)),N(Promise.resolve());if(e===this.config.sessionId)return N(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId(),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,je(this.config.defaultTracking)&&(r&&i&&n.push(this.track(ot,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 je(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,N(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=mt(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(Ke(t)){var r=t._q;t._q=[],t=ze(new C,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(Ke(r)){var o=r._q;r._q=[],r=ze(new C,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(Ke(t)){var r=t._q;t._q=[],t=ze(new U,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 o(this,void 0,void 0,(function(){var n,r,i;return s(this,(function(o){return n=Date.now(),r=me(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===it||t.event_type===ot||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=r(r({},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}(L),_i=function(){var e=new wi;return{init:Y(e.init.bind(e),"init",$(e),Q(e,["config"])),add:Y(e.add.bind(e),"add",$(e),Q(e,["config.apiKey","timeline.plugins"])),remove:Y(e.remove.bind(e),"remove",$(e),Q(e,["config.apiKey","timeline.plugins"])),track:Y(e.track.bind(e),"track",$(e),Q(e,["config.apiKey","timeline.queue.length"])),logEvent:Y(e.logEvent.bind(e),"logEvent",$(e),Q(e,["config.apiKey","timeline.queue.length"])),identify:Y(e.identify.bind(e),"identify",$(e),Q(e,["config.apiKey","timeline.queue.length"])),groupIdentify:Y(e.groupIdentify.bind(e),"groupIdentify",$(e),Q(e,["config.apiKey","timeline.queue.length"])),setGroup:Y(e.setGroup.bind(e),"setGroup",$(e),Q(e,["config.apiKey","timeline.queue.length"])),revenue:Y(e.revenue.bind(e),"revenue",$(e),Q(e,["config.apiKey","timeline.queue.length"])),flush:Y(e.flush.bind(e),"flush",$(e),Q(e,["config.apiKey","timeline.queue.length"])),getUserId:Y(e.getUserId.bind(e),"getUserId",$(e),Q(e,["config","config.userId"])),setUserId:Y(e.setUserId.bind(e),"setUserId",$(e),Q(e,["config","config.userId"])),getDeviceId:Y(e.getDeviceId.bind(e),"getDeviceId",$(e),Q(e,["config","config.deviceId"])),setDeviceId:Y(e.setDeviceId.bind(e),"setDeviceId",$(e),Q(e,["config","config.deviceId"])),reset:Y(e.reset.bind(e),"reset",$(e),Q(e,["config","config.userId","config.deviceId"])),getSessionId:Y(e.getSessionId.bind(e),"getSessionId",$(e),Q(e,["config"])),setSessionId:Y(e.setSessionId.bind(e),"setSessionId",$(e),Q(e,["config"])),extendSession:Y(e.extendSession.bind(e),"extendSession",$(e),Q(e,["config"])),setOptOut:Y(e.setOptOut.bind(e),"setOptOut",$(e),Q(e,["config"])),setTransport:Y(e.setTransport.bind(e),"setTransport",$(e),Q(e,["config"]))}},Ei=_i(),Si=Ei.add,Ii=Ei.extendSession,Ti=Ei.flush,ki=Ei.getDeviceId,xi=Ei.getSessionId,Pi=Ei.getUserId,Oi=Ei.groupIdentify,Ai=Ei.identify,Ci=Ei.init,Ri=Ei.logEvent,Ni=Ei.remove,Li=Ei.reset,Ui=Ei.revenue,qi=Ei.setDeviceId,Di=Ei.setGroup,ji=Ei.setOptOut,Fi=Ei.setSessionId,Mi=Ei.setTransport,Vi=Ei.setUserId,zi=Ei.track;e.Identify=C,e.Revenue=U,e.Types=E,e.add=Si,e.createInstance=_i,e.extendSession=Ii,e.flush=Ti,e.getDeviceId=ki,e.getSessionId=xi,e.getUserId=Pi,e.groupIdentify=Oi,e.identify=Ai,e.init=Ci,e.logEvent=Ri,e.remove=Ni,e.reset=Li,e.revenue=Ui,e.runQueuedFunctions=function(e,t){ze(e,t)},e.setDeviceId=qi,e.setGroup=Di,e.setOptOut=ji,e.setSessionId=Fi,e.setTransport=Mi,e.setUserId=Vi,e.track=zi,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=function(){return r=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},r.apply(this,arguments)};function i(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 o(e,t,n,r){return new(n||(n=Promise))((function(i,o){function s(e){try{c(r.next(e))}catch(e){o(e)}}function u(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}c((r=r.apply(e,t||[])).next())}))}function s(e,t){var n,r,i,o,s={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function u(u){return function(c){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)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 s.label++,{value:u[1],done:!1};case 5:s.label++,r=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(i=s.trys,(i=i.length>0&&i[i.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){s.label=u[1];break}if(6===u[0]&&s.label<i[1]){s.label=i[1],i=u;break}if(i&&s.label<i[2]){s.label=i[2],s.ops.push(u);break}i[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}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,c])}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function a(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 l(e){return this instanceof l?(this.v=e,this):new l(e)}function d(e,t,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r,i=n.apply(e,t||[]),o=[];return r={},s("next"),s("throw"),s("return"),r[Symbol.asyncIterator]=function(){return this},r;function s(e){i[e]&&(r[e]=function(t){return new Promise((function(n,r){o.push([e,t,n,r])>1||u(e,t)}))})}function u(e,t){try{(n=i[e](t)).value instanceof l?Promise.resolve(n.value.v).then(c,a):d(o[0][2],n)}catch(e){d(o[0][3],e)}var n}function c(e){u("next",e)}function a(e){u("throw",e)}function d(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function f(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=u(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)}))}}}var h;!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"}(h||(h={}));var p,v,g,y=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=h.Unknown),{event:e,code:t,message:n}},m=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,m)},b=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return o(this,void 0,void 0,(function(){return s(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(t.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=m(),t.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 o(this,void 0,void 0,(function(){var r,i;return s(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 o(this,void 0,void 0,(function(){var t,n,i,o,a,l,d,f,h,p,v,g,m,b,w,_,E,I,S,T;return s(this,(function(s){switch(s.label){case 0:if(!e)return[2];t=c(e,1),n=t[0],i=c(e,2),o=i[1],a=this.plugins.filter((function(e){return"before"===e.type})),s.label=1;case 1:s.trys.push([1,6,7,8]),l=u(a),d=l.next(),s.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(r({},n))]:[3,4];case 3:if(null===(m=s.sent()))return o({event:n,code:0,message:""}),[2];n=m,s.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=s.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(I=l.return)&&I.call(l)}finally{if(E)throw E.error}return[7];case 8:h=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),s.label=9;case 9:s.trys.push([9,14,15,16]),p=u(h),v=p.next(),s.label=10;case 10:return v.done?[3,13]:(g=v.value).execute?[4,g.execute(r({},n))]:[3,12];case 11:if(null===(m=s.sent()))return o({event:n,code:0,message:""}),[2];n=m,s.label=12;case 12:return v=p.next(),[3,10];case 13:return[3,16];case 14:return b=s.sent(),S={error:b},[3,16];case 15:try{v&&!v.done&&(T=p.return)&&T.call(p)}finally{if(S)throw S.error}return[7];case 16:return w=this.plugins.filter((function(e){return"destination"===e.type})),_=w.map((function(e){var t=r({},n);return e.execute(t).catch((function(e){return y(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=c(e,1)[0]||y(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return o(this,void 0,void 0,(function(){var e,t,n,r=this;return s(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}(),w="AMP",_="".concat(w,"_unsent"),E="https://api2.amplitude.com/2/httpapi",I=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!S(t,n))return!1}return!0},S=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var c=s.value;if(Array.isArray(c))return!1;if("object"==typeof c)i=i&&I(c);else if(!["number","string"].includes(typeof c))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 I(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},T=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return r({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(p.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(p.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(p.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(p.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(p.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(p.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(p.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(p.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(p.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[p.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[p.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===p.ADD?"number"==typeof n:e===p.UNSET||e===p.REMOVE||S(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"}(p||(p={})),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={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(g||(g={}));var k,P=function(e,t){return r(r({},t),{event_type:g.IDENTIFY,user_properties:e.getUserProperties()})},O=function(e){return{promise:e||Promise.resolve()}},x=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new b(this),this.name=e}return e.prototype._init=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return o(this,void 0,void 0,(function(){var t,n,r,i,o,c,a,l;return s(this,(function(s){switch(s.label){case 0:t=this[e],this[e]=[],s.label=1;case 1:s.trys.push([1,8,9,10]),n=u(t),r=n.next(),s.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 s.sent(),[3,6];case 4:return[4,o];case 5:s.sent(),s.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return c=s.sent(),a={error:c},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(a)throw a.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:s.sent(),s.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var i=function(e,t,n){return r(r(r({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return O(this.dispatch(i))},e.prototype.identify=function(e,t){var n=P(e,t);return O(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var o=function(e,t,n,i){var o;return r(r({},i),{event_type:g.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n,i);return O(this.dispatch(o))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,o=new T;return o.set(e,t),r(r({},n),{event_type:g.IDENTIFY,user_properties:o.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return O(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return r(r({},t),{event_type:g.REVENUE,event_properties:e.getEventProperties()})}(e,t);return O(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),O())},e.prototype._addPlugin=function(e){return O(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)),O())},e.prototype._removePlugin=function(e){return O(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(y(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return o(this,void 0,void 0,(function(){var t=this;return s(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.process=function(e){return o(this,void 0,void 0,(function(){var t,n,r;return s(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),this.config.optOut?[2,y(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(r=i.sent()).code?this.config.loggerProvider.log(r.message):100===r.code?this.config.loggerProvider.warn(r.message):this.config.loggerProvider.error(r.message),[2,r];case 2:return t=i.sent(),n=String(t),this.config.loggerProvider.error(n),[2,r=y(e,0,n)];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=Boolean(e)},e.prototype.flush=function(){return O(this.timeline.flush())},e}(),A=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 I(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?r({},this.properties):{};return e[k.REVENUE_PRODUCT_ID]=this.productId,e[k.REVENUE_QUANTITY]=this.quantity,e[k.REVENUE_PRICE]=this.price,e[k.REVENUE_TYPE]=this.revenueType,e[k.REVENUE_CURRENCY]=this.currency,e[k.REVENUE]=this.revenue,e[k.RECEIPT]=this.receipt,e[k.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"}(k||(k={}));var C;!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"}(C||(C={}));var R="Amplitude Logger ",N=function(){function e(){this.logLevel=C.None}return e.prototype.disable=function(){this.logLevel=C.None},e.prototype.enable=function(e){void 0===e&&(e=C.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Verbose||console.log("".concat(R,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Warn||console.warn("".concat(R,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Error||console.error("".concat(R,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<C.Debug||console.log("".concat(R,"[Debug]: ").concat(e.join(" ")))},e}(),L=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:C.Warn,loggerProvider:new N,offline:!1,optOut:!1,serverUrl:E,serverZone:"US",useBatch:!1}},U=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=L();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=D(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}(),q=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":E},D=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=L().serverZone),void 0===n&&(n=L().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:L().serverZone;return{serverZone:r,serverUrl:q(r,n)}},j=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function F(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var M=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 o(this,void 0,void 0,(function(){var n,r=this;return s(this,(function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(_,"_").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=m()),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),o(this,void 0,void 0,(function(){var t,n,r=this;return s(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)})),u=t,c=this.config.flushQueueSize,a=Math.max(c,1),[4,u.reduce((function(e,t,n){var r=Math.floor(n/a);return e[r]||(e[r]=[]),e[r].push(t),e}),[]).reduce((function(t,n){return o(r,void 0,void 0,(function(){return s(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 u,c,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),o(this,void 0,void 0,(function(){var n,r,o,u,c;return s(this,(function(s){switch(s.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,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new j,s.label=1;case 1:return s.trys.push([1,3,,4]),r=D(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(o=s.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(F(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return u=s.sent(),c=(a=u)instanceof Error?a.message:String(a),this.config.loggerProvider.error(c),this.handleResponse({status:h.Failed,statusCode:0},e),[3,4];case 4:return[2]}var a}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case h.Success:this.handleSuccessResponse(e,t);break;case h.Invalid:this.handleInvalidResponse(e,t);break;case h.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case h.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=a(a(a(a([],c(Object.values(e.body.eventsWithInvalidFields)),!1),c(Object.values(e.body.eventsWithMissingFields)),!1),c(Object.values(e.body.eventsWithInvalidIdLengths)),!1),c(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter((function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(F(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(F(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),c=new Set(o),a=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 c.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));a.length>0&&this.config.loggerProvider.warn(F(e));var l=this.removeEventsExceedFlushMaxRetries(a);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(y(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}(),V=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:$(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),$=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},K=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}(),z=function(){return z=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},z.apply(this,arguments)},B=function(e,t){var n=typeof e;if(n!==typeof t)return!1;for(var r=0,i=["string","number","boolean","undefined"];r<i.length;r++){if(i[r]===n)return e===t}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var o=Array.isArray(e),s=Array.isArray(t);if(o!==s)return!1;if(!o||!s){var u=Object.keys(e).sort(),c=Object.keys(t).sort();if(!B(u,c))return!1;var a=!0;return Object.keys(e).forEach((function(n){B(e[n],t[n])||(a=!1)})),a}for(var l=0;l<e.length;l++)if(!B(e[l],t[l]))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 W,Y,J,Q,H,G=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=z({},this.identity.userProperties),n=z(z({},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},updateUserProperties:function(e){for(var t=n.userProperties||{},r=0,i=Object.entries(e);r<i.length;r++){var o=i[r],s=o[0],u=o[1];switch(s){case"$set":for(var c=0,a=Object.entries(u);c<a.length;c++){var l=a[c],d=l[0],f=l[1];t[d]=f}break;case"$unset":for(var h=0,p=Object.keys(u);h<p.length;h++){delete t[d=p[h]]}break;case"$clearAll":t={}}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return z({},this.identity)},e.prototype.setIdentity=function(e){var t=z({},this.identity);this.identity=z({},e),B(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}(),Z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,X=function(){function e(){this.identityStore=new G,this.eventBridge=new K,this.applicationContextProvider=new V}return e.getInstance=function(t){return Z.analyticsConnectorInstances||(Z.analyticsConnectorInstances={}),Z.analyticsConnectorInstances[t]||(Z.analyticsConnectorInstances[t]=new e),Z.analyticsConnectorInstances[t]},e}(),ee=function(e){return void 0===e&&(e="$default_instance"),X.getInstance(e)},te=function(){function e(){this.name="identity",this.type="before",this.identityStore=ee().identityStore}return e.prototype.execute=function(e){return o(this,void 0,void 0,(function(){var t;return s(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return e.instanceName&&(this.identityStore=ee(e.instanceName).identityStore),[2]}))}))},e}(),ne=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},re=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},ie=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[w,t,e.substring(0,n)].filter(Boolean).join("_")},oe=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:""},se=function(){var e,t=ne();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=ue(n[0]),i=ue(n[1]);return i?(e[r]=i,e):e}),{}):{}},ue=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},ce=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},ae=function(e){return function(){var t=r({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},le=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=u(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},de=function(e,t){return function(){var n,r,i={};try{for(var o=u(t),s=o.next();!s.done;s=o.next()){var c=s.value;i[c]=le(e,c)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},fe=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(),c=u.logger,a=u.logLevel;if(a&&a<C.Debug||!a||!c)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ce(1),time:{start:(new Date).toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then((function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),c.debug(JSON.stringify(l,null,2))})):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),c.debug(JSON.stringify(l,null,2))),d}},he=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return o(this,void 0,void 0,(function(){return s(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),pe=function(){function e(e){this.options=r({},e)}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n;return s(this,(function(r){switch(r.label){case 0:if(!ne())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 o(this,void 0,void 0,(function(){var n,r;return s(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=ve(n))&&void 0!==t?t:ge(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 o(this,void 0,void 0,(function(){var r,i,o;return s(this,(function(s){return r=ne(),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+"=")})))?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return o(this,void 0,void 0,(function(){var r,i,o,u,c,a,l;return s(this,(function(s){try{r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(i=null!==t?r:-1)&&((u=new Date).setTime(u.getTime()+24*i*60*60*1e3),o=u),c="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(c+="; expires=".concat(o.toUTCString())),c+="; path=/",this.options.domain&&(c+="; domain=".concat(this.options.domain)),this.options.secure&&(c+="; Secure"),this.options.sameSite&&(c+="; SameSite=".concat(this.options.sameSite)),(a=ne())&&(a.document.cookie=c)}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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(e){return[2]}))}))},e}(),ve=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},ge=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},ye=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,c,a,l,d,f,p,v,g,y,m,b,w,_,E,I;if("object"!=typeof e)return null;var S=e.code||0,T=this.buildStatus(S);switch(T){case h.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 h.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!==(c=e.events_with_invalid_id_lengths)&&void 0!==c?c:{},epsThreshold:null!==(a=e.eps_threshold)&&void 0!==a?a:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(p=e.throttled_devices)&&void 0!==p?p:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case h.PayloadTooLarge:return{status:T,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case h.RateLimit:return{status:T,statusCode:S,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(w=e.throttled_users)&&void 0!==w?w:{},exceededDailyQuotaDevices:null!==(_=e.exceeded_daily_quota_devices)&&void 0!==_?_:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(I=e.throttled_events)&&void 0!==I?I:[]}};case h.Timeout:default:return{status:T,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?h.Success:429===e?h.RateLimit:413===e?h.PayloadTooLarge:408===e?h.Timeout:e>=400&&e<500?h.Invalid:e>=500?h.Failed:h.Unknown},e}(),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n,r,i;return s(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}(ye),be=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],we="data-amp-track-",_e=["div","span","h1","h2","h3","h4","h5","h6"],Ee=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},Ie=function(e){return Ee(e,"attribution")},Se=function(e){return Ee(e,"pageViews")},Te=function(e){return Ee(e,"sessions")},ke=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Pe=function(e){if(ke(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},Oe=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Se(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}},xe=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 c=u.apply(e,o);"function"==typeof s&&s(null==c?void 0:c.promise)}}return e},Ae=function(e){return e&&void 0!==e._q},Ce="2.12.1",Re=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat("amplitude-ts","/").concat(Ce),"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 o(this,void 0,void 0,(function(){var i,o,u;return s(this,(function(s){return i=(new Date).getTime(),o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,u=null!==(n=e.event_id)&&void 0!==n?n:o+1,this.config.lastEventId=u,e.time||(this.config.lastEventTime=i),[2,r(r(r(r(r(r(r(r({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:oe()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:m(),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:u,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Ne=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return o(this,void 0,void 0,(function(){var t,n,r;return s(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 o(this,void 0,void 0,(function(){var t;return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(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 o(this,void 0,void 0,(function(){return s(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),Le=1e3,Ue=function(e){function t(t){var n,r=this;return(r=e.call(this,null===(n=ne())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,r}return n(t,e),t.prototype.set=function(t,n){var r;return o(this,void 0,void 0,(function(){var i;return s(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>Le?(i=n.length-Le,[4,e.prototype.set.call(this,t,n.slice(0,Le))]):[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(Le,".")),[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}(Ne),qe=function(e){function t(){var t;return e.call(this,null===(t=ne())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Ne),De=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 o(this,void 0,void 0,(function(){var n=this;return s(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}(ye),je=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.send=function(e,t){return o(this,void 0,void 0,(function(){var n=this;return s(this,(function(r){return[2,new Promise((function(r,i){var o=ne();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}(ye),Fe=function(e,t,n){return void 0===n&&(n=!0),o(void 0,void 0,void 0,(function(){var r,i,o,u,a,l,d,f,h;return s(this,(function(s){switch(s.label){case 0:return r=function(e){return"".concat(w.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=s.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:s.sent(),s.label=3;case 3:return o=c(i.split("."),6),u=o[0],a=o[1],l=o[2],d=o[3],f=o[4],h=o[5],[2,{deviceId:u,userId:Ve(a),sessionId:Me(d),lastEventId:Me(h),lastEventTime:Me(f),optOut:Boolean(l)}]}}))}))},Me=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ve=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},$e="[Amplitude]",Ke="".concat($e," Form Started"),ze="".concat($e," Form Submitted"),Be="".concat($e," File Downloaded"),We="session_start",Ye="session_end",Je="".concat($e," File Extension"),Qe="".concat($e," File Name"),He="".concat($e," Link ID"),Ge="".concat($e," Link Text"),Ze="".concat($e," Link URL"),Xe="".concat($e," Form ID"),et="".concat($e," Form Name"),tt="".concat($e," Form Destination"),nt="cookie",rt=function(e){function t(t,n,r,i,o,s,u,c,a,l,d,f,h,p,v,g,y,m,b,w,_,E,I,S,T,k,P,O,x,A,R,L,U,q){void 0===r&&(r=new he),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===c&&(c=1e3),void 0===a&&(a=5),void 0===l&&(l=30),void 0===d&&(d=nt),void 0===g&&(g=new N),void 0===y&&(y=C.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===I&&(I=""),void 0===S&&(S="US"),void 0===k&&(k=18e5),void 0===P&&(P=new Ue({loggerProvider:g})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===x&&(x="fetch"),void 0===A&&(A=!1),void 0===R&&(R=!1);var D=e.call(this,{apiKey:t,storageProvider:P,transportProvider:st(x)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=i,D.defaultTracking=o,D.autocapture=s,D.flushIntervalMillis=c,D.flushMaxRetries=a,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=f,D.instanceName=h,D.loggerProvider=g,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=_,D.plan=E,D.serverUrl=I,D.serverZone=S,D.sessionTimeout=k,D.storageProvider=P,D.trackingOptions=O,D.transport=x,D.useBatch=A,D.fetchRemoteConfig=R,D.version=Ce,D._optOut=!1,D._cookieStorage=r,D.deviceId=u,D.lastEventId=p,D.lastEventTime=v,D.optOut=w,D.sessionId=T,D.pageCounter=U,D.userId=L,D.debugLogsEnabled=q,D.loggerProvider.enable(q?C.Debug:D.logLevel),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(ie(this.apiKey),e)},t}(U),it=function(e,t,n){return void 0===t&&(t={}),o(void 0,void 0,void 0,(function(){var i,o,u,c,a,l,d,f,h,p,v,g,y,b,w,_,E,I,S,T,k,P,O,x,A,C,R,N,L,U,q,D,j,F,M,V,$,K,z,B,W,Y,J;return s(this,(function(s){switch(s.label){case 0:return i=t.identityStorage||nt,S={},i===nt?[3,1]:(u="",[3,5]);case 1:return null===(k=null===(T=t.cookieOptions)||void 0===T?void 0:T.domain)||void 0===k?[3,2]:(c=k,[3,4]);case 2:return[4,ut()];case 3:c=s.sent(),s.label=4;case 4:u=c,s.label=5;case 5:return o=r.apply(void 0,[(S.domain=u,S.expiration=365,S.sameSite="Lax",S.secure=!1,S.upgrade=!0,S),t.cookieOptions]),a=ot(t.identityStorage,o),[4,Fe(e,a,null===(O=null===(P=t.cookieOptions)||void 0===P?void 0:P.upgrade)||void 0===O||O)];case 6:return l=s.sent(),[4,a.get(ie(e))];case 7:return d=s.sent(),f=se(),h=null!==(N=null!==(R=null!==(C=null!==(A=null!==(x=t.deviceId)&&void 0!==x?x:f.ampDeviceId)&&void 0!==A?A:f.deviceId)&&void 0!==C?C:null==d?void 0:d.deviceId)&&void 0!==R?R:l.deviceId)&&void 0!==N?N:m(),p=null!==(L=null==d?void 0:d.lastEventId)&&void 0!==L?L:l.lastEventId,v=null!==(U=null==d?void 0:d.lastEventTime)&&void 0!==U?U:l.lastEventTime,g=null!==(D=null!==(q=t.optOut)&&void 0!==q?q:null==d?void 0:d.optOut)&&void 0!==D?D:l.optOut,y=null!==(j=null==d?void 0:d.sessionId)&&void 0!==j?j:l.sessionId,b=null!==(M=null!==(F=t.userId)&&void 0!==F?F:null==d?void 0:d.userId)&&void 0!==M?M:l.userId,n.previousSessionDeviceId=null!==(V=null==d?void 0:d.deviceId)&&void 0!==V?V:l.deviceId,n.previousSessionUserId=null!==($=null==d?void 0:d.userId)&&void 0!==$?$:l.userId,w={ipAddress:null===(z=null===(K=t.trackingOptions)||void 0===K?void 0:K.ipAddress)||void 0===z||z,language:null===(W=null===(B=t.trackingOptions)||void 0===B?void 0:B.language)||void 0===W||W,platform:null===(J=null===(Y=t.trackingOptions)||void 0===Y?void 0:Y.platform)||void 0===J||J},_=null==d?void 0:d.pageCounter,E=null==d?void 0:d.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(I=new rt(e,t.appVersion,a,o,t.defaultTracking,t.autocapture,h,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,t.instanceName,p,v,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,w,t.transport,t.useBatch,t.fetchRemoteConfig,b,_,E)).storageProvider.isEnabled()];case 8:return s.sent()||(I.loggerProvider.warn("Storage provider ".concat(I.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),I.storageProvider=new he),[2,I]}}))}))},ot=function(e,t){switch(void 0===e&&(e=nt),void 0===t&&(t={}),e){case"localStorage":return new Ue;case"sessionStorage":return new qe;case"none":return new he;default:return new pe(r(r({},t),{expirationDays:t.expiration}))}},st=function(e){return"xhr"===e?new De:"beacon"===e?new je:new me},ut=function(e){return o(void 0,void 0,void 0,(function(){var t,n,r,i,o,u,c;return s(this,(function(s){switch(s.label){case 0:return[4,(new pe).isEnabled()];case 1:if(!s.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,s.label=2;case 2:return o<r.length?(u=r[o],[4,(c=new pe({domain:"."+u})).set(i,1)]):[3,7];case 3:return s.sent(),[4,c.get(i)];case 4:return s.sent()?[4,c.remove(i)]:[3,6];case 5:return s.sent(),[2,"."+u];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},ct=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},at=function(){var e,t=ct();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=lt(n[0]),i=lt(n[1]);return i?(e[r]=i,e):e}),{}):{}},lt=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},dt="dclid",ft="fbclid",ht="gbraid",pt="gclid",vt="ko_click_id",gt="li_fat_id",yt="msclkid",mt="rtd_cid",bt="ttclid",wt="twclid",_t="wbraid",Et={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},It=function(){function e(){}return e.prototype.parse=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,r(r(r(r({},Et),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=at();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=at();return(e={})[dt]=t[dt],e[ft]=t[ft],e[ht]=t[ht],e[pt]=t[pt],e[vt]=t[vt],e[gt]=t[gt],e[yt]=t[yt],e[mt]=t[mt],e[bt]=t[bt],e[wt]=t[wt],e[_t]=t[_t],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"}(W||(W={})),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"}(Y||(Y={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(J||(J={})),function(e){e.US="US",e.EU="EU"}(Q||(Q={})),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"}(H||(H={}));var St=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Tt=function(e){var t;void 0===e&&(e={});var n,i,u=ct(),a=void 0,l=e.trackOn,d=e.trackHistoryChanges,f=e.eventType,h=void 0===f?"[Amplitude] Page Viewed":f,p=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},v=function(){return o(void 0,void 0,void 0,(function(){var e,t,n;return s(this,(function(i){switch(i.label){case 0:return e=p("undefined"!=typeof location&&location.href||""),n={event_type:h},t=[{}],[4,kt()];case 1:return[2,(n.event_properties=r.apply(void 0,[r.apply(void 0,t.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&p(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===l||"function"==typeof l&&l()},y="undefined"!=typeof location?location.href:null,m=function(){return o(void 0,void 0,void 0,(function(){var e,n,r,i;return s(this,(function(o){switch(o.label){case 0:return e=location.href,n=Ot(d,e,y||"")&&g(),y=e,n?(null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return i=(r=t).track,[4,v()];case 2:i.apply(r,[o.sent()]),o.label=3;case 3:o.label=4;case 4:return[2]}}))}))},b=function(){m()},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,r){return o(void 0,void 0,void 0,(function(){var o,l;return s(this,(function(s){switch(s.label){case 0:return t=r,i=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),u&&(u.addEventListener("popstate",b),n=u.history.pushState,u.history.pushState=new Proxy(u.history.pushState,{apply:function(e,t,n){var r=c(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),m()}})),g()?(a.log("Tracking page view event"),l=(o=t).track,[4,v()]):[3,2];case 1:l.apply(o,[s.sent()]),s.label=2;case 2:return[2]}}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){var t;return s(this,(function(n){switch(n.label){case 0:return"attribution"===l&&Pt(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),[4,v()]):[3,2];case 1:t=n.sent(),e.event_type=t.event_type,e.event_properties=r(r({},e.event_properties),t.event_properties),n.label=2;case 2:return i&&e.event_type===h&&(i.pageCounter=i.pageCounter?i.pageCounter+1:1,e.event_properties=r(r({},e.event_properties),{"[Amplitude] Page Counter":i.pageCounter})),[2,e]}}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(this,(function(e){return u&&(u.removeEventListener("popstate",b),n&&(u.history.pushState=n)),[2]}))}))}};return w},kt=function(){return o(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=St,[4,(new It).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},Pt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[W.SET]||{},r=t[W.UNSET]||{},i=a(a([],c(Object.keys(n)),!1),c(Object.keys(r)),!1);return Object.keys(Et).every((function(e){return i.includes(e)}))}return!1},Ot=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},xt=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 o(void 0,void 0,void 0,(function(){var i;return s(this,(function(o){return null===(i=ne())||void 0===i||i.addEventListener("load",(function(){if(r){if("undefined"!=typeof document){var i=function(e){var t=!1;n(e,"change",(function(){var n,i=Ct(e);t||r.track(Ke,((n={})[Xe]=At(e.id),n[et]=At(e.name),n[tt]=i,n)),t=!0})),n(e,"submit",(function(){var n,i,o=Ct(e);t||r.track(Ke,((n={})[Xe]=At(e.id),n[et]=At(e.name),n[tt]=o,n)),r.track(ze,((i={})[Xe]=At(e.id),i[et]=At(e.name),i[tt]=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.")})),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(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]}))}))}}},At=function(e){if("string"==typeof e)return e},Ct=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Rt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return o(void 0,void 0,void 0,(function(){var i;return s(this,(function(o){return null===(i=ne())||void 0===i||i.addEventListener("load",(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(Be,((t={})[Je]=s,t[Qe]=n.pathname,t[He]=e.id,t[Ge]=e.text,t[Ze]=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.")})),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){return s(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]}))}))}}},Nt=!1,Lt=function(){var e=ne(),t=[],n=function(n,r){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 o(void 0,void 0,void 0,(function(){return s(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 o(void 0,void 0,void 0,(function(){return s(this,(function(n){return t.forEach((function(t){var n=t.type,r=t.handler;e&&e.removeEventListener(n,r)})),t=[],[2]}))}))}}},Ut="Remote config fetch rejected due to timeout after 5 seconds",qt=function(){function e(e){var t=e.localConfig,n=e.configKeys,i=this;this.retryTimeout=1e3,this.attempts=0,this.sessionTargetingMatch=!1,this.metrics={},this.getRemoteConfig=function(e,t,n){return o(i,void 0,void 0,(function(){var r,i,o;return s(this,(function(s){switch(s.label){case 0:return r=Date.now(),[4,this.fetchWithTimeout(n)];case 1:return(i=s.sent())&&(o=i.configs&&i.configs[e])?(this.metrics.fetchTimeAPISuccess=Date.now()-r,[2,o[t]]):(this.metrics.fetchTimeAPIFail=Date.now()-r,[2,void 0])}}))}))},this.fetchWithTimeout=function(e){return o(i,void 0,void 0,(function(){var t,n,r;return s(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 o(i,void 0,void 0,(function(){var n,i,o,c,a,l,d,f,h,p,v;return s(this,(function(s){switch(s.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:Ut})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),s.label=1;case 1:s.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(i=u(this.configKeys),o=i.next();!o.done;o=i.next())c=o.value,n.append("config_keys",c)}catch(e){p={error:e}}finally{try{o&&!o.done&&(v=i.return)&&v.call(i)}finally{if(p)throw p.error}}return t&&n.set("session_id",String(t)),a={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,r(r({},a),{signal:e}))];case 2:if(null===(d=s.sent()))return[2,this.completeRequest({err:"Unexpected error occurred"})];switch((new ye).buildStatus(d.status)){case H.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case H.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=s.sent(),h=f,e.aborted?[2,this.completeRequest({err:Ut})]:[2,this.completeRequest({err:h.message})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return o(i,void 0,void 0,(function(){var n=this;return s(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 o(i,void 0,void 0,(function(){var t;return s(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.serverZone===Q.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===Q.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}(),Dt=function(e){var t=e.localConfig,n=e.configKeys;return o(void 0,void 0,void 0,(function(){return s(this,(function(e){return[2,new qt({localConfig:t,configKeys:n})]}))}))},jt=function(){function e(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return o(this,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return e=this,[4,Dt({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=t.sent(),[2]}}))}))},e.prototype.generateJoinedConfig=function(){var e,t,n,i;return o(this,void 0,void 0,(function(){var o,u,c;return s(this,(function(s){switch(s.label){case 0:return s.trys.push([0,3,,4]),(u=this.remoteConfigFetch)?[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)]:[3,2];case 1:u=s.sent(),s.label=2;case 2:return o=u,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(o,null,2)),o&&"autocapture"in o&&("boolean"==typeof o.autocapture&&(this.config.autocapture=o.autocapture),"object"==typeof o.autocapture&&(void 0===this.config.autocapture&&(this.config.autocapture=o.autocapture),"boolean"==typeof this.config.autocapture&&(this.config.autocapture=r({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},o.autocapture)),"object"==typeof this.config.autocapture&&(this.config.autocapture=r(r({},this.config.autocapture),o.autocapture))),this.config.defaultTracking=this.config.autocapture),this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),null!==(e=(i=this.config).requestMetadata)&&void 0!==e||(i.requestMetadata=new j),(null===(t=this.remoteConfigFetch)||void 0===t?void 0:t.metrics.fetchTimeAPISuccess)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),(null===(n=this.remoteConfigFetch)||void 0===n?void 0:n.metrics.fetchTimeAPIFail)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return c=s.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",c),[3,4];case 4:return[2,this.config]}}))}))},e}(),Ft="[Amplitude] Element Clicked",Mt="[Amplitude] Element Tag",Vt="[Amplitude] Element Text",$t="[Amplitude] Page URL",Kt="https://app.amplitude.com",zt={US:Kt,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};function Bt(e){return"function"==typeof e}function Wt(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 Yt=Wt((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 Jt(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var Qt=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=u(o),l=s.next();!l.done;l=s.next()){l.value.remove(this)}}catch(t){e={error:t}}finally{try{l&&!l.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(Bt(d))try{d()}catch(e){i=e instanceof Yt?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var h=u(f),p=h.next();!p.done;p=h.next()){var v=p.value;try{Zt(v)}catch(e){i=null!=i?i:[],e instanceof Yt?i=a(a([],c(i)),c(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}if(i)throw new Yt(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)Zt(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)&&Jt(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&Jt(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),Ht=Qt.EMPTY;function Gt(e){return e instanceof Qt||e&&"closed"in e&&Bt(e.remove)&&Bt(e.add)&&Bt(e.unsubscribe)}function Zt(e){Bt(e)?e():e.unsubscribe()}var Xt={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},en=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setTimeout.apply(void 0,a([e,t],c(n)))};function tn(e){en((function(){throw e}))}function nn(){}function rn(e){e()}var on=function(e){function t(t){var n=e.call(this)||this;return n.isStopped=!1,t?(n.destination=t,Gt(t)&&t.add(n)):n.destination=dn,n}return n(t,e),t.create=function(e,t,n){return new an(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}(Qt),sn=Function.prototype.bind;function un(e,t){return sn.call(e,t)}var cn=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){ln(e)}},e.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(e){ln(e)}else ln(e)},e.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(e){ln(e)}},e}(),an=function(e){function t(t,n,r){var i,o,s=e.call(this)||this;Bt(t)||!t?i={next:null!=t?t:void 0,error:null!=n?n:void 0,complete:null!=r?r:void 0}:s&&Xt.useDeprecatedNextContext?((o=Object.create(t)).unsubscribe=function(){return s.unsubscribe()},i={next:t.next&&un(t.next,o),error:t.error&&un(t.error,o),complete:t.complete&&un(t.complete,o)}):i=t;return s.destination=new cn(i),s}return n(t,e),t}(on);function ln(e){tn(e)}var dn={closed:!0,next:nn,error:function(e){throw e},complete:nn},fn="function"==typeof Symbol&&Symbol.observable||"@@observable";function hn(e){return e}function pn(e){return 0===e.length?hn:1===e.length?e[0]:function(t){return e.reduce((function(e,t){return t(e)}),t)}}var vn=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 on||function(e){return e&&Bt(e.next)&&Bt(e.error)&&Bt(e.complete)}(r)&&Gt(r)?e:new an(e,t,n);return rn((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=gn(t))((function(t,r){var i=new an({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[fn]=function(){return this},e.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return pn(e)(this)},e.prototype.toPromise=function(e){var t=this;return new(e=gn(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 gn(e){var t;return null!==(t=null!=e?e:Xt.Promise)&&void 0!==t?t:Promise}function yn(e){return Bt(null==e?void 0:e.lift)}function mn(e){return function(t){if(yn(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 bn(e,t,n,r,i){return new wn(e,t,n,r,i)}var wn=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}(on);!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,yn(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 Qt;var n=this.getSubject();t.add(this.source.subscribe(bn(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=Qt.EMPTY)}return t},t.prototype.refCount=function(){return mn((function(e,t){var n=null;e._refCount++;var r=bn(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)}}(vn);var _n,En={now:function(){return(En.delegate||performance).now()},delegate:void 0},In={schedule:function(e){var t=requestAnimationFrame,n=cancelAnimationFrame,r=t((function(t){n=void 0,e(t)}));return new Qt((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=In.delegate;return((null==n?void 0:n.requestAnimationFrame)||requestAnimationFrame).apply(void 0,a([],c(e)))},cancelAnimationFrame:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return cancelAnimationFrame.apply(void 0,a([],c(e)))},delegate:void 0};new vn((function(e){var t=_n||En,n=t.now(),r=0,i=function(){e.closed||(r=In.requestAnimationFrame((function(o){r=0;var s=t.now();e.next({timestamp:_n?s:o,elapsed:s-n}),i()})))};return i(),function(){r&&In.cancelAnimationFrame(r)}}));var Sn=Wt((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),Tn=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 kn(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new Sn},t.prototype.next=function(e){var t=this;rn((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var i=u(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;rn((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;rn((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?Ht:(this.currentObservers=null,o.push(e),new Qt((function(){t.currentObservers=null,Jt(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 vn;return e.source=this,e},t.create=function(e,t){return new kn(e,t)},t}(vn),kn=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:Ht},t}(Tn);!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)}}(Tn);var Pn={now:function(){return(Pn.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=Pn);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,c=1;c<r.length&&r[c]<=s;c+=2)u=c;u&&r.splice(0,u+1)}}}(Tn),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))}}(Tn);var On,xn=function(e){function t(t,n){return e.call(this)||this}return n(t,e),t.prototype.schedule=function(e,t){return this},t}(Qt),An=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return setInterval.apply(void 0,a([e,t],c(n)))},Cn=function(e){return clearInterval(e)},Rn=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),An(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&&Cn(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,Jt(r,this),null!=t&&(this.id=this.recycleAsyncId(n,t,null)),this.delay=null,e.prototype.unsubscribe.call(this)}},t}(xn),Nn=1,Ln={};function Un(e){return e in Ln&&(delete Ln[e],!0)}var qn=function(e){var t=Nn++;return Ln[t]=!0,On||(On=Promise.resolve()),On.then((function(){return Un(t)&&e()})),t},Dn=function(e){Un(e)},jn={setImmediate:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=jn.delegate;return((null==n?void 0:n.setImmediate)||qn).apply(void 0,a([],c(e)))},clearImmediate:function(e){return Dn(e)},delegate:void 0},Fn=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=jn.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&&(jn.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},t}(Rn),Mn=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=Pn.now,e}(),Vn=function(e){function t(t,n){void 0===n&&(n=Mn.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}(Mn),$n=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}(Vn);new $n(Fn);var Kn=new Vn(Rn),zn=Kn,Bn=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}(Rn),Wn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t}(Vn);new Wn(Bn);var Yn=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=In.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&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(In.cancelAnimationFrame(n),t._scheduled=void 0)},t}(Rn),Jn=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}(Vn);new Jn(Yn),function(e){function t(t,n){void 0===t&&(t=Qn),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}(Vn);var Qn=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 Qt.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}(Rn),Hn=new vn((function(e){return e.complete()}));function Gn(e){return e&&Bt(e.schedule)}function Zn(e){return e[e.length-1]}function Xn(e){return Gn(Zn(e))?e.pop():void 0}function er(e,t){return"number"==typeof Zn(e)?e.pop():t}var tr=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function nr(e){return Bt(null==e?void 0:e.then)}function rr(e){return Bt(e[fn])}function ir(e){return Symbol.asyncIterator&&Bt(null==e?void 0:e[Symbol.asyncIterator])}function or(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 sr,ur="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function cr(e){return Bt(null==e?void 0:e[ur])}function ar(e){return d(this,arguments,(function(){var t,n,r;return s(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,l(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,l(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,l(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 lr(e){return Bt(null==e?void 0:e.getReader)}function dr(e){if(e instanceof vn)return e;if(null!=e){if(rr(e))return i=e,new vn((function(e){var t=i[fn]();if(Bt(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(tr(e))return r=e,new vn((function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()}));if(nr(e))return n=e,new vn((function(e){n.then((function(t){e.closed||(e.next(t),e.complete())}),(function(t){return e.error(t)})).then(null,tn)}));if(ir(e))return fr(e);if(cr(e))return t=e,new vn((function(e){var n,r;try{for(var i=u(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(lr(e))return fr(ar(e))}var t,n,r,i;throw or(e)}function fr(e){return new vn((function(t){(function(e,t){var n,r,i,u;return o(this,void 0,void 0,(function(){var o,c;return s(this,(function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),n=f(e),s.label=1;case 1:return[4,n.next()];case 2:if((r=s.sent()).done)return[3,4];if(o=r.value,t.next(o),t.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=s.sent(),i={error:c},[3,11];case 6:return s.trys.push([6,,9,10]),r&&!r.done&&(u=n.return)?[4,u.call(n)]:[3,8];case 7:s.sent(),s.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 hr(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 pr(e,t){return void 0===t&&(t=0),mn((function(n,r){n.subscribe(bn(r,(function(n){return hr(r,e,(function(){return r.next(n)}),t)}),(function(){return hr(r,e,(function(){return r.complete()}),t)}),(function(n){return hr(r,e,(function(){return r.error(n)}),t)})))}))}function vr(e,t){return void 0===t&&(t=0),mn((function(n,r){r.add(e.schedule((function(){return n.subscribe(r)}),t))}))}function gr(e,t){if(!e)throw new Error("Iterable cannot be null");return new vn((function(n){hr(n,t,(function(){var r=e[Symbol.asyncIterator]();hr(n,t,(function(){r.next().then((function(e){e.done?n.complete():n.next(e.value)}))}),0,!0)}))}))}function yr(e,t){if(null!=e){if(rr(e))return function(e,t){return dr(e).pipe(vr(t),pr(t))}(e,t);if(tr(e))return function(e,t){return new vn((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(nr(e))return function(e,t){return dr(e).pipe(vr(t),pr(t))}(e,t);if(ir(e))return gr(e,t);if(cr(e))return function(e,t){return new vn((function(n){var r;return hr(n,t,(function(){r=e[ur](),hr(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 Bt(null==r?void 0:r.return)&&r.return()}}))}(e,t);if(lr(e))return function(e,t){return gr(ar(e),t)}(e,t)}throw or(e)}function mr(e,t){return t?yr(e,t):dr(e)}function br(e){return e instanceof Date&&!isNaN(e)}!function(e){e.NEXT="N",e.ERROR="E",e.COMPLETE="C"}(sr||(sr={})),Wt((function(e){return function(){e(this),this.name="EmptyError",this.message="no elements in sequence"}})),Wt((function(e){return function(){e(this),this.name="ArgumentOutOfRangeError",this.message="argument out of range"}})),Wt((function(e){return function(t){e(this),this.name="NotFoundError",this.message=t}})),Wt((function(e){return function(t){e(this),this.name="SequenceError",this.message=t}}));var wr=Wt((function(e){return function(t){void 0===t&&(t=null),e(this),this.message="Timeout has occurred",this.name="TimeoutError",this.info=t}}));function _r(e){throw new wr(e)}function Er(e,t){return mn((function(n,r){var i=0;n.subscribe(bn(r,(function(n){r.next(e.call(t,n,i++))})))}))}var Ir=Array.isArray;function Sr(e){return Er((function(t){return function(e,t){return Ir(t)?e.apply(void 0,a([],c(t))):e(t)}(e,t)}))}function Tr(e,t,n){return void 0===n&&(n=1/0),Bt(t)?Tr((function(n,r){return Er((function(e,i){return t(n,e,r,i)}))(dr(e(n,r)))}),n):("number"==typeof t&&(n=t),mn((function(t,r){return function(e,t,n,r,i,o,s,u){var c=[],a=0,l=0,d=!1,f=function(){!d||c.length||a||t.complete()},h=function(e){return a<r?p(e):c.push(e)},p=function(e){o&&t.next(e),a++;var u=!1;dr(n(e,l++)).subscribe(bn(t,(function(e){null==i||i(e),o?h(e):t.next(e)}),(function(){u=!0}),void 0,(function(){if(u)try{a--;for(var e=function(){var e=c.shift();s?hr(t,s,(function(){return p(e)})):p(e)};c.length&&a<r;)e();f()}catch(e){t.error(e)}})))};return e.subscribe(bn(t,h,(function(){d=!0,f()}))),function(){null==u||u()}}(t,r,e,n)})))}function kr(e){return void 0===e&&(e=1/0),Tr(hn,e)}function Pr(){return kr(1)}var Or=["addListener","removeListener"],xr=["addEventListener","removeEventListener"],Ar=["on","off"];function Cr(e,t,n,r){if(Bt(n)&&(r=n,n=void 0),r)return Cr(e,t,n).pipe(Sr(r));var i=c(function(e){return Bt(e.addEventListener)&&Bt(e.removeEventListener)}(e)?xr.map((function(r){return function(i){return e[r](t,i,n)}})):function(e){return Bt(e.addListener)&&Bt(e.removeListener)}(e)?Or.map(Rr(e,t)):function(e){return Bt(e.on)&&Bt(e.off)}(e)?Ar.map(Rr(e,t)):[],2),o=i[0],s=i[1];if(!o&&tr(e))return Tr((function(e){return Cr(e,t,n)}))(dr(e));if(!o)throw new TypeError("Invalid event target");return new vn((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 Rr(e,t){return function(n){return function(r){return e[n](t,r)}}}function Nr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=Xn(e),r=er(e,1/0),i=e;return i.length?1===i.length?dr(i[0]):kr(r)(mr(i,n)):Hn}function Lr(e,t){return mn((function(n,r){var i=0;n.subscribe(bn(r,(function(n){return e.call(t,n,i++)&&r.next(n)})))}))}function Ur(e){return e<=0?function(){return Hn}:mn((function(t,n){var r=0;t.subscribe(bn(n,(function(t){++r<=e&&(n.next(t),e<=r&&n.complete())})))}))}function qr(e,t){return t?function(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return Pr()(mr(e,Xn(e)))}(t.pipe(Ur(1),mn((function(e,t){e.subscribe(bn(t,nn))}))),n.pipe(qr(e)))}:Tr((function(t,n){return dr(e(t,n)).pipe(Ur(1),function(e){return Er((function(){return e}))}(t))}))}function Dr(e,t){void 0===t&&(t=Kn);var n=function(e,t,n){void 0===e&&(e=0),void 0===n&&(n=zn);var r=-1;return null!=t&&(Gn(t)?n=t:r=t),new vn((function(t){var i=br(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)}))}(e,t);return qr((function(){return n}))}function jr(e){void 0===e&&(e={});var t=e.connector,n=void 0===t?function(){return new Tn}:t,r=e.resetOnError,i=void 0===r||r,o=e.resetOnComplete,s=void 0===o||o,u=e.resetOnRefCountZero,c=void 0===u||u;return function(e){var t,r,o,u=0,a=!1,l=!1,d=function(){null==r||r.unsubscribe(),r=void 0},f=function(){d(),t=o=void 0,a=l=!1},h=function(){var e=t;f(),null==e||e.unsubscribe()};return mn((function(e,p){u++,l||a||d();var v=o=null!=o?o:n();p.add((function(){0!==--u||l||a||(r=Fr(h,c))})),v.subscribe(p),!t&&u>0&&(t=new an({next:function(e){return v.next(e)},error:function(e){l=!0,d(),r=Fr(f,i,e),v.error(e)},complete:function(){a=!0,d(),r=Fr(f,s),v.complete()}}),dr(e).subscribe(t))}))(e)}}function Fr(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 an({next:function(){i.unsubscribe(),e()}});return dr(t.apply(void 0,a([],c(n)))).subscribe(i)}}else e()}new vn(nn);var Mr=["input","select","textarea"],Vr=function(e,t){return function(n,r){var i,o,s,u=e.pageUrlAllowlist,c=e.shouldTrackEventResolver,a=null===(o=null===(i=null==r?void 0:r.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i);if(!a)return!1;if(c)return c(n,r);if(!Br(window.location.href,u))return!1;var l=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t){var d=t.some((function(e){var t;return!!(null===(t=null==r?void 0:r.matches)||void 0===t?void 0:t.call(r,e))}));if(!d)return!1}switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:var f=null===(s=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===s?void 0:s.call(window,r);return!(!f||"pointer"!==f.getPropertyValue("cursor")||"click"!==n)||"click"===n}}},$r=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},Kr=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!Mr.includes(i)&&!o},zr=function(e){var t="";return Kr(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=zr(e),t+=r.split(/(\s+)/).filter($r).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},Br=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},Wr=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}),{})},Yr=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 $r(r)?r:""}return Yr(n)},Jr=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:Jr(null==e?void 0:e.parentElement,t):null},Qr=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={})[Mt]=i,t[Vt]=zr(e),t[$t]=window.location.href.split("?")[0],t);return Wr(o)};var Hr=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},Gr=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Kt:t,r=this;this.endpoint=Kt,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===Kt&&(this.endpoint=i);var c=null;window.addEventListener("message",(function(e){var n,r,i,a,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,h=null==f?void 0:f.action;if(h)if("id"in f)null===(a=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===a||a.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===h)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===h){var p=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;c=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:Qr,isElementSelectable:function(e){return!o||o((null==p?void 0:p.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u}),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"===h&&(null===(l=null==c?void 0:c.close)||void 0===l||l.call(c))}})),this.notify({action:"page-loaded"})},e}(),Zr=["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot"],Xr=["type"],ei=["svg","path","g"],ti=["password","hidden"];var ni=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=ri(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 c=String(e.tagName).toLowerCase(),a={tag:c},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 h=Array.from(e.classList);h.length&&(a.classes=h);var p={},v=Array.from(e.attributes).filter((function(e){return!Zr.includes(e.name)})),g=!Kr(e);if(!ti.includes(String(e.getAttribute("type")))&&!ei.includes(c))try{for(var y=u(v),m=y.next();!m.done;m=y.next()){var b=m.value;g&&!Xr.includes(b.name)||(p[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(p).length&&(a.attrs=p),a}(e)})),1024),t):[]};function ri(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 ri(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=c(e,1)[0]})).map((function(e){var t=c(e,2),n=t[0],r=t[1];return"".concat(String(ri(n,!0)),": ").concat(String(ri(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var ii;function oi(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,a=e.shouldTrackEvent,l=o.clickObservable,d=l.pipe(mn((function(e,t){var n,r=!1;e.subscribe(bn(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),Lr((function(e){var t=c(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),f=Nr(d,l.pipe((t=s.debounceTime,void 0===n&&(n=Kn),mn((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 c(){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(bn(r,(function(e){o=e,s=n.now(),i||(i=n.schedule(c,t),r.add(i))}),(function(){u(),r.complete()}),void 0,(function(){o=i=null})))}))),Er((function(){return"timeout"}))));return l.pipe(Dr(0),Lr(Hr),Lr((function(e){return a("click",e.closestTrackedAncestor)})),(r=f,mn((function(e,t){var n=[];return e.subscribe(bn(t,(function(e){return n.push(e)}),(function(){t.next(n),t.complete()}))),dr(r).subscribe(bn(t,(function(){var e=n;n=[],t.next(e)}),nn)),function(){n=null}})))).subscribe((function(e){var t,n,r=(e.length,Ft);try{for(var o=u(e),s=o.next();!s.done;s=o.next()){var c=s.value;null==i||i.track(r,c.targetElementProperties)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}))}function si(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,s=e.shouldTrackActionClick,u=n.clickObservable,l=n.mutationObservable,d=n.navigateObservable,f=u.pipe(Lr((function(e){return!o("click",e.closestTrackedAncestor)})),Er((function(e){var t=Jr(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e})),Lr(Hr),Lr((function(e){return s("click",e.closestTrackedAncestor)}))),h=[l];d&&h.push(d);var p,v,g=Nr.apply(void 0,a([],c(h),!1)),y=f.pipe((p=function(e){return g.pipe(Ur(1),function(e,t){var n=br(e)?{first:e}:"number"==typeof e?{each:e}:e,r=n.first,i=n.each,o=n.with,s=void 0===o?_r:o,u=n.scheduler,c=void 0===u?null!=t?t:Kn:u,a=n.meta,l=void 0===a?null:a;if(null==r&&null==i)throw new TypeError("No timeout provided.");return mn((function(e,t){var n,o,u=null,a=0,d=function(e){o=hr(t,c,(function(){try{n.unsubscribe(),dr(s({meta:l,lastValue:u,seen:a})).subscribe(t)}catch(e){t.error(e)}}),e)};n=e.subscribe(bn(t,(function(e){null==o||o.unsubscribe(),a++,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}))),!a&&d(null!=r?"number"==typeof r?r:+r-c.now():i)}))}({first:500,with:function(){return Hn}}),Er((function(){return e})))},mn((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(bn(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;dr(p(e,s)).subscribe(n=bn(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(Ft,i("click",e.closestTrackedAncestor))}))}!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(ii||(ii={}));var ui,ci=function(e){var t,n,i;void 0===e&&(e={});var l=e.dataAttributePrefix,d=void 0===l?we:l,f=e.visualTaggingOptions,h=void 0===f?{enabled:!0,messenger:new Gr}:f;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:be,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:_e,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var p="@amplitude/plugin-autocapture-browser",v=[],g=function(e,t){var n,r,i,o=null===(i=null===(r=null==t?void 0:t.tagName)||void 0===r?void 0:r.toLowerCase)||void 0===i?void 0:i.call(r),s="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},u=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,d),a=Yr(t),l=((n={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",n["[Amplitude] Element Class"]=t.getAttribute("class"),n["[Amplitude] Element Hierarchy"]=ni(t),n[Mt]=o,n[Vt]=zr(t),n["[Amplitude] Element Position Left"]=null==s.left?null:Math.round(s.left),n["[Amplitude] Element Position Top"]=null==s.top?null:Math.round(s.top),n["[Amplitude] Element Aria Label"]=u,n["[Amplitude] Element Attributes"]=c,n["[Amplitude] Element Parent Label"]=a,n[$t]=window.location.href.split("?")[0],n["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",n["[Amplitude] Viewport Height"]=window.innerHeight,n["[Amplitude] Viewport Width"]=window.innerWidth,n);return"a"===o&&"click"===e&&t instanceof HTMLAnchorElement&&(l["[Amplitude] Element Href"]=t.href),Wr(l)},y=function(t,n){var r={event:t,timestamp:Date.now(),type:n};if(function(e){return"click"===e.type||"change"===e.type}(r)&&null!==r.event.target){var i=Jr(r.event.target,e.cssSelectorAllowlist);return i&&(r.closestTrackedAncestor=i,r.targetElementProperties=g(r.type,i)),r}return r};return{name:p,type:"enrichment",setup:function(t,n){return o(void 0,void 0,void 0,(function(){var i,o,u,l,d,f,m,b,w,_;return s(this,(function(s){return"undefined"==typeof document||(i=Vr(e,e.cssSelectorAllowlist),o=Vr(e,e.actionClickAllowlist),u=function(){var e,t,n=Cr(document,"click",{capture:!0}).pipe(Er((function(e){return y(e,"click")})),jr()),r=Cr(document,"change",{capture:!0}).pipe(Er((function(e){return y(e,"change")})),jr());window.navigation&&(t=Cr(window.navigation,"navigate").pipe(Er((function(e){return y(e,"navigate")})),jr()));var i=new vn((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()}})).pipe(Er((function(e){return y(e,"mutation")})),jr());return(e={})[ii.ClickObservable]=n,e[ii.ChangeObservable]=r,e[ii.NavigateObservable]=t,e[ii.MutationObservable]=i,e}(),l=oi({allObservables:u,options:e,amplitude:n,shouldTrackEvent:i}),v.push(l),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent;return n.changeObservable.pipe(Lr(Hr),Lr((function(e){return i("change",e.closestTrackedAncestor)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:u,getEventProperties:g,amplitude:n,shouldTrackEvent:i}),v.push(d),f=si({allObservables:u,options:e,getEventProperties:g,amplitude:n,shouldTrackEvent:i,shouldTrackActionClick:o}),v.push(f),null===(w=null==t?void 0:t.loggerProvider)||void 0===w||w.log("".concat(p," has been successfully added.")),window.opener&&h.enabled&&(m=e.cssSelectorAllowlist,b=e.actionClickAllowlist,null===(_=h.messenger)||void 0===_||_.setup(r(r({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:zt[t.serverZone]}),{isElementSelectable:Vr(e,a(a([],c(m),!1),c(b),!1)),cssSelectorAllowlist:m,actionClickAllowlist:b})))),[2]}))}))},execute:function(e){return o(void 0,void 0,void 0,(function(){return s(this,(function(t){return[2,e]}))}))},teardown:function(){return o(void 0,void 0,void 0,(function(){var e,t,n,r;return s(this,(function(i){try{for(e=u(v),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]}))}))}}},ai="dclid",li="fbclid",di="gbraid",fi="gclid",hi="ko_click_id",pi="li_fat_id",vi="msclkid",gi="rtd_cid",yi="ttclid",mi="twclid",bi="wbraid",wi={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},_i=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Ei=function(e,t,n,r,o){void 0===o&&(o=!0),e.referrer;var s=e.referring_domain,u=i(e,["referrer","referring_domain"]),c=t||{};c.referrer;var a=c.referring_domain,l=i(c,["referrer","referring_domain"]);if(Ii(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(!o&&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=_i(s||"")!==_i(a||""),h=!t||d||f;return h?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."),h},Ii=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}))},Si=function(){function e(){}return e.prototype.parse=function(){return o(this,void 0,void 0,(function(){return s(this,(function(e){return[2,r(r(r(r({},wi),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=se();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=se();return(e={})[ai]=t[ai],e[li]=t[li],e[di]=t[di],e[fi]=t[fi],e[hi]=t[hi],e[pi]=t[pi],e[vi]=t[vi],e[gi]=t[gi],e[yi]=t[yi],e[mi]=t[mi],e[bi]=t[bi],e},e}(),Ti=function(){function e(e,t){var n,i,o,s,u,c;this.shouldTrackNewCampaign=!1,this.options=r({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(i=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,o=i,o?(o.startsWith(".")&&(o=o.substring(1)),[new RegExp("".concat(o.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(s=t.apiKey,void 0===(u="MKTG")&&(u=""),void 0===c&&(c=10),[w,u,s.substring(0,c)].filter(Boolean).join("_")),this.currentCampaign=wi,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 o(this,void 0,void 0,(function(){var e,t;return s(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=c.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||re(this.sessionTimeout,this.lastEventTime),Ei(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 o(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new Si).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,i,o,s=(t=this.currentCampaign,n=this.options,i=r(r({},wi),t),o=Object.entries(i).reduce((function(e,t){var r,i=c(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)}),new T),P(o));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ki=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return n(t,e),t.prototype.init=function(e,t,n){var i,o;return void 0===e&&(e=""),arguments.length>2?(i=t,o=n):"string"==typeof t?(i=t,o=void 0):(i=null==t?void 0:t.userId,o=t),O(this._init(r(r({},o),{userId:i,apiKey:e})))},t.prototype._init=function(t){var n,i,u;return o(this,void 0,void 0,(function(){var c,a,l,d,f,h=this;return s(this,(function(p){switch(p.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,it(t.apiKey,t,this)]);case 1:return c=p.sent(),t.fetchRemoteConfig?[4,(g=c,o(void 0,void 0,void 0,(function(){var e;return s(this,(function(t){switch(t.label){case 0:return[4,(e=new jt(g)).initialize()];case 1:return t.sent(),[2,e]}}))})))]:[3,4];case 2:return[4,p.sent().generateJoinedConfig()];case 3:c=p.sent(),p.label=4;case 4:return[4,e.prototype._init.call(this,c)];case 5:return p.sent(),this.logBrowserOptions(c),Ie(this.config.defaultTracking)?(a=function(e){return Ie(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?r({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new Ti(a,this.config),[4,this.webAttribution.init()]):[3,7];case 6:p.sent(),p.label=7;case 7:return l=se(),d=Number.isNaN(Number(l.ampSessionId))?void 0:Number(l.ampSessionId),this.setSessionId(null!==(u=null!==(i=null!==(n=t.sessionId)&&void 0!==n?n:d)&&void 0!==i?i:this.config.sessionId)&&void 0!==u?u:Date.now()),(f=ee(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,9]:[4,this.add(Lt()).promise];case 8:p.sent(),p.label=9;case 9:return[4,this.add(new M).promise];case 10:return p.sent(),[4,this.add(new Re).promise];case 11:return p.sent(),[4,this.add(new te).promise];case 12:return p.sent(),function(e){Nt||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."),Nt=!0)}(this.config),v=this.config.defaultTracking,Ee(v,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Rt()).promise]):[3,14];case 13:p.sent(),p.label=14;case 14:return function(e){return Ee(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(xt()).promise]):[3,16];case 15:p.sent(),p.label=16;case 16:return Se(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Tt(Oe(this.config))).promise]):[3,18];case 17:p.sent(),p.label=18;case 18:return ke(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(ci(Pe(this.config))).promise]):[3,20];case 19:p.sent(),p.label=20;case 20:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 21:return p.sent(),f.eventBridge.setEventReceiver((function(e){h.track(e.eventType,e.eventProperties)})),[2]}var v,g}))}))},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,function(e,t){ee(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),this.config.deviceId=e,function(e,t){ee(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(m()),this.setUserId(void 0)},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)),O(Promise.resolve());if(e===this.config.sessionId)return O(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId(),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,Te(this.config.defaultTracking)&&(r&&i&&n.push(this.track(Ye,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 Te(this.config.defaultTracking)&&n.push(this.track(We,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,O(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=st(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(Ae(t)){var r=t._q;t._q=[],t=xe(new T,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(Ae(r)){var o=r._q;r._q=[],r=xe(new T,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(Ae(t)){var r=t._q;t._q=[],t=xe(new A,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 o(this,void 0,void 0,(function(){var n,r,i;return s(this,(function(o){return n=Date.now(),r=re(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===We||t.event_type===Ye||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=r(r({},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}(x),Pi=function(){var e=new ki;return{init:fe(e.init.bind(e),"init",ae(e),de(e,["config"])),add:fe(e.add.bind(e),"add",ae(e),de(e,["config.apiKey","timeline.plugins"])),remove:fe(e.remove.bind(e),"remove",ae(e),de(e,["config.apiKey","timeline.plugins"])),track:fe(e.track.bind(e),"track",ae(e),de(e,["config.apiKey","timeline.queue.length"])),logEvent:fe(e.logEvent.bind(e),"logEvent",ae(e),de(e,["config.apiKey","timeline.queue.length"])),identify:fe(e.identify.bind(e),"identify",ae(e),de(e,["config.apiKey","timeline.queue.length"])),groupIdentify:fe(e.groupIdentify.bind(e),"groupIdentify",ae(e),de(e,["config.apiKey","timeline.queue.length"])),setGroup:fe(e.setGroup.bind(e),"setGroup",ae(e),de(e,["config.apiKey","timeline.queue.length"])),revenue:fe(e.revenue.bind(e),"revenue",ae(e),de(e,["config.apiKey","timeline.queue.length"])),flush:fe(e.flush.bind(e),"flush",ae(e),de(e,["config.apiKey","timeline.queue.length"])),getUserId:fe(e.getUserId.bind(e),"getUserId",ae(e),de(e,["config","config.userId"])),setUserId:fe(e.setUserId.bind(e),"setUserId",ae(e),de(e,["config","config.userId"])),getDeviceId:fe(e.getDeviceId.bind(e),"getDeviceId",ae(e),de(e,["config","config.deviceId"])),setDeviceId:fe(e.setDeviceId.bind(e),"setDeviceId",ae(e),de(e,["config","config.deviceId"])),reset:fe(e.reset.bind(e),"reset",ae(e),de(e,["config","config.userId","config.deviceId"])),getSessionId:fe(e.getSessionId.bind(e),"getSessionId",ae(e),de(e,["config"])),setSessionId:fe(e.setSessionId.bind(e),"setSessionId",ae(e),de(e,["config"])),extendSession:fe(e.extendSession.bind(e),"extendSession",ae(e),de(e,["config"])),setOptOut:fe(e.setOptOut.bind(e),"setOptOut",ae(e),de(e,["config"])),setTransport:fe(e.setTransport.bind(e),"setTransport",ae(e),de(e,["config"]))}},Oi=Pi(),xi=Oi.add,Ai=Oi.extendSession,Ci=Oi.flush,Ri=Oi.getDeviceId,Ni=Oi.getSessionId,Li=Oi.getUserId,Ui=Oi.groupIdentify,qi=Oi.identify,Di=Oi.init,ji=Oi.logEvent,Fi=Oi.remove,Mi=Oi.reset,Vi=Oi.revenue,$i=Oi.setDeviceId,Ki=Oi.setGroup,zi=Oi.setOptOut,Bi=Oi.setSessionId,Wi=Oi.setTransport,Yi=Oi.setUserId,Ji=Oi.track;e.Types=void 0,(ui=e.Types||(e.Types={})).OfflineDisabled=null,ui.DEFAULT_CSS_SELECTOR_ALLOWLIST=be,ui.DEFAULT_DATA_ATTRIBUTE_PREFIX=we,ui.DEFAULT_ACTION_CLICK_ALLOWLIST=_e,e.Identify=T,e.Revenue=A,e.add=xi,e.createInstance=Pi,e.extendSession=Ai,e.flush=Ci,e.getDeviceId=Ri,e.getSessionId=Ni,e.getUserId=Li,e.groupIdentify=Ui,e.identify=qi,e.init=Di,e.logEvent=ji,e.remove=Fi,e.reset=Mi,e.revenue=Vi,e.runQueuedFunctions=function(e,t){xe(e,t)},e.setDeviceId=$i,e.setGroup=Ki,e.setOptOut=zi,e.setSessionId=Bi,e.setTransport=Wi,e.setUserId=Yi,e.track=Ji,Object.defineProperty(e,"__esModule",{value:!0})}));
|