@amplitude/analytics-browser 2.45.8 → 2.45.10
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/browser-client.js +1 -1
- package/lib/cjs/browser-client.js.map +1 -1
- package/lib/cjs/config.d.ts +2 -3
- package/lib/cjs/config.d.ts.map +1 -1
- package/lib/cjs/config.js +1 -2
- package/lib/cjs/config.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/browser-client.js +1 -1
- package/lib/esm/browser-client.js.map +1 -1
- package/lib/esm/config.d.ts +2 -3
- package/lib/esm/config.d.ts.map +1 -1
- package/lib/esm/config.js +1 -2
- package/lib/esm/config.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/config.d.ts +2 -3
- package/lib/scripts/config.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 +9 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.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 a}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var f,v="AMP",p="".concat(v,"_unsent"),h="$default_instance",g="https://api2.amplitude.com/2/httpapi",m="https://api.eu.amplitude.com/2/httpapi",y="https://api2.amplitude.com/batch",b="https://api.eu.amplitude.com/batch",w="dclid",E="fbclid",S="gbraid",k="gclid",T="ko_click_id",x="li_fat_id",P="msclkid",_="rdt_cid",A="ttclid",O="twclid",I="wbraid",C={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],D=["authorization","cookie","set-cookie"],L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&L(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.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[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||N(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(f||(f={}));var j,U=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],F="Event skipped due to empty event type";!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"}(j||(j={}));var q,B=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=j.Unknown),{event:e,code:t,message:n}},H=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},V=d([],l(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),z=function(e){var t,n=H();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,z)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],l(r.entries()),!1).map(function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(V[r]):V[r]}).join("")},W=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=z(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),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._clearOptOutListeners(),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.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a,s,d,f,v,p,h,g,m,y,b,w,E,S,k,T;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),s=c(a),d=s.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(E)throw E.error}return[7];case 8:v=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),p=c(v),h=p.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=12;case 12:return h=p.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),k={error:y},[3,16];case 15:try{h&&!h.done&&(T=p.return)&&T.call(p)}finally{if(k)throw k.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),w=b.map(function(e){var t=o({},n);return e.execute(t).catch(function(e){return B(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||B(n,100,"Event not tracked, no destination plugins on the instance");i(t)}),[2]}})})},e.prototype.flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r=this;return u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),t=c(this._optOutListeners),n=t.next(),u.label=1;case 1:if(n.done)return[3,6];r=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,r(e)];case 3:return u.sent(),[3,5];case 4:return i=u.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=u.sent(),a={error:o},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),G=function(e,t){return o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},$=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new W(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(a=o())&&"promise"in a?[4,a.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,a];case 5:u.sent(),u.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),$(this.dispatch(r))},e.prototype.identify=function(e,t){var n=G(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),$(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var a=function(e,t,n,r){var a;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(a={},a[e]=t,a)})}(e,t,n,r);return $(this.dispatch(a))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,a=new M;return a.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:a.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),$(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return $(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),$())},e.prototype._addPlugin=function(e){return $(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)),$())},e.prototype._removePlugin=function(e){return $(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(B(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},i=o({},n);if(void 0===e)return i;var a={};return Object.keys(e).forEach(function(t){Object.values(r).includes(t)||(a[t]=e[t])}),U.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case r.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case r.UNSET:Object.keys(n).forEach(function(e){delete i[e]});break;case r.SET:Object.assign(i,n)}}}),Object.assign(i,a),i},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,B(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(F),[2,B(e,0,F)]):(e.event_type===i.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(o=a.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=B(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return $(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),J=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){try{var t=JSON.parse(JSON.stringify(e));L(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[q.REVENUE_PRODUCT_ID]=this.productId,e[q.REVENUE_QUANTITY]=this.quantity,e[q.REVENUE_PRICE]=this.price,e[q.REVENUE_TYPE]=this.revenueType,e[q.REVENUE_CURRENCY]=this.currency,e[q.REVENUE]=this.revenue,e[q.RECEIPT]=this.receipt,e[q.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"}(q||(q={}));var Y;!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"}(Y||(Y={}));var X="Amplitude Logger ",Q=function(){function e(){this.logLevel=Y.None}return e.prototype.disable=function(){this.logLevel=Y.None},e.prototype.enable=function(e){void 0===e&&(e=Y.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Y.Verbose||console.log("".concat(X,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Y.Warn||console.warn("".concat(X,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Y.Error||console.error("".concat(X,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<Y.Debug||console.log("".concat(X,"[Debug]: ").concat(e.join(" ")))},e}(),Z=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:Y.Warn,loggerProvider:new Q,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},ee=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=Z();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var a=ne(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),te=function(e,t){return"EU"===e?t?b:m:t?y:g},ne=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=Z().serverZone),void 0===n&&(n=Z().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:Z().serverZone;return{serverZone:r,serverUrl:te(r,n)}},re=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function ie(e){return e>=200&&e<300}var oe=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=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},se=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ue=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=se(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},ce=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),u=s.logger,c=s.logLevel;if(c&&c<Y.Debug||!c||!u)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:oe(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()),u.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))),d}},le=new Set([g,m,y,b]);function de(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var fe=function(){function e(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=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,function(){var n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(p,"_").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=z()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var t,n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]).reduce(function(t,n){return s(r,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),s(this,void 0,void 0,function(){var r,i,o,s,c,l;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,a(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new re,u.label=1;case 1:return u.trys.push([1,3,,4]),i=ne(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=function(e,t){return void 0===t&&(t=!1),!!le.has(e)||t}(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,o)];case 2:return null===(s=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(de(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return c=u.sent(),l=(d=c)instanceof Error?d.message:String(d),this.config.loggerProvider.error(l),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:oe()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}var d})})},e.prototype.handleResponse=function(e,t){var n;ie(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:de(e),stack_trace:oe()});var r=e.status;switch(r){case j.Success:this.handleSuccessResponse(e,t);break;case j.Invalid:this.handleInvalidResponse(e,t);break;case j.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case j.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(de(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(de(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,a=new Set(r),s=new Set(i),u=new Set(o),c=t.filter(function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(de(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){var r,i,o;ie(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:oe()})),this.removeEvents(e),e.forEach(function(e){return e.callback(B(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}(),ve=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:pe(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),pe=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},he=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}(),ge=function(){return ge=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},ge.apply(this,arguments)};function me(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 ye(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.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 a}"function"==typeof SuppressedError&&SuppressedError;var be=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=me(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===i)return e===t}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),u=Array.isArray(t);if(s!==u)return!1;if(!s||!u){var c=Object.keys(e).sort(),l=Object.keys(t).sort();if(!be(c,l))return!1;var d=!0;return Object.keys(e).forEach(function(n){be(e[n],t[n])||(d=!1)}),d}for(var f=0;f<e.length;f++)if(!be(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var we=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=ge({},this.identity.userProperties),n=ge(ge({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,a,s,u=n.userProperties||{};try{for(var c=me(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=ye(l.value,2),f=d[0],v=d[1];switch(f){case"$set":try{for(var p=(i=void 0,me(Object.entries(v))),h=p.next();!h.done;h=p.next()){var g=ye(h.value,2),m=g[0],y=g[1];u[m]=y}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(a=void 0,me(Object.keys(v))),w=b.next();!w.done;w=b.next()){delete u[m=w.value]}}catch(e){a={error:e}}finally{try{w&&!w.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return n.userProperties=u,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return ge({},this.identity)},e.prototype.setIdentity=function(e){var t=ge({},this.identity);this.identity=ge({},e),be(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}(),Ee="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Se=function(){function e(){this.identityStore=new we,this.eventBridge=new he,this.applicationContextProvider=new ve}return e.getInstance=function(t){return Ee.analyticsConnectorInstances||(Ee.analyticsConnectorInstances={}),Ee.analyticsConnectorInstances[t]||(Ee.analyticsConnectorInstances[t]=new e),Ee.analyticsConnectorInstances[t]},e}(),ke=function(e){return void 0===e&&(e=h),Se.getInstance(e)},Te=function(){function e(){this.name="identity",this.type="before",this.identityStore=ke().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=ke(e.instanceName).identityStore),[2]})})},e}(),xe=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Pe=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},_e=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:""},Ae=function(){var e,t=H();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=Oe(n[0]),i=Oe(n[1]);return i?(e[r]=i,e):e},{}):{}},Oe=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Ie=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Ce=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},Re=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},De=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},Le=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),Ne=function(){function e(e,t){void 0===t&&(t={}),this.options=o({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return u(this,function(s){switch(s.label){case 0:return t="AMP_TEST",n=o({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&(null===(n=a.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);null===(r=a.config.diagnosticsClient)||void 0===r||r.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,s.sent()]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=Me(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,o,a,s,l,d,f,v;return u(this,function(u){switch(u.label){case 0:r=H(),i=r,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(a=u.sent()){a.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:a.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(s=c(a),l=s.next();!l.done;l=s.next())if(d=l.value,je(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{l&&!l.done&&(v=s.return)&&v.call(s)}finally{if(f)throw f.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=H(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),a=void 0,s=this.config.duplicateResolverFn;if("function"==typeof s&&o.length>1&&(a=o.find(function(t){var n;try{var i=s(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),a||(a=o[0]),a)return a.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=H();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=null!==t?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),a=s}var u="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=u}catch(t){var c=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=H();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Me=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},je=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},Ue=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},Fe=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),qe="tags",Be="counters",He="histograms",Ve="events",ze="internal",We="last_flush_timestamp",Ge=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=H())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(qe)||e.createObjectStore(qe,{keyPath:"key"}),e.objectStoreNames.contains(Be)||e.createObjectStore(Be,{keyPath:"key"}),e.objectStoreNames.contains(He)||e.createObjectStore(He,{keyPath:"key"}),e.objectStoreNames.contains(Ve))||e.createObjectStore(Ve,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(ze)||e.createObjectStore(ze,{keyPath:"key"})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([qe],"readwrite"),r=n.objectStore(qe),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Be],"readwrite"),r=n.objectStore(Be),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([He],"readwrite"),r=n.objectStore(He),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Ve],"readwrite"),r=n.objectStore(Ve),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([ze],"readwrite"),i=r.objectStore(ze),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([ze],"readonly"),r=n.objectStore(ze),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(We)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(We,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),t=e.transaction([qe,Be,He,Ve],"readwrite"),[4,Promise.all([this.getAllFromStore(t,qe),this.getAllFromStore(t,Be),this.getAllFromStore(t,He),this.getAllFromStore(t,Ve)])];case 2:return n=l.apply(void 0,[u.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,Be),this.clearTable(t,He),this.clearTable(t,Ve)])];case 3:return u.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}})},e}(),$e=function(e){var t,n,r=function(){var e=H();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();if(0!==r.length)try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},Ke=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},Je=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},Ye=3e5,Xe=1e4,Qe=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=o({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=Re(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:Ge.isSupported()?this.storage=new Ge(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=H();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",o({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=$e({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=Ke(i),a=$e({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:Je(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=Xe?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=Xe?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=Xe)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},Ye))},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=o({},this.inMemoryTags),t=o({},this.inMemoryCounters),n=o({},this.inMemoryHistograms),r=d([],l(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),a={},n.forEach(function(e){a[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),c=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(a).length&&0===Object.keys(s).length&&0===c.length?[2]:(l={tags:o,histogram:s,counters:a,events:c},this.fetch(l),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!H())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(Ye),[2]):(n=e-t)>=Ye?(this._flush(),[2]):(this._setFlushTimer(Ye-n),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Re(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),Ze=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S;if("object"!=typeof e)return null;var k=e.code||0,T=this.buildStatus(k);switch(T){case j.Success:return{status:T,statusCode:k,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 j.Invalid:return{status:T,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},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!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case j.PayloadTooLarge:return{status:T,statusCode:k,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case j.RateLimit:return{status:T,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case j.Timeout:default:return{status:T,statusCode:k}}},e.prototype.buildStatus=function(e){return ie(e)?j.Success:429===e?j.RateLimit:413===e?j.PayloadTooLarge:408===e?j.Timeout:e>=400&&e<500?j.Invalid:e>=500?j.Failed:j.Unknown},e}();function et(){return"undefined"!=typeof CompressionStream}function tt(e){return s(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var nt=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}();var rt=401,it=403,ot=429,at=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=r||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new nt(e,t),this.customFetch=i}return e.prototype.subscribe=function(e,t,n){var r=z(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,function(){var n,r,i,o,a,s,c=this;return u(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,l,d,f,v,p,h;return u(this,function(u){switch(u.label){case 0:i=!0,a=new AbortController,s=setTimeout(function(){return a.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),l=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(g=o.customFetch({url:l,method:"GET",headers:d,signal:a.signal}),m=a.signal,new Promise(function(e,t){var n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),g.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return v=u.sent(),[3,5];case 3:return[4,fetch(l,{method:"GET",headers:d,signal:a.signal})];case 4:v=u.sent(),u.label=5;case 5:return(f=v).ok||f.status>=200&&f.status<300?[3,7]:[4,f.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(f.status,": ").concat(p)),f.status===rt||f.status===it?(o.logger.error("Remote config client fetch failed with ".concat(f.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==ot&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(h=u.sent())instanceof Error&&"AbortError"===h.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),h),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,c.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var g,m})},o=this,a=0,l.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=l.sent()))return[2,s.value];if("break"===s)return[3,4];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}(),st=H(),ut=null==st?void 0:st.console,ct={},lt={},dt=!1;var ft,vt={addListener:function(e,t){var n,r=(n=e,!!ut&&"function"==typeof ut[n]&&(lt[n]||(lt[n]=ut[n],ut[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(ct[n]&&!dt){dt=!0;var r=ct[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return dt=!1,lt[n].apply(ut,e)}),!0));if(!r)return new Error("Console override failed");ct[e]?ct[e].push(t):ct[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(ct)),i=r.next();!i.done;i=r.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(lt)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(ut[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}lt={},ct={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(ft||(ft={}));var pt=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],ht="data-amp-track-",gt=["div","span","h1","h2","h3","h4","h5","h6"],mt=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),yt=mt,bt=mt,wt=["*"];function Et(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function St(e,t,n){e&&kt({json:e,allowlist:t.map(Tt),excludelist:n.map(Tt),ancestors:[]})}function kt(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,u=e.parentObject,f=e.targetKey;i||(i=r);var v=Object.keys(i);try{for(var p=c(v),h=p.next();!h.done;h=p.next()){var g=h.value,m=d(d([],l(s),!1),[g],!1);Et(i[g])?Pt(m,o)&&!Pt(m,a)||delete i[g]:kt({json:r,targetObject:i[g],allowlist:o,excludelist:a,ancestors:m,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&u&&f&&delete u[f]}function Tt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function xt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(xt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&xt(e,t,n+1,r+1)}function Pt(e,t){return t.some(function(t){return xt(e,t)})}var _t=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=l(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),u=s[0],d=s[1];i[u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Nt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=H();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=Ot(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Dt(this.body,e,t)]})})},e}(),At=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),Nt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Ot(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Dt(this.body,e,t)]})})},e}();function Ot(e,t){var n,r,i,o=H(),a=null==o?void 0:o.TextEncoder;if(a&&null!=e){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(s=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var u=e,d=0,f=0;try{for(var v=c(u.entries()),p=v.next();!p.done;p=v.next()){var h=l(p.value,2),g=h[0],m=h[1];if(d+=g.length,"string"==typeof m)d+=(new a).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}i=d}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(s=e);return i}}var It,Ct=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),Nt(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Dt(n.sent(),e,t)]}})})},e}(),Rt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split(": "),2),u=s[0],d=s[1];u&&d&&(r[u]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return Nt(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){var n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(St(n,e,t),[2,n]):[2,null]})})},e}();function Dt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return St(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(It||(It={}));var Lt="[REDACTED]",Nt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?It.REMOVE:a,u=d([],l(D),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===It.REDACT&&(f[t]=Lt):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===It.REDACT&&(f[t]=Lt)};try{for(var p=c(Object.keys(e)),h=p.next();!h.done;h=p.next()){v(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return f},Mt=function(){function e(e,t,n,r,i,o,a,s,u,c,l){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=u,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(d([],l(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(d([],l(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=l(e,2);return t[0],void 0!==t[1]}))},e}();var jt=function(e,t){void 0===t&&(t=z()),this.callback=e,this.id=t};function Ut(e){try{e()}catch(e){}}var Ft=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=H();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=H();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,u,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,p=null===(l=null===(c=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&v&&p&&this.observeXhr(f,v,p);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(e){Ut(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var u,c,l,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var v=Math.floor(performance.now()-a),p=Math.floor(o+v),h=new Mt(e,d,o,o,u,n,c,v,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,a,s=this;return u(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){Ut(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new _t(r):void 0,i?new Ct(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){Ut(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&Ut(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,a=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=l(n,2),s=i[0],u=i[1];try{this.$$AmplitudeAnalyticsEvent=o({method:s,url:null===(e=null==u?void 0:u.toString)||void 0===e?void 0:e.call(u),headers:{}},a.getTimestamps())}catch(e){Ut(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,a),s=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new Rt(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,c=new At(s,r);u.status=i.status,a.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(e){Ut(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){Ut(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),qt=new Ft,Bt=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,o(o(o(o({},C),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Ae();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=Ae();return(e={})[w]=t[w],e[E]=t[E],e[S]=t[S],e[k]=t[k],e[T]=t[T],e[x]=t[x],e[P]=t[P],e[_]=t[_],e[A]=t[A],e[O]=t[O],e[I]=t[I],e},e}(),Ht="data-amp-mask",Vt="*****",zt=/\b(?:\d[ -]*?){13,16}\b/,Wt=/(\d{3}-?\d{2}-?\d{4})/g,Gt=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,$t=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(zt,Vt)).replace(Wt,Vt)).replace(Gt,Vt);try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,Vt)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},Kt=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(Ht)?Vt:e?e(document.title):document.title},Jt={};Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.Observable=void 0;const Yt=e=>Boolean(Symbol[e]),Xt=e=>Yt(e)?Symbol[e]:"@@"+e,Qt=Xt("iterator"),Zt=Xt("observable"),en=Xt("species");function tn(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function nn(e){let t=e.constructor;return void 0!==t&&(t=t[en],null===t&&(t=void 0)),void 0!==t?t:dn}function rn(e){rn.log?rn.log(e):setTimeout(()=>{throw e})}function on(e){Promise.resolve().then(()=>{try{e()}catch(e){rn(e)}})}function an(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=tn(t,"unsubscribe");e&&e.call(t)}}catch(e){rn(e)}}function sn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function un(e,t,n){e._state="running";let r=e._observer;try{let i=tn(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(sn(e),!i)throw n;i.call(r,n);break;case"complete":sn(e),i&&i.call(r)}}catch(e){rn(e)}"closed"===e._state?an(e):"running"===e._state&&(e._state="ready")}function cn(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void on(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(un(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void un(e,t,n);e._queue.push({type:t,value:n})}}class ln{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){cn(n,"next",e)},error(e){cn(n,"error",e)},complete(){cn(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(sn(this),an(this))}}class dn{constructor(e){if(!(this instanceof dn))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new ln(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(nn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(nn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=nn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=nn(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=nn(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[Zt](){return this}static from(e){let t="function"==typeof this?this:dn;if(null==e)throw new TypeError(e+" is not an object");let n=tn(e,Zt);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof dn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(Yt("iterator")&&(n=tn(e,Qt),n))return new t(t=>{on(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{on(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:dn)(t=>{on(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[en](){return this}}Jt.Observable=dn,Object.defineProperty(dn,Symbol("extensions"),{value:{symbol:Zt,hostReportError:rn},configurable:!0});var fn=Jt.Observable;function vn(e,t){return new fn(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function pn(e,t){return new fn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o})}function hn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new fn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=c(t),s=a.next();!s.done;s=a.next()){var u=s.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var gn={},mn={get exports(){return gn},set exports(e){gn=e}},yn=Object.prototype.hasOwnProperty;function bn(e){return"[Throws: "+(e?e.message:"?")+"]"}function wn(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return bn(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(yn.call(e,t))try{return e[t]}catch(e){return bn(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}mn.exports=function(e,t,n){return JSON.stringify(wn(e),t,n)};var En,Sn=gn.ensureProperties=wn,kn=gn||e({__proto__:null,ensureProperties:Sn,get default(){return gn}},[gn]),Tn="https://app.amplitude.com",xn={US:Tn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var Pn="__AMPLITUDE_MESSENGER_INSTANCE__",_n="__AMPLITUDE_MESSENGER__",An=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?Tn:t;this[En]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,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,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(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.registerActionHandler=function(e,t){var n,r,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var s=c(a),u=s.next();!u.done;u=s.next()){t(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===Tn&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var s=e.data,u=null==s?void 0:s.action;if(u)if("id"in s&&s.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(s);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(s.data);else{var l=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];l.push(s.data),r.pendingMessages.set(u,l)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=H();(null==e?void 0:e[_n])===this&&delete e[_n]},e}();function On(e){var t,n=H(),r=null==n?void 0:n[_n];if("object"==typeof(t=r)&&null!==t&&Pn in t&&!0===t[Pn])return r;var i=new An(e);return n&&(n[_n]=i),i}En=Pn;var In="__AMPLITUDE_BACKGROUND_CAPTURE__";var Cn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Rn(e,t){var n=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var r=e/t*100;n=Math.min(100,Math.max(0,r))}return n}function Dn(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,start_time:n,last_position:n,percent_completed:Rn(n,r)},void 0!==t?{stop_reason:t}:{})}function Ln(e){return{mux_playback_id:e.getAttribute("playback-id"),mux_video_id:e.getAttribute("metadata-video-id"),mux_video_title:e.getAttribute("metadata-video-title")}}function Nn(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,s,c,d;return u(this,function(u){switch(u.label){case 0:return[4,Promise.all([new Promise(function(t){return e.getDuration(t)}),new Promise(function(t){return e.getCurrentTime(t)})])];case 1:if(i=l.apply(void 0,[u.sent(),2]),a=i[0],s=i[1],c={},"mux"===n){d=void 0;try{d=new URL(t.getAttribute("src")),c.mux_video_title=d.searchParams.get("metadata-video-title"),c.mux_video_id=d.searchParams.get("metadata-video-id"),c.mux_playback_id=d.pathname.split("/").pop()}catch(e){}}return[2,o(o({duration:a,start_time:s,last_position:s,percent_completed:Rn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function Mn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Nn(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'play' handler: ".concat(e))})};e.on("play",a),r.push(function(){return e.off("play",a)});var c=function(){Nn(e,i,n,"paused").then(function(e){t.onPause(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(e))})};e.on("pause",c),r.push(function(){return e.off("pause",c)});var l=function(){Nn(e,i,n,"ended").then(function(e){t.onEnded(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(e))})};e.on("ended",l),r.push(function(){return e.off("ended",l)});var d=function(){o=!0,Nn(e,i,n,"seeking").then(function(e){t.onSeeking(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(e))})};e.on("seeking",d),r.push(function(){return e.off("seeking",d)});var f=function(){o=!1,Nn(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(e))})};e.on("seeked",f),r.push(function(){return e.off("seeked",f)});var v=function(){(function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return[2,{currentTime:t.sent()}]}})})})(e).then(function(e){var n={position:e.currentTime,isSeeking:o};t.onTimeUpdate(n)}).catch(function(e){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(e))})};e.on("timeupdate",v),r.push(function(){return e.off("timeupdate",v)})};return e.on("ready",i),function(){e.off("ready",i),r.forEach(function(e){return e()})}}var jn=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(e){a.updatePlaybackState("playing",e)},onPause:function(e){a.updatePlaybackState("paused",e)},onEnded:function(e){a.updatePlaybackState("ended",e)},onSeeking:function(){var e=o(o({},a.state),{isSeeking:!0});a.updateState(e)},onSeeked:function(e){var t=o(o({},a.state),{isSeeking:!1,position:e.last_position});a.updateState(t)},onError:function(e){a.updateStateWithError(e)},onTimeUpdate:function(e){a.updateTime(e)}},this.onStateChange=n,this.untrack=i?Mn(t,this.handler,r):function(e,t,n){var r=function(){var r=o(o({},Dn(e)),"mux"===n?Ln(e):{});t.onPlay(r)};e.addEventListener("play",r);var i=function(){var r=o(o({},Dn(e,"paused")),"mux"===n?Ln(e):{});t.onPause(r)};e.addEventListener("pause",i);var a=function(){var r=o(o({},Dn(e,"ended")),"mux"===n?Ln(e):{});t.onEnded(r)};e.addEventListener("ended",a);var s=function(){var r=o(o({},Dn(e,"seeking")),"mux"===n?Ln(e):{});t.onSeeking(r)};e.addEventListener("seeking",s);var u=function(){var r=o(o({},Dn(e)),"mux"===n?Ln(e):{});t.onSeeked(r)};e.addEventListener("seeked",u);var c=function(){var n=e,r={position:e.currentTime,isSeeking:!!n.seeking};t.onTimeUpdate(r)};return e.addEventListener("timeupdate",c),function(){e.removeEventListener("play",r),e.removeEventListener("pause",i),e.removeEventListener("ended",a),e.removeEventListener("seeking",s),e.removeEventListener("seeked",u),e.removeEventListener("timeupdate",c)}}(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch(e){}},e.prototype.updateStateWithError=function(e){var t=this.state,n=o(o({},t),{playbackState:"error",errorMessage:e});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t){var n=o(o({},this.state),{playbackState:e,lastEvent:t,position:t.last_position});this.updateState(n)},e.prototype.updateTime=function(e){var t,n;if(this.state.lastEvent&&"playing"===this.state.playbackState){var r=e.isSeeking||this.state.isSeeking,i=null!==(t=this.state.position)&&void 0!==t?t:0,a=e.position;if(r)this.state=o(o({},this.state),{position:a});else{var s=a-i,u=o(o({},this.state),{position:a,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+s});this.updateState(u)}}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.untrack()},e}();function Un(e,t,n){var r,i,o=[];try{for(var a=c(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(e){n.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function Fn(e){var t,n,r,i,o,a,s,u,f,v,p,h;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var g=Object.keys(e);try{for(var m=c(g),y=m.next();!y.done;y=m.next()){var b=y.value;try{var w=e[b];"boolean"==typeof(null==w?void 0:w.enabled)&&(w.enabled?(delete w.enabled,0===Object.keys(w).length&&(e[b]=!0)):e[b]=!1),Fn(w)}catch(e){}}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}try{if(null===(f=null===(u=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===u?void 0:u.captureRules)||void 0===f?void 0:f.length)try{for(var E=c(e.autocapture.networkTracking.captureRules),S=E.next();!S.done;S=E.next()){var k=S.value;try{for(var T=(o=void 0,c(["responseHeaders","requestHeaders"])),x=T.next();!x.done;x=T.next()){var P=x.value,_=null!==(v=k[P])&&void 0!==v?v:{},A=_.captureSafeHeaders,O=_.allowlist;(A||O)&&(void 0===O||Array.isArray(O)?k[P]=d(d([],l(A?R:[]),!1),l(null!=O?O:[]),!1):delete k[P])}}catch(e){o={error:e}}finally{try{x&&!x.done&&(a=T.return)&&a.call(T)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{S&&!S.done&&(i=E.return)&&i.call(E)}finally{if(r)throw r.error}}}catch(e){}var I=null===(p=e.autocapture)||void 0===p?void 0:p.frustrationInteractions;I&&(I.rageClick&&(I.rageClicks=I.rageClick,delete I.rageClick),I.deadClick&&(I.deadClicks=I.deadClick,delete I.deadClick));try{var C=null===(h=e.autocapture)||void 0===h?void 0:h.elementInteractions;if(C&&"object"==typeof C&&(!0===C.viewportContentUpdated&&(C.viewportContentUpdated={}),!1===C.viewportContentUpdated&&(C.viewportContentUpdated={enabled:!1}),void 0!==C.exposureDuration)){var D=C.viewportContentUpdated;void 0===D?C.viewportContentUpdated={exposureDuration:C.exposureDuration}:"object"==typeof D&&void 0===D.exposureDuration&&!1!==D.enabled&&(D.exposureDuration=C.exposureDuration),delete C.exposureDuration}}catch(e){}}}var qn=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=H();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},Bn=function(e){return qn(e,"attribution")},Hn=function(e){return qn(e,"formInteractions")},Vn=function(e){return qn(e,"pageViews")},zn=function(e){return qn(e,"sessions")},Wn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},Gn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},$n=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},Kn=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},Jn=function(e){if(Gn(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},Yn=function(e){if($n(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},Xn=function(e){if(Wn(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),o(o({},t),{captureRules:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),a=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),o(o({},e),{hosts:void 0})}return e}))})}var n,r},Qn=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Vn(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}},Zn=function(e,t){er(e,t)},er=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var u=s.apply(e,o);"function"==typeof a&&a(null==u?void 0:u.promise)}}return e},tr=function(e){return e&&void 0!==e._q};var nr="2.45.8",rr="amplitude-ts",ir=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(rr,"/").concat(nr),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a;return u(this,function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,a=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:_e()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:z(),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:a,library:this.library,user_agent:this.userAgent})]})})},e}(),or=1e3,ar=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=H())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>or?(i=n.length-or,[4,e.prototype.set.call(this,t,n.slice(0,or))]):[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(or,".")),[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}(Fe),sr=function(e){function t(){var t;return e.call(this,null===(t=H())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}(Fe),ur=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r=this;return u(this,function(i){return[2,new Promise(function(i,a){"undefined"==typeof XMLHttpRequest&&a(new Error("XHRTransport is not supported."));var d=new XMLHttpRequest;d.open("POST",e,!0),d.onreadystatechange=function(){if(d.readyState===r.state.done){var e=d.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":"application/json",Accept:"*/*"},v=JSON.stringify(t),p=n&&v.length>=2048&&et(),h=function(e){var t,n;f=o(o({},r.customHeaders),f);try{for(var i=c(Object.entries(f)),a=i.next();!a.done;a=i.next()){var s=l(a.value,2),u=s[0],v=s[1];d.setRequestHeader(u,v)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};s(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,tt(v)]:[3,2];case 1:return(e=t.sent())?(f["Content-Encoding"]="gzip",h(e)):h(v),[3,3];case 2:h(v),t.label=3;case 3:return[2]}})}).catch(a)})]})})},t}(Ze),cr=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r,i,a,s,c,l,d,f,v;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&et(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,tt(r)]:[3,2];case 1:(c=u.sent())&&(s["Content-Encoding"]="gzip",a=c),u.label=2;case 2:return s=o(o({},this.customHeaders),s),l="string"==typeof a?a.length:a.byteLength,d={headers:s,body:a,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(f=u.sent()).text()];case 4:v=u.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch(e){return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(Ze),lr=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,n){return s(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,i){var o=H();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,a)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(Ze),dr=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,o,a,s,c,d,f,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(v.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=l(i.split("."),6),a=o[0],s=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:a,userId:vr(s),sessionId:fr(d),lastEventId:fr(p),lastEventTime:fr(f),optOut:Boolean(c)}]}})})},fr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},vr=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},pr="[Amplitude]",hr="".concat(pr," Form Started"),gr="".concat(pr," Form Submitted"),mr="".concat(pr," File Downloaded"),yr="session_start",br="session_end",wr="".concat(pr," File Extension"),Er="".concat(pr," File Name"),Sr="".concat(pr," Link ID"),kr="".concat(pr," Link Text"),Tr="".concat(pr," Link URL"),xr="".concat(pr," Form ID"),Pr="".concat(pr," Form Name"),_r="".concat(pr," Form Destination"),Ar="cookie",Or=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return q},get LogLevel(){return Y},get ServerZone(){return ft},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:pt,DEFAULT_DATA_ATTRIBUTE_PREFIX:ht,DEFAULT_ACTION_CLICK_ALLOWLIST:gt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Cn}),Ir=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Cr=function(e,t,n,r,i,s){void 0===i&&(i=!0),e.referrer;var u=e.referring_domain,c=a(e,["referrer","referring_domain"]),l=t||{};l.referrer;var d,f=l.referring_domain,v=a(l,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var h=Dr(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&jr(e.referring_domain,s)){if("always"===h)return Lr(h,e.referring_domain,r),!1;if("ifEmptyCampaign"===h&&(d=o(o({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Lr(h,e.referring_domain,r),!1}}if(Rr(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(c)!==JSON.stringify(v),m=Ir(u||"")!==Ir(f||""),y=!t||g||m;return y?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."),y},Rr=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})},Dr=function(e,t){if(!0===e)return Cn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Cn).includes(n))return n;if(void 0===n)return Cn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Lr(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var Nr=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],Mr=function(e){var t,n,r=e||(null===(n=null===(t=H())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],a=i[i.length-2];return Nr.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},jr=function(e,t){var n=H();if(!n)return!1;var r,i,o,a=(t||"").trim()||Mr(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Ur=function(e){function t(t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,_,A,O,I,C,R,D,L,N,M,j,U,F,q,B,H,V,z){void 0===r&&(r=new Le),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Ar),void 0===g&&(g=new Q),void 0===m&&(m=Y.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===T&&(T="US"),void 0===_&&(_=18e5),void 0===A&&(A=new ar({loggerProvider:g})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===I&&(I="fetch"),void 0===C&&(C=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===V&&(V=!1);var W,G=this;(G=e.call(this,{apiKey:t,storageProvider:A,transportProvider:Br(I)})||this).apiKey=t,G.appVersion=n,G.cookieOptions=i,G.defaultTracking=o,G.autocapture=a,G.flushIntervalMillis=u,G.flushMaxRetries=c,G.flushQueueSize=l,G.identityStorage=d,G.ingestionMetadata=f,G.instanceName=v,G.loggerProvider=g,G.logLevel=m,G.minIdLength=y,G.offline=b,G.partnerId=E,G.plan=S,G.serverUrl=k,G.serverZone=T,G.sessionTimeout=_,G.storageProvider=A,G.trackingOptions=O,G.transport=I,G.useBatch=C,G.fetchRemoteConfig=R,G.networkTrackingOptions=M,G.identify=j,G.enableDiagnostics=U,G.diagnosticsSampleRate=F,G.diagnosticsClient=q,G.remoteConfig=B,G.topLevelDomain=H,G.enableRequestBodyCompression=V,G.customEnrichment=z,G.version=nr,G._optOut=!1,G._cookieStorage=r,G.deviceId=s,G.lastEventId=p,G.lastEventTime=h,G.optOut=w,G.deferredSessionId=P,G.sessionId=x,G.pageCounter=L,G.userId=D,G.debugLogsEnabled=N,G.loggerProvider.enable(N?Y.Debug:G.logLevel),G.networkTrackingOptions=M,G.identify=j,G.enableDiagnostics=U,G.diagnosticsSampleRate=F,G.diagnosticsClient=q;var $=null!==(W=null==B?void 0:B.fetchRemoteConfig)&&void 0!==W?W:R;return G.remoteConfig=G.remoteConfig||{},G.remoteConfig.fetchRemoteConfig=$,G.fetchRemoteConfig=$,G.topLevelDomain=H||Mr(),G}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,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=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,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof Ne&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Pe(this.apiKey),e)},t}(ee),Fr=function(e,t,n,r,i){return void 0===t&&(t={}),s(void 0,void 0,void 0,function(){var a,s,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,_,A,O,I,C,R,D,L,N,M,j,U,F,q,B,H,V,W,G,$,K,J,Y,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return a=t.identityStorage||Ar,s="",a!==Ar||(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)||""===(null===(O=t.cookieOptions)||void 0===O?void 0:O.domain)?[3,2]:[4,Hr(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=o({domain:null!==(C=null===(I=t.cookieOptions)||void 0===I?void 0:I.domain)&&void 0!==C?C:s,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(e){var t=Me(e);if(!t)return!1;var n=JSON.parse(t);return je(n.cookieDomain,c.domain)},diagnosticsClient:r},d=qr(t.identityStorage,c,l),[4,dr(e,d,null===(D=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===D||D)];case 3:return f=u.sent(),[4,d.get(Pe(e))];case 4:return v=u.sent(),p=Ae(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(M=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(N=p.ampDeviceId)&&void 0!==N?N:p.deviceId:void 0)&&void 0!==M?M:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:z(),y=null!==(F=null==v?void 0:v.lastEventId)&&void 0!==F?F:f.lastEventId,b=null!==(q=null==v?void 0:v.lastEventTime)&&void 0!==q?q:f.lastEventTime,w=null!==(H=null!==(B=t.optOut)&&void 0!==B?B:null==v?void 0:v.optOut)&&void 0!==H?H:f.optOut,E=null!==(V=null==v?void 0:v.sessionId)&&void 0!==V?V:f.sessionId,S=null==v?void 0:v.deferredSessionId,k=null!==(G=null!==(W=t.userId)&&void 0!==W?W:null==v?void 0:v.userId)&&void 0!==G?G:f.userId,n.previousSessionDeviceId=null!==($=null==v?void 0:v.deviceId)&&void 0!==$?$:f.deviceId,n.previousSessionUserId=null!==(K=null==v?void 0:v.userId)&&void 0!==K?K:f.userId,T={ipAddress:null===(Y=null===(J=t.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===Y||Y,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},x=null==v?void 0:v.pageCounter,P=null==v?void 0:v.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(_=new Ur(e,t.appVersion,d,c,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,E,S,t.sessionTimeout,t.storageProvider,T,t.transport,t.useBatch,t.fetchRemoteConfig,k,x,P,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment)).storageProvider.isEnabled()];case 5:return u.sent()||(_.loggerProvider.warn("Storage provider ".concat(_.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),_.storageProvider=new Le),[2,_]}})})},qr=function(e,t,n){switch(void 0===e&&(e=Ar),void 0===t&&(t={}),e){case"localStorage":return new ar;case"sessionStorage":return new sr;case"none":return new Le;default:return new Ne(o(o({},t),{expirationDays:t.expiration}),n)}},Br=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new ur(n):"beacon"===t?new lr:new cr(n,r,i)},Hr=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,a,s,c;return u(this,function(u){switch(u.label){case 0:return[4,new Ne(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,Nr.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),a=r.length-o-1;a>=0;--a)i.push(r.slice(a).join("."));a=0,u.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,Ne.isDomainWritable(s)];case 4:return u.sent()?[2,"."+s]:[3,6];case 5:return c=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:c instanceof Error?c.message:String(c)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(n)}),[2,""]}})})},Vr="AMP_PAGE_VIEW",zr=function(e){var t;void 0===e&&(e={});var n,r,i=H(),a=void 0,c=!1,d=e.trackOn,f=e.trackHistoryChanges,v=e.eventType,p=void 0===v?"[Amplitude] Page Viewed":v,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},g=function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:return t=h("undefined"!=typeof location&&location.href||""),r={event_type:p},n=[{}],[4,Wr()];case 1:return[2,(r.event_properties=o.apply(void 0,[o.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"undefined"!=typeof location&&h(location.pathname)||"","[Amplitude] Page Title":Kt($t),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),r)]}})})},m=function(){return void 0===d||"function"==typeof d&&d()},y="undefined"!=typeof location?location.href:null,b=function(){s(void 0,void 0,void 0,function(){var e,n,i,o,s;return u(this,function(u){switch(u.label){case 0:return e=location.href,n=$r(f,e,y||"")&&m(),y=e,n?(i=void 0,r&&(i=z(),r.set(Vr,{pageViewId:i})),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(o=t).track,[4,g(i)];case 2:s.apply(o,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,d,f;return u(this,function(u){switch(u.label){case 0:if(t=o,n=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),c=!0,i){try{r=new Fe(i.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",b),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),c&&b()}})}return m()?(a.log("Tracking page view event"),s=void 0,r&&(s=z(),r.set(Vr,{pageViewId:s})),f=(d=t).track,[4,g(s)]):[3,2];case 1:f.apply(d,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,i,s;return u(this,function(u){switch(u.label){case 0:return"attribution"===d&&Gr(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r?[4,r.get(Vr)]:[3,2]):[3,4];case 1:i=u.sent(),t=null==i?void 0:i.pageViewId,u.label=2;case 2:return[4,g(t)];case 3:s=u.sent(),e.event_type=s.event_type,e.event_properties=o(o({},e.event_properties),s.event_properties),u.label=4;case 4:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",b),c=!1),[2]})})}};return w},Wr=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=De,[4,(new Bt).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Gr=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[r.SET]||{},i=t[r.UNSET]||{},o=d(d([],l(Object.keys(n)),!1),l(Object.keys(i)),!1);return Object.keys(C).every(function(e){return o.includes(e)})}return!1},$r=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},Kr=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return t=function(e){if(Hn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,a=function(e){if(!o.has(e)){o.add(e);var a=!1;r(e,"change",function(){var t,n=Yr(e);a||i.track(hr,((t={})[xr]=Jr(e.id),t[Pr]=Jr(e.name),t[_r]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=Yr(e);if(a||i.track(hr,((o={})[xr]=Jr(e.id),o[Pr]=Jr(e.name),o[_r]=u,o)),a=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(gr,((s={})[xr]=Jr(e.id),s[Pr]=Jr(e.name),s[_r]=u,s)),a=!1})}};Array.from(document.getElementsByTagName("form")).forEach(a),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&a(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(a)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(a=H())?a.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},Jr=function(e){if("string"==typeof e)return e},Yr=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Xr=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,o;return u(this,function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;a&&r.track(mr,((t={})[wr]=a,t[Er]=n.pathname,t[Sr]=e.id,t[kr]=e.text,t[Tr]=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){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=H())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}},Qr=!1,Zr=function(){var e=H(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}};function ei(e,t){var n,r;if(e){Fn(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",kn(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var a=o({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){a.elementInteractions=o({},i.autocapture.elementInteractions);var s=a.elementInteractions,u=null!==(r=s.pageUrlAllowlist)&&void 0!==r?r:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Un(u,l,t.loggerProvider),delete s.pageUrlAllowlistRegex}var d=function(e,t){var n,r,i,a,s;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var u=o({},e),l=null!==(a=u.captureRules)&&void 0!==a?a:[];try{for(var d=c(l),f=d.next();!f.done;f=d.next()){var v=f.value;v.urls=Un(null!==(s=v.urls)&&void 0!==s?s:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u}}(i.autocapture.networkTracking,t.loggerProvider);d&&(a.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",kn(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var ti="1.29.0",ni="[Amplitude] Element Clicked",ri="[Amplitude] Element Tag",ii="[Amplitude] Element Text",oi="[Amplitude] Page URL",ai="[Amplitude] Viewport Height",si="[Amplitude] Viewport Width",ui="[Amplitude] Page View ID",ci="data-amp-mask-attributes",li="data-amp-internal-shadow";function di(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function fi(e,t){return t.map(vi).join(" > ")}function vi(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var pi=":scope > ";function hi(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function gi(e){var t,n=e.getRootNode();return hi(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function mi(e,t){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:n=e,r=0,i=0,a.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return a.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return hi(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function yi(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=l(r.pop(),2),a=o[0],s=o[1],u=a.shadowRoot;if(u&&s+1<=t){n.push({root:u,depth:s+1});for(var c=u.children,d=0;d<c.length;d++)r.push([c[d],s+1])}var f=a.children;for(d=0;d<f.length;d++)r.push([f[d],s])}return n}function bi(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=gi(r);n.push({root:o,target:r});var a=r.getRootNode();if(!hi(a))break;r=a.host}var s=n.length-1,u=!1,c=n;return s>t&&(c=n.slice(s-t),u=!0),{segments:c.reverse(),truncated:u}}function wi(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&hi(i)?"".concat(n,":nth-of-type(").concat(Ei(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(Ei(e,r.children),")")}function Ei(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var Si={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function ki(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var a=n.charCodeAt(o);0!==a?a>=1&&a<=31||127===a||0===o&&a>=48&&a<=57||1===o&&a>=48&&a<=57&&45===n.charCodeAt(0)?i+="\\".concat(a.toString(16)," "):i+=0!==o||1!==r||45!==a?a>=128||45===a||95===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function Ti(e){return ki(e)}var xi={name:"stableId",try:function(e,t){var n=di(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(Ti(n))}},Pi=!1,_i=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:d([],l([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:d([],l([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:Pi,maxShadowDomDepth:1});function Ai(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:Pi,maxShadowDomDepth:Ii(e.maxShadowDomDepth)})}function Oi(e,t){if(!e)return Ci();var n,r=Ci();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Ii(e.maxShadowDomDepth),Ai(r)}function Ii(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Ci(){return{enabled:_i.enabled,explicitTrackingAttribute:_i.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(_i.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(_i.unstableClassPatterns),!1),maxAncestorWalkDepth:_i.maxAncestorWalkDepth,shadowDomEnabled:_i.shadowDomEnabled,maxShadowDomDepth:_i.maxShadowDomDepth}}var Ri=[Si,xi];function Di(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Ai(t),l=null!==(o=n.strategies)&&void 0!==o?o:Ri,d=null!==(s=null!==(a=n.scope)&&void 0!==a?a:e.ownerDocument)&&void 0!==s?s:document,f={scope:d,config:u},v=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,u.maxAncestorWalkDepth);try{for(var p=c(l),h=p.next();!h.done;h=p.next())for(var g=h.value,m=0;m<v.length;m++){var y=v[m],b=g.try(y,f);if(null!==b)if(0!==m){var w=fi(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(Li(d,E,e,g.name,n.logger))return E}else if(Li(d,b,e,g.name,n.logger))return b}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function Li(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var a=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return 1===o.length&&o[0]===n}function Ni(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var Mi=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),ji=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new Mi(Fi(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new Mi(a,!0)}var s=e.tagName.toLowerCase();if(o)return new Mi(s+Fi(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new Mi(s,!0);for(var l=Ui(e),d=!1,f=!1,v=-1,p=-1,h=u.children,g=0;h&&(-1===v||!f)&&g<h.length;++g){var m=h[g];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!f&&m.tagName.toLowerCase()===s){d=!0;var y=new Set(l);if(y.size)for(var b=Ui(m),w=0;w<b.length;++w){var E=b[w];if(y.has(E)&&(y.delete(E),!y.size)){f=!0;break}}else f=!0}}else v=p}var S=s;if(n&&"input"===s.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+ki(e.getAttribute("type")||"")+"]"),f)S+=":nth-child("+String(v+1)+")";else if(d)try{for(var k=c(l),T=k.next();!T.done;T=k.next()){S+="."+ki(T.value.slice(1))}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}return new Mi(S,!1)},Ui=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},Fi=function(e){return"#"+ki(e)};function qi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=ji(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Bi(e,t){void 0===t&&(t={});var n=Ai(e),r=new Set,i=t.logger,o=function(e){return qi(e,i)},a=function(e,r){var o;return null!==(o=Di(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Ai(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=hi(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=di(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(Ti(p))],l(u),!1).join(" > ");if(Ni(a,h,e))return h}u.unshift(wi(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(pi).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&hi(t)?"".concat(pi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var r,u;try{return n.shadowDomEnabled?function(e,t){var r=bi(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?a:s):(n.enabled?a:o)(e,null!==(u=null!==(r=t.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==u?u:document)}catch(t){var c=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(c)),qi(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Ai(e);try{for(var a=c(r),s=a.next();!s.done;s=a.next()){var u=s.value;try{u(n)}catch(e){var l=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(l))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var Hi,Vi,zi=Object.freeze({enabled:!1,maxDepth:0}),Wi=function(){var e=zi,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;try{for(var i=c(d([],l(t),!1)),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},Gi=["input","select","textarea"],$i=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ie(window.location.href,n))&&!!Ie(window.location.href,t)},Ki=function(e,t){return function(n,r){var i,o,a=e.shouldTrackEventResolver,s=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(!s)return!1;if(a)return a(n,r);if(!$i(e))return!1;var u=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}if(t){var c=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(!c)return!1}switch(s){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},Ji=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},Yi=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return function(e){return null==e||"object"==typeof e&&0===Object.keys(e).length||"string"==typeof e&&0===e.trim().length}(r)||(t[n]=r),t},{})},Xi=function(){var e;try{var t=H(),n=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},Qi=function(e,t,n){return void 0===n&&(n=zi),n.enabled?eo(e,t,n.maxDepth):Zi(e,t)},Zi=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:Zi(null==e?void 0:e.parentElement,t):null},eo=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var a=c(mi(e,n)),s=a.next();!s.done;s=a.next()){var u=o(s.value);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return null},to=function(e,t,n){return void 0===n&&(n=zi),n.enabled?ro(e,t,n.maxDepth):no(e,t)},no=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},ro=function(e,t,n){var r=no(e,t),i=e instanceof Document?e.documentElement:e;return i?(yi(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},io=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function oo(e){if(!e)return"";try{var t=new URL(e);return t.search="",Ce(t.href)}catch(t){return Ce(e)}}function ao(e){var t,n;return void 0===e&&(e=H()),oo(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(Vi||(Vi={}));var so="__AMPLITUDE_VISUAL_TAGGING__";var uo=H(),co=function(e){return e.get()},lo={childList:!0,attributes:!0,characterData:!0,subtree:!0},fo=function(e){return new fn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),hi(e)&&i.set(e,t),s.observe(e,lo))},a=function(e,t,n){var r=n-t;r<=0||yi(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},s=new MutationObserver(function(n){var r,o;t.next(n);try{var s=co(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!hi(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&a(e,t,s.maxDepth)})};try{for(var l=c(n),d=l.next();!d.done;d=l.next()){u(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){a(u,0,e.maxDepth)})}return function(){null==n||n(),s.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},vo=function(e){return void 0===e&&(e="click"),new fn(function(t){var n,r=function(e){t.next(e)};return null===(n=H())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=H())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},po=function(){var e=pn(new fn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=o(o({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return uo.addEventListener("error",t),function(){uo.removeEventListener("error",t)}}),new fn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return uo.addEventListener("unhandledrejection",t),function(){uo.removeEventListener("unhandledrejection",t)}}));return pn(e,new fn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return vt.addListener("error",t),function(){vt.removeListener(t)}}))},ho=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},go={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},mo=function(e){var t,n,r,i,o=Object.values(go).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var l=(r=void 0,c(u.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,v=go[f.event_type];v&&o[v].add(u.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},yo=function(e){var t,n,r,i,o=new Map;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var l=(r=void 0,c(u.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(u)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},bo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return go[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},wo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,a=new Set;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var l=u.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),v=f.next();!v.done;v=f.next()){var p=v.value;a.add(p)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(bo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=a.value;ho(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),Eo=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",ci,Ht,li]),So=["type"],ko=["svg","path","g"],To=["password","hidden"];function xo(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=zi),null===e)return null;var l=String(e.tagName).toLowerCase(),d={tag:l},f=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&hi(n)?n.children:[]}(e,n.enabled));f.length&&(d.index=f.indexOf(e),d.indexOfType=f.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();v&&(d.prevSib=String(v));var p=e.getAttribute("id");p&&(d.id=String(p));var h=Array.from(e.classList);h.length&&(d.classes=h);var g={},m=Array.from(e.attributes).filter(function(e){return!Eo.has(e.name)}),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!Gi.includes(i)&&!o}(e);if(!To.includes(String(e.getAttribute("type")))&&!ko.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!So.includes(E.name)||(t.has(E.name)?g[E.name]=Vt:g[E.name]=String(E.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(g).length&&(d.attrs=g),e.shadowRoot&&(d.attrs=o(o({},d.attrs||{}),((a={})[li]="true",a)),d.shadow=!0),d}function Po(e,t){return void 0===t&&(t=zi),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(mi(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if("HTML"===s.tagName)break;i.push(s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var _o;var Ao,Oo=function(e,t){var n,r,i,a=this;this.replaceSensitiveString=function(e){return $t(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o,s=performance.now();if(!e)return[];for(var u=a.getShadowMode(),f=Po(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=Ji(h.getAttribute(ci)),m=p===f.length-1?[]:null!==(r=v.get(f[p+1]))&&void 0!==r?r:new Set,y=new Set(d(d([],l(m),!1),l(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return xo(e,null!==(t=v.get(e))&&void 0!==t?t:new Set,u)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(i))})};try{for(var w=c(o),E=w.next();!E.done;E=w.next())b(E.value)}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var S=performance.now();return null===(i=a.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?a.getText(t):a.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return null===(t=a.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var s=Oi(e,t),u=a.selectorEngine.getConfig().enabled,c=a.shadowGate.get().enabled,l=a.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?zi:Object.freeze({enabled:!0,maxDepth:n})}(s));a.selectorEngine.updateConfig(o(o(o({},r?s:a.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),r&&u!==s.enabled&&(null==t||t.debug(s.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!c&&l.enabled&&(null===(n=a.diagnosticsClient)||void 0===n||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return a.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,u,c,d=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=a.getHierarchy(t),p=null===(s=v[0])||void 0===s?void 0:s.attrs,h=a.getNearestLabel(t),g=(u=null!=p?p:{},c=n,Object.entries(u).reduce(function(e,t){var n=l(t,2),r=n[0],i=n[1];if(r.startsWith(c)){var o=r.replace(c,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[ri]=d,r[ii]=a.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=a.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[oi]=Ce(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=Kt(a.replaceSensitiveString),r[ai]=window.innerHeight,r[si]=window.innerWidth,r),y=Xi();if(y&&(m[ui]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=a.replaceSensitiveString(b)}return Yi(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=a.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){var s=a.getShadowMode(),u=function(e,t){var n,r;if(void 0===t&&(t=zi),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var a=i[0];if(!(a instanceof Element))return null!=a?a:o;var s=bi(a,t.maxDepth),u=s.segments;return s.truncated&&u.length>0?u[u.length-1].target:a}(o.event,s);if(i){var c=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=Qi(u,n,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=a.getEventProperties(o.type,l,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?a.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(Ht,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=c(o),u=s.next();!u.done;u=s.next()){var l=u.value;l.nodeType!==Node.TEXT_NODE?l instanceof Element&&(l.hasAttribute(Ht)||l.hasAttribute("contenteditable")?i+=Vt:i+=a.getTextWithMaskedDescendants(l)):i+=l.textContent||""}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=a.getShadowMode();return t.enabled?function(e,t){var n,r;return!!Po(e,t).some(function(e){return e.hasAttribute(Ht)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(Ht))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(Ht,"]"))}(e)},this.getText=function(e){if(a.hasMaskedAncestor(e))return Vt;var t="";return t=e.querySelector("[".concat(Ht,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=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={})[ri]=i,t[ii]=a.getText(e),t[oi]=window.location.href.split("?")[0],t);return Yi(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(_o||(_o=Bi(Oi())),_o),this.shadowGate=(Hi||(Hi=Wi()),Hi);var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],u=[];try{for(var f=c(s),v=f.next();!v.done;v=f.next()){var p=v.value;if(u.length>=25)break;if(p instanceof RegExp)u.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{u.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u};function Io(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture.elementSelector","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateSelectorConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}function Co(e){var t,n,r,i,o,a=e.mutationObservable,s=e.onRescan,u=e.onFlush,c=e.exposureDuration,l=e.quietMs,d=void 0===l?150:l,f=e.maxWaitMs,v=void 0===f?4e3:f,p=!1,h=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},g=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,h(),g(),s(),r=setTimeout(function(){r=void 0,u()},c+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){h(),g(),p=!1,y(),n=setTimeout(m,v)};return{start:function(){i||(i=a.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,h(),g()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Ao||(Ao={}));var Ro=function(e,t){var n,r,i,a,f,v,p,h,g,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ti);var w=e.dataAttributePrefix,E=void 0===w?ht:w,S=e.visualTaggingOptions,k=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:pt,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:gt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var T=!1!==(null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.enabled),x=null!==(p=null!==(v=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==v?v:e.exposureDuration)&&void 0!==p?p:150;e.viewportContentUpdated=o(o({},e.viewportContentUpdated),{exposureDuration:x}),e.pageUrlExcludelist=null===(h=e.pageUrlExcludelist)||void 0===h?void 0:h.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var P,_,A="@amplitude/plugin-autocapture-browser",O=[],I=new Oo(e,t),C=new Set,R=new Set,D=new Set,L=function(){var t,n,r=hn(vo().map(function(t){return I.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=hn(new fn(function(t){var n,r=function(n){var r=I.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=H())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=H())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=hn(new fn(function(t){var n=function(n){var r=I.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=I.shadowGate,a=hn(fo(o).map(function(t){return I.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new fn(function(e){var t,n=function(t){e.next(t)};return null===(t=H())||void 0===t||t.addEventListener("scroll",n),function(){var e;null===(e=H())||void 0===e||e.removeEventListener("scroll",n)}}),u=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new fn(function(n){var r=H();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var a=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:1}),s=t.join(","),u=function(e){e instanceof Element&&e.matches(s)&&a.observe(e),e.querySelectorAll(s).forEach(function(e){a.observe(e)})},c=function(e){if(o)try{to(e,s,co(o)).forEach(function(e){a.observe(e)})}catch(e){}},l=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&co(o).enabled?to(e,s,co(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(l),l();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&c(r.document)}),f=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)u(e);else if(e instanceof Element)if(o&&co(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}c(e)}else u(e)})})});return function(){null==i||i(void 0),null==d||d(),f.unsubscribe(),a.disconnect()}})}(a,e.cssSelectorAllowlist,function(e){_=e},o);return(t={})[Ao.ChangeObservable]=i,t[Ao.ClickObservable]=r,t[Ao.MutationObservable]=a,t[Ao.NavigateObservable]=n,t[Ao.ScrollObservable]=s,t[Ao.ExposureObservable]=u,t},N=mo(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=yo(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),j=function(e,t,n,r){return new wo(e,t,n,r)}(N,M,I,e);return{name:A,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,function(){var r,i,a,s,c,f,v,p,h,g,m,y,b,w,S,U,F,q,B,V,z,W,G,$,K,J,Y;return u(this,function(u){return"undefined"==typeof document||(r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=o(o({},e.pageActions),t),N=mo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=yo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(N,M,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),(i=Io(t,I))&&O.push({unsubscribe:i}),a=Ki(e,e.cssSelectorAllowlist),s=Ki(e,e.actionClickAllowlist),c=L(),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(io).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(ni,e.targetElementProperties)})}({allObservables:c,amplitude:n,shouldTrackEvent:a,evaluateTriggers:j.evaluate.bind(j)}),O.push(f),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(io).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:c,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return I.getEventProperties.apply(I,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:a,evaluateTriggers:j.evaluate.bind(j)}),O.push(v),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,l=s.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=Qi(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(io).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?pn(u,c):u,f=pn(l,d),v=null,p=null;return vn(f,function(e){if(v&&(clearTimeout(v),v=null),"click"===e.type)return p=e,v=setTimeout(function(){v=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(ni,i("click",e.closestTrackedAncestor)))})}({allObservables:c,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return I.getEventProperties.apply(I,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:a,shouldTrackActionClick:s}),p&&O.push(p),h=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e,t,r,i,o=H(),a=Math.floor(null!==(t=null!==(e=null==o?void 0:o.scrollX)&&void 0!==e?e:null==o?void 0:o.pageXOffset)&&void 0!==t?t:0),s=Math.floor(null!==(i=null!==(r=null==o?void 0:o.scrollY)&&void 0!==r?r:null==o?void 0:o.pageYOffset)&&void 0!==i?i:0);n.maxX=Math.max(n.maxX,a),n.maxY=Math.max(n.maxY,s)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}({allObservables:c,amplitude:n}),O.push(h),g=o({},h.getState()),m={},y=H(),w=function(e){e&&(null==b||b.reset()),e&&r||(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,u=e.elementExposedInSentEvents,c=e.exposureTracker,l=e.isPageEnd,d=e.lastScroll,f=o.getState(),v=H(),p=null!==(n=null==v?void 0:v.innerWidth)&&void 0!==n?n:0,h=null!==(r=null==v?void 0:v.innerHeight)&&void 0!==r?r:0,g=Array.from(a).filter(function(e){return!u.has(e)}),m=((t={})[oi]=ao(v),t["[Amplitude] Max Page X"]=f.maxX+p,t["[Amplitude] Max Page Y"]=f.maxY+h,t[ai]=h,t[si]=p,t["[Amplitude] Element Exposed"]=g,t),y=Xi();y&&(m[ui]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,s.clear(),u.clear(),null==c||c.reset()};0!==g.length||f.maxX!==d.maxX||f.maxY!==d.maxY?(null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=f.maxX,d.maxY=f.maxY,g.forEach(function(e){u.add(e)}),a.clear(),l&&b()):l&&b()}({amplitude:n,scrollTracker:h,currentElementExposed:D,elementExposedForPage:C,elementExposedInSentEvents:R,exposureTracker:m.exposure,isPageEnd:e,lastScroll:g}))},S=ao(y),U=function(){var e=ao(y);e!==S&&(S=e,w(!0))},F=function(e,t){var n=ao(y),r=function(e,t){var n;if(void 0===t&&(t=H()),null==e||""===e)return ao(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return oo(new URL(e,r).href)}catch(e){return ao(t)}}(t,y);n!==r?(S=r,w(!0),e()):e()},q=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,C,R,D,w)},T&&(m.exposure=function(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new Map,s=new Map,u=t.exposureObservable.subscribe(function(e){var t=e,i=t.target;if(t.isIntersecting){if(!a.get(i)){var u=s.get(i);u&&clearTimeout(u);var c=setTimeout(function(){a.set(i,!0);var e=r.getElementPath(i);n(e),s.set(i,null)},o);s.set(i,c)}}else!t.isIntersecting&&t.intersectionRatio<1&&(c=s.get(i))&&(clearTimeout(c),s.set(i,null))});return{unsubscribe:function(){u.unsubscribe()},reset:function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),a.clear()}}}({allObservables:c,onExposure:q,dataExtractor:I,exposureDuration:x}),m.exposure&&O.push(m.exposure),b=Co({mutationObservable:c[Ao.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==_||_()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),w(!1)},exposureDuration:x}),b.start(),O.push({unsubscribe:function(){null==b||b.stop()}}),B=function(){w(!0)},null==y||y.addEventListener("beforeunload",B),P=function(){null==y||y.removeEventListener("beforeunload",B)},O.push({unsubscribe:function(){return P()}}),(V=c[Ao.NavigateObservable])?O.push(V.subscribe(function(e){var t,n,r=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(r){var i=oo(r);if(i===S)return;return S=i,void w(!0)}U()})):y&&(z=function(){U()},y.addEventListener("popstate",z),W=y.history.pushState,G=y.history.replaceState,y.history&&W&&(y.history.pushState=new Proxy(W,{apply:function(e,t,n){F(function(){e.apply(t,n)},n[2])}})),y.history&&G&&(y.history.replaceState=new Proxy(G,{apply:function(e,t,n){F(function(){e.apply(t,n)},n[2])}})),O.push({unsubscribe:function(){y.removeEventListener("popstate",z),y.history&&W&&(y.history.pushState=W),y.history&&G&&(y.history.replaceState=G)}}))),null===(Y=null==t?void 0:t.loggerProvider)||void 0===Y||Y.log("".concat(A," has been successfully added.")),window.opener&&k.enabled&&($=e.cssSelectorAllowlist,K=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[so]){n[so]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;s=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ti}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(J=On(),{dataExtractor:I,isElementSelectable:Ki(e,d(d([],l($),!1),l(K),!1)),cssSelectorAllowlist:$,actionClickAllowlist:K}),function(e,t){var n,r=e;if(!0!==r[In]){r[In]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",o=null,a=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}(J),J.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:xn[t.serverZone]})))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){try{for(e=c(O),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]})})}}},Do=["mutation","navigate"];function Lo(e,t){var n,r,i,o,a=t.event,s=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function No(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:o({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Mo(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,a=r.selectionObservable,c=[],l={},d=null;function f(e){c=[],l={},e&&(Lo(l,e),c.push(e))}var v=vn(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return u(this,function(n){return Lo(l,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||l.isOutOfBounds?(d&&(t=No(c)),f(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(No(c))},1e3)}})]:[2,null]})})}),p=null==a?void 0:a.subscribe(function(){f()}),h=v.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var jo,Uo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(jo||(jo={})),function(e){e.X="x",e.Y="y"}(Uo||(Uo={}));function Fo(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function qo(e){e.changes=[],e.startTime=void 0}function Bo(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Ho=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new fn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,s=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==s&&clearTimeout(s),qo(n),qo(i))}return t.subscribe(function(e){null!==s&&clearTimeout(s),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Uo.X?n:i);var t=function(e,t){var n=void 0;if(Fo(e)&&(n=e.startTime),Fo(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,s=setTimeout(function(){u(),s=null},o)):u(),Bo(n),Bo(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},Vo=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,s=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new fn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===jo.DECREASING&&e.next(Uo.X),r=jo.INCREASING):o.x<n.x&&(r===jo.INCREASING&&e.next(Uo.X),r=jo.DECREASING),o.y>n.y?(i===jo.DECREASING&&e.next(Uo.Y),i=jo.INCREASING):o.y<n.y&&(i===jo.INCREASING&&e.next(Uo.Y),i=jo.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Ho({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){$i(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function zo(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Wo=4e3,Go=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var a=!1!==e.deadClicks&&null!==e.deadClicks,f=!1!==e.rageClicks&&null!==e.rageClicks,v=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(v=!1);var p=zo(e,"rageClicks",wt,f),h=zo(e,"deadClicks",yt,a),g=zo(e,"errorClicks",bt,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:ht,y=new Oo(e),b=d([],l(new Set(d(d(d([],l(p),!1),l(h),!1),l(g),!1))),!1),w=function(){var e,t,n=function(e){return hn(vo(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=hn(po().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=hn(fo(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=hn(new fn(function(e){var t=function(t){e.next(o(o({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var u=hn(new fn(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),c=hn(new fn(function(e){var t=function(t){e.next(t)},n={capture:!0};return uo.document.addEventListener("mousemove",t,n),function(){uo.document.removeEventListener("mousemove",t,n)}}));return(e={})[Ao.ClickObservable]=r,e[Ao.PointerDownObservable]=i,e[Ao.MutationObservable]=s,e[Ao.NavigateObservable]=t,e[Ao.BrowserErrorObservable]=a,e[Ao.SelectionObservable]=u,e[Ao.MouseMoveObservable]=c,e};return{name:n,type:"enrichment",setup:function(t,c){return s(void 0,void 0,void 0,function(){var s,l,d,b,E,S,k,T,x,P,_,A;return u(this,function(u){return"undefined"==typeof document||(s=w(),(l=Io(t,y))&&r.push({unsubscribe:l}),f&&(d=Ki(e,p),b=Mo({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=Ki(e,h),S=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,s=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return io(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Vi.LEFT_OR_TOUCH_CONTACT}),l=u?pn(s,u):s,d=pn(c,l),f=null;return vn(d,function(e){return f&&Do.includes(e.type)?(clearTimeout(f),f=null,Promise.resolve(null)):"click"===e.type?f?Promise.resolve(null):new Promise(function(t){f=setTimeout(function(){t(e),f=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:E}),r.push(S)),i&&(k=Ki(e,g),T=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,a=n.browserErrorObservable,s=i.filter(function(e){return io(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Vi.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,l=function(){null!==u&&(clearTimeout(u),u=null),c=null};return pn(s,a).subscribe(function(e){var n;if("click"===e.type)return l(),c=e,void(u=setTimeout(l,2e3));"error"===e.type&&c&&(t.track("[Amplitude] Error Click",o(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),c.targetElementProperties)),l())})}({amplitude:c,allObservables:s,shouldTrackErrorClick:k}),r.push(T)),v&&(x=void 0,P=void 0,"object"==typeof e.thrashedCursor&&(x=e.thrashedCursor.directionChanges,P=e.thrashedCursor.threshold,x&&x<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(x," is below the minimum of ").concat(5,", setting to ").concat(5)),x=5),P&&P>Wo&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(P," is above the maximum of ").concat(Wo,", setting to ").concat(Wo)),P=Wo)),_=Vo({amplitude:c,options:e,allObservables:s,directionChanges:x,thresholdMs:P}),r.push(_)),null===(A=null==t?void 0:t.loggerProvider)||void 0===A||A.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function $o(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function Ko(e,t){var n,r=$o(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],a=i.map(function(e){return e.sourceURL}).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),c=i.map(function(e){return e.invokerType}).filter(Boolean),l=i.map(function(e){return e.invoker}).filter(Boolean);return o(o(o(o(o(o(o({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),u.length>0&&{"[Amplitude] Main Thread Block Script Positions":u}),c.length>0&&{"[Amplitude] Main Thread Block Invoker Types":c}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}function Jo(e,t){var n,r=$o(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];return o(o({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function Yo(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var s=o.value;a.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;a.length>0&&a[0].startTime<u;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,s;try{for(var u=c(e.getEntries()),l=u.next();!l.done;l=u.next()){var d=l.value;if(!$i(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?Ko(d,a):Jo(d,a);t.track("[Amplitude] Main Thread Block",f)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),s.disconnect()}}}var Xo,Qo,Zo=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a,s,c;return u(this,function(u){return"undefined"==typeof document||(r&&(a=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(a=e.mainThreadBlock.durationThreshold),s=Yo({amplitude:o,options:e,durationThreshold:a}),n.push(s)),null===(c=null==i?void 0:i.loggerProvider)||void 0===c||c.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},ea="[Amplitude] Network Request",ta="500-599";function na(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function ra(e,t){var n,r,i=t.split(",");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split("-").map(Number),2),u=s[0],d=s[1];if(e===u&&void 0===d)return!0;if(e>=u&&e<=d)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function ia(e){var t;if(e)try{var n=null===(t=H())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,u=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:a,fragment:r,href:e,hrefWithoutQueryOrHash:s,host:null!==(t=null==u?void 0:u[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function oa(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],l(R),!1);if(void 0===e){return}}}function aa(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function sa(e,t){var n;void 0===t&&(t={});var r=ia(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(na(o,"*.amplitude.com")||na(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return na(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!ra(e.status,ta))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return na(t,e)}))&&(!r||!e.urls||Ie(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!ra(n,e.statusCodeRange||ta))}(t,o,e.status,e.url,e.method),i){var n=oa(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=oa(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!aa(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!aa(t.requestBody)){u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===ea}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function ua(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return sa(e.event,n)}).subscribe(function(e){var t,n,o,a=e.event,c=ia(a.url);if(c){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){s(this,void 0,void 0,function(){var i,o,a;return u(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=l.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(ea,e),[2]}})})}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(Xo||(Xo={}));var ca=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new fn(function(e){var n=new jt(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return qt.subscribe(n,t),function(){qt.unsubscribe(n)}});return(e={})[Xo.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a;return u(this,function(s){return"undefined"!=typeof document||function(){var e,t=H();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(a=r(),t=null==i?void 0:i.loggerProvider,Qo=ua({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added.")),[2]):[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return Qo.unsubscribe(),[2]})})}}};let la=-1;const da=e=>{addEventListener("pageshow",t=>{t.persisted&&(la=t.timeStamp,e(t))},!0)},fa=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},va=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},pa=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ha=()=>{const e=pa();return e?.activationStart??0},ga=(e,t=-1)=>{const n=pa();let r="navigate";return la>=0?r="back-forward-cache":n&&(document.prerendering||ha()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},ma=new WeakMap;function ya(e,t){return ma.get(e)||ma.set(e,new t),ma.get(e)}class ba{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const wa=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Ea=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let Sa=-1;const ka=new Set,Ta=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,xa=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of ka)e();isFinite(Sa)||(Sa="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",xa,!0))}},Pa=()=>{if(Sa<0){const e=ha(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;Sa=t??Ta(),addEventListener("visibilitychange",xa,!0),addEventListener("prerenderingchange",xa,!0),da(()=>{setTimeout(()=>{Sa=Ta()})})}return{get firstHiddenTime(){return Sa},onHidden(e){ka.add(e)}}},_a=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},Aa=[1800,3e3],Oa=(e,t={})=>{_a(()=>{const n=Pa();let r,i=ga("FCP");const o=wa("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ha(),0),i.entries.push(t),r(!0)))});o&&(r=fa(e,i,Aa,t.reportAllChanges),da(n=>{i=ga("FCP"),r=fa(e,i,Aa,t.reportAllChanges),va(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},Ia=[.1,.25];let Ca=0,Ra=1/0,Da=0;const La=e=>{for(const t of e)t.interactionId&&(Ra=Math.min(Ra,t.interactionId),Da=Math.max(Da,t.interactionId),Ca=Da?(Da-Ra)/7+1:0)};let Na;const Ma=()=>Na?Ca:performance.interactionCount??0;let ja=0;class Ua{u=[];l=new Map;m;p;v(){ja=Ma(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((Ma()-ja)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const Fa=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=Ea(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},qa=[200,500],Ba=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Pa();_a(()=>{"interactionCount"in performance||Na||(Na=wa("event",La,{type:"event",buffered:!0,durationThreshold:0}));let r,i=ga("INP");const o=ya(t,Ua),a=e=>{Fa(()=>{for(const t of e)o.h(t);const t=o.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,r())})},s=wa("event",a,{durationThreshold:t.durationThreshold??40});r=fa(e,i,qa,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{a(s.takeRecords()),r(!0)}),da(()=>{o.v(),i=ga("INP"),r=fa(e,i,qa,t.reportAllChanges)}))})};class Ha{m;h(e){this.m?.(e)}}const Va=[2500,4e3],za=[800,1800],Wa=e=>{document.prerendering?_a(()=>Wa(e)):"complete"!==document.readyState?addEventListener("load",()=>Wa(e),!0):setTimeout(e)};function Ga(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function $a(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Ga(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Ka,Ja=function(){var e=null,t=H(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return void 0===n||(o=Ce((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Ce((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Ce(o.split("?")[0],t.loggerProvider)},((e,t={})=>{_a(()=>{const n=Pa();let r,i=ga("LCP");const o=ya(t,Ha),a=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ha(),0),i.entries=[t],r())},s=wa("largest-contentful-paint",a);if(s){r=fa(e,i,Va,t.reportAllChanges);const n=Ea(()=>{a(s.takeRecords()),s.disconnect(),r(!0)}),o=e=>{e.isTrusted&&(Fa(n),removeEventListener(e.type,o,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});da(n=>{i=ga("LCP"),r=fa(e,i,Va,t.reportAllChanges),va(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})})(function(e){a["[Amplitude] LCP"]=$a(e)}),Oa(function(e){a["[Amplitude] FCP"]=$a(e)}),Ba(function(e){a["[Amplitude] INP"]=$a(e)}),((e,t={})=>{const n=Pa();Oa(Ea(()=>{let r,i=ga("CLS",0);const o=ya(t,ba),a=e=>{for(const t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,r())},s=wa("layout-shift",a);s&&(r=fa(e,i,Ia,t.reportAllChanges),n.onHidden(()=>{a(s.takeRecords()),r(!0)}),da(()=>{o.i=0,i=ga("CLS",0),r=fa(e,i,Ia,t.reportAllChanges),va(()=>r())}),setTimeout(r))}))})(function(e){a["[Amplitude] CLS"]=$a(e)}),((e,t={})=>{let n=ga("TTFB"),r=fa(e,n,za,t.reportAllChanges);Wa(()=>{const i=pa();i&&(n.value=Math.max(i.responseStart-ha(),0),n.entries=[i],r(!0),da(()=>{n=ga("TTFB",0),r=fa(e,n,za,t.reportAllChanges),r(!0)}))})})(function(e){a["[Amplitude] TTFB"]=$a(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},Ya=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Ue(t.apiKey,"MKTG"),this.webExpStorageKey=Ue(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=C,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||xe(this.sessionTimeout,this.lastEventTime),Cr(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new Bt).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,a=(t=this.currentCampaign,n=this.options,r=o(o({},C),t),i=Object.entries(r).reduce(function(e,t){var r,i=l(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)},new M),G(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Xa=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),Qa=function(e){var t;void 0===e&&(e={});var n,r,i,a,c,l,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,f=H(),v={},p=!1,h=!1,g=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new Bt).parse()];case 1:return e=t.sent(),v=De(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",v)),[2]}})})},m=function(){g()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(o){switch(o.label){case 0:return n=t,r=e.loggerProvider,p=!0,r.log("Installing event property attribution tracking."),[4,g()];case 1:if(o.sent(),!f)return[2];if(f.addEventListener("popstate",m),!h){if(i=Reflect.get(f.history,"pushState"),a=Reflect.get(f.history,"replaceState"),!i||!a)return[2];c=y(i),f.history.pushState=c,l=y(a),f.history.replaceState=l,h=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return Xa.has(e.event_type)||(e.event_properties=o(o({},v),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){return f&&(f.removeEventListener("popstate",m),e=Reflect.get(f.history,"pushState"),t=Reflect.get(f.history,"replaceState"),h&&e===c&&i&&(f.history.pushState=i),h&&t===l&&a&&(f.history.replaceState=a)),p=!1,h=!1,i=void 0,a=void 0,c=void 0,l=void 0,v={},[2]})})}}},Za="AMP_CURRENT_PAGE",es="AMP_PREVIOUS_PAGE",ts="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Ka||(Ka={}));var ns=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),rs=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=H(),i=void 0,a=!1,c=void 0,d=!1,f=!1,v=function(e){var t;try{var n=Ce(e,c);t=new URL(n).hostname}catch(e){null==c||c.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?v(e):void 0;if(!r)return Ka.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?Ka.Internal:Ka.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return u(this,function(s){switch(s.label){case 0:return i&&a?[4,i.get(ts)]:[3,3];case 1:return e=s.sent(),t=Ce("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[Za])||"",r=void 0,r=t===n?(null==e?void 0:e[es])||"":n||(document.referrer||""),[4,i.set(ts,(o={},o[Za]=t,o[es]=r,o))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},g=function(){h()},m={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){var t,n,o,s,p,m,y,b;return u(this,function(u){switch(u.label){case 0:if((c=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),f=!0,!r)return[3,7];try{i=new Fe(r.sessionStorage)}catch(e){null==c||c.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return a=null!==(b=u.sent())&&void 0!==b&&b,i&&a?(t="undefined"!=typeof document&&document.referrer||"",n=t?v(t):void 0,o="undefined"!=typeof location&&location.hostname||"",s=Ce("undefined"!=typeof location&&location.href||""),[4,i.get(ts)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[Za])||"",!!n&&n!==o&&m!==s?[4,i.set(ts,(y={},y[Za]=s,y[es]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,h()];case 5:u.sent(),u.label=6;case 6:r.addEventListener("popstate",g),d||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),d=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(s){switch(s.label){case 0:return t=Ce("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(ts)]:[3,2];case 1:if(n=s.sent(),r=(null==n?void 0:n[es])||"",ns.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":is(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":is(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":is(e,"[Amplitude] Page Path","undefined"!=typeof location&&Ce(location.pathname)||""),"[Amplitude] Page Title":is(e,"[Amplitude] Page Title",Kt($t)),"[Amplitude] Page URL":is(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",g),f=!1),i&&a?[4,i.set(ts,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function is(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var os=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(a=i.remoteConfig)||void 0===a?void 0:a.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return s(void 0,void 0,void 0,function(){var r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||e.error("Could not execute custom enrichment function",n),[2,t]}return[2,t]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return t&&t(),[2]})})}};return i},as="userProperty",ss="eventProperty",us=function(e){return e===as||e===ss},cs=[as,ss],ls=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(us))),!1);return t.length>0?t:d([],l(cs),!1)}(e.trackingMethod).includes(t)},ds=function(e){return ls(e,as)},fs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),$(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,c,l,d,f,v;return s(this,void 0,void 0,function(){var p,h,g,m,y,b,w,E,S,k,T,x,P,_,A,O=this;return u(this,function(I){switch(I.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),h=null!==(n=t.loggerProvider)&&void 0!==n?n:new Q,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:Y.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(c=t.enableDiagnostics)||void 0===c||c,p?(m=new at(t.apiKey,h,g,null===(l=t.remoteConfig)||void 0===l?void 0:l.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:I.sent(),I.label=2;case 2:return(w=new Qe(t.apiKey,h,g,{enabled:b,sampleRate:y})).setTag("library","".concat(rr,"/").concat(nr)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=H();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,Fr(t.apiKey,t,this,w,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return E=I.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&ei(t,E),e()})})]:[3,5];case 4:I.sent(),I.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return I.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=m,D=this.config,S=Bn(D.defaultTracking)&&D.defaultTracking&&"object"==typeof D.defaultTracking&&D.defaultTracking.attribution&&"object"==typeof D.defaultTracking.attribution?o({},D.defaultTracking.attribution):{},Bn(this.config.defaultTracking)&&ds(S)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(O,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Ya(S,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Ya(S,this.config),[4,this.webAttribution.init()]):[3,8];case 7:I.sent(),I.label=8;case 8:return k=Ae(),T=k.ampTimestamp?Number(k.ampTimestamp):void 0,x=!T||Date.now()<T,P=x&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(_=this.config.deferredSessionId)||this.config.optOut||(_=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:P)&&void 0!==f?f:_)&&void 0!==v?v:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(O,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(A=ke(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(Zr()).promise];case 9:I.sent(),I.label=10;case 10:return[4,this.add(new fe({diagnosticsClient:w})).promise];case 11:return I.sent(),[4,this.add(new ir).promise];case 12:return I.sent(),[4,this.add(new Te).promise];case 13:return I.sent(),function(e){Qr||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."),Qr=!0)}(this.config),R=this.config.defaultTracking,qn(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Xr()).promise]):[3,15];case 14:I.sent(),I.label=15;case 15:return Hn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Kr()).promise]):[3,17];case 16:I.sent(),I.label=17;case 17:return Vn(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(zr(Qn(this.config))).promise]):[3,20];case 18:return I.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return s(O,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(zr(Qn(this.config))).promise]);case 1:return t.sent(),[2]}})})}),I.label=20;case 20:return Bn(this.config.defaultTracking)&&function(e){return ls(e,ss)}(S)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(Qa(S)).promise]):[3,22];case 21:I.sent(),I.label=22;case 22:return Gn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Ro(Jn(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:I.sent(),I.label=24;case 24:return $n(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Go(Yn(this.config))).promise]):[3,26];case 25:I.sent(),I.label=26;case 26:return Wn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(ca(Xn(this.config))).promise]):[3,28];case 27:I.sent(),I.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Ja()).promise]):[3,30];case 29:I.sent(),I.label=30;case 30:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(Zo(Kn(this.config))).promise]):[3,32];case 31:I.sent(),I.label=32;case 32:return function(e){return qn(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(rs()).promise]):[3,34];case 33:I.sent(),I.label=34;case 34:return("boolean"==typeof(C=this.config.customEnrichment)?C:"object"==typeof C&&null!==C&&!1!==C.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(os()).promise]):[3,36];case 35:I.sent(),I.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return I.sent(),A.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i="number"==typeof n?{time:n}:void 0;O.track(e.eventType,r,i)}),[2]}var C,R,D})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){ke(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){ke(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(z()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n,r;if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var i=new M,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var a=c(Object.entries(o)),s=a.next();!s.done;s=a.next()){var u=l(s.value,2),d=u[0],f=u[1];i.set(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),$(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,$(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return $(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,zn(this.config.defaultTracking)&&(r&&i&&n.push(this.track(br,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 a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(G(this.config.identify)).promise),zn(this.config.defaultTracking)&&n.push(this.track(yr,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,$(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=Br(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(tr(t)){var r=t._q;t._q=[],t=er(new M,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(tr(r)){var o=r._q;r._q=[],r=er(new M,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(tr(t)){var r=t._q;t._q=[],t=er(new J,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!ds(this.webAttribution.options))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 s(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=xe(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===yr||t.event_type===br||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=o(o({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",kn(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(K),vs=function(){var e=new fs;return{init:ce(e.init.bind(e),"init",ae(e),ue(e,["config"])),add:ce(e.add.bind(e),"add",ae(e),ue(e,["config.apiKey","timeline.plugins"])),remove:ce(e.remove.bind(e),"remove",ae(e),ue(e,["config.apiKey","timeline.plugins"])),track:ce(e.track.bind(e),"track",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),logEvent:ce(e.logEvent.bind(e),"logEvent",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),identify:ce(e.identify.bind(e),"identify",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),groupIdentify:ce(e.groupIdentify.bind(e),"groupIdentify",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),setGroup:ce(e.setGroup.bind(e),"setGroup",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),revenue:ce(e.revenue.bind(e),"revenue",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),flush:ce(e.flush.bind(e),"flush",ae(e),ue(e,["config.apiKey","timeline.queue.length"])),getUserId:ce(e.getUserId.bind(e),"getUserId",ae(e),ue(e,["config","config.userId"])),setUserId:ce(e.setUserId.bind(e),"setUserId",ae(e),ue(e,["config","config.userId"])),getDeviceId:ce(e.getDeviceId.bind(e),"getDeviceId",ae(e),ue(e,["config","config.deviceId"])),setDeviceId:ce(e.setDeviceId.bind(e),"setDeviceId",ae(e),ue(e,["config","config.deviceId"])),reset:ce(e.reset.bind(e),"reset",ae(e),ue(e,["config","config.userId","config.deviceId"])),getSessionId:ce(e.getSessionId.bind(e),"getSessionId",ae(e),ue(e,["config"])),setSessionId:ce(e.setSessionId.bind(e),"setSessionId",ae(e),ue(e,["config"])),extendSession:ce(e.extendSession.bind(e),"extendSession",ae(e),ue(e,["config"])),setOptOut:ce(e.setOptOut.bind(e),"setOptOut",ae(e),ue(e,["config"])),setTransport:ce(e.setTransport.bind(e),"setTransport",ae(e),ue(e,["config"])),getIdentity:ce(e.getIdentity.bind(e),"getIdentity",ae(e),ue(e,["config"])),setIdentity:ce(e.setIdentity.bind(e),"setIdentity",ae(e),ue(e,["config","config.userId","config.deviceId"])),getOptOut:ce(e.getOptOut.bind(e),"getOptOut",ae(e),ue(e,["config"])),_setDiagnosticsSampleRate:ce(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",ae(e),ue(e,["config"]))}},ps=vs(),hs=function(){function e(e){this.amplitude=e,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(e){return this.videoEl=e,this},e.prototype.withEmbeddedPlayer=function(e){return this.embeddedVideoPlayer=e,this},e.prototype.withVendor=function(e){return this.vendor=e,this},e.prototype.withExtraEventProperties=function(e){return this.extraEventProperties=e,this},e.prototype.captureVideoStarted=function(){var e=this;return this.listeners.push(function(t,n){"playing"!==t.playbackState&&"playing"===n.playbackState&&e.amplitude.track("Video Content Started",o(o({},n.lastEvent),e.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){"playing"===t.playbackState&&"playing"!==n.playbackState&&e.amplitude.track("Video Content Stopped",o(o(o({},n.lastEvent),{watch_duration:n.watchTime}),e.extraEventProperties))}),this},e.prototype.start=function(){var e,t=this,n=null!==(e=this.videoEl)&&void 0!==e?e:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var r=new jn({videoEl:n,onStateChange:function(e,n){t.listeners.forEach(function(t){return t(e,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){r.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[]},e}();var gs=ps.add,ms=ps.extendSession,ys=ps.flush,bs=ps.getDeviceId,ws=ps.getIdentity,Es=ps.getOptOut,Ss=ps.getSessionId,ks=ps.getUserId,Ts=ps.groupIdentify,xs=ps.identify,Ps=ps.init,_s=ps.logEvent,As=ps.remove,Os=ps.reset,Is=ps.revenue,Cs=ps.setDeviceId,Rs=ps.setGroup,Ds=ps.setIdentity,Ls=ps.setOptOut,Ns=ps.setSessionId,Ms=ps.setTransport,js=ps.setUserId,Us=ps.track,Fs=ps._setDiagnosticsSampleRate,qs=Object.freeze({__proto__:null,add:gs,extendSession:ms,flush:ys,getDeviceId:bs,getIdentity:ws,getOptOut:Es,getSessionId:Ss,getUserId:ks,groupIdentify:Ts,identify:xs,init:Ps,logEvent:_s,remove:As,reset:Os,revenue:Is,setDeviceId:Cs,setGroup:Rs,setIdentity:Ds,setOptOut:Ls,setSessionId:Ns,setTransport:Ms,setUserId:js,track:Us,_setDiagnosticsSampleRate:Fs,createInstance:vs,AmplitudeBrowser:fs,runQueuedFunctions:Zn,Revenue:J,Identify:M,trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new hs(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),n.vendor&&i.withVendor(n.vendor);var a=null!==(r=n.extraEventProperties)&&void 0!==r?r:{};try{i.withExtraEventProperties(o({view_session_id:z()},a)).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:Or});!function(){var e=H();if(e){var t=function(e){var t=vs(),n=H();return n&&n.amplitudeGTM&&n.amplitudeGTM._iq&&e&&(n.amplitudeGTM._iq[e]=t),t};if(e.amplitudeGTM=Object.assign(e.amplitudeGTM||{},qs,{createInstance:t}),e.amplitudeGTM.invoked){var n=e.amplitudeGTM._q;e.amplitudeGTM._q=[],Zn(qs,n);for(var r=Object.keys(e.amplitudeGTM._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitudeGTM._iq[o],t(o)),s=a._q;a._q=[],Zn(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
|
|
1
|
+
!function(){"use strict";function e(e,t){return t.forEach(function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach(function(n){if("default"!==n&&!(n in e)){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})}),Object.freeze(e)}var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},t(e,n)};function n(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}var r,i,o=function(){return o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},o.apply(this,arguments)};function a(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function s(e,t,n,r){return new(n||(n=Promise))(function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,s)}u((r=r.apply(e,t||[])).next())})}function u(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=s(0),a.throw=s(1),a.return=s(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(s){return function(u){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,s[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&s[0]?r.return:s[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;switch(r=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,r=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],r=0}finally{n=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,u])}}}function c(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function l(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.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 a}function d(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(r||(r={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(i||(i={}));var f,v="AMP",p="".concat(v,"_unsent"),h="$default_instance",g="https://api2.amplitude.com/2/httpapi",m="https://api.eu.amplitude.com/2/httpapi",y="https://api2.amplitude.com/batch",b="https://api.eu.amplitude.com/batch",w="dclid",E="fbclid",S="gbraid",k="gclid",T="ko_click_id",x="li_fat_id",P="msclkid",_="rdt_cid",A="ttclid",I="twclid",O="wbraid",C={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],D=["authorization","cookie","set-cookie"],L=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!N(t,n))return!1}return!0},N=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if("object"==typeof s)i=i&&L(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return L(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return o({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(f.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(f.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(f.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(f.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(f.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(f.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(f.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(f.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(f.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[f.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[f.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===f.ADD?"number"==typeof n:e===f.UNSET||e===f.REMOVE||N(t,n)))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(f||(f={}));var j,U=[f.CLEAR_ALL,f.UNSET,f.SET,f.SET_ONCE,f.ADD,f.APPEND,f.PREPEND,f.PREINSERT,f.POSTINSERT,f.REMOVE],F="Event skipped due to empty event type";!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"}(j||(j={}));var q=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=j.Unknown),{event:e,code:t,message:n}},B=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},H=d([],l(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),z=function(e){var t,n=B();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,z)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,d([],l(r.entries()),!1).map(function(e){var t=l(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(H[r]):H[r]}).join("")},V={},W={get exports(){return V},set exports(e){V=e}},G=Object.prototype.hasOwnProperty;function $(e){return"[Throws: "+(e?e.message:"?")+"]"}function K(e){var t=[];return function e(n){if(null===n||"object"!=typeof n)return n;if(-1!==t.indexOf(n))return"[Circular]";if(t.push(n),"function"==typeof n.toJSON)try{var r=e(n.toJSON());return t.pop(),r}catch(e){return $(e)}if(Array.isArray(n)){var i=n.map(e);return t.pop(),i}var o=Object.keys(n).reduce(function(t,r){return t[r]=e(function(e,t){if(G.call(e,t))try{return e[t]}catch(e){return $(e)}return e[t]}(n,r)),t},{});return t.pop(),o}(e)}W.exports=function(e,t,n){return JSON.stringify(K(e),t,n)};var J,Y=V.ensureProperties=K,X=V||e({__proto__:null,ensureProperties:Y,get default(){return V}},[V]),Q=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return void 0===e.name&&(e.name=z(),this.loggerProvider.warn("Plugin name is undefined.\n Generating a random UUID for plugin name: ".concat(e.name,".\n Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i)?(this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2]):(e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return o.sent(),"locked"!==this.pluginStatus.get(i)?[2]:(this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2])}})})},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,function(){var r,i;return u(this,function(o){switch(o.label){case 0:return this.pluginStatus.delete(e),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._clearOptOutListeners(),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.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,a,s,d,f,v,p,h,g,m,y,b,w,E,S,k,T;return u(this,function(u){switch(u.label){case 0:if(!e)return[2];t=l(e,1),n=t[0],r=l(e,2),i=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(e){return"before"===e.type}),u.label=1;case 1:u.trys.push([1,6,7,8]),s=c(a),d=s.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(o({},n))]:[3,4];case 3:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=4;case 4:return d=s.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),E={error:f},[3,8];case 7:try{d&&!d.done&&(S=s.return)&&S.call(s)}finally{if(E)throw E.error}return[7];case 8:v=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),u.label=9;case 9:u.trys.push([9,14,15,16]),p=c(v),h=p.next(),u.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(o({},n))]:[3,12];case 11:if(null===(m=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),i({event:n,code:0,message:""}),[2];n=m,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(X(n))),u.label=12;case 12:return h=p.next(),[3,10];case 13:return[3,16];case 14:return y=u.sent(),k={error:y},[3,16];case 15:try{h&&!h.done&&(T=p.return)&&T.call(p)}finally{if(k)throw k.error}return[7];case 16:return b=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(X(n))),w=b.map(function(e){var t=o({},n);return e.execute(t).catch(function(e){return q(t,0,String(e))})}),Promise.all(w).then(function(e){var t=l(e,1)[0]||q(n,100,"Event not tracked, no destination plugins on the instance");i(t)}),[2]}})})},e.prototype.flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r=this;return u(this,function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return r.apply(e)}))];case 1:return i.sent(),t=this.plugins.filter(function(e){return"destination"===e.type}),n=t.map(function(e){return e.flush&&e.flush()}),[4,Promise.all(n)];case 2:return i.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),t=c(this._optOutListeners),n=t.next(),u.label=1;case 1:if(n.done)return[3,6];r=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,r(e)];case 3:return u.sent(),[3,5];case 4:return i=u.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o=u.sent(),a={error:o},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),Z=function(e,t){return o(o({},t),{event_type:i.IDENTIFY,user_properties:e.getUserProperties()})},ee=function(e){return{promise:e||Promise.resolve()}},te=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 Q(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o,a,s,l,d;return u(this,function(u){switch(u.label){case 0:n=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),r=c(n),i=r.next(),u.label=2;case 2:return i.done?[3,7]:(o=i.value,(a=o())&&"promise"in a?[4,a.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,a];case 5:u.sent(),u.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),l={error:s},[3,10];case 9:try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(l)throw l.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e,t)]:[3,12];case 11:return u.sent(),[3,13];case 12:null==t||t(),u.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=function(e,t,n){return o(o(o({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.identify=function(e,t){var n=Z(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),ee(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var a=function(e,t,n,r){var a;return o(o({},r),{event_type:i.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(a={},a[e]=t,a)})}(e,t,n,r);return ee(this.dispatch(a))},e.prototype.setGroup=function(e,t,n){var r=function(e,t,n){var r,a=new M;return a.set(e,t),o(o({},n),{event_type:i.IDENTIFY,user_properties:a.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),ee(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=function(e,t){return o(o({},t),{event_type:i.REVENUE,event_properties:e.getEventProperties()})}(e,t);return ee(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),ee())},e.prototype._addPlugin=function(e){return ee(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)),ee())},e.prototype._removePlugin=function(e){return ee(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(q(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,function(){var t=this;return u(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},i=o({},n);if(void 0===e)return i;var a={};return Object.keys(e).forEach(function(t){Object.values(r).includes(t)||(a[t]=e[t])}),U.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case r.CLEAR_ALL:Object.keys(i).forEach(function(e){delete i[e]});break;case r.UNSET:Object.keys(n).forEach(function(e){delete i[e]});break;case r.SET:Object.assign(i,n)}}}),Object.assign(i,a),i},e.prototype.process=function(e){return s(this,void 0,void 0,function(){var t,n,r,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,q(e,0,"Event skipped due to optOut config")]:"string"!=typeof(t=e.event_type)||0===t.trim().length?(this.config.loggerProvider.error(F),[2,q(e,0,F)]):(e.event_type===i.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)]);case 1:return 200===(o=a.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),r=String(n),this.config.loggerProvider.error(r),[2,o=q(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=Boolean(e),this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return ee(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0!==t)return t;this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e))},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),ne=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){try{var t=JSON.parse(JSON.stringify(e));L(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?o({},this.properties):{};return e[J.REVENUE_PRODUCT_ID]=this.productId,e[J.REVENUE_QUANTITY]=this.quantity,e[J.REVENUE_PRICE]=this.price,e[J.REVENUE_TYPE]=this.revenueType,e[J.REVENUE_CURRENCY]=this.currency,e[J.REVENUE]=this.revenue,e[J.RECEIPT]=this.receipt,e[J.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(J||(J={}));var re;!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"}(re||(re={}));var ie="Amplitude Logger ",oe=function(){function e(){this.logLevel=re.None}return e.prototype.disable=function(){this.logLevel=re.None},e.prototype.enable=function(e){void 0===e&&(e=re.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Verbose||console.log("".concat(ie,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Warn||console.warn("".concat(ie,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Error||console.error("".concat(ie,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<re.Debug||console.log("".concat(ie,"[Debug]: ").concat(e.join(" ")))},e}(),ae=function(e){return void 0===e||""===e?h:e},se=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:h,logLevel:re.Warn,loggerProvider:new oe,offline:!1,optOut:!1,serverUrl:g,serverZone:"US",useBatch:!1}},ue=function(){function e(e){var t,n,r,i;this._optOut=!1;var o=se();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=ae(e.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 a=le(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=a.serverZone,this.serverUrl=a.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),ce=function(e,t){return"EU"===e?t?b:m:t?y:g},le=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=se().serverZone),void 0===n&&(n=se().useBatch),e)return{serverUrl:e,serverZone:void 0};var r=["US","EU"].includes(t)?t:se().serverZone;return{serverZone:r,serverUrl:ce(r,n)}},de=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function fe(e){return e>=200&&e<300}var ve=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},pe=function(e){return function(){var t=o({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},he=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=c(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(!(a in e))return;e=e[a]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ge=function(e,t){return function(){var n,r,i={};try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=he(e,s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},me=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=n(),u=s.logger,c=s.logLevel;if(c&&c<re.Debug||!c||!u)return e.apply(i,o);var l={type:"invoke public method",name:t,args:o,stacktrace:ve(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()),u.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=(new Date).toISOString()),u.debug(JSON.stringify(l,null,2))),d}},ye=new Set([g,m,y,b]);function be(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var we=function(){function e(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=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return s(this,void 0,void 0,function(){var n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(p,"_").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=z()),new Promise(function(n){var r={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(r),t.schedule(t.config.flushIntervalMillis),t.saveEvents()})},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter(function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)})},e.prototype.scheduleEvents=function(e){var t=this;e.forEach(function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)})},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,function(){var t,n,r=this;return u(this,function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce(function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e},[]).reduce(function(t,n){return s(r,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}})})},Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),s(this,void 0,void 0,function(){var r,i,o,s,c,l;return u(this,function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,a(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new de,u.label=1;case 1:return u.trys.push([1,3,,4]),i=le(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,o=function(e,t){return void 0===t&&(t=!1),!!ye.has(e)||t}(i,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(i,r,o)];case 2:return null===(s=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(s,e),[3,4]):("body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(be(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return c=u.sent(),l=(d=c)instanceof Error?d.message:String(d),this.config.loggerProvider.error(l),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:ve()}),this.handleResponse({status:j.Failed,statusCode:0},e),[3,4];case 4:return[2]}var d})})},e.prototype.handleResponse=function(e,t){var n;fe(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:be(e),stack_trace:ve()});var r=e.status;switch(r){case j.Success:this.handleSuccessResponse(e,t);break;case j.Invalid:this.handleInvalidResponse(e,t);break;case j.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case j.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=d(d(d(d([],l(Object.values(e.body.eventsWithInvalidFields)),!1),l(Object.values(e.body.eventsWithMissingFields)),!1),l(Object.values(e.body.eventsWithInvalidIdLengths)),!1),l(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter(function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)});o.length>0&&this.config.loggerProvider.warn(be(e));var a=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(a)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(be(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,a=new Set(r),s=new Set(i),u=new Set(o),c=t.filter(function(t,r){if(!(t.event.user_id&&a.has(t.event.user_id)||t.event.device_id&&s.has(t.event.device_id)))return u.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)});c.length>0&&this.config.loggerProvider.warn(be(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){var r,i,o;fe(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:ve()})),this.removeEvents(e),e.forEach(function(e){return e.callback(q(e.event,t,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(e){return e.event});this.config.storageProvider.set(this.storageKey,e)}},e.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(t){return!e.some(function(e){return e.event.insert_id===t.event.insert_id})}),this.saveEvents()},e}(),Ee=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Se(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),Se=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},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}(),Te=function(){return Te=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},Te.apply(this,arguments)};function xe(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 Pe(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.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 a}"function"==typeof SuppressedError&&SuppressedError;var _e=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=xe(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===i)return e===t}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var s=Array.isArray(e),u=Array.isArray(t);if(s!==u)return!1;if(!s||!u){var c=Object.keys(e).sort(),l=Object.keys(t).sort();if(!_e(c,l))return!1;var d=!0;return Object.keys(e).forEach(function(n){_e(e[n],t[n])||(d=!1)}),d}for(var f=0;f<e.length;f++)if(!_e(e[f],t[f]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var Ae=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=Te({},this.identity.userProperties),n=Te(Te({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,a,s,u=n.userProperties||{};try{for(var c=xe(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=Pe(l.value,2),f=d[0],v=d[1];switch(f){case"$set":try{for(var p=(i=void 0,xe(Object.entries(v))),h=p.next();!h.done;h=p.next()){var g=Pe(h.value,2),m=g[0],y=g[1];u[m]=y}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(a=void 0,xe(Object.keys(v))),w=b.next();!w.done;w=b.next()){delete u[m=w.value]}}catch(e){a={error:e}}finally{try{w&&!w.done&&(s=b.return)&&s.call(b)}finally{if(a)throw a.error}}break;case"$clearAll":u={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}return n.userProperties=u,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return Te({},this.identity)},e.prototype.setIdentity=function(e){var t=Te({},this.identity);this.identity=Te({},e),_e(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}(),Ie="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:self,Oe=function(){function e(){this.identityStore=new Ae,this.eventBridge=new ke,this.applicationContextProvider=new Ee}return e.getInstance=function(t){return Ie.analyticsConnectorInstances||(Ie.analyticsConnectorInstances={}),Ie.analyticsConnectorInstances[t]||(Ie.analyticsConnectorInstances[t]=new e),Ie.analyticsConnectorInstances[t]},e}(),Ce=function(e){return Oe.getInstance(ae(e))},Re=function(){function e(){this.name="identity",this.type="before",this.identityStore=Ce().identityStore}return e.prototype.execute=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return e.instanceName&&(this.identityStore=Ce(e.instanceName).identityStore),[2]})})},e}(),De=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},Le=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},Ne=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:""},Me=function(){var e,t=B();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=je(n[0]),i=je(n[1]);return i?(e[r]=i,e):e},{}):{}},je=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},Ue=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},Fe=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},qe=function(e,t){var n=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t}(e.toString());return 31*Math.abs(n)%1e5/1e5<t},Be=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},He=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}})})},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),ze=function(){function e(e,t){void 0===t&&(t={}),this.options=o({},e),this.config=t}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r,i,a=this;return u(this,function(s){switch(s.label){case 0:return t="AMP_TEST",n=o({},this.options),r=new e(n),i=String(Date.now()),[4,r.transaction(t,function(e){var n,r;try{e.set(i);var o=e.get()===i;return!o&&a.config.diagnosticsClient&&(null===(n=a.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),o}catch(e){if(a.config.diagnosticsClient){var s=e instanceof Error?e.message:String(e);null===(r=a.config.diagnosticsClient)||void 0===r||r.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:s,sync:!0})}return!1}finally{e.set(null)}})];case 1:return[2,s.sent()]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=Ve(t);return void 0===n?void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t)):JSON.parse(n)}catch(n){return void console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t))}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,o,a,s,l,d,f,v;return u(this,function(u){switch(u.label){case 0:r=B(),i=r,u.label=1;case 1:return u.trys.push([1,4,,5]),(o=null==i?void 0:i.cookieStore)?[4,o.getAll(e)]:[3,3];case 2:if(a=u.sent()){a.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:a.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(s=c(a),l=s.next();!l.done;l=s.next())if(d=l.value,We(d.domain,this.options.domain))return[2,d.value]}catch(e){f={error:e}}finally{try{l&&!l.done&&(v=s.return)&&v.call(s)}finally{if(f)throw f.error}}}u.label=3;case 3:return[3,5];case 4:return u.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=B(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),a=void 0,s=this.config.duplicateResolverFn;if("function"==typeof s&&o.length>1&&(a=o.find(function(t){var n;try{var i=s(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),a||(a=o[0]),a)return a.substring(e.length+1)},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return u(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=B();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=null!==t?i:-1,a=void 0;if(o){var s=new Date;s.setTime(s.getTime()+24*o*60*60*1e3),a=s}var u="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=u}catch(t){var c=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,this.set(e,null)];case 1:return t.sent(),[2]}})})},e.prototype.reset=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2]})})},e.isDomainWritable=function(t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return s(this,void 0,void 0,function(){var n,r,i=this;return u(this,function(o){switch(o.label){case 0:if(n=function(){var e,t=B();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks}(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),Ve=function(e){var t;return null!==(t=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}}(e))&&void 0!==t?t:function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}}(e)},We=function(e,t){if(""===e&&""===t)return!0;if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},Ge=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},$e=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return s(this,void 0,void 0,function(){return u(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return s(this,void 0,void 0,function(){return u(this,function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return s(this,void 0,void 0,function(){return u(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),Ke="tags",Je="counters",Ye="histograms",Xe="events",Qe="internal",Ze="last_flush_timestamp",et=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return void 0!==(null===(e=B())||void 0===e?void 0:e.indexedDB)},e.prototype.getDB=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(){var t=r.result;t?e.createTables(t):e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.")}})},e.prototype.createTables=function(e){(e.objectStoreNames.contains(Ke)||e.createObjectStore(Ke,{keyPath:"key"}),e.objectStoreNames.contains(Je)||e.createObjectStore(Je,{keyPath:"key"}),e.objectStoreNames.contains(Ye)||e.createObjectStore(Ye,{keyPath:"key"}),e.objectStoreNames.contains(Xe))||e.createObjectStore(Xe,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1});e.objectStoreNames.contains(Qe)||e.createObjectStore(Qe,{keyPath:"key"})},e.prototype.setTags=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Ke],"readwrite"),r=n.objectStore(Ke),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tags",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1];r.put({key:n,value:i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set tag",n,i,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",i),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Je],"readwrite"),r=n.objectStore(Je),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to increment counters",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e=a.result,t=e?e.value:0;r.put({key:n,value:t+i}).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to update counter",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing counter",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",i),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===Object.entries(e).length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Ye],"readwrite"),r=n.objectStore(Ye),[2,new Promise(function(t){var i=Object.entries(e);n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),t()},i.forEach(function(e){var t=l(e,2),n=t[0],i=t[1],a=r.get(n);a.onsuccess=function(){var e,t=a.result;e=t?{key:n,count:t.count+i.count,min:Math.min(t.min,i.min),max:Math.max(t.max,i.max),sum:t.sum+i.sum}:{key:n,count:i.count,min:i.min,max:i.max,sum:i.sum},r.put(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to set histogram stats",n,e)}},a.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",n,e)}})})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",i),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return s(this,void 0,void 0,function(){var t,n,r,i,o=this;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),0===e.length?[2]:[4,this.getDB()];case 1:return t=a.sent(),n=t.transaction([Xe],"readwrite"),r=n.objectStore(Xe),[2,new Promise(function(t){n.oncomplete=function(){t()},n.onabort=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event records",e),t()};var i=r.count();i.onsuccess=function(){var t=i.result,n=Math.max(0,10-t);n<e.length&&o.logger.debug("DiagnosticsStorage: Only added ".concat(n," of ").concat(e.length," events due to storage limit")),e.slice(0,n).forEach(function(e){r.add(e).onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},i.onerror=function(e){o.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return i=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",i),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return s(this,void 0,void 0,function(){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=a.sent(),r=n.transaction([Qe],"readwrite"),i=r.objectStore(Qe),[2,new Promise(function(n,o){r.onabort=function(){return o(new Error("Failed to set internal value"))};var a=i.put({key:e,value:t});a.onsuccess=function(){return n()},a.onerror=function(){return o(new Error("Failed to set internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",o),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return s(this,void 0,void 0,function(){var t,n,r,i;return u(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return t=o.sent(),n=t.transaction([Qe],"readonly"),r=n.objectStore(Qe),[2,new Promise(function(t,i){n.onabort=function(){return i(new Error("Failed to get internal value"))};var o=r.get(e);o.onsuccess=function(){return t(o.result)},o.onerror=function(){return i(new Error("Failed to get internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",i),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(Ze)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(Ze,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(new Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=u.sent(),t=e.transaction([Ke,Je,Ye,Xe],"readwrite"),[4,Promise.all([this.getAllFromStore(t,Ke),this.getAllFromStore(t,Je),this.getAllFromStore(t,Ye),this.getAllFromStore(t,Xe)])];case 2:return n=l.apply(void 0,[u.sent(),4]),r=n[0],i=n[1],o=n[2],a=n[3],[4,Promise.all([this.clearTable(t,Je),this.clearTable(t,Ye),this.clearTable(t,Xe)])];case 3:return u.sent(),[2,{tags:r,counters:i,histogramStats:o,events:a}];case 4:return s=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(new Error("Failed to get all from ".concat(t)))}})},e}(),tt=function(e){var t,n,r=function(){var e=B();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]}();if(0!==r.length)try{for(var i=c(r),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},nt=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},rt=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},it=3e5,ot=1e4,at=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=o({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=qe(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:et.isSupported()?this.storage=new et(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),function(e){var t=B();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",o({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=tt({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=nt(i),a=tt({filename:o,stack:i});a&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:rt(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:a}})},!0)}}(this))}return e.prototype.isStorageAndTrackEnabled=function(){return Boolean(this.storage)&&Boolean(this.shouldTrack)},e.prototype.setTag=function(e,t){this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryTags).length>=ot?this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit"):(this.inMemoryTags[e]=t,this.startTimersIfNeeded()))},e.prototype.increment=function(e,t){void 0===t&&(t=1),this.isStorageAndTrackEnabled()&&(Object.keys(this.inMemoryCounters).length>=ot?this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit"):(this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()))},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled())if(Object.keys(this.inMemoryHistograms).length>=ot)this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");else{var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){this.isStorageAndTrackEnabled()&&(this.inMemoryEvents.length>=10?this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit"):(this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()))},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},it))},e.prototype.saveAllDataToStorage=function(){return s(this,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){switch(i.label){case 0:return this.storage?(e=o({},this.inMemoryTags),t=o({},this.inMemoryCounters),n=o({},this.inMemoryHistograms),r=d([],l(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])]):[2];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return s(this,void 0,void 0,function(){var e,t,n,r,i,o,a,s,c,l;return u(this,function(u){switch(u.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return u.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=u.sent(),t=e.tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),a={},n.forEach(function(e){a[e.key]=e.value}),s={},r.forEach(function(e){s[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),c=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(a).length&&0===Object.keys(s).length&&0===c.length?[2]:(l={tags:o,histogram:s,counters:a,events:c},this.fetch(l),[2])}})})},e.prototype.fetch=function(e){return s(this,void 0,void 0,function(){var t;return u(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!B())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return n.sent().ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return s(this,void 0,void 0,function(){var e,t,n;return u(this,function(r){switch(r.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return-1===(t=r.sent()||-1)?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(it),[2]):(n=e-t)>=it?(this._flush(),[2]):(this._setFlushTimer(it-n),[2])}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=qe(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),st=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S;if("object"!=typeof e)return null;var k=e.code||0,T=this.buildStatus(k);switch(T){case j.Success:return{status:T,statusCode:k,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 j.Invalid:return{status:T,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(a=e.events_with_invalid_fields)&&void 0!==a?a:{},eventsWithMissingFields:null!==(s=e.events_with_missing_fields)&&void 0!==s?s:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},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!==(v=e.throttled_devices)&&void 0!==v?v:{},throttledEvents:null!==(p=e.throttled_events)&&void 0!==p?p:[]}};case j.PayloadTooLarge:return{status:T,statusCode:k,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case j.RateLimit:return{status:T,statusCode:k,body:{error:null!==(g=e.error)&&void 0!==g?g:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(E=e.exceeded_daily_quota_users)&&void 0!==E?E:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case j.Timeout:default:return{status:T,statusCode:k}}},e.prototype.buildStatus=function(e){return fe(e)?j.Success:429===e?j.RateLimit:413===e?j.PayloadTooLarge:408===e?j.Timeout:e>=400&&e<500?j.Invalid:e>=500?j.Failed:j.Unknown},e}();function ut(){return"undefined"!=typeof CompressionStream}function ct(e){return s(this,void 0,void 0,function(){var t,n;return u(this,function(r){switch(r.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];r.label=1;case 1:return r.trys.push([1,3,,4]),n=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(n).arrayBuffer()];case 2:return[2,r.sent()];case 3:return r.sent(),[2,void 0];case 4:return[2]}})})}var lt=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}();var dt=401,ft=403,vt=429,pt=function(){function e(t,n,r,i,o,a){void 0===r&&(r="US"),void 0===a&&(a=e.CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=new lt(t,n),this.customFetch=o,this.configGroup=a}return e.prototype.subscribe=function(e,t,n){var r=z(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return-1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return s(this,void 0,void 0,function(){var e,t=this;return u(this,function(n){switch(n.label){case 0:return this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(e){return s(this,void 0,void 0,function(){var t,n,r,i=this;return u(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending callback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return s(this,void 0,void 0,function(){var n,r;return u(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),s(this,void 0,void 0,function(){var n,r,i,o,a,s,c=this;return u(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,a,s,l,d,f,v,p,h;return u(this,function(u){switch(u.label){case 0:i=!0,a=new AbortController,s=setTimeout(function(){return a.abort()},t),u.label=1;case 1:return u.trys.push([1,10,11,12]),l=o.getUrlParams(),d={Accept:"*/*"},o.customFetch?[4,(g=o.customFetch({url:l,method:"GET",headers:d,signal:a.signal}),m=a.signal,new Promise(function(e,t){var n=function(){var e=new Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),g.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))]:[3,3];case 2:return v=u.sent(),[3,5];case 3:return[4,fetch(l,{method:"GET",headers:d,signal:a.signal})];case 4:v=u.sent(),u.label=5;case 5:return(f=v).ok||f.status>=200&&f.status<300?[3,7]:[4,f.text()];case 6:return p=u.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(f.status,": ").concat(p)),f.status===dt||f.status===ft?(o.logger.error("Remote config client fetch failed with ".concat(f.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):f.status>=400&&f.status<500&&f.status!==vt&&(i=!1),[3,9];case 7:return[4,f.json()];case 8:return[2,{value:{remoteConfig:u.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(h=u.sent())instanceof Error&&"AbortError"===h.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),h),[3,12];case 11:return clearTimeout(s),[7];case 12:return i?r<e-1?[4,new Promise(function(e){return setTimeout(e,c.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:u.sent(),u.label=14;case 14:return[2]}var g,m})},o=this,a=0,l.label=1;case 1:return a<e?[5,i(a)]:[3,4];case 2:if("object"==typeof(s=l.sent()))return[2,s.value];if("break"===s)return[3,4];l.label=3;case 3:return a++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.CONFIG_GROUP="browser",e}(),ht=B(),gt=null==ht?void 0:ht.console,mt={},yt={},bt=!1;var wt,Et={addListener:function(e,t){var n,r=(n=e,!!gt&&"function"==typeof gt[n]&&(yt[n]||(yt[n]=gt[n],gt[n]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];try{if(mt[n]&&!bt){bt=!0;var r=mt[n];r&&r.forEach(function(t){try{t(n,e)}catch(e){}})}}catch(e){}return bt=!1,yt[n].apply(gt,e)}),!0));if(!r)return new Error("Console override failed");mt[e]?mt[e].push(t):mt[e]=[t]},removeListener:function(e){var t,n;try{for(var r=c(Object.values(mt)),i=r.next();!i.done;i=r.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},_restoreConsole:function(){var e,t;try{for(var n=c(Object.entries(yt)),r=n.next();!r.done;r=n.next()){var i=l(r.value,2),o=i[0],a=i[1];a&&(gt[o]=a)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}yt={},mt={}}};!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(wt||(wt={}));var St=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],kt="data-amp-track-",Tt=["div","span","h1","h2","h3","h4","h5","h6"],xt=d(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],l(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),Pt=xt,_t=xt,At=["*"];function It(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e||null==e}function Ot(e,t,n){e&&Ct({json:e,allowlist:t.map(Rt),excludelist:n.map(Rt),ancestors:[]})}function Ct(e){var t,n,r=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,u=e.parentObject,f=e.targetKey;i||(i=r);var v=Object.keys(i);try{for(var p=c(v),h=p.next();!h.done;h=p.next()){var g=h.value,m=d(d([],l(s),!1),[g],!1);It(i[g])?Lt(m,o)&&!Lt(m,a)||delete i[g]:Ct({json:r,targetObject:i[g],allowlist:o,excludelist:a,ancestors:m,parentObject:i,targetKey:g})}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=p.return)&&n.call(p)}finally{if(t)throw t.error}}0===Object.keys(i).length&&u&&f&&delete u[f]}function Rt(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Dt(e,t,n,r){if(void 0===n&&(n=0),void 0===r&&(r=0),r===t.length)return n===e.length;if(n===e.length){for(;r<t.length&&"**"===t[r];)r++;return r===t.length}var i=t[r];if("**"===i){if(r+1===t.length)return!0;for(var o=n;o<=e.length;o++)if(Dt(e,t,o,r+1))return!0;return!1}return("*"===i||i===e[n])&&Dt(e,t,n+1,r+1)}function Lt(e,t){return t.some(function(t){return Dt(e,t)})}var Nt=function(){function e(e){this.request=e}return e.prototype.headers=function(e){var t,n;void 0===e&&(e=[]);var r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=l(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=c(Object.entries(r)),a=o.next();!a.done;a=o.next()){var s=l(a.value,2),u=s[0],d=s[1];i[u]=d}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return zt(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=B();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=jt(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Bt(this.body,e,t)]})})},e}(),Mt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),zt(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return jt(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){return 0===e.length?[2,null]:[2,Bt(this.body,e,t)]})})},e}();function jt(e,t){var n,r,i,o=B(),a=null==o?void 0:o.TextEncoder;if(a&&null!=e){var s;if("string"==typeof e)s=e,i=(new a).encode(s).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(s=e).size;else if("undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams)s=e,i=(new a).encode(s.toString()).length;else if(ArrayBuffer.isView(e))i=(s=e).byteLength;else if(e instanceof ArrayBuffer)i=(s=e).byteLength;else if("undefined"!=typeof FormData&&e instanceof FormData){var u=e,d=0,f=0;try{for(var v=c(u.entries()),p=v.next();!p.done;p=v.next()){var h=l(p.value,2),g=h[0],m=h[1];if(d+=g.length,"string"==typeof m)d+=(new a).encode(m).length;else{if(!("undefined"!=typeof Blob&&m instanceof Blob))return;d+=m.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}i=d}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream)return void(s=e);return i}}var Ut,Ft=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),zt(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),n.label=1;case 1:return n.trys.push([1,3,,4]),e=this.clonedResponse.text(),t=new Promise(function(e){return setTimeout(function(){return e(null)},500)}),[4,Promise.race([e,t])];case 2:return[2,n.sent()];case 3:return n.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return 0===e.length?[2,null]:[4,this.text()];case 1:return[2,Bt(n.sent(),e,t)]}})})},e}(),qt=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){var t,n;if(void 0===e&&(e=[]),!this.headersString)return{};var r={},i=this.headersString.split("\r\n");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split(": "),2),u=s[0],d=s[1];u&&d&&(r[u]=d)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return zt(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),s(this,void 0,void 0,function(){var n;return u(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(Ot(n,e,t),[2,n]):[2,null]})})},e}();function Bt(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return Ot(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(Ut||(Ut={}));var Ht="[REDACTED]",zt=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,a=t.strategy,s=void 0===a?Ut.REMOVE:a,u=d([],l(D),!1),f={},v=function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?s===Ut.REDACT&&(f[t]=Ht):o.find(function(e){return e.toLowerCase()===n})?f[t]=e[t]:s===Ut.REDACT&&(f[t]=Ht)};try{for(var p=c(Object.keys(e)),h=p.next();!h.done;h=p.next()){v(h.value)}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}return f},Vt=function(){function e(e,t,n,r,i,o,a,s,u,c,l){void 0===a&&(a=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=a,this.duration=s,this.responseWrapper=u,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers(d([],l(R),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers(d([],l(R),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter(function(e){var t=l(e,2);return t[0],void 0!==t[1]}))},e}();var Wt=function(e,t){void 0===t&&(t=z()),this.callback=e,this.id=t};function Gt(e){try{e()}catch(e){}}var $t=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=B();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=B();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,a,s,u,c,l,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,v=null===(s=null===(a=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===a?void 0:a.prototype)||void 0===s?void 0:s.send,p=null===(l=null===(c=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===c?void 0:c.prototype)||void 0===l?void 0:l.setRequestHeader;f&&v&&p&&this.observeXhr(f,v,p);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(e){Gt(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,a){var s;if(void 0!==o&&void 0!==a){var u,c,l,d="GET";if(!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?u=null===(s=null==t?void 0:t.toString)||void 0===s?void 0:s.call(t):(u=t.url,d=t.method),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var v=Math.floor(performance.now()-a),p=Math.floor(o+v),h=new Vt(e,d,o,o,u,n,c,v,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,function(){var t,i,o,a,s=this;return u(this,function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){Gt(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return a=u.sent(),o=a,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new Nt(r):void 0,i?new Ft(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){Gt(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){return n instanceof Error&&"InvalidStateError"===n.name&&Gt(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,a=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=l(n,2),s=i[0],u=i[1];try{this.$$AmplitudeAnalyticsEvent=o({method:s,url:null===(e=null==u?void 0:u.toString)||void 0===e?void 0:e.call(u),headers:{}},a.getTimestamps())}catch(e){Gt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,o=e.createXhrJsonParser(this,a),s=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new qt(i.status,e,t?parseInt(t,10):void 0,o),r=i.$$AmplitudeAnalyticsEvent.headers,c=new Mt(s,r);u.status=i.status,a.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},c,n,void 0,u.startTime,u.durationStart)}catch(e){Gt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){Gt(function(){var t;return null===(t=a.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}(),Kt=new $t,Jt=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,function(){return u(this,function(e){return[2,o(o(o(o({},C),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=Me();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=Me();return(e={})[w]=t[w],e[E]=t[E],e[S]=t[S],e[k]=t[k],e[T]=t[T],e[x]=t[x],e[P]=t[P],e[_]=t[_],e[A]=t[A],e[I]=t[I],e[O]=t[O],e},e}(),Yt="data-amp-mask",Xt="*****",Qt=/\b(?:\d[ -]*?){13,16}\b/,Zt=/(\d{3}-?\d{2}-?\d{4})/g,en=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,tn=function(e,t){var n,r;if(void 0===t&&(t=[]),"string"!=typeof e)return"";var i=e;i=(i=(i=i.replace(Qt,Xt)).replace(Zt,Xt)).replace(en,Xt);try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,Xt)}catch(e){}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},nn=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(Yt)?Xt:e?e(document.title):document.title},rn={};Object.defineProperty(rn,"__esModule",{value:!0}),rn.Observable=void 0;const on=e=>Boolean(Symbol[e]),an=e=>on(e)?Symbol[e]:"@@"+e,sn=an("iterator"),un=an("observable"),cn=an("species");function ln(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw new TypeError(n+" is not a function");return n}}function dn(e){let t=e.constructor;return void 0!==t&&(t=t[cn],null===t&&(t=void 0)),void 0!==t?t:bn}function fn(e){fn.log?fn.log(e):setTimeout(()=>{throw e})}function vn(e){Promise.resolve().then(()=>{try{e()}catch(e){fn(e)}})}function pn(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=ln(t,"unsubscribe");e&&e.call(t)}}catch(e){fn(e)}}function hn(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function gn(e,t,n){e._state="running";let r=e._observer;try{let i=ln(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(hn(e),!i)throw n;i.call(r,n);break;case"complete":hn(e),i&&i.call(r)}}catch(e){fn(e)}"closed"===e._state?pn(e):"running"===e._state&&(e._state="ready")}function mn(e,t,n){if("closed"!==e._state){if("buffering"!==e._state)return"ready"!==e._state?(e._state="buffering",e._queue=[{type:t,value:n}],void vn(()=>function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(gn(e,t[n].type,t[n].value),"closed"!==e._state);++n);}}(e))):void gn(e,t,n);e._queue.push({type:t,value:n})}}class yn{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){mn(n,"next",e)},error(e){mn(n,"error",e)},complete(){mn(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(hn(this),pn(this))}}class bn{constructor(e){if(!(this instanceof bn))throw new TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw new TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return"object"==typeof e&&null!==e||(e={next:e,error:arguments[1],complete:arguments[2]}),new yn(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(new TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(dn(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");return new(dn(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=dn(this),n=arguments.length>1,r=!1,i=arguments[1];return new t(t=>this.subscribe({next(o){let a=!r;if(r=!0,!a||n)try{i=e(i,o)}catch(e){return t.error(e)}else i=o},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(new TypeError("Cannot reduce an empty sequence"));t.next(i),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=dn(this);return new t(n=>{let r,i=0;return function o(a){r=a.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw new TypeError(e+" is not a function");let t=dn(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let a=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(a);e>=0&&r.splice(e,1),o()}});r.push(a)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[un](){return this}static from(e){let t="function"==typeof this?this:bn;if(null==e)throw new TypeError(e+" is not an object");let n=ln(e,un);if(n){let r=n.call(e);if(Object(r)!==r)throw new TypeError(r+" is not an object");return function(e){return e instanceof bn}(r)&&r.constructor===t?r:new t(e=>r.subscribe(e))}if(on("iterator")&&(n=ln(e,sn),n))return new t(t=>{vn(()=>{if(!t.closed){for(let r of n.call(e))if(t.next(r),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{vn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw new TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:bn)(t=>{vn(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[cn](){return this}}rn.Observable=bn,Object.defineProperty(bn,Symbol("extensions"),{value:{symbol:un,hostReportError:fn},configurable:!0});var wn=rn.Observable;function En(e,t){return new wn(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function Sn(e,t){return new wn(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=c(i),o=n.next();!o.done;o=n.next()){var a=o.value;try{a.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},a=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return a(e),a(t),o})}function kn(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new wn(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){var n,r,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.next)||void 0===i||i.call(s,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){var n,i,o;try{for(var a=c(t),s=a.next();!s.done;s=a.next()){var u=s.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}r()},complete:function(){var e,n,i;try{for(var o=c(t),a=o.next();!a.done;a=o.next()){var s=a.value;null===(i=s.complete)||void 0===i||i.call(s)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var Tn,xn="https://app.amplitude.com",Pn={US:xn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};var _n="__AMPLITUDE_MESSENGER_INSTANCE__",An="__AMPLITUDE_MESSENGER__",In=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?xn:t;this[Tn]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,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,a){r.requestCallbacks[i]={resolve:t,reject:a},r.notify(o),n.timeout>0&&setTimeout(function(){a(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.registerActionHandler=function(e,t){var n,r,i,o;this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var a=this.pendingMessages.get(e);if(a){this.pendingMessages.delete(e);try{for(var s=c(a),u=s.next();!u.done;u=s.next()){t(u.value)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return s(this,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=function(e){return document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})}(e).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,a=i.endpoint;o&&(this.logger=o),a&&this.endpoint===xn&&(this.endpoint=a),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){var t,n,i,o,a;if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var s=e.data,u=null==s?void 0:s.action;if(u)if("id"in s&&s.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(s);else{if("ping"===u)return void r.notify({action:"pong"});var c=r.actionHandlers.get(u);if(c)c(s.data);else{var l=null!==(a=r.pendingMessages.get(u))&&void 0!==a?a:[];l.push(s.data),r.pendingMessages.set(u,l)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=B();(null==e?void 0:e[An])===this&&delete e[An]},e}();function On(e){var t,n=B(),r=null==n?void 0:n[An];if("object"==typeof(t=r)&&null!==t&&_n in t&&!0===t[_n])return r;var i=new In(e);return n&&(n[An]=i),i}Tn=_n;var Cn="__AMPLITUDE_BACKGROUND_CAPTURE__";var Rn={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function Dn(e,t){var n=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var r=e/t*100;n=Math.min(100,Math.max(0,r))}return n}function Ln(e,t){var n=e.currentTime,r=e.duration;return o({duration:r,start_time:n,last_position:n,percent_completed:Dn(n,r)},void 0!==t?{stop_reason:t}:{})}function Nn(e){return{mux_playback_id:e.getAttribute("playback-id"),mux_video_id:e.getAttribute("metadata-video-id"),mux_video_title:e.getAttribute("metadata-video-title")}}function Mn(e,t,n,r){return s(this,void 0,void 0,function(){var i,a,s,c,d;return u(this,function(u){switch(u.label){case 0:return[4,Promise.all([new Promise(function(t){return e.getDuration(t)}),new Promise(function(t){return e.getCurrentTime(t)})])];case 1:if(i=l.apply(void 0,[u.sent(),2]),a=i[0],s=i[1],c={},"mux"===n){d=void 0;try{d=new URL(t.getAttribute("src")),c.mux_video_title=d.searchParams.get("metadata-video-title"),c.mux_video_id=d.searchParams.get("metadata-video-id"),c.mux_playback_id=d.pathname.split("/").pop()}catch(e){}}return[2,o(o({duration:a,start_time:s,last_position:s,percent_completed:Dn(s,a)},void 0!==r?{stop_reason:r}:{}),c)]}})})}function jn(e,t,n){void 0===n&&(n=null);var r=[],i=function(){var i=e.elem,o=!1,a=function(){Mn(e,i,n).then(function(e){t.onPlay(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'play' handler: ".concat(e))})};e.on("play",a),r.push(function(){return e.off("play",a)});var c=function(){Mn(e,i,n,"paused").then(function(e){t.onPause(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(e))})};e.on("pause",c),r.push(function(){return e.off("pause",c)});var l=function(){Mn(e,i,n,"ended").then(function(e){t.onEnded(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(e))})};e.on("ended",l),r.push(function(){return e.off("ended",l)});var d=function(){o=!0,Mn(e,i,n,"seeking").then(function(e){t.onSeeking(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(e))})};e.on("seeking",d),r.push(function(){return e.off("seeking",d)});var f=function(){o=!1,Mn(e,i,n).then(function(e){t.onSeeked(e)}).catch(function(e){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(e))})};e.on("seeked",f),r.push(function(){return e.off("seeked",f)});var v=function(){(function(e){return s(this,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return e.getCurrentTime(t)})];case 1:return[2,{currentTime:t.sent()}]}})})})(e).then(function(e){var n={position:e.currentTime,isSeeking:o};t.onTimeUpdate(n)}).catch(function(e){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(e))})};e.on("timeupdate",v),r.push(function(){return e.off("timeupdate",v)})};return e.on("ready",i),function(){e.off("ready",i),r.forEach(function(e){return e()})}}var Un=function(){function e(e){var t=e.videoEl,n=e.onStateChange,r=e.vendor,i=e.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(e){a.updatePlaybackState("playing",e)},onPause:function(e){a.updatePlaybackState("paused",e)},onEnded:function(e){a.updatePlaybackState("ended",e)},onSeeking:function(){var e=o(o({},a.state),{isSeeking:!0});a.updateState(e)},onSeeked:function(e){var t=o(o({},a.state),{isSeeking:!1,position:e.last_position});a.updateState(t)},onError:function(e){a.updateStateWithError(e)},onTimeUpdate:function(e){a.updateTime(e)}},this.onStateChange=n,this.untrack=i?jn(t,this.handler,r):function(e,t,n){var r=function(){var r=o(o({},Ln(e)),"mux"===n?Nn(e):{});t.onPlay(r)};e.addEventListener("play",r);var i=function(){var r=o(o({},Ln(e,"paused")),"mux"===n?Nn(e):{});t.onPause(r)};e.addEventListener("pause",i);var a=function(){var r=o(o({},Ln(e,"ended")),"mux"===n?Nn(e):{});t.onEnded(r)};e.addEventListener("ended",a);var s=function(){var r=o(o({},Ln(e,"seeking")),"mux"===n?Nn(e):{});t.onSeeking(r)};e.addEventListener("seeking",s);var u=function(){var r=o(o({},Ln(e)),"mux"===n?Nn(e):{});t.onSeeked(r)};e.addEventListener("seeked",u);var c=function(){var n=e,r={position:e.currentTime,isSeeking:!!n.seeking};t.onTimeUpdate(r)};return e.addEventListener("timeupdate",c),function(){e.removeEventListener("play",r),e.removeEventListener("pause",i),e.removeEventListener("ended",a),e.removeEventListener("seeking",s),e.removeEventListener("seeked",u),e.removeEventListener("timeupdate",c)}}(t,this.handler,r)}return e.prototype.stateChangeHandler=function(e,t){try{this.onStateChange(e,t)}catch(e){}},e.prototype.updateStateWithError=function(e){var t=this.state,n=o(o({},t),{playbackState:"error",errorMessage:e});this.updateState(n)},e.prototype.updatePlaybackState=function(e,t){var n=o(o({},this.state),{playbackState:e,lastEvent:t,position:t.last_position});this.updateState(n)},e.prototype.updateTime=function(e){var t,n;if(this.state.lastEvent&&"playing"===this.state.playbackState){var r=e.isSeeking||this.state.isSeeking,i=null!==(t=this.state.position)&&void 0!==t?t:0,a=e.position;if(r)this.state=o(o({},this.state),{position:a});else{var s=a-i,u=o(o({},this.state),{position:a,watchTime:(null!==(n=this.state.watchTime)&&void 0!==n?n:0)+s});this.updateState(u)}}},e.prototype.updateState=function(e){var t=this.state;this.state=e,this.stateChangeHandler(t,e)},e.prototype.destroy=function(){this.untrack()},e}();function Fn(e,t,n){var r,i,o=[];try{for(var a=c(null!=t?t:[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(e){n.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return e.concat(o)}function qn(e){var t,n,r,i,o,a,s,u,f,v,p,h;if("object"==typeof e&&null!==e&&!Array.isArray(e)){var g=Object.keys(e);try{for(var m=c(g),y=m.next();!y.done;y=m.next()){var b=y.value;try{var w=e[b];"boolean"==typeof(null==w?void 0:w.enabled)&&(w.enabled?(delete w.enabled,0===Object.keys(w).length&&(e[b]=!0)):e[b]=!1),qn(w)}catch(e){}}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}try{if(null===(f=null===(u=null===(s=e.autocapture)||void 0===s?void 0:s.networkTracking)||void 0===u?void 0:u.captureRules)||void 0===f?void 0:f.length)try{for(var E=c(e.autocapture.networkTracking.captureRules),S=E.next();!S.done;S=E.next()){var k=S.value;try{for(var T=(o=void 0,c(["responseHeaders","requestHeaders"])),x=T.next();!x.done;x=T.next()){var P=x.value,_=null!==(v=k[P])&&void 0!==v?v:{},A=_.captureSafeHeaders,I=_.allowlist;(A||I)&&(void 0===I||Array.isArray(I)?k[P]=d(d([],l(A?R:[]),!1),l(null!=I?I:[]),!1):delete k[P])}}catch(e){o={error:e}}finally{try{x&&!x.done&&(a=T.return)&&a.call(T)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{S&&!S.done&&(i=E.return)&&i.call(E)}finally{if(r)throw r.error}}}catch(e){}var O=null===(p=e.autocapture)||void 0===p?void 0:p.frustrationInteractions;O&&(O.rageClick&&(O.rageClicks=O.rageClick,delete O.rageClick),O.deadClick&&(O.deadClicks=O.deadClick,delete O.deadClick));try{var C=null===(h=e.autocapture)||void 0===h?void 0:h.elementInteractions;if(C&&"object"==typeof C&&(!0===C.viewportContentUpdated&&(C.viewportContentUpdated={}),!1===C.viewportContentUpdated&&(C.viewportContentUpdated={enabled:!1}),void 0!==C.exposureDuration)){var D=C.viewportContentUpdated;void 0===D?C.viewportContentUpdated={exposureDuration:C.exposureDuration}:"object"==typeof D&&void 0===D.exposureDuration&&!1!==D.enabled&&(D.exposureDuration=C.exposureDuration),delete C.exposureDuration}}catch(e){}}}var Bn=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])&&(!function(){var e,t,n=B();return"string"==typeof(null===(t=null===(e=null==n?void 0:n.chrome)||void 0===e?void 0:e.runtime)||void 0===t?void 0:t.id)}()||!!(null==e?void 0:e[t]))},Hn=function(e){return Bn(e,"attribution")},zn=function(e){return Bn(e,"formInteractions")},Vn=function(e){return Bn(e,"pageViews")},Wn=function(e){return Bn(e,"sessions")},Gn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},$n=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},Kn=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},Jn=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;return!0===t?{mainThreadBlock:!0}:"object"==typeof t&&null!==t?t:void 0}},Yn=function(e){if($n(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},Xn=function(e){if(Kn(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},Qn=function(e){if(Gn(e.autocapture)){var t=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),o(o({},t),{captureRules:(n=null==t?void 0:t.captureRules,r=e.loggerProvider,null==n?void 0:n.map(function(e){var t,n;if((null===(t=e.urls)||void 0===t?void 0:t.length)&&(null===(n=e.hosts)||void 0===n?void 0:n.length)){var i=JSON.stringify(e.hosts),a=JSON.stringify(e.urls);return null==r||r.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),o(o({},e),{hosts:void 0})}return e}))})}var n,r},Zn=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return Vn(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}},er=function(e,t){tr(e,t)},tr=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,a=r.resolve,s=e&&e[i];if("function"==typeof s){var u=s.apply(e,o);"function"==typeof a&&a(null==u?void 0:u.promise)}}return e},nr=function(e){return e&&void 0!==e._q};var rr="2.45.10",ir="amplitude-ts",or=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(ir,"/").concat(rr),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return s(this,void 0,void 0,function(){var r,i,a;return u(this,function(s){return r=(new Date).getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,a=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=r),[2,o(o(o(o(o(o(o(o({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Ne()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:z(),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:a,library:this.library,user_agent:this.userAgent})]})})},e}(),ar=1e3,sr=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=B())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return n(t,e),t.prototype.set=function(t,n){var r;return s(this,void 0,void 0,function(){var i;return u(this,function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>ar?(i=n.length-ar,[4,e.prototype.set.call(this,t,n.slice(0,ar))]):[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(ar,".")),[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}($e),ur=function(e){function t(){var t;return e.call(this,null===(t=B())||void 0===t?void 0:t.sessionStorage)||this}return n(t,e),t}($e),cr=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r=this;return u(this,function(i){return[2,new Promise(function(i,a){"undefined"==typeof XMLHttpRequest&&a(new Error("XHRTransport is not supported."));var d=new XMLHttpRequest;d.open("POST",e,!0),d.onreadystatechange=function(){if(d.readyState===r.state.done){var e=d.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:d.status}))}}};var f={"Content-Type":"application/json",Accept:"*/*"},v=JSON.stringify(t),p=n&&v.length>=2048&&ut(),h=function(e){var t,n;f=o(o({},r.customHeaders),f);try{for(var i=c(Object.entries(f)),a=i.next();!a.done;a=i.next()){var s=l(a.value,2),u=s[0],v=s[1];d.setRequestHeader(u,v)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}d.send(e)};s(r,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return p?[4,ct(v)]:[3,2];case 1:return(e=t.sent())?(f["Content-Encoding"]="gzip",h(e)):h(v),[3,3];case 2:h(v),t.label=3;case 3:return[2]}})}).catch(a)})]})})},t}(st),lr=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return n(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),s(this,void 0,void 0,function(){var r,i,a,s,c,l,d,f,v;return u(this,function(u){switch(u.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return r=JSON.stringify(t),i=n&&r.length>=2048&&ut(),a=r,s={"Content-Type":"application/json",Accept:"*/*"},i?[4,ct(r)]:[3,2];case 1:(c=u.sent())&&(s["Content-Encoding"]="gzip",a=c),u.label=2;case 2:return s=o(o({},this.customHeaders),s),l="string"==typeof a?a.length:a.byteLength,d={headers:s,body:a,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(e,d)];case 3:return[4,(f=u.sent()).text()];case 4:v=u.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch(e){return[2,this.buildResponse({code:f.status})]}return[2]}})})},t}(st),dr=function(e){function t(){return e.call(this)||this}return n(t,e),t.prototype.send=function(e,t,n){return s(this,void 0,void 0,function(){var n=this;return u(this,function(r){return[2,new Promise(function(r,i){var o=B();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(t);return r(o.navigator.sendBeacon(e,a)?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(st),fr=function(e,t,n){return void 0===n&&(n=!0),s(void 0,void 0,void 0,function(){var r,i,o,a,s,c,d,f,p;return u(this,function(u){switch(u.label){case 0:return r=function(e){return"".concat(v.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(r)];case 1:return(i=u.sent())?n?[4,t.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:u.sent(),u.label=3;case 3:return o=l(i.split("."),6),a=o[0],s=o[1],c=o[2],d=o[3],f=o[4],p=o[5],[2,{deviceId:a,userId:pr(s),sessionId:vr(d),lastEventId:vr(p),lastEventTime:vr(f),optOut:Boolean(c)}]}})})},vr=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},pr=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},hr="[Amplitude]",gr="".concat(hr," Form Started"),mr="".concat(hr," Form Submitted"),yr="".concat(hr," File Downloaded"),br="session_start",wr="session_end",Er="".concat(hr," File Extension"),Sr="".concat(hr," File Name"),kr="".concat(hr," Link ID"),Tr="".concat(hr," Link Text"),xr="".concat(hr," Link URL"),Pr="".concat(hr," Form ID"),_r="".concat(hr," Form Name"),Ar="".concat(hr," Form Destination"),Ir="cookie",Or=Object.freeze({__proto__:null,get IdentifyOperation(){return r},get SpecialEventType(){return i},get RevenueProperty(){return J},get LogLevel(){return re},get ServerZone(){return wt},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:St,DEFAULT_DATA_ATTRIBUTE_PREFIX:kt,DEFAULT_ACTION_CLICK_ALLOWLIST:Tt,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:Rn}),Cr=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Rr=function(e,t,n,r,i,s){void 0===i&&(i=!0),e.referrer;var u=e.referring_domain,c=a(e,["referrer","referring_domain"]),l=t||{};l.referrer;var d,f=l.referring_domain,v=a(l,["referrer","referring_domain"]),p=n.excludeInternalReferrers;if(p){var h=Lr(p,r);if(!(h instanceof TypeError)&&e.referring_domain&&Ur(e.referring_domain,s)){if("always"===h)return Nr(h,e.referring_domain,r),!1;if("ifEmptyCampaign"===h&&(d=o(o({},e),{referring_domain:void 0,referrer:void 0}),Object.values(d).every(function(e){return!e})))return Nr(h,e.referring_domain,r),!1}}if(Dr(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every(function(e){return!e})}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(c)!==JSON.stringify(v),m=Cr(u||"")!==Cr(f||""),y=!t||g||m;return y?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."),y},Dr=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})},Lr=function(e,t){if(!0===e)return Rn.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(Rn).includes(n))return n;if(void 0===n)return Rn.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),new TypeError(r)};function Nr(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var Mr=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],jr=function(e){var t,n,r=e||(null===(n=null===(t=B())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],a=i[i.length-2];return Mr.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},Ur=function(e,t){var n=B();if(!n)return!1;var r,i,o,a=(t||"").trim()||jr(n.location.hostname);return r=e,o=(i=a).startsWith(".")?i:".".concat(i),!!(r.startsWith(".")?r:".".concat(r)).endsWith(o)},Fr=function(e){function t(t,n,r,i,o,a,s,u,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,_,A,I,O,C,R,D,L,N,M,j,U,F,q,B,H,z,V){void 0===r&&(r=new He),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=Ir),void 0===g&&(g=new oe),void 0===m&&(m=re.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===T&&(T="US"),void 0===_&&(_=18e5),void 0===A&&(A=new sr({loggerProvider:g})),void 0===I&&(I={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===C&&(C=!1),void 0===R&&(R=!0),void 0===U&&(U=!0),void 0===F&&(F=0),void 0===z&&(z=!1);var W,G=this;(G=e.call(this,{apiKey:t,instanceName:v,storageProvider:A,transportProvider:Hr(O)})||this).apiKey=t,G.appVersion=n,G.cookieOptions=i,G.defaultTracking=o,G.autocapture=a,G.flushIntervalMillis=u,G.flushMaxRetries=c,G.flushQueueSize=l,G.identityStorage=d,G.ingestionMetadata=f,G.loggerProvider=g,G.logLevel=m,G.minIdLength=y,G.offline=b,G.partnerId=E,G.plan=S,G.serverUrl=k,G.serverZone=T,G.sessionTimeout=_,G.storageProvider=A,G.trackingOptions=I,G.transport=O,G.useBatch=C,G.fetchRemoteConfig=R,G.networkTrackingOptions=M,G.identify=j,G.enableDiagnostics=U,G.diagnosticsSampleRate=F,G.diagnosticsClient=q,G.remoteConfig=B,G.topLevelDomain=H,G.enableRequestBodyCompression=z,G.customEnrichment=V,G.version=rr,G._optOut=!1,G._cookieStorage=r,G.deviceId=s,G.lastEventId=p,G.lastEventTime=h,G.optOut=w,G.deferredSessionId=P,G.sessionId=x,G.pageCounter=L,G.userId=D,G.debugLogsEnabled=N,G.loggerProvider.enable(N?re.Debug:G.logLevel),G.networkTrackingOptions=M,G.identify=j,G.enableDiagnostics=U,G.diagnosticsSampleRate=F,G.diagnosticsClient=q;var $=null!==(W=null==B?void 0:B.fetchRemoteConfig)&&void 0!==W?W:R;return G.remoteConfig=G.remoteConfig||{},G.remoteConfig.fetchRemoteConfig=$,G.fetchRemoteConfig=$,G.topLevelDomain=H||jr(),G}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,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=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,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof ze&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Le(this.apiKey),e)},t}(ue),qr=function(e,t,n,r,i){return void 0===t&&(t={}),s(void 0,void 0,void 0,function(){var a,s,c,l,d,f,v,p,h,g,m,y,b,w,E,S,k,T,x,P,_,A,I,O,C,R,D,L,N,M,j,U,F,q,B,H,V,W,G,$,K,J,Y,X,Q,Z,ee,te,ne,re,ie;return u(this,function(u){switch(u.label){case 0:return a=t.identityStorage||Ir,s="",a!==Ir||(null===(A=t.cookieOptions)||void 0===A?void 0:A.domain)||""===(null===(I=t.cookieOptions)||void 0===I?void 0:I.domain)?[3,2]:[4,zr(void 0,r)];case 1:s=u.sent(),u.label=2;case 2:return c=o({domain:null!==(C=null===(O=t.cookieOptions)||void 0===O?void 0:O.domain)&&void 0!==C?C:s,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(e){var t=Ve(e);if(!t)return!1;var n=JSON.parse(t);return We(n.cookieDomain,c.domain)},diagnosticsClient:r},d=Br(t.identityStorage,c,l),[4,fr(e,d,null===(D=null===(R=t.cookieOptions)||void 0===R?void 0:R.upgrade)||void 0===D||D)];case 3:return f=u.sent(),[4,d.get(Le(e))];case 4:return v=u.sent(),p=Me(),h=p.ampTimestamp?Number(p.ampTimestamp):void 0,g=!h||Date.now()<h,m=null!==(U=null!==(j=null!==(M=null!==(L=t.deviceId)&&void 0!==L?L:g?null!==(N=p.ampDeviceId)&&void 0!==N?N:p.deviceId:void 0)&&void 0!==M?M:null==v?void 0:v.deviceId)&&void 0!==j?j:f.deviceId)&&void 0!==U?U:z(),y=null!==(F=null==v?void 0:v.lastEventId)&&void 0!==F?F:f.lastEventId,b=null!==(q=null==v?void 0:v.lastEventTime)&&void 0!==q?q:f.lastEventTime,w=null!==(H=null!==(B=t.optOut)&&void 0!==B?B:null==v?void 0:v.optOut)&&void 0!==H?H:f.optOut,E=null!==(V=null==v?void 0:v.sessionId)&&void 0!==V?V:f.sessionId,S=null==v?void 0:v.deferredSessionId,k=null!==(G=null!==(W=t.userId)&&void 0!==W?W:null==v?void 0:v.userId)&&void 0!==G?G:f.userId,n.previousSessionDeviceId=null!==($=null==v?void 0:v.deviceId)&&void 0!==$?$:f.deviceId,n.previousSessionUserId=null!==(K=null==v?void 0:v.userId)&&void 0!==K?K:f.userId,T={ipAddress:null===(Y=null===(J=t.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===Y||Y,language:null===(Q=null===(X=t.trackingOptions)||void 0===X?void 0:X.language)||void 0===Q||Q,platform:null===(ee=null===(Z=t.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===ee||ee},x=null==v?void 0:v.pageCounter,P=null==v?void 0:v.debugLogsEnabled,void 0!==t.autocapture&&(t.defaultTracking=t.autocapture),[4,(_=new Fr(e,t.appVersion,d,c,t.defaultTracking,t.autocapture,m,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,a,t.ingestionMetadata,t.instanceName,y,b,null!==(te=null==i?void 0:i.loggerProvider)&&void 0!==te?te:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,w,t.partnerId,t.plan,t.serverUrl,null!==(ne=null==i?void 0:i.serverZone)&&void 0!==ne?ne:t.serverZone,E,S,t.sessionTimeout,t.storageProvider,T,t.transport,t.useBatch,t.fetchRemoteConfig,k,x,P,t.networkTrackingOptions,t.identify,null!==(re=null==i?void 0:i.enableDiagnostics)&&void 0!==re?re:t.enableDiagnostics,null!==(ie=null==i?void 0:i.diagnosticsSampleRate)&&void 0!==ie?ie:n._diagnosticsSampleRate,r,t.remoteConfig,s,t.enableRequestBodyCompression,t.customEnrichment)).storageProvider.isEnabled()];case 5:return u.sent()||(_.loggerProvider.warn("Storage provider ".concat(_.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),_.storageProvider=new He),[2,_]}})})},Br=function(e,t,n){switch(void 0===e&&(e=Ir),void 0===t&&(t={}),e){case"localStorage":return new sr;case"sessionStorage":return new ur;case"none":return new He;default:return new ze(o(o({},t),{expirationDays:t.expiration}),n)}},Hr=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new cr(n):"beacon"===t?new dr:new lr(n,r,i)},zr=function(e,t){return s(void 0,void 0,void 0,function(){var n,r,i,o,a,s,c;return u(this,function(u){switch(u.label){case 0:return[4,new ze(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!u.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];if(n=null!=e?e:location.hostname,1===(r=n.split(".")).length)return[2,""];for(i=[],o=1,Mr.find(function(e){return n.endsWith(".".concat(e))})&&(o=2),a=r.length-o-1;a>=0;--a)i.push(r.slice(a).join("."));a=0,u.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],u.label=3;case 3:return u.trys.push([3,5,,6]),[4,ze.isDomainWritable(s)];case 4:return u.sent()?[2,"."+s]:[3,6];case 5:return c=u.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:c instanceof Error?c.message:String(c)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(n)}),[2,""]}})})},Vr="AMP_PAGE_VIEW",Wr=function(e){var t;void 0===e&&(e={});var n,r,i=B(),a=void 0,c=!1,d=e.trackOn,f=e.trackHistoryChanges,v=e.eventType,p=void 0===v?"[Amplitude] Page Viewed":v,h=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==a||a.error("Malformed URI sequence: ",e)}return t},g=function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(i){switch(i.label){case 0:return t=h("undefined"!=typeof location&&location.href||""),r={event_type:p},n=[{}],[4,Gr()];case 1:return[2,(r.event_properties=o.apply(void 0,[o.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"undefined"!=typeof location&&h(location.pathname)||"","[Amplitude] Page Title":nn(tn),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),r)]}})})},m=function(){return void 0===d||"function"==typeof d&&d()},y="undefined"!=typeof location?location.href:null,b=function(){s(void 0,void 0,void 0,function(){var e,n,i,o,s;return u(this,function(u){switch(u.label){case 0:return e=location.href,n=Kr(f,e,y||"")&&m(),y=e,n?(i=void 0,r&&(i=z(),r.set(Vr,{pageViewId:i})),null==a||a.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return s=(o=t).track,[4,g(i)];case 2:s.apply(o,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})},w={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,o){return s(void 0,void 0,void 0,function(){var s,d,f;return u(this,function(u){switch(u.label){case 0:if(t=o,n=e,(a=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),c=!0,i){try{r=new $e(i.sessionStorage)}catch(e){null==a||a.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",b),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),c&&b()}})}return m()?(a.log("Tracking page view event"),s=void 0,r&&(s=z(),r.set(Vr,{pageViewId:s})),f=(d=t).track,[4,g(s)]):[3,2];case 1:f.apply(d,[u.sent()]),u.label=2;case 2:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,i,s;return u(this,function(u){switch(u.label){case 0:return"attribution"===d&&$r(e)?(null==a||a.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,r?[4,r.get(Vr)]:[3,2]):[3,4];case 1:i=u.sent(),t=null==i?void 0:i.pageViewId,u.label=2;case 2:return[4,g(t)];case 3:s=u.sent(),e.event_type=s.event_type,e.event_properties=o(o({},e.event_properties),s.event_properties),u.label=4;case 4:return n&&e.event_type===p&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=o(o({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return i&&(i.removeEventListener("popstate",b),c=!1),[2]})})}};return w},Gr=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return e=Be,[4,(new Jt).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},$r=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[r.SET]||{},i=t[r.UNSET]||{},o=d(d([],l(Object.keys(n)),!1),l(Object.keys(i)),!1);return Object.keys(C).every(function(e){return o.includes(e)})}return!1},Kr=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},Jr=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return t=function(e){if(zn(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions}(n),o=function(){if(i){if("undefined"!=typeof document){var o=new WeakSet,a=function(e){if(!o.has(e)){o.add(e);var a=!1;r(e,"change",function(){var t,n=Xr(e);a||i.track(gr,((t={})[Pr]=Yr(e.id),t[_r]=Yr(e.name),t[Ar]=n,t)),a=!0}),r(e,"submit",function(r){var o,s,u=Xr(e);if(a||i.track(gr,((o={})[Pr]=Yr(e.id),o[_r]=Yr(e.name),o[Ar]=u,o)),a=!0,void 0!==(null==t?void 0:t.shouldTrackSubmit))if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");i.track(mr,((s={})[Pr]=Yr(e.id),s[_r]=Yr(e.name),s[Ar]=u,s)),a=!1})}};Array.from(document.getElementsByTagName("form")).forEach(a),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("FORM"===e.nodeName&&a(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(a)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")},"complete"===document.readyState?o():(a=B())?a.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return null==e||e.disconnect(),n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[],[2]})})}}},Yr=function(e){if("string"==typeof e)return e},Xr=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},Qr=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,r){return s(void 0,void 0,void 0,function(){var i,o;return u(this,function(a){return i=function(){if(r){if("undefined"!=typeof document){var i=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var i=o.exec(n.href),a=null==i?void 0:i[1];a&&function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})}(e,"click",function(){var t;a&&r.track(yr,((t={})[Er]=a,t[Sr]=n.pathname,t[kr]=e.id,t[Tr]=e.text,t[xr]=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){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("a");null==t||t.forEach(i)}}catch(e){n.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")},"complete"===document.readyState?i():(o=B())?o.addEventListener("load",i):n.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return null==e||e.disconnect(),t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[],[2]})})}}},Zr=!1,ei=function(){var e=B(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1,[2]):(e.offline=!navigator.onLine,n("online",function(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0}),[2])})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(n){return t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[],[2]})})}}};function ti(e,t){var n,r;if(e){qn(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",X(e));var i=e;if(i&&"autocapture"in i){if("boolean"==typeof i.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture&&null!==i.autocapture){var a=o({},i.autocapture);if(void 0===t.autocapture&&(t.autocapture=i.autocapture),"object"==typeof i.autocapture.elementInteractions&&null!==i.autocapture.elementInteractions&&(null===(n=i.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===n?void 0:n.length)){a.elementInteractions=o({},i.autocapture.elementInteractions);var s=a.elementInteractions,u=null!==(r=s.pageUrlAllowlist)&&void 0!==r?r:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;s.pageUrlAllowlist=Fn(u,l,t.loggerProvider),delete s.pageUrlAllowlistRegex}var d=function(e,t){var n,r,i,a,s;if("object"==typeof e&&null!==e&&(null===(i=e.captureRules)||void 0===i?void 0:i.length)){var u=o({},e),l=null!==(a=u.captureRules)&&void 0!==a?a:[];try{for(var d=c(l),f=d.next();!f.done;f=d.next()){var v=f.value;v.urls=Fn(null!==(s=v.urls)&&void 0!==s?s:[],v.urlsRegex,t),delete v.urlsRegex}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(n)throw n.error}}return u}}(i.autocapture.networkTracking,t.loggerProvider);d&&(a.networkTracking=d),"boolean"==typeof t.autocapture&&(t.autocapture=o({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},a)),"object"==typeof t.autocapture&&(t.autocapture=o(o({},t.autocapture),a))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&null!==i.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",X(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}var ni="1.29.1",ri="[Amplitude] Element Clicked",ii="[Amplitude] Element Tag",oi="[Amplitude] Element Text",ai="[Amplitude] Page URL",si="[Amplitude] Viewport Height",ui="[Amplitude] Viewport Width",ci="[Amplitude] Page View ID",li="data-amp-mask-attributes",di="data-amp-internal-shadow";function fi(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r?null:function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=c(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?r:null}function vi(e,t){return t.map(pi).join(" > ")}function pi(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var hi=":scope > ";function gi(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function mi(e){var t,n=e.getRootNode();return gi(n)?n:null!==(t=e.ownerDocument)&&void 0!==t?t:document}function yi(e,t){var n,r,i,o;return u(this,function(a){switch(a.label){case 0:n=e,r=0,i=0,a.label=1;case 1:return null!==n&&i<1024?(i+=1,[4,n]):[3,3];case 2:return a.sent(),n.parentElement?(n=n.parentElement,[3,1]):r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return gi(t)?t.host:null}(n))&&o!==n?(r+=1,n=o,[3,1]):[3,3];case 3:return[2]}})}function bi(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=l(r.pop(),2),a=o[0],s=o[1],u=a.shadowRoot;if(u&&s+1<=t){n.push({root:u,depth:s+1});for(var c=u.children,d=0;d<c.length;d++)r.push([c[d],s+1])}var f=a.children;for(d=0;d<f.length;d++)r.push([f[d],s])}return n}function wi(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=mi(r);n.push({root:o,target:r});var a=r.getRootNode();if(!gi(a))break;r=a.host}var s=n.length-1,u=!1,c=n;return s>t&&(c=n.slice(s-t),u=!0),{segments:c.reverse(),truncated:u}}function Ei(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&gi(i)?"".concat(n,":nth-of-type(").concat(Si(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(Si(e,r.children),")")}function Si(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var ki={name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}};function Ti(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var a=n.charCodeAt(o);0!==a?a>=1&&a<=31||127===a||0===o&&a>=48&&a<=57||1===o&&a>=48&&a<=57&&45===n.charCodeAt(0)?i+="\\".concat(a.toString(16)," "):i+=0!==o||1!==r||45!==a?a>=128||45===a||95===a||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122?n.charAt(o):"\\".concat(n.charAt(o)):"\\-":i+="�"}return i}function xi(e){return Ti(e)}var Pi={name:"stableId",try:function(e,t){var n=fi(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(xi(n))}},_i=!1,Ai=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:d([],l([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:d([],l([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:_i,maxShadowDomDepth:1});function Ii(e){var t;return o(o({},e),{shadowDomEnabled:null!==(t=e.shadowDomEnabled)&&void 0!==t?t:_i,maxShadowDomDepth:Ci(e.maxShadowDomDepth)})}function Oi(e,t){if(!e)return Ri();var n,r=Ri();return"boolean"==typeof e.enabled&&(r.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=c(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(e){var u=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(u,")"))}}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth="number"!=typeof(n=e.maxAncestorWalkDepth)?void 0:Number.isFinite(n)?n<=0?void 0:Math.floor(n):void 0,"boolean"==typeof e.shadowDomEnabled&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Ci(e.maxShadowDomDepth),Ii(r)}function Ci(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}function Ri(){return{enabled:Ai.enabled,explicitTrackingAttribute:Ai.explicitTrackingAttribute,autogeneratedIdPatterns:d([],l(Ai.autogeneratedIdPatterns),!1),unstableClassPatterns:d([],l(Ai.unstableClassPatterns),!1),maxAncestorWalkDepth:Ai.maxAncestorWalkDepth,shadowDomEnabled:Ai.shadowDomEnabled,maxShadowDomDepth:Ai.maxShadowDomDepth}}var Di=[ki,Pi];function Li(e,t,n){var r,i,o,a,s;void 0===n&&(n={});var u=Ii(t),l=null!==(o=n.strategies)&&void 0!==o?o:Di,d=null!==(s=null!==(a=n.scope)&&void 0!==a?a:e.ownerDocument)&&void 0!==s?s:document,f={scope:d,config:u},v=function(e,t){var n=[],r=e;for(;null!==r&&(n.push(r),!(void 0!==t&&n.length>t));)r=r.parentElement;return n}(e,u.maxAncestorWalkDepth);try{for(var p=c(l),h=p.next();!h.done;h=p.next())for(var g=h.value,m=0;m<v.length;m++){var y=v[m],b=g.try(y,f);if(null!==b)if(0!==m){var w=vi(0,v.slice(0,m).reverse()),E="".concat(b," > ").concat(w);if(Ni(d,E,e,g.name,n.logger))return E}else if(Ni(d,b,e,g.name,n.logger))return b}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(r)throw r.error}}return null}function Ni(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var a=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return 1===o.length&&o[0]===n}function Mi(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}var ji=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),Ui=function(e,t,n){var r,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new ji(qi(o),!0);var a=e.tagName.toLowerCase();if("body"===a||"head"===a||"html"===a)return new ji(a,!0)}var s=e.tagName.toLowerCase();if(o)return new ji(s+qi(o),!0);var u=e.parentNode;if(!u||u.nodeType===Node.DOCUMENT_NODE)return new ji(s,!0);for(var l=Fi(e),d=!1,f=!1,v=-1,p=-1,h=u.children,g=0;h&&(-1===v||!f)&&g<h.length;++g){var m=h[g];if(m.nodeType===Node.ELEMENT_NODE)if(p+=1,m!==e){if(!f&&m.tagName.toLowerCase()===s){d=!0;var y=new Set(l);if(y.size)for(var b=Fi(m),w=0;w<b.length;++w){var E=b[w];if(y.has(E)&&(y.delete(E),!y.size)){f=!0;break}}else f=!0}}else v=p}var S=s;if(n&&"input"===s.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(S+="[type="+Ti(e.getAttribute("type")||"")+"]"),f)S+=":nth-child("+String(v+1)+")";else if(d)try{for(var k=c(l),T=k.next();!T.done;T=k.next()){S+="."+Ti(T.value.slice(1))}}catch(e){r={error:e}}finally{try{T&&!T.done&&(i=k.return)&&i.call(k)}finally{if(r)throw r.error}}return new ji(S,!1)},Fi=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},qi=function(e){return"#"+Ti(e)};function Bi(e,t){try{return function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=Ui(r,Boolean(t),r===e);if(!i)break;if(n.push(i),i.optimized)break;r=r.parentElement}return n.reverse(),n.join(" > ")}(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}function Hi(e,t){void 0===t&&(t={});var n=Ii(e),r=new Set,i=t.logger,o=function(e){return Bi(e,i)},a=function(e,r){var o;return null!==(o=Li(e,n,{strategies:t.strategies,scope:r,logger:i}))&&void 0!==o?o:function(e,t,n){var r,i;void 0===n&&(n={});for(var o=Ii(t),a=null!==(i=null!==(r=n.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==i?i:document,s=gi(a),u=[],c=e,f=0,v=!(o.shadowDomEnabled&&s);null!==c&&!(v&&void 0!==o.maxAncestorWalkDepth&&f>o.maxAncestorWalkDepth);){var p=fi(c,o);if(null!==p){var h=d(["".concat(c.tagName.toLowerCase(),"#").concat(xi(p))],l(u),!1).join(" > ");if(Mi(a,h,e))return h}u.unshift(Ei(c,o.shadowDomEnabled)),c=c.parentElement,f+=1}var g=u.join(" > ");return o.shadowDomEnabled&&s&&null===c?"".concat(hi).concat(g):g}(e,n,{scope:r})},s=function(e,t){return function(e,t,n){return e&&n&&gi(t)?"".concat(hi).concat(e):e}(o(e),t,function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e))};return{generate:function(e){var r,u;try{return n.shadowDomEnabled?function(e,t){var r=wi(e,n.maxShadowDomDepth),o=r.segments;return r.truncated&&(null==i||i.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(n.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),o.map(function(e){var n=e.target,r=e.root;return t(n,r)}).join(" >>> ")}(e,n.enabled?a:s):(n.enabled?a:o)(e,null!==(u=null!==(r=t.scope)&&void 0!==r?r:e.ownerDocument)&&void 0!==u?u:document)}catch(t){var c=t instanceof Error?t.message:String(t);return null==i||i.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(c)),Bi(e,i)}},getConfig:function(){return n},updateConfig:function(e){var t,o;n=Ii(e);try{for(var a=c(r),s=a.next();!s.done;s=a.next()){var u=s.value;try{u(n)}catch(e){var l=e instanceof Error?e.message:String(e);null==i||i.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(l))}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(t)throw t.error}}},onConfigChange:function(e){return r.add(e),function(){r.delete(e)}}}}var zi,Vi,Wi=Object.freeze({enabled:!1,maxDepth:0}),Gi=function(){var e=Wi,t=new Set;return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,function(e){var n,r;try{for(var i=c(d([],l(t),!1)),o=i.next();!o.done;o=i.next()){var a=o.value;try{a(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()}(n)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},$i=["input","select","textarea"],Ki=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&Ue(window.location.href,n))&&!!Ue(window.location.href,t)},Ji=function(e,t){return function(n,r){var i,o,a=e.shouldTrackEventResolver,s=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(!s)return!1;if(a)return a(n,r);if(!Ki(e))return!1;var u=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof u)switch(u.toLowerCase()){case"hidden":case"password":return!1}if(t){var c=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(!c)return!1}switch(s){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},Yi=function(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[]},Xi=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},{})},Qi=function(){var e;try{var t=B(),n=null===(e=null==t?void 0:t.sessionStorage)||void 0===e?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},Zi=function(e,t,n){return void 0===n&&(n=Wi),n.enabled?to(e,t,n.maxDepth):eo(e,t)},eo=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:eo(null==e?void 0:e.parentElement,t):null},to=function(e,t,n){var r,i;if(!e)return null;var o=function(e){if(t.some(function(t){var n;return null===(n=null==e?void 0:e.matches)||void 0===n?void 0:n.call(e,t)}))return{value:e}};try{for(var a=c(yi(e,n)),s=a.next();!s.done;s=a.next()){var u=o(s.value);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}return null},no=function(e,t,n){return void 0===n&&(n=Wi),n.enabled?io(e,t,n.maxDepth):ro(e,t)},ro=function(e,t){var n=[];return t?(e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n):n},io=function(e,t,n){var r=ro(e,t),i=e instanceof Document?e.documentElement:e;return i?(bi(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r):r},oo=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)};function ao(e){if(!e)return"";try{var t=new URL(e);return t.search="",Fe(t.href)}catch(t){return Fe(e)}}function so(e){var t,n;return void 0===e&&(e=B()),ao(null!==(n=null===(t=null==e?void 0:e.location)||void 0===t?void 0:t.href)&&void 0!==n?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(Vi||(Vi={}));var uo="__AMPLITUDE_VISUAL_TAGGING__";var co=B(),lo=function(e){return e.get()},fo={childList:!0,attributes:!0,characterData:!0,subtree:!0},vo=function(e){return new wn(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),gi(e)&&i.set(e,t),s.observe(e,fo))},a=function(e,t,n){var r=n-t;r<=0||bi(e,r).forEach(function(e){var n=e.root,r=e.depth;return o(n,t+r)})},s=new MutationObserver(function(n){var r,o;t.next(n);try{var s=lo(e);if(!s.enabled)return;var u=function(e){var t=function(e){var t=e.getRootNode();if(!gi(t))return 0;var n=i.get(t);return null!=n?n:0}(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&a(e,t,s.maxDepth)})};try{for(var l=c(n),d=l.next();!d.done;d=l.next()){u(d.value)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(o=l.return)&&o.call(l)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){a(u,0,e.maxDepth)})}return function(){null==n||n(),s.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},po=function(e){return void 0===e&&(e="click"),new wn(function(t){var n,r=function(e){t.next(e)};return null===(n=B())||void 0===n||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null===(t=B())||void 0===t||t.document.removeEventListener(e,r,{capture:!0})}})},ho=function(){var e=Sn(new wn(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=o(o({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return co.addEventListener("error",t),function(){co.removeEventListener("error",t)}}),new wn(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return co.addEventListener("unhandledrejection",t),function(){co.removeEventListener("unhandledrejection",t)}}));return Sn(e,new wn(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return Et.addListener("error",t),function(){Et.removeListener(t)}}))},go=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},mo={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},yo=function(e){var t,n,r,i,o=Object.values(mo).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var l=(r=void 0,c(u.definition)),d=l.next();!d.done;d=l.next()){var f=d.value,v=mo[f.event_type];v&&o[v].add(u.id)}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},bo=function(e){var t,n,r,i,o=new Map;try{for(var a=c(e),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var l=(r=void 0,c(u.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var v=f.match.eventId,p=o.get(v);p||(p=[],o.set(v,p)),p.push(u)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return o},wo=function(e,t){return t.filter(function(t){return t.definition.some(function(t){return mo[t.event_type]===e.type&&t.filters.every(function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){return console.error("Error matching event to filter",e),!1}return!1}(e,t)})})})},Eo=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=function(e,t){var n,r,i,o,a=new Set;try{for(var s=c(e),u=s.next();!u.done;u=s.next()){var l=u.value,d=t.get(l.id);if(d)try{for(var f=(i=void 0,c(d)),v=f.next();!v.done;v=f.next()){var p=v.value;a.add(p)}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return Array.from(a)}(wo(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]})),this.labeledEventToTriggerMap);try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=a.value;go(s.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),So=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",li,Yt,di]),ko=["type"],To=["svg","path","g"],xo=["password","hidden"];function Po(e,t,n){var r,i,a,s,u;if(void 0===n&&(n=Wi),null===e)return null;var l=String(e.tagName).toLowerCase(),d={tag:l},f=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&gi(n)?n.children:[]}(e,n.enabled));f.length&&(d.index=f.indexOf(e),d.indexOfType=f.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var v=null===(u=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===u?void 0:u.toLowerCase();v&&(d.prevSib=String(v));var p=e.getAttribute("id");p&&(d.id=String(p));var h=Array.from(e.classList);h.length&&(d.classes=h);var g={},m=Array.from(e.attributes).filter(function(e){return!So.has(e.name)}),y=!function(e){var t,n,r,i=null===(n=null===(t=null==e?void 0:e.tagName)||void 0===t?void 0:t.toLowerCase)||void 0===n?void 0:n.call(t),o=e instanceof HTMLElement&&"true"===(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase());return!$i.includes(i)&&!o}(e);if(!xo.includes(String(e.getAttribute("type")))&&!To.includes(l))try{for(var b=c(m),w=b.next();!w.done;w=b.next()){var E=w.value;y&&!ko.includes(E.name)||(t.has(E.name)?g[E.name]=Xt:g[E.name]=String(E.value).substring(0,128))}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=b.return)&&i.call(b)}finally{if(r)throw r.error}}return Object.keys(g).length&&(d.attrs=g),e.shadowRoot&&(d.attrs=o(o({},d.attrs||{}),((a={})[di]="true",a)),d.shadow=!0),d}function _o(e,t){return void 0===t&&(t=Wi),e?t.enabled?function(e,t){var n,r,i=[];try{for(var o=c(yi(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if("HTML"===s.tagName)break;i.push(s)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e,t.maxDepth):function(e){var t=[];t.push(e);var n=e.parentElement;for(;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var Ao;var Io=function(e,t){var n,r,i,a=this;this.replaceSensitiveString=function(e){return tn(e,a.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o,s=performance.now();if(!e)return[];for(var u=a.getShadowMode(),f=_o(e,u),v=new Map,p=f.length-1;p>=0;p--){var h=f[p];if(h){var g=Yi(h.getAttribute(li)),m=p===f.length-1?[]:null!==(r=v.get(f[p+1]))&&void 0!==r?r:new Set,y=new Set(d(d([],l(m),!1),l(g),!1));v.set(h,y)}}o=f.map(function(e){var t;return Po(e,null!==(t=v.get(e))&&void 0!==t?t:new Set,u)});var b=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=l(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=a.replaceSensitiveString(i))})};try{for(var w=c(o),E=w.next();!E.done;E=w.next())b(E.value)}catch(e){t={error:e}}finally{try{E&&!E.done&&(n=w.return)&&n.call(w)}finally{if(t)throw t.error}}var S=performance.now();return null===(i=a.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",S-s),o},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?a.getText(t):a.getNearestLabel(n)},this.getElementPath=function(e){var t;if(!e)return"";var n=performance.now(),r=a.selectorEngine.generate(e),i=performance.now();return null===(t=a.diagnosticsClient)||void 0===t||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateSelectorConfig=function(e,t){var n;if(null!=e){var r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(r||i){var s=Oi(e,t),u=a.selectorEngine.getConfig().enabled,c=a.shadowGate.get().enabled,l=a.shadowGate.arm(function(e){var t,n=null!==(t=e.maxShadowDomDepth)&&void 0!==t?t:1;return!e.shadowDomEnabled||n<=0?Wi:Object.freeze({enabled:!0,maxDepth:n})}(s));a.selectorEngine.updateConfig(o(o(o({},r?s:a.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),r&&u!==s.enabled&&(null==t||t.debug(s.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!c&&l.enabled&&(null===(n=a.diagnosticsClient)||void 0===n||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}else null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.")}},this.getShadowMode=function(){return a.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,u,c,d=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),f="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},v=a.getHierarchy(t),p=null===(s=v[0])||void 0===s?void 0:s.attrs,h=a.getNearestLabel(t),g=(u=null!=p?p:{},c=n,Object.entries(u).reduce(function(e,t){var n=l(t,2),r=n[0],i=n[1];if(r.startsWith(c)){var o=r.replace(c,"");o&&(e[o]=i||"")}return e},{})),m=((r={})["[Amplitude] Element Hierarchy"]=v,r[ii]=d,r[oi]=a.getText(t),r["[Amplitude] Element Position Left"]=null==f.left?null:Math.round(f.left),r["[Amplitude] Element Position Top"]=null==f.top?null:Math.round(f.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Path"]=a.getElementPath(t),r["[Amplitude] Element Parent Label"]=h,r[ai]=Fe(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=nn(a.replaceSensitiveString),r[si]=window.innerHeight,r[ui]=window.innerWidth,r),y=Qi();if(y&&(m[ci]=y),m["[Amplitude] Element ID"]=t.getAttribute("id")||"",m["[Amplitude] Element Class"]=t.getAttribute("class"),m["[Amplitude] Element Aria Label"]=null==p?void 0:p["aria-label"],"a"===d&&"click"===e&&t instanceof HTMLAnchorElement){var b=t.href.substring(0,128);m["[Amplitude] Element Href"]=a.replaceSensitiveString(b)}return Xi(m)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=a.addTypeAndTimestamp(e,t);try{if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){var s=a.getShadowMode(),u=function(e,t){var n,r;if(void 0===t&&(t=Wi),!t.enabled)return e.target;var i=null===(n=e.composedPath)||void 0===n?void 0:n.call(e),o=null!==(r=e.target)&&void 0!==r?r:null;if(!i||0===i.length)return o;var a=i[0];if(!(a instanceof Element))return null!=a?a:o;var s=wi(a,t.maxDepth),u=s.segments;return s.truncated&&u.length>0?u[u.length-1].target:a}(o.event,s);if(i){var c=function(e,t){var n,r=null===(n=null===window||void 0===window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return"pointer"===(null==r?void 0:r.getPropertyValue("cursor"))&&"click"===t}(u,o.type);if(c)return o.closestTrackedAncestor=u,o.targetElementProperties=a.getEventProperties(o.type,o.closestTrackedAncestor,r),o}var l=Zi(u,n,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=a.getEventProperties(o.type,l,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}catch(e){return}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?a.getText(n):"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(Yt,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=c(o),u=s.next();!u.done;u=s.next()){var l=u.value;l.nodeType!==Node.TEXT_NODE?l instanceof Element&&(l.hasAttribute(Yt)||l.hasAttribute("contenteditable")?i+=Xt:i+=a.getTextWithMaskedDescendants(l)):i+=l.textContent||""}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=a.getShadowMode();return t.enabled?function(e,t){var n,r;return!!_o(e,t).some(function(e){return e.hasAttribute(Yt)})||null!==(r=null===(n=document.documentElement)||void 0===n?void 0:n.hasAttribute(Yt))&&void 0!==r&&r}(e,t):function(e){return null!==e.closest("[".concat(Yt,"]"))}(e)},this.getText=function(e){if(a.hasMaskedAncestor(e))return Xt;var t="";return t=e.querySelector("[".concat(Yt,"], [contenteditable]"))?a.getTextWithMaskedDescendants(e):e.innerText||"",a.replaceSensitiveString(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=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={})[ii]=i,t[oi]=a.getText(e),t[ai]=window.location.href.split("?")[0],t);return Xi(o)},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(Ao||(Ao=Hi(Oi())),Ao),this.shadowGate=(zi||(zi=Gi()),zi);var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],u=[];try{for(var f=c(s),v=f.next();!v.done;v=f.next()){var p=v.value;if(u.length>=25)break;if(p instanceof RegExp)u.push(p);else if("pattern"in p&&"string"==typeof p.pattern)try{u.push(new RegExp(p.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{v&&!v.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u};function Oo(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture.elementSelector","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateSelectorConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var Co,Ro=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:function(e){var t;return e.assignedSlot||e.parentElement||(null===(t=e.parentNode)||void 0===t?void 0:t.host)||null}(e)};function Do(e){var t=e.allObservables,n=e.onExposure,r=e.dataExtractor,i=e.exposureDuration,o=void 0===i?150:i,a=new Map,s=new Map,u=new Set,c=function(e){var t=s.get(e);t&&(clearTimeout(t),s.set(e,null))},l=function(e){if(function(e){var t=B(),n=t.document.documentElement.clientHeight||t.innerHeight,r=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,a=Math.max(i.left,0),s=Math.min(i.right,r);if(o<-1||o>n+1||a>=s||i.width<=0)return!1;for(var u=Ro(e,t.getComputedStyle(e).position);u;){var c=t.getComputedStyle(u),l=c.overflowY&&"visible"!==c.overflowY,d=c.overflowX&&"visible"!==c.overflowX;if(l||d){var f=u.getBoundingClientRect();if(l&&(o<f.top-1||o>f.bottom+1))return!1;if(d&&(a=Math.max(a,f.left))>=(s=Math.min(s,f.right)))return!1}u=Ro(u,c.position)}return!0}(e)){if(!a.get(e)&&!s.get(e)){var t=setTimeout(function(){a.set(e,!0);var t=r.getElementPath(e);n(t),s.set(e,null)},o);s.set(e,t)}}else c(e)},d=t.exposureObservable,f=t.scrollObservable,v=d.subscribe(function(e){var t=e,n=t.target;t.isIntersecting?(u.add(n),l(n)):(u.delete(n),c(n))}),p=f.subscribe(function(){u.forEach(l)}),h=function(){s.forEach(function(e){e&&clearTimeout(e)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),u.clear()},reset:function(){h(),u.forEach(l)}}}function Lo(e){var t,n,r,i,o,a=e.mutationObservable,s=e.onRescan,u=e.onFlush,c=e.exposureDuration,l=e.quietMs,d=void 0===l?150:l,f=e.maxWaitMs,v=void 0===f?4e3:f,p=!1,h=function(){t&&(clearTimeout(t),t=void 0),n&&(clearTimeout(n),n=void 0),r&&(clearTimeout(r),r=void 0)},g=function(){o&&(document.removeEventListener("DOMContentLoaded",o),o=void 0)},m=function(){p||("undefined"!=typeof document&&"loading"!==document.readyState?(p=!0,h(),g(),s(),r=setTimeout(function(){r=void 0,u()},c+50)):o||(o=function(){o=void 0,y()},document.addEventListener("DOMContentLoaded",o)))},y=function(){p||(t&&clearTimeout(t),t=setTimeout(m,d))},b=function(){h(),g(),p=!1,y(),n=setTimeout(m,v)};return{start:function(){i||(i=a.subscribe(function(){y()}),b())},reset:function(){b()},stop:function(){null==i||i.unsubscribe(),i=void 0,h(),g()}}}!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(Co||(Co={}));var No=function(e,t){var n,r,i,a,f,v,p,h,g,m,y,b;void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ni);var w=e.dataAttributePrefix,E=void 0===w?kt:w,S=e.visualTaggingOptions,k=void 0===S?{enabled:!0}:S;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:St,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:Tt,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0;var T=!1!==(null===(a=e.viewportContentUpdated)||void 0===a?void 0:a.enabled),x=null!==(p=null!==(v=null===(f=e.viewportContentUpdated)||void 0===f?void 0:f.exposureDuration)&&void 0!==v?v:e.exposureDuration)&&void 0!==p?p:150;e.viewportContentUpdated=o(o({},e.viewportContentUpdated),{exposureDuration:x}),e.pageUrlExcludelist=null===(h=e.pageUrlExcludelist)||void 0===h?void 0:h.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(n){return console.warn("Invalid regex pattern: ".concat(t.pattern),n),e}return e},[]);var P,_,A="@amplitude/plugin-autocapture-browser",I=[],O=new Io(e,t),C=new Set,R=new Set,D=new Set,L=function(){var t,n,r=kn(po().map(function(t){return O.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,E)})),i=kn(new wn(function(t){var n,r=function(n){var r=O.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,E);t.next(r)};return null===(n=B())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=B())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=kn(new wn(function(t){var n=function(n){var r=O.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,E);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=O.shadowGate,a=kn(vo(o).map(function(t){return O.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,E)})),s=new wn(function(e){var t,n,r=function(t){e.next(t)};return null===(t=B())||void 0===t||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null===(n=B())||void 0===n||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null===(e=B())||void 0===e||e.removeEventListener("scroll",r,{capture:!0}),null===(t=B())||void 0===t||t.removeEventListener("resize",r)}}),u=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new wn(function(n){var r=B();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var a=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:0}),s=t.join(","),u=function(e){e instanceof Element&&e.matches(s)&&a.observe(e),e.querySelectorAll(s).forEach(function(e){a.observe(e)})},c=function(e){if(o)try{no(e,s,lo(o)).forEach(function(e){a.observe(e)})}catch(e){}},l=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&lo(o).enabled?no(e,s,lo(o)):e.querySelectorAll(s)}catch(e){return}Array.from(t).forEach(function(e){a.unobserve(e),a.observe(e)})}};null==i||i(l),l();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&c(r.document)}),f=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)u(e);else if(e instanceof Element)if(o&&lo(o).enabled){try{e.matches(s)&&a.observe(e)}catch(e){}c(e)}else u(e)})})});return function(){null==i||i(void 0),null==d||d(),f.unsubscribe(),a.disconnect()}})}(a,e.cssSelectorAllowlist,function(e){_=e},o);return(t={})[Co.ChangeObservable]=i,t[Co.ClickObservable]=r,t[Co.MutationObservable]=a,t[Co.NavigateObservable]=n,t[Co.ScrollObservable]=s,t[Co.ExposureObservable]=u,t},N=yo(Object.values(null!==(m=null===(g=e.pageActions)||void 0===g?void 0:g.labeledEvents)&&void 0!==m?m:{})),M=bo(null!==(b=null===(y=e.pageActions)||void 0===y?void 0:y.triggers)&&void 0!==b?b:[]),j=function(e,t,n,r){return new Eo(e,t,n,r)}(N,M,O,e);return{name:A,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,function(){var r,i,a,s,c,f,v,p,h,g,m,y,b,w,S,U,F,q,H,z,V,W,G,$,K,J,Y;return u(this,function(u){return"undefined"==typeof document||(r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(t){!function(t){var n,r;t&&(e.pageActions=o(o({},e.pageActions),t),N=yo(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),M=bo(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),j.update(N,M,e))}(t)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),(i=Oo(t,O))&&I.push({unsubscribe:i}),a=Ji(e,e.cssSelectorAllowlist),s=Ji(e,e.actionClickAllowlist),c=L(),f=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackEvent,i=e.evaluateTriggers;return n.clickObservable.filter(oo).filter(function(e){return r("click",e.closestTrackedAncestor)}).map(function(e){return i(e)}).subscribe(function(e){null==t||t.track(ri,e.targetElementProperties)})}({allObservables:c,amplitude:n,shouldTrackEvent:a,evaluateTriggers:j.evaluate.bind(j)}),I.push(f),v=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.filter(oo).filter(function(e){return i("change",e.closestTrackedAncestor)}).map(function(e){return o(e)}).subscribe(function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))})}({allObservables:c,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O.getEventProperties.apply(O,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:a,evaluateTriggers:j.evaluate.bind(j)}),I.push(v),p=function(e){var t=e.amplitude,n=e.allObservables,r=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=n.clickObservable,u=n.mutationObservable,c=n.navigateObservable,l=s.filter(function(e){return!o("click",e.closestTrackedAncestor)}).map(function(e){var t=Zi(e.event.target,r.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=i(e.type,e.closestTrackedAncestor)),e}).filter(oo).filter(function(e){return a("click",e.closestTrackedAncestor)}),d=c?Sn(u,c):u,f=Sn(l,d),v=null,p=null;return En(f,function(e){if(v&&(clearTimeout(v),v=null),"click"===e.type)return p=e,v=setTimeout(function(){v=null,p=null},500),Promise.resolve(null);if(p){var t=p;return p=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==t||t.track(ri,i("click",e.closestTrackedAncestor)))})}({allObservables:c,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return O.getEventProperties.apply(O,d(d([],l(e),!1),[E],!1))},amplitude:n,shouldTrackEvent:a,shouldTrackActionClick:s}),p&&I.push(p),h=function(e){e.amplitude;var t=e.allObservables.scrollObservable,n={maxX:0,maxY:0},r=t.subscribe(function(){var e,t,r,i,o=B(),a=Math.floor(null!==(t=null!==(e=null==o?void 0:o.scrollX)&&void 0!==e?e:null==o?void 0:o.pageXOffset)&&void 0!==t?t:0),s=Math.floor(null!==(i=null!==(r=null==o?void 0:o.scrollY)&&void 0!==r?r:null==o?void 0:o.pageYOffset)&&void 0!==i?i:0);n.maxX=Math.max(n.maxX,a),n.maxY=Math.max(n.maxY,s)});return{unsubscribe:function(){r.unsubscribe()},getState:function(){return n},reset:function(){n.maxX=0,n.maxY=0}}}({allObservables:c,amplitude:n}),I.push(h),g=o({},h.getState()),m={},y=B(),w=function(e){e&&(null==b||b.reset()),e&&r||(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,u=e.elementExposedInSentEvents,c=e.exposureTracker,l=e.isPageEnd,d=e.lastScroll,f=o.getState(),v=B(),p=null!==(n=null==v?void 0:v.innerWidth)&&void 0!==n?n:0,h=null!==(r=null==v?void 0:v.innerHeight)&&void 0!==r?r:0,g=Array.from(a).filter(function(e){return!u.has(e)}),m=((t={})[ai]=so(v),t["[Amplitude] Max Page X"]=f.maxX+p,t["[Amplitude] Max Page Y"]=f.maxY+h,t[si]=h,t[ui]=p,t["[Amplitude] Element Exposed"]=g,t),y=Qi();y&&(m[ci]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,s.clear(),u.clear(),null==c||c.reset()};0!==g.length||f.maxX!==d.maxX||f.maxY!==d.maxY?(null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=f.maxX,d.maxY=f.maxY,g.forEach(function(e){u.add(e)}),a.clear(),l&&b()):l&&b()}({amplitude:n,scrollTracker:h,currentElementExposed:D,elementExposedForPage:C,elementExposedInSentEvents:R,exposureTracker:m.exposure,isPageEnd:e,lastScroll:g}))},S=so(y),U=function(){var e=so(y);e!==S&&(S=e,w(!0))},F=function(e,t){var n=so(y),r=function(e,t){var n;if(void 0===t&&(t=B()),null==e||""===e)return so(t);var r=(null===(n=null==t?void 0:t.location)||void 0===n?void 0:n.href)||"http://localhost/";try{return ao(new URL(e,r).href)}catch(e){return so(t)}}(t,y);n!==r?(S=r,w(!0),e()):e()},q=function(e){!function(e,t,n,r,i){if(!t.has(e)&&!n.has(e)){t.add(e),r.add(e);var o=Array.from(r);JSON.stringify(o).length>=18e3&&i(!1)}}(e,C,R,D,w)},T&&(m.exposure=Do({allObservables:c,onExposure:q,dataExtractor:O,exposureDuration:x}),m.exposure&&I.push(m.exposure),b=Lo({mutationObservable:c[Co.MutationObservable],onRescan:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==_||_()},onFlush:function(){var e,n;null===(n=null===(e=t.loggerProvider)||void 0===e?void 0:e.debug)||void 0===n||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),w(!1)},exposureDuration:x}),b.start(),I.push({unsubscribe:function(){null==b||b.stop()}}),H=function(){w(!0)},null==y||y.addEventListener("beforeunload",H),P=function(){null==y||y.removeEventListener("beforeunload",H)},I.push({unsubscribe:function(){return P()}}),(z=c[Co.NavigateObservable])?I.push(z.subscribe(function(e){var t,n,r=null===(n=null===(t=e.event)||void 0===t?void 0:t.destination)||void 0===n?void 0:n.url;if(r){var i=ao(r);if(i===S)return;return S=i,void w(!0)}U()})):y&&(V=function(){U()},y.addEventListener("popstate",V),W=y.history.pushState,G=y.history.replaceState,y.history&&W&&(y.history.pushState=new Proxy(W,{apply:function(e,t,n){F(function(){e.apply(t,n)},n[2])}})),y.history&&G&&(y.history.replaceState=new Proxy(G,{apply:function(e,t,n){F(function(){e.apply(t,n)},n[2])}})),I.push({unsubscribe:function(){y.removeEventListener("popstate",V),y.history&&W&&(y.history.pushState=W),y.history&&G&&(y.history.replaceState=G)}}))),null===(Y=null==t?void 0:t.loggerProvider)||void 0===Y||Y.log("".concat(A," has been successfully added.")),window.opener&&k.enabled&&($=e.cssSelectorAllowlist,K=e.actionClickAllowlist,function(e,t){var n=e;if(!0!==n[uo]){n[uo]=!0;var r=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,u=function(t){e.notify({action:"element-selected",data:t})},c=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var n;s=null===(n=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===n?void 0:n.call(window,{getEventTagProps:r.getEventTagProps,isElementSelectable:function(e){return!i||i((null==t?void 0:t.actionType)||"click",e)},onTrack:c,onSelect:u,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:r.extractDataFromDataSource,dataExtractor:r,diagnostics:{autocapture:{version:ni}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(J=On(),{dataExtractor:O,isElementSelectable:Ji(e,d(d([],l($),!1),l(K),!1)),cssSelectorAllowlist:$,actionClickAllowlist:K}),function(e,t){var n,r=e;if(!0!==r[Cn]){r[Cn]=!0;var i=null!==(n=null==t?void 0:t.scriptUrl)&&void 0!==n?n:"https://cdn.amplitude.com/libs/background-capture-1.0.3.js.gz",o=null,a=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){var t,n;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Initializing background capture (external script)");var r=new URL(i,e.endpoint).toString();e.loadScriptOnce(r).then(function(){var t,n,r;null===(n=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Background capture script loaded (external)"),o=null===(r=null===window||void 0===window?void 0:window.amplitudeBackgroundCapture)||void 0===r?void 0:r.call(window,{messenger:e,onBackgroundCapture:a}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==o?void 0:o.close)||void 0===e||e.call(o),o=null})}}(J),J.setup(o({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:Pn[t.serverZone]})))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,r;return u(this,function(i){try{for(e=c(I),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]})})}}},Mo=["mutation","navigate"];function jo(e,t){var n,r,i,o,a=t.event,s=a.pageX,u=a.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:s,s),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function Uo(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:o({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}function Fo(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,a=r.selectionObservable,c=[],l={},d=null;function f(e){c=[],l={},e&&(jo(l,e),c.push(e))}var v=En(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return s(t,void 0,void 0,function(){var t;return u(this,function(n){return jo(l,e),t=null,0===c.length||function(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}(c,e)||function(e,t){var n=e[Math.max(0,e.length-4+1)];return t.timestamp-n.timestamp>=1e3}(c,e)||l.isOutOfBounds?(d&&(t=Uo(c)),f(e)):c.push(e),d&&(clearTimeout(d.timerId),d.resolve(t),d=null),c.length>=4?[2,new Promise(function(e){d={resolve:e,timerId:setTimeout(function(){e(Uo(c))},1e3)}})]:[2,null]})})}),p=null==a?void 0:a.subscribe(function(){f()}),h=v.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){h.unsubscribe(),null==p||p.unsubscribe()}}}var qo,Bo;!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(qo||(qo={})),function(e){e.X="x",e.Y="y"}(Bo||(Bo={}));function Ho(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function zo(e){e.changes=[],e.startTime=void 0}function Vo(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length;r++){if(i-t[r]<n)break}0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var Wo=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new wn(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},a=void 0,s=null;function u(){void 0!==a&&(e.next(a),a=void 0,null!==s&&clearTimeout(s),zo(n),zo(i))}return t.subscribe(function(e){null!==s&&clearTimeout(s),function(e){var t=+Date.now();e.startTime=e.startTime||t;var n=e.changes,r=e.changesThreshold;n.push(t),n.length>r&&n.shift()}(e===Bo.X?n:i);var t=function(e,t){var n=void 0;if(Ho(e)&&(n=e.startTime),Ho(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return t?(a=a||t,s=setTimeout(function(){u(),s=null},o)):u(),Vo(n),Vo(i),function(){null!==s&&(clearTimeout(s),s=null)}})})},Go=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=void 0===i?20:i,a=e.thresholdMs,s=void 0===a?2e3:a,u=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new wn(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};null!==n?(o.x>n.x?(r===qo.DECREASING&&e.next(Bo.X),r=qo.INCREASING):o.x<n.x&&(r===qo.INCREASING&&e.next(Bo.X),r=qo.DECREASING),o.y>n.y?(i===qo.DECREASING&&e.next(Bo.Y),i=qo.INCREASING):o.y<n.y&&(i===qo.INCREASING&&e.next(Bo.Y),i=qo.DECREASING),n=o):n=o})})}({allWindowObservables:r});return Wo({mouseDirectionChangeObservable:u,directionChanges:o,thresholdMs:s}).subscribe(function(e){Ki(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function $o(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var Ko=4e3,Jo=function(e){var t;void 0===e&&(e={});var n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var a=!1!==e.deadClicks&&null!==e.deadClicks,f=!1!==e.rageClicks&&null!==e.rageClicks,v=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(v=!1);var p=$o(e,"rageClicks",At,f),h=$o(e,"deadClicks",Pt,a),g=$o(e,"errorClicks",_t,i),m=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:kt,y=new Io(e),b=d([],l(new Set(d(d(d([],l(p),!1),l(h),!1),l(g),!1))),!1),w=function(){var e,t,n=function(e){return kn(po(e).map(function(e){return y.addAdditionalEventProperties(e,"click",b,m,!0)}))},r=n("click"),i=n("pointerdown"),a=kn(ho().map(function(e){return y.addTypeAndTimestamp(e,"error")})),s=kn(vo(y.shadowGate).map(function(e){return y.addAdditionalEventProperties(e,"mutation",b,m)}));window.navigation&&(t=kn(new wn(function(e){var t=function(t){e.next(o(o({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return y.addAdditionalEventProperties(e,"navigate",b,m)})));var u=kn(new wn(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){try{if(t.selectionStart===t.selectionEnd)return}catch(e){return}return e.next()}var n=window.getSelection();if(n&&!n.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),c=kn(new wn(function(e){var t=function(t){e.next(t)},n={capture:!0};return co.document.addEventListener("mousemove",t,n),function(){co.document.removeEventListener("mousemove",t,n)}}));return(e={})[Co.ClickObservable]=r,e[Co.PointerDownObservable]=i,e[Co.MutationObservable]=s,e[Co.NavigateObservable]=t,e[Co.BrowserErrorObservable]=a,e[Co.SelectionObservable]=u,e[Co.MouseMoveObservable]=c,e};return{name:n,type:"enrichment",setup:function(t,c){return s(void 0,void 0,void 0,function(){var s,l,d,b,E,S,k,T,x,P,_,A;return u(this,function(u){return"undefined"==typeof document||(s=w(),(l=Oo(t,y))&&r.push({unsubscribe:l}),f&&(d=Ji(e,p),b=Fo({allObservables:s,amplitude:c,shouldTrackRageClick:d}),r.push(b)),a&&(E=Ji(e,h),S=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackDeadClick,a=n.clickObservable,s=n.mutationObservable,u=n.navigateObservable,c=a.filter(function(e){return oo(e)&&i("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Vi.LEFT_OR_TOUCH_CONTACT}),l=u?Sn(s,u):s,d=Sn(c,l),f=null;return En(d,function(e){return f&&Mo.includes(e.type)?(clearTimeout(f),f=null,Promise.resolve(null)):"click"===e.type?f?Promise.resolve(null):new Promise(function(t){f=setTimeout(function(){t(e),f=null},3e3)}):Promise.resolve(null)}).subscribe(function(e){if(e){var n={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};t.track("[Amplitude] Dead Click",o(o({},r("click",e.closestTrackedAncestor)),n),{time:e.timestamp})}})}({amplitude:c,allObservables:s,getEventProperties:function(e,t){return y.getEventProperties(e,t,m)},shouldTrackDeadClick:E}),r.push(S)),i&&(k=Ji(e,g),T=function(e){var t=e.amplitude,n=e.allObservables,r=e.shouldTrackErrorClick,i=n.pointerDownObservable,a=n.browserErrorObservable,s=i.filter(function(e){return oo(e)&&r("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===Vi.LEFT_OR_TOUCH_CONTACT}),u=null,c=null,l=function(){null!==u&&(clearTimeout(u),u=null),c=null};return Sn(s,a).subscribe(function(e){var n;if("click"===e.type)return l(),c=e,void(u=setTimeout(l,2e3));"error"===e.type&&c&&(t.track("[Amplitude] Error Click",o(((n={})["[Amplitude] Kind"]=e.event.kind,n["[Amplitude] Message"]=e.event.message,n["[Amplitude] Stack"]=e.event.stack,n["[Amplitude] Filename"]=e.event.filename,n["[Amplitude] Line Number"]=e.event.lineNumber,n["[Amplitude] Column Number"]=e.event.columnNumber,n),c.targetElementProperties)),l())})}({amplitude:c,allObservables:s,shouldTrackErrorClick:k}),r.push(T)),v&&(x=void 0,P=void 0,"object"==typeof e.thrashedCursor&&(x=e.thrashedCursor.directionChanges,P=e.thrashedCursor.threshold,x&&x<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(x," is below the minimum of ").concat(5,", setting to ").concat(5)),x=5),P&&P>Ko&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(P," is above the maximum of ").concat(Ko,", setting to ").concat(Ko)),P=Ko)),_=Go({amplitude:c,options:e,allObservables:s,directionChanges:x,thresholdMs:P}),r.push(_)),null===(A=null==t?void 0:t.loggerProvider)||void 0===A||A.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,n,i;return u(this,function(o){try{for(e=c(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function Yo(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}function Xo(e,t){var n,r=Yo(e,t),i=null!==(n=e.scripts)&&void 0!==n?n:[],a=i.map(function(e){return e.sourceURL}).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),u=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),c=i.map(function(e){return e.invokerType}).filter(Boolean),l=i.map(function(e){return e.invoker}).filter(Boolean);return o(o(o(o(o(o(o({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),a.length>0&&{"[Amplitude] Main Thread Block Script URLs":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),u.length>0&&{"[Amplitude] Main Thread Block Script Positions":u}),c.length>0&&{"[Amplitude] Main Thread Block Invoker Types":c}),l.length>0&&{"[Amplitude] Main Thread Block Invokers":l})}function Qo(e,t){var n,r=Yo(e,t),i=null!==(n=e.attribution)&&void 0!==n?n:[];return o(o({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}function Zo(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=c(e.getEntries()),o=i.next();!o.done;o=i.next()){var s=o.value;a.push(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var u=r-1e4;a.length>0&&a[0].startTime<u;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch(e){}var u=new PerformanceObserver(function(e){var r,s;try{for(var u=c(e.getEntries()),l=u.next();!l.done;l=u.next()){var d=l.value;if(!Ki(n))return;if(!(d.duration<i)){var f="long-animation-frame"===o?Xo(d,a):Qo(d,a);t.track("[Amplitude] Main Thread Block",f)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(s=u.return)&&s.call(u)}finally{if(r)throw r.error}}});try{u.observe({entryTypes:[o]})}catch(e){return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){u.disconnect(),s.disconnect()}}}var ea,ta,na=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a,s,c;return u(this,function(u){return"undefined"==typeof document||(r&&(a=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(a=e.mainThreadBlock.durationThreshold),s=Zo({amplitude:o,options:e,durationThreshold:a}),n.push(s)),null===(c=null==i?void 0:i.loggerProvider)||void 0===c||c.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t,r,i;return u(this,function(o){try{for(e=c(n),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},ra="[Amplitude] Network Request",ia="500-599";function oa(e,t){var n="^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$";return new RegExp(n).test(e)}function aa(e,t){var n,r,i=t.split(",");try{for(var o=c(i),a=o.next();!a.done;a=o.next()){var s=l(a.value.split("-").map(Number),2),u=s[0],d=s[1];if(e===u&&void 0===d)return!0;if(e>=u&&e<=d)return!0}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function sa(e){var t;if(e)try{var n=null===(t=B())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),a=r.href,s=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:r.href,host:s}}catch(t){try{return function(e){var t,n=e.indexOf("#"),r=n>=0?e.slice(n+1):"",i=n>=0?e.slice(0,n):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,u=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i);return{query:a,fragment:r,href:e,hrefWithoutQueryOrHash:s,host:null!==(t=null==u?void 0:u[1])&&void 0!==t?t:""}}(e)}catch(e){return}}}function ua(e){if("object"==typeof e&&null!==e){if(0!==e.length)return e}else{if(e)return d([],l(R),!1);if(void 0===e){return}}}function ca(e){var t,n,r;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)&&!(null===(r=null==e?void 0:e.excludelist)||void 0===r?void 0:r.length)}function la(e,t){var n;void 0===t&&(t={});var r=sa(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(oa(o,"*.amplitude.com")||oa(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return oa(o,e)}))return!1;if(!t.captureRules&&void 0!==e.status&&!aa(e.status,ia))return!1;if(t.captureRules&&(d([],l(t.captureRules),!1).reverse().find(function(t){if(i=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return oa(t,e)}))&&(!r||!e.urls||Ue(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return!((n||0===n)&&!aa(n,e.statusCodeRange||ia))}(t,o,e.status,e.url,e.method),i){var n=ua(t.responseHeaders);if(e.responseWrapper&&n){var r=e.responseWrapper.headers(n);r&&(e.responseHeaders=r)}var a=ua(t.requestHeaders);if(e.requestWrapper&&a){var s=e.requestWrapper.headers(a);s&&(e.requestHeaders=s)}if(e.responseWrapper&&t.responseBody&&!ca(t.responseBody)){var u=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,u)}if(e.requestWrapper&&t.requestBody&&!ca(t.requestBody)){u=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,u)}}return void 0!==i}),!i))return!1;return!e.requestWrapper||!function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===ra}))return!0}catch(e){}return!1}(o,e.requestWrapper)}function da(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude,i=e.loggerProvider;return t.networkObservable.filter(function(e){return la(e.event,n)}).subscribe(function(e){var t,n,o,a=e.event,c=sa(a.url);if(c){var d=null===(n=a.responseWrapper)||void 0===n?void 0:n.bodySize,f=null===(o=a.requestWrapper)||void 0===o?void 0:o.bodySize;!function(e,t,n,r){s(this,void 0,void 0,function(){var i,o,a;return u(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=l.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch(e){null==r||r.debug("Failed to stringify response body")}s.label=2;case 2:return null==n||n.track(ra,e),[2]}})})}(((t={})["[Amplitude] URL"]=c.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=c.query,t["[Amplitude] URL Fragment"]=c.fragment,t["[Amplitude] Request Method"]=a.method,t["[Amplitude] Status Code"]=a.status,t["[Amplitude] Start Time"]=a.startTime,t["[Amplitude] Completion Time"]=a.endTime,t["[Amplitude] Duration"]=a.duration,t["[Amplitude] Request Body Size"]=f,t["[Amplitude] Response Body Size"]=d,t["[Amplitude] Request Type"]=a.type,t["[Amplitude] Request Headers"]=a.requestHeaders,t["[Amplitude] Response Headers"]=a.responseHeaders,t),a,r,i)}})}!function(e){e.NetworkObservable="networkObservable"}(ea||(ea={}));var fa=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new wn(function(e){var n=new Wt(function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)});return Kt.subscribe(n,t),function(){Kt.unsubscribe(n)}});return(e={})[ea.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var a;return u(this,function(s){return"undefined"!=typeof document||function(){var e,t=B();return"ReactNative"===(null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.product)}()?(a=r(),t=null==i?void 0:i.loggerProvider,ta=da({allObservables:a,networkTrackingOptions:e,amplitude:o,loggerProvider:t}),null==t||t.log("".concat(n," has been successfully added.")),[2]):[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return ta.unsubscribe(),[2]})})}}};let va=-1;const pa=e=>{addEventListener("pageshow",t=>{t.persisted&&(va=t.timeStamp,e(t))},!0)},ha=(e,t,n,r)=>{let i,o;return a=>{t.value>=0&&(a||r)&&(o=t.value-(i??0),(o||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t)))}},ga=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},ma=()=>{const e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},ya=()=>{const e=ma();return e?.activationStart??0},ba=(e,t=-1)=>{const n=ma();let r="navigate";return va>=0?r="back-forward-cache":n&&(document.prerendering||ya()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},wa=new WeakMap;function Ea(e,t){return wa.get(e)||wa.set(e,new t),wa.get(e)}class Sa{t;i=0;o=[];h(e){if(e.hadRecentInput)return;const t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}const ka=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){const r=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},Ta=e=>{let t=!1;return()=>{t||(e(),t=!0)}};let xa=-1;const Pa=new Set,_a=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,Aa=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(const e of Pa)e();isFinite(xa)||(xa="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",Aa,!0))}},Ia=()=>{if(xa<0){const e=ya(),t=document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime;xa=t??_a(),addEventListener("visibilitychange",Aa,!0),addEventListener("prerenderingchange",Aa,!0),pa(()=>{setTimeout(()=>{xa=_a()})})}return{get firstHiddenTime(){return xa},onHidden(e){Pa.add(e)}}},Oa=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},Ca=[1800,3e3],Ra=(e,t={})=>{Oa(()=>{const n=Ia();let r,i=ba("FCP");const o=ka("paint",e=>{for(const t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ya(),0),i.entries.push(t),r(!0)))});o&&(r=ha(e,i,Ca,t.reportAllChanges),pa(n=>{i=ba("FCP"),r=ha(e,i,Ca,t.reportAllChanges),ga(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},Da=[.1,.25];let La=0,Na=1/0,Ma=0;const ja=e=>{for(const t of e)t.interactionId&&(Na=Math.min(Na,t.interactionId),Ma=Math.max(Ma,t.interactionId),La=Ma?(Ma-Na)/7+1:0)};let Ua;const Fa=()=>Ua?La:performance.interactionCount??0;let qa=0;class Ba{u=[];l=new Map;m;p;v(){qa=Fa(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((Fa()-qa)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;const t=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10){const e=this.u.splice(10);for(const t of e)this.l.delete(t.id)}this.p?.(n)}}}const Ha=e=>{const t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(e=Ta(e),addEventListener("visibilitychange",e,{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},za=[200,500],Va=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const n=Ia();Oa(()=>{"interactionCount"in performance||Ua||(Ua=ka("event",ja,{type:"event",buffered:!0,durationThreshold:0}));let r,i=ba("INP");const o=Ea(t,Ba),a=e=>{Ha(()=>{for(const t of e)o.h(t);const t=o.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,r())})},s=ka("event",a,{durationThreshold:t.durationThreshold??40});r=ha(e,i,za,t.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{a(s.takeRecords()),r(!0)}),pa(()=>{o.v(),i=ba("INP"),r=ha(e,i,za,t.reportAllChanges)}))})};class Wa{m;h(e){this.m?.(e)}}const Ga=[2500,4e3],$a=[800,1800],Ka=e=>{document.prerendering?Oa(()=>Ka(e)):"complete"!==document.readyState?addEventListener("load",()=>Ka(e),!0):setTimeout(e)};function Ja(e){var t,n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0;return performance.timeOrigin+n}function Ya(e){return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor(Ja(e)),navigationStart:Math.floor(performance.timeOrigin)}}var Xa,Qa=function(){var e=null,t=B(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return void 0===n||(o=Fe((null==r?void 0:r.href)||"",t.loggerProvider),a={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":Fe((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":Fe(o.split("?")[0],t.loggerProvider)},((e,t={})=>{Oa(()=>{const n=Ia();let r,i=ba("LCP");const o=Ea(t,Wa),a=e=>{t.reportAllChanges||(e=e.slice(-1));for(const t of e)o.h(t),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-ya(),0),i.entries=[t],r())},s=ka("largest-contentful-paint",a);if(s){r=ha(e,i,Ga,t.reportAllChanges);const n=Ta(()=>{a(s.takeRecords()),s.disconnect(),r(!0)}),o=e=>{e.isTrusted&&(Ha(n),removeEventListener(e.type,o,{capture:!0}))};for(const e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});pa(n=>{i=ba("LCP"),r=ha(e,i,Ga,t.reportAllChanges),ga(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})})(function(e){a["[Amplitude] LCP"]=Ya(e)}),Ra(function(e){a["[Amplitude] FCP"]=Ya(e)}),Va(function(e){a["[Amplitude] INP"]=Ya(e)}),((e,t={})=>{const n=Ia();Ra(Ta(()=>{let r,i=ba("CLS",0);const o=Ea(t,Sa),a=e=>{for(const t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,r())},s=ka("layout-shift",a);s&&(r=ha(e,i,Da,t.reportAllChanges),n.onHidden(()=>{a(s.takeRecords()),r(!0)}),pa(()=>{o.i=0,i=ba("CLS",0),r=ha(e,i,Da,t.reportAllChanges),ga(()=>r())}),setTimeout(r))}))})(function(e){a["[Amplitude] CLS"]=Ya(e)}),((e,t={})=>{let n=ba("TTFB"),r=ha(e,n,$a,t.reportAllChanges);Ka(()=>{const i=ma();i&&(n.value=Math.max(i.responseStart-ya(),0),n.entries=[i],r(!0),pa(()=>{n=ba("TTFB",0),r=ha(e,n,$a,t.reportAllChanges),r(!0)}))})})(function(e){a["[Amplitude] TTFB"]=Ya(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",a),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},Za=function(){function e(e,t){var n,r,i;this.shouldTrackNewCampaign=!1,this.options=o({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=(null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain,i=r,i?(i.startsWith(".")&&(i=i.substring(1)),[new RegExp("".concat(i.replace(".","\\."),"$"))]):[]),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=Ge(t.apiKey,"MKTG"),this.webExpStorageKey=Ge(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=C,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,function(){var e,t;return u(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return t=l.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||De(this.sessionTimeout,this.lastEventTime),Rr(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return(e=t.sent())?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||(new Jt).parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,i,a=(t=this.currentCampaign,n=this.options,r=o(o({},C),t),i=Object.entries(r).reduce(function(e,t){var r,i=l(t,2),o=i[0],a=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=a?a:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),a?e.set(o,a):e.unset(o)},new M),Z(i));return e&&(a.event_id=e),a},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),es=new Set([i.IDENTIFY,i.GROUP_IDENTIFY]),ts=function(e){var t;void 0===e&&(e={});var n,r,i,a,c,l,d=null!==(t=e.fallbackAttributionEvent)&&void 0!==t&&t,f=B(),v={},p=!1,h=!1,g=function(){return s(void 0,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,(new Jt).parse()];case 1:return e=t.sent(),v=Be(e),d&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",v)),[2]}})})},m=function(){g()},y=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),p&&m()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){return u(this,function(o){switch(o.label){case 0:return n=t,r=e.loggerProvider,p=!0,r.log("Installing event property attribution tracking."),[4,g()];case 1:if(o.sent(),!f)return[2];if(f.addEventListener("popstate",m),!h){if(i=Reflect.get(f.history,"pushState"),a=Reflect.get(f.history,"replaceState"),!i||!a)return[2];c=y(i),f.history.pushState=c,l=y(a),f.history.replaceState=l,h=!0}return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){return u(this,function(t){return es.has(e.event_type)||(e.event_properties=o(o({},v),e.event_properties)),[2,e]})})},teardown:function(){return s(void 0,void 0,void 0,function(){var e,t;return u(this,function(n){return f&&(f.removeEventListener("popstate",m),e=Reflect.get(f.history,"pushState"),t=Reflect.get(f.history,"replaceState"),h&&e===c&&i&&(f.history.pushState=i),h&&t===l&&a&&(f.history.replaceState=a)),p=!1,h=!1,i=void 0,a=void 0,c=void 0,l=void 0,v={},[2]})})}}},ns="AMP_CURRENT_PAGE",rs="AMP_PREVIOUS_PAGE",is="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(Xa||(Xa={}));var os=new Set([i.IDENTIFY,i.GROUP_IDENTIFY,i.REVENUE]),as=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=B(),i=void 0,a=!1,c=void 0,d=!1,f=!1,v=function(e){var t;try{var n=Fe(e,c);t=new URL(n).hostname}catch(e){null==c||c.error("Could not parse URL: ",e)}return t},p=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?v(e):void 0;if(!r)return Xa.Direct;var i=n.some(function(e){return-1!==t.indexOf(e)}),o=n.some(function(e){return-1!==r.indexOf(e)});return t===r||o&&i?Xa.Internal:Xa.External},h=function(){return s(void 0,void 0,void 0,function(){var e,t,n,r,o;return u(this,function(s){switch(s.label){case 0:return i&&a?[4,i.get(is)]:[3,3];case 1:return e=s.sent(),t=Fe("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[ns])||"",r=void 0,r=t===n?(null==e?void 0:e[rs])||"":n||(document.referrer||""),[4,i.set(is,(o={},o[ns]=t,o[rs]=r,o))];case 2:s.sent(),s.label=3;case 3:return[2]}})})},g=function(){h()},m={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return s(void 0,void 0,void 0,function(){var t,n,o,s,p,m,y,b;return u(this,function(u){switch(u.label){case 0:if((c=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),f=!0,!r)return[3,7];try{i=new $e(r.sessionStorage)}catch(e){null==c||c.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:return a=null!==(b=u.sent())&&void 0!==b&&b,i&&a?(t="undefined"!=typeof document&&document.referrer||"",n=t?v(t):void 0,o="undefined"!=typeof location&&location.hostname||"",s=Fe("undefined"!=typeof location&&location.href||""),[4,i.get(is)]):[3,6];case 2:return p=u.sent(),m=(null==p?void 0:p[ns])||"",!!n&&n!==o&&m!==s?[4,i.set(is,(y={},y[ns]=s,y[rs]=t,y))]:[3,4];case 3:return u.sent(),[3,6];case 4:return[4,h()];case 5:u.sent(),u.label=6;case 6:r.addEventListener("popstate",g),d||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=l(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),f&&g()}}),d=!0),u.label=7;case 7:return[2]}})})},execute:function(e){return s(void 0,void 0,void 0,function(){var t,n,r;return u(this,function(s){switch(s.label){case 0:return t=Fe("undefined"!=typeof location&&location.href||""),i&&a?[4,i.get(is)]:[3,2];case 1:if(n=s.sent(),r=(null==n?void 0:n[rs])||"",os.has(e.event_type))return[2,e];e.event_properties=o(o({},e.event_properties||{}),{"[Amplitude] Page Domain":ss(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":ss(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":ss(e,"[Amplitude] Page Path","undefined"!=typeof location&&Fe(location.pathname)||""),"[Amplitude] Page Title":ss(e,"[Amplitude] Page Title",nn(tn)),"[Amplitude] Page URL":ss(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":p(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){switch(e.label){case 0:return r&&(r.removeEventListener("popstate",g),f=!1),i&&a?[4,i.set(is,{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})}};return m};function ss(e,t,n){return e.event_properties||(e.event_properties={}),void 0===e.event_properties[t]?n:e.event_properties[t]}var us=function(){var e,t,n;function r(t){if(t)try{var n=new Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}var i={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return s(void 0,void 0,void 0,function(){var o,a;return u(this,function(s){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null===(a=i.remoteConfig)||void 0===a?void 0:a.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&function(e){return"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body}(e)?r(e.body||""):r("")}),t=function(){var e;return null===(e=i.remoteConfigClient)||void 0===e?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return s(void 0,void 0,void 0,function(){var r;return u(this,function(i){if(n)try{return[2,null!==(r=n(t))&&void 0!==r?r:null]}catch(n){return null==e||e.error("Could not execute custom enrichment function",n),[2,t]}return[2,t]})})},teardown:function(){return s(void 0,void 0,void 0,function(){return u(this,function(e){return t&&t(),[2]})})}};return i},cs="userProperty",ls="eventProperty",ds=function(e){return e===cs||e===ls},fs=[cs,ls],vs=function(e,t){return function(e){var t=d([],l(new Set((Array.isArray(e)?e:[e]).filter(ds))),!1);return t.length>0?t:d([],l(fs),!1)}(e.trackingMethod).includes(t)},ps=function(e){return vs(e,cs)},hs=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return n(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>2?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),ee(this._init(o(o({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,c,l,d,f,v;return s(this,void 0,void 0,function(){var p,h,g,m,y,b,w,E,S,k,T,x,P,_,A,I=this;return u(this,function(O){switch(O.label){case 0:return this.initializing?[2]:(this.initializing=!0,p=function(e){var t,n;return void 0===e&&(e={}),!0===(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)||!1!==(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)&&!1!==e.fetchRemoteConfig}(t),h=null!==(n=t.loggerProvider)&&void 0!==n?n:new oe,t.loggerProvider||h.enable(null!==(r=t.logLevel)&&void 0!==r?r:re.Warn),g=null!==(i=t.serverZone)&&void 0!==i?i:"US",y=this._diagnosticsSampleRate,b=null===(c=t.enableDiagnostics)||void 0===c||c,p?(m=new pt(t.apiKey,h,g,null===(l=t.remoteConfig)||void 0===l?void 0:l.serverUrl),[4,new Promise(function(e){null==m||m.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(y=i);var o=t.enabled;"boolean"==typeof o&&(b=o)}e()})})]):[3,2]);case 1:O.sent(),O.label=2;case 2:return(w=new at(t.apiKey,h,g,{enabled:b,sampleRate:y})).setTag("library","".concat(ir,"/").concat(rr)),w.setTag("platform","Web"),w.setTag("web_environment",function(){var e=B();if(!e)return"unknown";var t=function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.chrome)||void 0===t?void 0:t.runtime)||void 0===n?void 0:n.id)}(e);return function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?t?"chrome_extension_service_worker":"service_worker":function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t}(e)?"web_worker":function(e){return void 0!==e.document}(e)?t?"chrome_extension":"browser":function(e){var t,n;return"string"==typeof(null===(n=null===(t=e.process)||void 0===t?void 0:t.versions)||void 0===n?void 0:n.node)}(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&w.setTag("user_agent",navigator.userAgent),[4,qr(t.apiKey,t,this,w,{loggerProvider:h,serverZone:g,enableDiagnostics:b,diagnosticsSampleRate:y})];case 3:return E=O.sent(),p&&m?[4,new Promise(function(e){null==m||m.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&ti(t,E),e()})})]:[3,5];case 4:O.sent(),O.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return O.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=m,D=this.config,S=Hn(D.defaultTracking)&&D.defaultTracking&&"object"==typeof D.defaultTracking&&D.defaultTracking.attribution&&"object"==typeof D.defaultTracking.attribution?o({},D.defaultTracking.attribution):{},Hn(this.config.defaultTracking)&&ps(S)?(this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(I,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[3,2]:(this.webAttribution=new Za(S,this.config),[4,this.webAttribution.init()]);case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new Za(S,this.config),[4,this.webAttribution.init()]):[3,8];case 7:O.sent(),O.label=8;case 8:return k=Me(),T=k.ampTimestamp?Number(k.ampTimestamp):void 0,x=!T||Date.now()<T,P=x&&!Number.isNaN(Number(k.ampSessionId))?Number(k.ampSessionId):void 0,-1!==(_=this.config.deferredSessionId)||this.config.optOut||(_=Date.now()),this.setSessionId(null!==(v=null!==(f=null!==(d=t.sessionId)&&void 0!==d?d:P)&&void 0!==f?f:_)&&void 0!==v?v:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return s(I,void 0,void 0,function(){return u(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(A=Ce(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,10]:[4,this.add(ei()).promise];case 9:O.sent(),O.label=10;case 10:return[4,this.add(new we({diagnosticsClient:w})).promise];case 11:return O.sent(),[4,this.add(new or).promise];case 12:return O.sent(),[4,this.add(new Re).promise];case 13:return O.sent(),function(e){Zr||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."),Zr=!0)}(this.config),R=this.config.defaultTracking,Bn(R,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Qr()).promise]):[3,15];case 14:O.sent(),O.label=15;case 15:return zn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Jr()).promise]):[3,17];case 16:O.sent(),O.label=17;case 17:return Vn(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Wr(Zn(this.config))).promise]):[3,20];case 18:return O.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return s(I,void 0,void 0,function(){return u(this,function(t){switch(t.label){case 0:return e?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Wr(Zn(this.config))).promise]);case 1:return t.sent(),[2]}})})}),O.label=20;case 20:return Hn(this.config.defaultTracking)&&function(e){return vs(e,ls)}(S)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(ts(S)).promise]):[3,22];case 21:O.sent(),O.label=22;case 22:return $n(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(No(Yn(this.config),{diagnosticsClient:w})).promise]):[3,24];case 23:O.sent(),O.label=24;case 24:return Kn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Jo(Xn(this.config))).promise]):[3,26];case 25:O.sent(),O.label=26;case 26:return Gn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(fa(Qn(this.config))).promise]):[3,28];case 27:O.sent(),O.label=28;case 28:return function(e){return"boolean"==typeof e?e:"object"==typeof e&&!0===e.webVitals}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(Qa()).promise]):[3,30];case 29:O.sent(),O.label=30;case 30:return function(e){return"object"==typeof e&&(!0===e.performanceTracking||"object"==typeof e.performanceTracking)}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(na(Jn(this.config))).promise]):[3,32];case 31:O.sent(),O.label=32;case 32:return function(e){return Bn(e,"pageUrlEnrichment")}(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(as()).promise]):[3,34];case 33:O.sent(),O.label=34;case 34:return("boolean"==typeof(C=this.config.customEnrichment)?C:"object"==typeof C&&null!==C&&!1!==C.enabled)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(us()).promise]):[3,36];case 35:O.sent(),O.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return O.sent(),A.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=a(t,["time"]),i="number"==typeof n?{time:n}:void 0;I.track(e.eventType,r,i)}),[2]}var C,R,D})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){Ce(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){Ce(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(z()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){var t,n,r;if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var i=new M,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var a=c(Object.entries(o)),s=a.next();!s.done;s=a.next()){var u=l(s.value,2),d=u[0],f=u[1];i.set(d,f)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),ee(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,ee(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return ee(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var r=this.getSessionId();r!==e&&this.timeline.onSessionIdChanged(e);var i=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,Wn(this.config.defaultTracking)&&(r&&i&&n.push(this.track(wr,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 a=this.trackCampaignEventIfNeeded(++o,n);return this.config.identify&&n.push(this.track(Z(this.config.identify)).promise),Wn(this.config.defaultTracking)&&n.push(this.track(br,void 0,{event_id:a?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,ee(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=Hr(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(nr(t)){var r=t._q;t._q=[],t=tr(new M,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(nr(r)){var o=r._q;r._q=[],r=tr(new M,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(nr(t)){var r=t._q;t._q=[],t=tr(new ne,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!ps(this.webAttribution.options))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 s(this,void 0,void 0,function(){var n,r,i;return u(this,function(o){return n=Date.now(),r=De(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===br||t.event_type===wr||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=o(o({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",X(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){e>1||e<0||this.config||(this._diagnosticsSampleRate=e)},t}(te),gs=function(){var e=new hs;return{init:me(e.init.bind(e),"init",pe(e),ge(e,["config"])),add:me(e.add.bind(e),"add",pe(e),ge(e,["config.apiKey","timeline.plugins"])),remove:me(e.remove.bind(e),"remove",pe(e),ge(e,["config.apiKey","timeline.plugins"])),track:me(e.track.bind(e),"track",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),logEvent:me(e.logEvent.bind(e),"logEvent",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),identify:me(e.identify.bind(e),"identify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),groupIdentify:me(e.groupIdentify.bind(e),"groupIdentify",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),setGroup:me(e.setGroup.bind(e),"setGroup",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),revenue:me(e.revenue.bind(e),"revenue",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),flush:me(e.flush.bind(e),"flush",pe(e),ge(e,["config.apiKey","timeline.queue.length"])),getUserId:me(e.getUserId.bind(e),"getUserId",pe(e),ge(e,["config","config.userId"])),setUserId:me(e.setUserId.bind(e),"setUserId",pe(e),ge(e,["config","config.userId"])),getDeviceId:me(e.getDeviceId.bind(e),"getDeviceId",pe(e),ge(e,["config","config.deviceId"])),setDeviceId:me(e.setDeviceId.bind(e),"setDeviceId",pe(e),ge(e,["config","config.deviceId"])),reset:me(e.reset.bind(e),"reset",pe(e),ge(e,["config","config.userId","config.deviceId"])),getSessionId:me(e.getSessionId.bind(e),"getSessionId",pe(e),ge(e,["config"])),setSessionId:me(e.setSessionId.bind(e),"setSessionId",pe(e),ge(e,["config"])),extendSession:me(e.extendSession.bind(e),"extendSession",pe(e),ge(e,["config"])),setOptOut:me(e.setOptOut.bind(e),"setOptOut",pe(e),ge(e,["config"])),setTransport:me(e.setTransport.bind(e),"setTransport",pe(e),ge(e,["config"])),getIdentity:me(e.getIdentity.bind(e),"getIdentity",pe(e),ge(e,["config"])),setIdentity:me(e.setIdentity.bind(e),"setIdentity",pe(e),ge(e,["config","config.userId","config.deviceId"])),getOptOut:me(e.getOptOut.bind(e),"getOptOut",pe(e),ge(e,["config"])),_setDiagnosticsSampleRate:me(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",pe(e),ge(e,["config"]))}},ms=gs(),ys=function(){function e(e){this.amplitude=e,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(e){return this.videoEl=e,this},e.prototype.withEmbeddedPlayer=function(e){return this.embeddedVideoPlayer=e,this},e.prototype.withVendor=function(e){return this.vendor=e,this},e.prototype.withExtraEventProperties=function(e){return this.extraEventProperties=e,this},e.prototype.captureVideoStarted=function(){var e=this;return this.listeners.push(function(t,n){"playing"!==t.playbackState&&"playing"===n.playbackState&&e.amplitude.track("Video Content Started",o(o({},n.lastEvent),e.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var e=this;return this.listeners.push(function(t,n){"playing"===t.playbackState&&"playing"!==n.playbackState&&e.amplitude.track("Video Content Stopped",o(o(o({},n.lastEvent),{watch_duration:n.watchTime}),e.extraEventProperties))}),this},e.prototype.start=function(){var e,t=this,n=null!==(e=this.videoEl)&&void 0!==e?e:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var r=new Un({videoEl:n,onStateChange:function(e,n){t.listeners.forEach(function(t){return t(e,n)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){r.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(e){return e()}),this.onRemoveListeners=[]},e}();var bs=ms.add,ws=ms.extendSession,Es=ms.flush,Ss=ms.getDeviceId,ks=ms.getIdentity,Ts=ms.getOptOut,xs=ms.getSessionId,Ps=ms.getUserId,_s=ms.groupIdentify,As=ms.identify,Is=ms.init,Os=ms.logEvent,Cs=ms.remove,Rs=ms.reset,Ds=ms.revenue,Ls=ms.setDeviceId,Ns=ms.setGroup,Ms=ms.setIdentity,js=ms.setOptOut,Us=ms.setSessionId,Fs=ms.setTransport,qs=ms.setUserId,Bs=ms.track,Hs=ms._setDiagnosticsSampleRate,zs=Object.freeze({__proto__:null,add:bs,extendSession:ws,flush:Es,getDeviceId:Ss,getIdentity:ks,getOptOut:Ts,getSessionId:xs,getUserId:Ps,groupIdentify:_s,identify:As,init:Is,logEvent:Os,remove:Cs,reset:Rs,revenue:Ds,setDeviceId:Ls,setGroup:Ns,setIdentity:Ms,setOptOut:js,setSessionId:Us,setTransport:Fs,setUserId:qs,track:Bs,_setDiagnosticsSampleRate:Hs,createInstance:gs,AmplitudeBrowser:hs,runQueuedFunctions:er,Revenue:ne,Identify:M,trackVideo:function(e,t,n){var r;void 0===n&&(n={});var i=new ys(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),n.vendor&&i.withVendor(n.vendor);var a=null!==(r=n.extraEventProperties)&&void 0!==r?r:{};try{i.withExtraEventProperties(o({view_session_id:z()},a)).captureVideoStarted().captureVideoStopped().start()}catch(e){return e}return function(){return i.stop()}},Types:Or});!function(){var e=B();if(e){var t=function(e){var t=gs(),n=B();return n&&n.amplitudeGTM&&n.amplitudeGTM._iq&&e&&(n.amplitudeGTM._iq[e]=t),t};if(e.amplitudeGTM=Object.assign(e.amplitudeGTM||{},zs,{createInstance:t}),e.amplitudeGTM.invoked){var n=e.amplitudeGTM._q;e.amplitudeGTM._q=[],er(zs,n);for(var r=Object.keys(e.amplitudeGTM._iq)||[],i=0;i<r.length;i++){var o=r[i],a=Object.assign(e.amplitudeGTM._iq[o],t(o)),s=a._q;a._q=[],er(a,s)}}}else console.error("[Amplitude] Error: GlobalScope is not defined")}()}();
|
|
2
2
|
//# sourceMappingURL=amplitude-gtm-min.js.map
|