From 619f218135307862b41933b5695b1807e273392f Mon Sep 17 00:00:00 2001 From: jaredvu Date: Tue, 8 Jul 2025 10:07:07 -0700 Subject: [PATCH 1/5] amplitude 2 cdn script --- scripts/inject-amplitude.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/scripts/inject-amplitude.js b/scripts/inject-amplitude.js index 72b35173e7..6de93aeaf7 100644 --- a/scripts/inject-amplitude.js +++ b/scripts/inject-amplitude.js @@ -4,7 +4,7 @@ import { fileURLToPath } from 'url'; const AMPLITUDE_API_KEY = process.env.AMPLITUDE_API_KEY; const AMPLITUDE_SERVER_URL = process.env.AMPLITUDE_SERVER_URL; -const AMPLITUDE_SERVER_ZONE = process.env.AMPLITUDE_SERVER_ZONE || "US"; +const AMPLITUDE_SERVER_ZONE = process.env.AMPLITUDE_SERVER_ZONE || 'US'; const currentPath = fileURLToPath(import.meta.url); const projectRoot = path.dirname(currentPath); @@ -14,7 +14,7 @@ if (AMPLITUDE_API_KEY) { const files = await fs.readdir('entry-points'); for (const file of files) { inject(file); - }; + } } catch (err) { console.error('Error injecting Amplitude scripts:', err); } @@ -24,22 +24,24 @@ async function inject(fileName) { const htmlFilePath = path.resolve(projectRoot, `../dist/entry-points/${fileName}`); const html = await fs.readFile(htmlFilePath, 'utf-8'); - const amplitudeCdnScript = ` - `; + const amplitudeCdnScript = + AMPLITUDE_SERVER_ZONE === 'US' + ? `` + : ``; const amplitudeListenerScript = `` - : ``; + ? `` + : ``; const amplitudeListenerScript = `` diff --git a/src/hooks/tradingView/useTradingViewLaunchable.ts b/src/hooks/tradingView/useTradingViewLaunchable.ts index 368c3fb7cf..bfeafae624 100644 --- a/src/hooks/tradingView/useTradingViewLaunchable.ts +++ b/src/hooks/tradingView/useTradingViewLaunchable.ts @@ -70,7 +70,6 @@ export const useTradingViewLaunchable = ({ symbol: marketId, saved_data: !isEmpty(savedTvChartConfig) ? savedTvChartConfig : undefined, auto_save_delay: 1, - disabled_features: [...(widgetOptions.disabled_features ?? []), 'chart_scroll'], }; const tvChartWidget = new Widget(options); From 47195418e6bd881f221dd892c6951b58c9949bec Mon Sep 17 00:00:00 2001 From: jaredvu Date: Mon, 14 Jul 2025 10:16:08 -0700 Subject: [PATCH 4/5] add script --- public/libs/amplitude-analytics-browser-2.0.0-min.js | 1 - public/libs/amplitude-analytics-browser-2.18.2-min.js | 1 - public/libs/amplitude-script-eu-min.js | 6 ++++++ scripts/inject-amplitude.js | 6 +----- 4 files changed, 7 insertions(+), 7 deletions(-) delete mode 100644 public/libs/amplitude-analytics-browser-2.0.0-min.js delete mode 100644 public/libs/amplitude-analytics-browser-2.18.2-min.js create mode 100644 public/libs/amplitude-script-eu-min.js diff --git a/public/libs/amplitude-analytics-browser-2.0.0-min.js b/public/libs/amplitude-analytics-browser-2.0.0-min.js deleted file mode 100644 index 80b8ab72f1..0000000000 --- a/public/libs/amplitude-analytics-browser-2.0.0-min.js +++ /dev/null @@ -1 +0,0 @@ -!function(){"use strict";var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0&&r[r.length-1])||6!==u[0]&&2!==u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function a(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r1e3)return!1;for(var t in e){var n=e[t];if(!A(t,n))return!1}return!0},A=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;if(Array.isArray(a))return!1;if("object"==typeof a)r=r&&L(a);else if(!["number","string"].includes(typeof a))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.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},j=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return n({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(c.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(c.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(c.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(c.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(c.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(c.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(c.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(c.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(c.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[c.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var i=this._properties[e];return void 0===i&&(i={},this._properties[e]=i),i[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[c.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===c.ADD?"number"==typeof n:e===c.UNSET||e===c.REMOVE||A(t,n)))},e}(),C=function(e,t){return n(n({},t),{event_type:d.IDENTIFY,user_properties:e.getUserProperties()})},M=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=v.Unknown),{event:e,code:t,message:n}},V=function(e){return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,V)},F=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i,s;return r(this,void 0,void 0,(function(){return o(this,(function(r){switch(r.label){case 0:return e.name=null!==(n=e.name)&&void 0!==n?n:V(),e.type=null!==(i=e.type)&&void 0!==i?i:"enrichment",[4,null===(s=e.setup)||void 0===s?void 0:s.call(e,t,this.client)];case 1:return r.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e){return this.plugins.splice(this.plugins.findIndex((function(t){return t.name===e})),1),Promise.resolve()},e.prototype.reset=function(e){this.applying=!1,this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return r(this,void 0,void 0,(function(){var t,i,r,a,c,l,d,f,p,v,h,g,y,m,b,_,I,S,w,E;return o(this,(function(o){switch(o.label){case 0:if(!e)return[2];t=u(e,1),i=t[0],r=u(e,2),a=r[1],c=this.plugins.filter((function(e){return"before"===e.type})),o.label=1;case 1:o.trys.push([1,6,7,8]),l=s(c),d=l.next(),o.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(n({},i))]:[3,4];case 3:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=o.sent(),I={error:f},[3,8];case 7:try{d&&!d.done&&(S=l.return)&&S.call(l)}finally{if(I)throw I.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),o.label=9;case 9:o.trys.push([9,14,15,16]),v=s(p),h=v.next(),o.label=10;case 10:return h.done?[3,13]:(g=h.value).execute?[4,g.execute(n({},i))]:[3,12];case 11:if(null===(y=o.sent()))return a({event:i,code:0,message:""}),[2];i=y,o.label=12;case 12:return h=v.next(),[3,10];case 13:return[3,16];case 14:return m=o.sent(),w={error:m},[3,16];case 15:try{h&&!h.done&&(E=v.return)&&E.call(v)}finally{if(w)throw w.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),_=b.map((function(e){var t=n({},i);return e.execute(t).catch((function(e){return M(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=u(e,1)[0];a(t)})),[2]}}))}))},e.prototype.flush=function(){return r(this,void 0,void 0,(function(){var e,t,n,i=this;return o(this,(function(r){switch(r.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return i.apply(e)})))];case 1:return r.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 r.sent(),[2]}}))}))},e}(),Q="Event rejected due to exceeded retry count",$=function(e){return{promise:e||Promise.resolve()}},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new F(this),this.name=e}return e.prototype._init=function(e){return r(this,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return r(this,void 0,void 0,(function(){var t,n,i,r,u,a;return o(this,(function(o){switch(o.label){case 0:t=this[e],this[e]=[],o.label=1;case 1:o.trys.push([1,6,7,8]),n=s(t),i=n.next(),o.label=2;case 2:return i.done?[3,5]:[4,(0,i.value)()];case 3:o.sent(),o.label=4;case 4:return i=n.next(),[3,2];case 5:return[3,8];case 6:return r=o.sent(),u={error:r},[3,8];case 7:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 8:return[2]}}))}))},e.prototype.track=function(e,t,i){var r=function(e,t,i){return n(n(n({},"string"==typeof e?{event_type:e}:e),i),t&&{event_properties:t})}(e,t,i);return $(this.dispatch(r))},e.prototype.identify=function(e,t){var n=C(e,t);return $(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,i,r){var o=function(e,t,i,r){var o;return n(n({},r),{event_type:d.GROUP_IDENTIFY,group_properties:i.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,i,r);return $(this.dispatch(o))},e.prototype.setGroup=function(e,t,i){var r=function(e,t,i){var r,o=new j;return o.set(e,t),n(n({},i),{event_type:d.IDENTIFY,user_properties:o.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,i);return $(this.dispatch(r))},e.prototype.revenue=function(e,t){var i=function(e,t){return n(n({},t),{event_type:d.REVENUE,event_properties:e.getEventProperties()})}(e,t);return $(this.dispatch(i))},e.prototype.add=function(e){return this.config?$(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),$())},e.prototype.remove=function(e){return this.config?$(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),$())},e.prototype.dispatchWithCallback=function(e,t){if(!this.config)return t(M(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return r(this,void 0,void 0,(function(){var t=this;return o(this,(function(n){return this.config?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,M(e,0,"Event skipped due to optOut config")]:[4,this.timeline.push(e)];case 1:return 200===(i=r.sent()).code?this.config.loggerProvider.log(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return t=r.sent(),n=String(t),this.config.loggerProvider.error(n),[2,i=M(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.config?this.config.optOut=Boolean(e):this.q.push(this.setOptOut.bind(this,Boolean(e)))},e.prototype.flush=function(){return $(this.timeline.flush())},e}(),B=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.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return L(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?n({},this.properties):{};return e[l.REVENUE_PRODUCT_ID]=this.productId,e[l.REVENUE_QUANTITY]=this.quantity,e[l.REVENUE_PRICE]=this.price,e[l.REVENUE_TYPE]=this.revenueType,e[l.REVENUE]=this.revenue,e},e}(),z="Amplitude Logger ",W=function(){function e(){this.logLevel=f.None}return e.prototype.disable=function(){this.logLevel=f.None},e.prototype.enable=function(e){void 0===e&&(e=f.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t0&&Promise.all(n.map((function(e){return i.execute(e)}))).catch(),[2,Promise.resolve(void 0)]}}))}))},e.prototype.execute=function(e){var t=this;return new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.addToQueue(i)}))},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n0&&t.schedule(e)}))}),e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),r(this,void 0,void 0,(function(){var t,n,i,r=this;return o(this,(function(o){switch(o.label){case 0:return t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),this.queue=n,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),s=t,u=this.config.flushQueueSize,a=Math.max(u,1),i=s.reduce((function(e,t,n){var i=Math.floor(n/a);return e[i]||(e[i]=[]),e[i].push(t),e}),[]),[4,Promise.all(i.map((function(t){return r.send(t,e)})))];case 1:return o.sent(),[2]}var s,u,a}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),r(this,void 0,void 0,(function(){var n,r,s,u,a;return o(this,(function(o){switch(o.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,i(t,["extra"])})),options:{min_id_length:this.config.minIdLength}},o.label=1;case 1:return o.trys.push([1,3,,4]),r=Y(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(s=o.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(H(s))):this.fulfillRequest(e,s.statusCode,s.status),[2]);case 3:return u=o.sent(),a=(c=u)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.fulfillRequest(e,0,a),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case v.Success:this.handleSuccessResponse(e,t);break;case v.Invalid:this.handleInvalidResponse(e,t);break;case v.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case v.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var i=a(a(a(a([],u(Object.values(e.body.eventsWithInvalidFields)),!1),u(Object.values(e.body.eventsWithMissingFields)),!1),u(Object.values(e.body.eventsWithInvalidIdLengths)),!1),u(e.body.silencedEvents),!1).flat(),r=new Set(i),o=t.filter((function(t,i){if(!r.has(i))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(o),!1))}},e.prototype.handlePayloadTooLargeResponse=function(e,t){1!==t.length?(this.config.loggerProvider.warn(H(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,a([],u(t),!1))):this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),c=new Set(r),l=new Set(o),d=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&c.has(t.event.device_id)))return l.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));d.length>0&&this.config.loggerProvider.warn(H(e)),this.addToQueue.apply(this,a([],u(d),!1))},e.prototype.handleOtherResponse=function(e){var t=this;this.addToQueue.apply(this,a([],u(e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e}))),!1))},e.prototype.fulfillRequest=function(e,t,n){this.saveEvents(),e.forEach((function(e){return e.callback(M(e.event,t,n))}))},e.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map((function(e){return e.event})));this.config.storageProvider.set(this.storageKey,e)}},e}(),ee=function(e){return void 0===e&&(e=0),((new Error).stack||"").split("\n").slice(2+e).map((function(e){return e.trim()}))},te=function(e){return function(){var t=n({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ne=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=s(t.split(".")),o=r.next();!o.done;o=r.next()){var u=o.value;if(!(u in e))return;e=e[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},ie=function(e,t){return function(){var n,i,r={};try{for(var o=s(t),u=o.next();!u.done;u=o.next()){var a=u.value;r[a]=ne(e,a)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},re=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],s=0;s=200&&e<300?v.Success:429===e?v.RateLimit:413===e?v.PayloadTooLarge:408===e?v.Timeout:e>=400&&e<500?v.Invalid:e>=500?v.Failed:v.Unknown},e}(),ue=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[q,t,e.substring(0,n)].filter(Boolean).join("_")},ae=function(){function e(e){this.options=n({},e)}return e.prototype.isEnabled=function(){return r(this,void 0,void 0,(function(){var t,n,i;return o(this,(function(r){switch(r.label){case 0:if(!h())return[2,!1];t=String(Date.now()),n=new e(this.options),i="AMP_TEST",r.label=1;case 1:return r.trys.push([1,4,5,7]),[4,n.set(i,t)];case 2:return r.sent(),[4,n.get(i)];case 3:return[2,r.sent()===t];case 4:return r.sent(),[2,!1];case 5:return[4,n.remove(i)];case 6:return r.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];try{try{t=decodeURIComponent(atob(t))}catch(e){}return[2,JSON.parse(t)]}catch(e){return[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t;return r(this,void 0,void 0,(function(){var n,i,r;return o(this,(function(o){return n=h(),i=null!==(t=null==n?void 0:n.document.cookie.split("; "))&&void 0!==t?t:[],(r=i.find((function(t){return 0===t.indexOf(e+"=")})))?[2,r.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return r(this,void 0,void 0,(function(){var i,r,s,u,a,c;return o(this,(function(o){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,s=void 0,(r=null!==t?i:-1)&&((u=new Date).setTime(u.getTime()+24*r*60*60*1e3),s=u),a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),s&&(a+="; expires=".concat(s.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite)),(c=h())&&(c.document.cookie=a)}catch(e){}return[2]}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return o(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 r(this,void 0,void 0,(function(){return o(this,(function(e){return[2]}))}))},e}(),ce=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return r(this,void 0,void 0,(function(){var n,i;return o(this,(function(r){switch(r.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,r.sent().json()];case 2:return i=r.sent(),[2,this.buildResponse(i)]}}))}))},n}(se),le=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:de(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),de=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},fe=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}(),pe=function(){return pe=Object.assign||function(e){for(var t,n=1,i=arguments.length;n=0;--s)i.push(n.slice(s).join("."));s=0,o.label=2;case 2:return s2?(r=t,o=i):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),$(this._init(n(n({},o),{userId:r,apiKey:e})))},i.prototype._init=function(t){var i,s;return r(this,void 0,void 0,(function(){var u,a,c,l,d=this;return o(this,(function(f){switch(f.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Ge(t.apiKey,t,this)]);case 1:return u=f.sent(),[4,e.prototype._init.call(this,u)];case 2:return f.sent(),this.setSessionId(null!==(s=null!==(i=t.sessionId)&&void 0!==i?i:this.config.sessionId)&&void 0!==s?s:Date.now()),(a=me(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),[4,this.add(new X).promise];case 3:return f.sent(),[4,this.add(new ke).promise];case 4:return f.sent(),[4,this.add(new be).promise];case 5:return f.sent(),v=this.config.defaultTracking,Ie(v,"fileDownloads")?[4,this.add({name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(e,t){return r(void 0,void 0,void 0,(function(){var n,i;return o(this,(function(r){return t?(n=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r=i.exec(n.href),o=null==r?void 0:r[1];o&&e.addEventListener("click",(function(){var i;o&&t.track(je,((i={})[Ve]=o,i[Fe]=n.pathname,i[Qe]=e.id,i[$e]=e.text,i[Ke]=e.href,i))}))},i=/\.(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(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))}}).promise]:[3,7];case 6:f.sent(),f.label=7;case 7:return function(e){return Ie(e,"formInteractions")}(this.config.defaultTracking)?[4,this.add({name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(e,t){return r(void 0,void 0,void 0,(function(){var n;return o(this,(function(i){return t?(n=function(e){var n=!1;e.addEventListener("change",(function(){var i;n||t.track(Le,((i={})[Be]=e.id,i[ze]=e.name,i[We]=e.action,i)),n=!0}),{}),e.addEventListener("submit",(function(){var i,r;n||t.track(Le,((i={})[Be]=e.id,i[ze]=e.name,i[We]=e.action,i)),t.track(Ae,((r={})[Be]=e.id,r[ze]=e.name,r[We]=e.action,r)),n=!1}))},Array.from(document.getElementsByTagName("form")).forEach(n),"undefined"!=typeof MutationObserver&&new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&n(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(n)}))}))})).observe(document.body,{subtree:!0,childList:!0}),[2]):(e.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])}))}))},execute:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){return[2,e]}))}))}}).promise]:[3,9];case 8:f.sent(),f.label=9;case 9:return Se(this.config.defaultTracking)?(p=this.config,c=Se(p.defaultTracking)&&p.defaultTracking&&"object"==typeof p.defaultTracking&&p.defaultTracking.attribution&&"object"==typeof p.defaultTracking.attribution?n({},p.defaultTracking.attribution):{},l=nt(c),[4,this.add(l).promise]):[3,11];case 10:f.sent(),f.label=11;case 11:return[4,this.add(rt(we(this.config))).promise];case 12:return f.sent(),this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 13:return f.sent(),a.eventBridge.setEventReceiver((function(e){d.track(e.eventType,e.eventProperties)})),[2]}var p,v}))}))},i.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},i.prototype.setUserId=function(e){this.config?e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){me(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setUserId.bind(this,e))},i.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},i.prototype.setDeviceId=function(e){this.config?(this.config.deviceId=e,function(e,t){me(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},i.prototype.reset=function(){this.setDeviceId(V()),this.setUserId(void 0)},i.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},i.prototype.setSessionId=function(e){var t;if(this.config){if(e!==this.config.sessionId){var n,i=this.getSessionId(),r=this.config.lastEventTime,o=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,n=this.config.defaultTracking,Ie(n,"sessions")&&(i&&r&&this.track(Me,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}),this.config.lastEventTime=this.config.sessionId,this.track(Ce,void 0,{event_id:++o,session_id:this.config.sessionId,time:this.config.lastEventTime})),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId}}else this.q.push(this.setSessionId.bind(this,e))},i.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},i.prototype.setTransport=function(e){this.config?this.config.transportProvider=He(e):this.q.push(this.setTransport.bind(this,e))},i.prototype.identify=function(t,n){if(Te(t)){var i=t._q;t._q=[],t=Oe(new j,i)}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)},i.prototype.groupIdentify=function(t,n,i,r){if(Te(i)){var o=i._q;i._q=[],i=Oe(new j,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},i.prototype.revenue=function(t,n){if(Te(t)){var i=t._q;t._q=[],t=Oe(new B,i)}return e.prototype.revenue.call(this,t,n)},i.prototype.process=function(t){return r(this,void 0,void 0,(function(){var n,i,r;return o(this,(function(o){return n=Date.now(),i=this.config.lastEventTime||Date.now(),r=n-i,t.event_type!==Ce&&t.event_type!==Me&&(!t.session_id||t.session_id===this.getSessionId())&&r>this.config.sessionTimeout&&this.setSessionId(n),[2,e.prototype.process.call(this,t)]}))}))},i}(K),ct=function(){var e=new at;return{init:re(e.init.bind(e),"init",te(e),ie(e,["config"])),add:re(e.add.bind(e),"add",te(e),ie(e,["config.apiKey","timeline.plugins"])),remove:re(e.remove.bind(e),"remove",te(e),ie(e,["config.apiKey","timeline.plugins"])),track:re(e.track.bind(e),"track",te(e),ie(e,["config.apiKey","timeline.queue.length"])),logEvent:re(e.logEvent.bind(e),"logEvent",te(e),ie(e,["config.apiKey","timeline.queue.length"])),identify:re(e.identify.bind(e),"identify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),groupIdentify:re(e.groupIdentify.bind(e),"groupIdentify",te(e),ie(e,["config.apiKey","timeline.queue.length"])),setGroup:re(e.setGroup.bind(e),"setGroup",te(e),ie(e,["config.apiKey","timeline.queue.length"])),revenue:re(e.revenue.bind(e),"revenue",te(e),ie(e,["config.apiKey","timeline.queue.length"])),flush:re(e.flush.bind(e),"flush",te(e),ie(e,["config.apiKey","timeline.queue.length"])),getUserId:re(e.getUserId.bind(e),"getUserId",te(e),ie(e,["config","config.userId"])),setUserId:re(e.setUserId.bind(e),"setUserId",te(e),ie(e,["config","config.userId"])),getDeviceId:re(e.getDeviceId.bind(e),"getDeviceId",te(e),ie(e,["config","config.deviceId"])),setDeviceId:re(e.setDeviceId.bind(e),"setDeviceId",te(e),ie(e,["config","config.deviceId"])),reset:re(e.reset.bind(e),"reset",te(e),ie(e,["config","config.userId","config.deviceId"])),getSessionId:re(e.getSessionId.bind(e),"getSessionId",te(e),ie(e,["config"])),setSessionId:re(e.setSessionId.bind(e),"setSessionId",te(e),ie(e,["config"])),extendSession:re(e.extendSession.bind(e),"extendSession",te(e),ie(e,["config"])),setOptOut:re(e.setOptOut.bind(e),"setOptOut",te(e),ie(e,["config"])),setTransport:re(e.setTransport.bind(e),"setTransport",te(e),ie(e,["config"]))}},lt=ct(),dt=lt.add,ft=lt.extendSession,pt=lt.flush,vt=lt.getDeviceId,ht=lt.getSessionId,gt=lt.getUserId,yt=lt.groupIdentify,mt=lt.identify,bt=lt.init,_t=lt.logEvent,It=lt.remove,St=lt.reset,wt=lt.revenue,Et=lt.setDeviceId,Ot=lt.setGroup,Tt=lt.setOptOut,kt=lt.setSessionId,Pt=lt.setTransport,Rt=lt.setUserId,xt=lt.track,Ut=Object.freeze({__proto__:null,add:dt,extendSession:ft,flush:pt,getDeviceId:vt,getSessionId:ht,getUserId:gt,groupIdentify:yt,identify:mt,init:bt,logEvent:_t,remove:It,reset:St,revenue:wt,setDeviceId:Et,setGroup:Ot,setOptOut:Tt,setSessionId:kt,setTransport:Pt,setUserId:Rt,track:xt,Types:U,createInstance:ct,runQueuedFunctions:Ee,Revenue:B,Identify:j});!function(){var e=h();if(e){var t=function(e){var t=ct(),n=h();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},Ut,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],Ee(Ut,n);for(var i=Object.keys(e.amplitude._iq)||[],r=0;r0&&i[i.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function l(e,t,n){if(n||2===arguments.length)for(var r,i=0,o=t.length;i1||u(e,t)}))},t&&(r[e]=t(r[e])))}function u(e,t){try{(n=i[e](t)).value instanceof d?Promise.resolve(n.value.v).then(a,c):l(o[0][2],n)}catch(e){l(o[0][3],e)}var n}function a(e){u("next",e)}function c(e){u("throw",e)}function l(e,t){e(t),o.shift(),o.length&&u(o[0][0],o[0][1])}}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=a(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,i){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,i,(t=e[n](t)).done,t.value)}))}}}"function"==typeof SuppressedError&&SuppressedError,function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(n||(n={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(r||(r={}));var h,v="AMP",g="".concat(v,"_unsent"),y="https://api2.amplitude.com/2/httpapi",m=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!b(t,n))return!1}return!0},b=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=a(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)i=i&&m(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return m(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},w=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return i({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(h.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(h.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(h.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(h.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(h.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(h.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(h.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(h.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(h.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[h.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return void 0===this._properties[h.CLEAR_ALL]&&(!this._propertySet.has(t)&&(e===h.ADD?"number"==typeof n:e===h.UNSET||e===h.REMOVE||b(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"}(h||(h={}));var _,E=[h.CLEAR_ALL,h.UNSET,h.SET,h.SET_ONCE,h.ADD,h.APPEND,h.PREPEND,h.PREINSERT,h.POSTINSERT,h.REMOVE];!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(_||(_={}));var S,I=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=_.Unknown),{event:e,code:t,message:n}},T=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},k=l([],c(Array(256).keys()),!1).map((function(e){return e.toString(16).padStart(2,"0")})),O=function(e){var t,n=T();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,O)}(e);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,l([],c(r.entries()),!1).map((function(e){var t=c(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(k[r]):k[r]})).join("")},P=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,r;return s(this,void 0,void 0,(function(){return u(this,(function(i){switch(i.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=O(),this.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(r=e.setup)||void 0===r?void 0:r.call(e,t,this.client)]);case 1:return i.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e,t){var n;return s(this,void 0,void 0,(function(){var r,i;return u(this,(function(o){switch(o.label){case 0:return r=this.plugins.findIndex((function(t){return t.name===e})),-1===r?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)]);case 1:return o.sent(),[2]}}))}))},e.prototype.reset=function(e){this.applying=!1,this.plugins.map((function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)})),this.plugins=[],this.client=e},e.prototype.push=function(e){var t=this;return new Promise((function(n){t.queue.push([e,n]),t.scheduleApply(0)}))},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout((function(){t.apply(t.queue.shift()).then((function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)}))}),e))},e.prototype.apply=function(e){return s(this,void 0,void 0,(function(){var t,n,r,o,s,l,d,f,p,h,v,g,y,m,b,w,_,E,S,T;return u(this,(function(u){switch(u.label){case 0:if(!e)return[2];t=c(e,1),n=t[0],r=c(e,2),o=r[1],this.loggerProvider.log("Timeline.apply: Initial event",n),s=this.plugins.filter((function(e){return"before"===e.type})),u.label=1;case 1:u.trys.push([1,6,7,8]),l=a(s),d=l.next(),u.label=2;case 2:return d.done?[3,5]:(g=d.value).execute?[4,g.execute(i({},n))]:[3,4];case 3:if(null===(y=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=y,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=4;case 4:return d=l.next(),[3,2];case 5:return[3,8];case 6:return f=u.sent(),_={error:f},[3,8];case 7:try{d&&!d.done&&(E=l.return)&&E.call(l)}finally{if(_)throw _.error}return[7];case 8:p=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),u.label=9;case 9:u.trys.push([9,14,15,16]),h=a(p),v=h.next(),u.label=10;case 10:return v.done?[3,13]:(g=v.value).execute?[4,g.execute(i({},n))]:[3,12];case 11:if(null===(y=u.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=y,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(g.name),"', event: ").concat(JSON.stringify(n))),u.label=12;case 12:return v=h.next(),[3,10];case 13:return[3,16];case 14:return m=u.sent(),S={error:m},[3,16];case 15:try{v&&!v.done&&(T=h.return)&&T.call(h)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),w=b.map((function(e){var t=i({},n);return e.execute(t).catch((function(e){return I(t,0,String(e))}))})),Promise.all(w).then((function(e){var t=c(e,1)[0]||I(n,100,"Event not tracked, no destination plugins on the instance");o(t)})),[2]}}))}))},e.prototype.flush=function(){return s(this,void 0,void 0,(function(){var e,t,n,r=this;return u(this,(function(i){switch(i.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map((function(e){return r.apply(e)})))];case 1:return i.sent(),t=this.plugins.filter((function(e){return"destination"===e.type})),n=t.map((function(e){return e.flush&&e.flush()})),[4,Promise.all(n)];case 2:return i.sent(),[2]}}))}))},e.prototype.onIdentityChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)}))},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)}))},e.prototype.onOptOutChanged=function(e){this.plugins.forEach((function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}))},e}(),A=function(e,t){return i(i({},t),{event_type:r.IDENTIFY,user_properties:e.getUserProperties()})},x=function(e){return{promise:e||Promise.resolve()}},R=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 P(this),this.name=e}return e.prototype._init=function(e){return s(this,void 0,void 0,(function(){return u(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return s(this,void 0,void 0,(function(){var t,n,r,i,o,s,c,l;return u(this,(function(u){switch(u.label){case 0:t=this[e],this[e]=[],u.label=1;case 1:u.trys.push([1,8,9,10]),n=a(t),r=n.next(),u.label=2;case 2:return r.done?[3,7]:(i=r.value,(o=i())&&"promise"in o?[4,o.promise]:[3,4]);case 3:return u.sent(),[3,6];case 4:return[4,o];case 5:u.sent(),u.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return s=u.sent(),c={error:s},[3,10];case 9:try{r&&!r.done&&(l=n.return)&&l.call(n)}finally{if(c)throw c.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:u.sent(),u.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var r=function(e,t,n){return i(i(i({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return x(this.dispatch(r))},e.prototype.identify=function(e,t){var n=A(e,t);return x(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,o){var s=function(e,t,n,o){var s;return i(i({},o),{event_type:r.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(s={},s[e]=t,s)})}(e,t,n,o);return x(this.dispatch(s))},e.prototype.setGroup=function(e,t,n){var o=function(e,t,n){var o,s=new w;return s.set(e,t),i(i({},n),{event_type:r.IDENTIFY,user_properties:s.getUserProperties(),groups:(o={},o[e]=t,o)})}(e,t,n);return x(this.dispatch(o))},e.prototype.revenue=function(e,t){var n=function(e,t){return i(i({},t),{event_type:r.REVENUE,event_properties:e.getEventProperties()})}(e,t);return x(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),x())},e.prototype._addPlugin=function(e){return x(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)),x())},e.prototype._removePlugin=function(e){return x(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(I(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return s(this,void 0,void 0,(function(){var t=this;return u(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.getOperationAppliedUserProperties=function(e){var t={};if(void 0===e)return t;var r={};return Object.keys(e).forEach((function(t){Object.values(n).includes(t)||(r[t]=e[t])})),E.forEach((function(r){if(Object.keys(e).includes(r)){var i=e[r];switch(r){case n.CLEAR_ALL:Object.keys(t).forEach((function(e){delete t[e]}));break;case n.UNSET:Object.keys(i).forEach((function(e){delete t[e]}));break;case n.SET:Object.assign(t,i)}}})),Object.assign(t,r),t},e.prototype.process=function(e){return s(this,void 0,void 0,(function(){var t,n,i,o;return u(this,(function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),this.config.optOut?[2,I(e,0,"Event skipped due to optOut config")]:(e.event_type===r.IDENTIFY&&(t=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:t})),[4,this.timeline.push(e)]);case 1:return 200===(o=s.sent()).code?this.config.loggerProvider.log(o.message):100===o.code?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=s.sent(),i=String(n),this.config.loggerProvider.error(i),[2,o=I(e,0,i)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=Boolean(e))},e.prototype.flush=function(){return x(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}(),C=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){return m(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?i({},this.properties):{};return e[S.REVENUE_PRODUCT_ID]=this.productId,e[S.REVENUE_QUANTITY]=this.quantity,e[S.REVENUE_PRICE]=this.price,e[S.REVENUE_TYPE]=this.revenueType,e[S.REVENUE_CURRENCY]=this.currency,e[S.REVENUE]=this.revenue,e[S.RECEIPT]=this.receipt,e[S.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"}(S||(S={}));var N;!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"}(N||(N={}));var L="Amplitude Logger ",U=function(){function e(){this.logLevel=N.None}return e.prototype.disable=function(){this.logLevel=N.None},e.prototype.enable=function(e){void 0===e&&(e=N.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t0&&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=O()),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.attemptsthis.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout((function(){t.queue=t.queue.map((function(e){return e.timeout=0,e})),t.flush(!0)}),e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),s(this,void 0,void 0,(function(){var t,n,r=this;return u(this,(function(i){switch(i.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),o=t,a=this.config.flushQueueSize,c=Math.max(a,1),[4,o.reduce((function(e,t,n){var r=Math.floor(n/c);return e[r]||(e[r]=[]),e[r].push(t),e}),[]).reduce((function(t,n){return s(r,void 0,void 0,(function(){return u(this,(function(r){switch(r.label){case 0:return[4,t];case 1:return r.sent(),[4,this.send(n,e)];case 2:return[2,r.sent()]}}))}))}),Promise.resolve())]);case 1:return i.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,a,c}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),s(this,void 0,void 0,(function(){var n,r,i,s,a;return u(this,(function(u){switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];n={api_key:this.config.apiKey,events:e.map((function(e){var t=e.event;return t.extra,o(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new M,u.label=1;case 1:return u.trys.push([1,3,,4]),r=F(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(r,n)];case 2:return null===(i=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(i,e),[3,4]):("body"in i?this.fulfillRequest(e,i.statusCode,"".concat(i.status,": ").concat(V(i))):this.fulfillRequest(e,i.statusCode,i.status),[2]);case 3:return s=u.sent(),a=(c=s)instanceof Error?c.message:String(c),this.config.loggerProvider.error(a),this.handleResponse({status:_.Failed,statusCode:0},e),[3,4];case 4:return[2]}var c}))}))},e.prototype.handleResponse=function(e,t){var n=e.status;switch(n){case _.Success:this.handleSuccessResponse(e,t);break;case _.Invalid:this.handleInvalidResponse(e,t);break;case _.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case _.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(n,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key"))this.fulfillRequest(t,e.statusCode,e.body.error);else{var r=l(l(l(l([],c(Object.values(e.body.eventsWithInvalidFields)),!1),c(Object.values(e.body.eventsWithMissingFields)),!1),c(Object.values(e.body.eventsWithInvalidIdLengths)),!1),c(e.body.silencedEvents),!1).flat(),i=new Set(r),o=t.filter((function(t,r){if(!i.has(r))return!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));o.length>0&&this.config.loggerProvider.warn(V(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(V(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)}else this.fulfillRequest(t,e.statusCode,e.body.error)},e.prototype.handleRateLimitResponse=function(e,t){var n=this,r=Object.keys(e.body.exceededDailyQuotaUsers),i=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(r),u=new Set(i),a=new Set(o),c=t.filter((function(t,r){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(r)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(V(e));var l=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(l)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map((function(e){return e.timeout=e.attempts*t.retryTimeout,e})),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){this.removeEvents(e),e.forEach((function(e){return e.callback(I(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}(),z=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:B(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),B=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},K=function(){function e(){this.queue=[]}return e.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},e.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),W=function(){return W=Object.assign||function(e){for(var t,n=1,r=arguments.length;n=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 J(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}"function"==typeof SuppressedError&&SuppressedError;var Y=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=H(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next()){if(s.value===i)return e===t}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}if(null==e&&null==t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;var u=Array.isArray(e),a=Array.isArray(t);if(u!==a)return!1;if(!u||!a){var c=Object.keys(e).sort(),l=Object.keys(t).sort();if(!Y(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){Y(e[n],t[n])||(d=!1)})),d}for(var f=0;fe},re=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[v,t,e.substring(0,n)].filter(Boolean).join("_")},ie=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:""},oe=function(){var e,t=T();return(null===(e=null==t?void 0:t.location)||void 0===e?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce((function(e,t){var n=t.split("=",2),r=se(n[0]),i=se(n[1]);return i?(e[r]=i,e):e}),{}):{}},se=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},ue=function(e){return function(){var t=i({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},ae=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=a(t.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},ce=function(e,t){return function(){var n,r,i={};try{for(var o=a(t),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=ae(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},le=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s=200&&e<300?_.Success:429===e?_.RateLimit:413===e?_.PayloadTooLarge:408===e?_.Timeout:e>=400&&e<500?_.Invalid:e>=500?_.Failed:_.Unknown},e}(),ge=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.send=function(e,t){return s(this,void 0,void 0,(function(){var n,r,i;return u(this,(function(o){switch(o.label){case 0:if("undefined"==typeof fetch)throw new Error("FetchTransport is not supported");return n={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(t),method:"POST"},[4,fetch(e,n)];case 1:return[4,(r=o.sent()).text()];case 2:i=o.sent();try{return[2,this.buildResponse(JSON.parse(i))]}catch(e){return[2,this.buildResponse({code:r.status})]}return[2]}}))}))},n}(ve);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(Q||(Q={}));var ye=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],me="data-amp-track-",be=["div","span","h1","h2","h3","h4","h5","h6"],we=function(){function e(e){this.request=e}return Object.defineProperty(e.prototype,"headers",{get:function(){if(this._headers)return this._headers;var e=this.request.headers;if(Array.isArray(e)){var t=e;this._headers=t.reduce((function(e,t){var n=c(t,2),r=n[0],i=n[1];return e[r]=i,e}),{})}else if(e instanceof Headers){var n={};e.forEach((function(e,t){n[t]=e})),this._headers=n}else"object"==typeof e&&(this._headers=e);return this._headers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=T();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=Ee(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),e}(),_e=function(){function e(e){this.body=e}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return Ee(this.body,100)},enumerable:!1,configurable:!0}),e}();function Ee(e,t){var n,r,i,o=T(),s=null==o?void 0:o.TextEncoder;if(s){var u;if("string"==typeof e)u=e,i=(new s).encode(u).length;else if(e instanceof Blob)i=(u=e).size;else if(e instanceof URLSearchParams)u=e,i=(new s).encode(u.toString()).length;else if(ArrayBuffer.isView(e))i=(u=e).byteLength;else if(e instanceof ArrayBuffer)i=(u=e).byteLength;else if(e instanceof FormData){var l=e,d=0,f=0;try{for(var p=a(l.entries()),h=p.next();!h.done;h=p.next()){var v=c(h.value,2),g=v[0],y=v[1];if(d+=g.length,"string"==typeof y)d+=(new s).encode(y).length;else{if(!(y instanceof Blob))return;d+=y.size}if(++f>=t)return}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}i=d}else if(e instanceof ReadableStream)return void(u=e);return i}}var Se=function(){function e(e){this.response=e}return Object.defineProperty(e.prototype,"headers",{get:function(){var e;if(this._headers)return this._headers;if(this.response.headers instanceof Headers){var t=this.response.headers,n={};return null===(e=null==t?void 0:t.forEach)||void 0===e||e.call(t,(function(e,t){n[t]=e})),this._headers=n,n}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bodySize",{get:function(){var e,t;if(void 0!==this._bodySize)return this._bodySize;var n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e}(),Ie=function(){function e(e,t,n){this.statusCode=e,this.headersString=t,this.size=n}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"headers",{get:function(){var e,t;if(this.headersString){var n={},r=this.headersString.split("\r\n");try{for(var i=a(r),o=i.next();!o.done;o=i.next()){var s=c(o.value.split(": "),2),u=s[0],l=s[1];u&&l&&(n[u]=l)}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}return n}},enumerable:!1,configurable:!0}),e}(),Te=function(){function e(e,t,n,r,i,o,s,u,a,c,l){void 0===s&&(s=0),this.type=e,this.method=t,this.timestamp=n,this.startTime=r,this.url=i,this.requestWrapper=o,this.status=s,this.duration=u,this.responseWrapper=a,this.error=c,this.endTime=l}return e.prototype.toSerializable=function(){var e,t,n,r,i={type:this.type,method:this.method,url:this.url,timestamp:this.timestamp,status:this.status,duration:this.duration,error:this.error,startTime:this.startTime,endTime:this.endTime,requestHeaders:null===(e=this.requestWrapper)||void 0===e?void 0:e.headers,requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers,responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize};return Object.fromEntries(Object.entries(i).filter((function(e){var t=c(e,2);return t[0],void 0!==t[1]})))},e}();var ke,Oe,Pe,Ae,xe,Re=function(e,t){void 0===t&&(t=O()),this.callback=e,this.id=t},Ce=function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=T();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=T();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,u,a;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var c=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,l=null===(u=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===u?void 0:u.send;c&&l&&this.observeXhr(c,l);var d=null===(a=this.globalScope)||void 0===a?void 0:a.fetch;d&&this.observeFetch(d),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach((function(n){var r;try{n.callback(e)}catch(e){null===(r=t.logger)||void 0===r||r.debug("an unexpected error occurred while triggering event callbacks",e)}}))},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){var u;if(void 0!==o&&void 0!==s){var a,c,l,d="GET";!function(e){return"object"==typeof e&&null!==e&&"url"in e&&"method"in e}(t)?a=null===(u=null==t?void 0:t.toString)||void 0===u?void 0:u.call(t):(a=t.url,d=t.method),d=(null==n?void 0:n.method)||d,r&&(c=r.status),i&&(l={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},c=0);var f=Math.floor(performance.now()-s),p=Math.floor(o+f),h=new Te(e,d,o,o,a,n,c,f,r,l,p);this.triggerEventCallbacks(h)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null===(e=Date.now)||void 0===e?void 0:e.call(Date),durationStart:null===(t=null===performance||void 0===performance?void 0:performance.now)||void 0===t?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return s(t,void 0,void 0,(function(){var t,i,o,s,a,c;return u(this,(function(u){switch(u.label){case 0:try{t=this.getTimestamps()}catch(e){null===(a=this.logger)||void 0===a||a.debug("an unexpected error occurred while retrieving timestamps",e)}u.label=1;case 1:return u.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=u.sent(),[3,4];case 3:return s=u.sent(),o=s,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new we(r):void 0,i?new Se(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){null===(c=this.logger)||void 0===c||c.debug("an unexpected error occurred while handling fetch",e)}if(i)return[2,i];throw o}}))}))})},e.prototype.observeXhr=function(e,t){if(this.globalScope&&e&&t){var n=this.globalScope.XMLHttpRequest.prototype,r=this;n.open=function(){for(var t,n,o=[],s=0;s=0;--o)r.push(n.slice(o).join("."));o=0,u.label=2;case 2:return o=this.localConfig.flushMaxRetries)return[2,this.completeRequest({err:"Remote config fetch rejected due to exceeded retry count"})];if(e.aborted)return[2,this.completeRequest({err:Qt})];t!==this.lastFetchedSessionId&&(this.lastFetchedSessionId=t,this.attempts=0),u.label=1;case 1:u.trys.push([1,3,,4]),n=new URLSearchParams({api_key:this.localConfig.apiKey});try{for(r=a(this.configKeys),o=r.next();!o.done;o=r.next())s=o.value,n.append("config_keys",s)}catch(e){h={error:e}}finally{try{o&&!o.done&&(v=r.return)&&v.call(r)}finally{if(h)throw h.error}}return t&&n.set("session_id",String(t)),c={headers:{Accept:"*/*"},method:"GET"},l="".concat(this.getServerUrl(),"?").concat(n.toString()),this.attempts+=1,[4,fetch(l,i(i({},c),{signal:e}))];case 2:if(null===(d=u.sent()))return[2,this.completeRequest({err:Gt})];switch((new ve).buildStatus(d.status)){case xe.Success:return this.attempts=0,[2,this.parseAndStoreConfig(d)];case xe.Failed:return[2,this.retryFetch(e,t)];default:return[2,this.completeRequest({err:"Network error occurred, remote config fetch failed"})]}case 3:return f=u.sent(),p=f,e.aborted?[2,this.completeRequest({err:Qt})]:[2,this.completeRequest({err:null!==(g=p.message)&&void 0!==g?g:Gt})];case 4:return[2]}}))}))},this.retryFetch=function(e,t){return s(r,void 0,void 0,(function(){var n=this;return u(this,(function(r){switch(r.label){case 0:return[4,new Promise((function(e){return setTimeout(e,n.attempts*n.retryTimeout)}))];case 1:return r.sent(),[2,this.fetchRemoteConfig(e,t)]}}))}))},this.parseAndStoreConfig=function(e){return s(r,void 0,void 0,(function(){var t;return u(this,(function(n){switch(n.label){case 0:return[4,e.json()];case 1:return t=n.sent(),this.completeRequest({success:"Remote config successfully fetched"}),[2,t]}}))}))},this.localConfig=t,this.configKeys=n}return e.prototype.getServerUrl=function(){return this.localConfig.serverZone===Ae.STAGING?"https://sr-client-cfg.stag2.amplitude.com/config":this.localConfig.serverZone===Ae.EU?"https://sr-client-cfg.eu.amplitude.com/config":"https://sr-client-cfg.amplitude.com/config"},e.prototype.completeRequest=function(e){var t=e.err,n=e.success;if(t)throw new Error(t);n&&this.localConfig.loggerProvider.log(n)},e}(),Xt=function(e){var t=e.localConfig,n=e.configKeys;return s(void 0,void 0,void 0,(function(){return u(this,(function(e){return[2,new Zt({localConfig:t,configKeys:n})]}))}))},en=function(){function e(e){this.config=e,this.config.loggerProvider.debug("Local configuration before merging with remote config",JSON.stringify(this.config,null,2))}return e.prototype.initialize=function(){return s(this,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return e=this,[4,Xt({localConfig:this.config,configKeys:["analyticsSDK"]})];case 1:return e.remoteConfigFetch=t.sent(),[2]}}))}))},e.prototype.generateJoinedConfig=function(){var e,t,n,r,o,c;return s(this,void 0,void 0,(function(){var s,l,d,f,p,h,v,g,y,m,b,w,_;return u(this,(function(u){switch(u.label){case 0:return u.trys.push([0,3,,4]),(l=this.remoteConfigFetch)?[4,this.remoteConfigFetch.getRemoteConfig("analyticsSDK","browserSDK",this.config.sessionId)]:[3,2];case 1:l=u.sent(),u.label=2;case 2:if(s=l,this.config.loggerProvider.debug("Remote configuration:",JSON.stringify(s,null,2)),s&&"autocapture"in s){if("boolean"==typeof s.autocapture&&(this.config.autocapture=s.autocapture),"object"==typeof s.autocapture){if(d=i({},s.autocapture),void 0===this.config.autocapture&&(this.config.autocapture=s.autocapture),"object"==typeof s.autocapture.elementInteractions&&(null===(e=s.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===e?void 0:e.length)){d.elementInteractions=i({},s.autocapture.elementInteractions),f=d.elementInteractions,p=null!==(t=f.pageUrlAllowlist)&&void 0!==t?t:[],h=[];try{for(v=a(s.autocapture.elementInteractions.pageUrlAllowlistRegex),g=v.next();!g.done;g=v.next()){y=g.value;try{h.push(new RegExp(y))}catch(e){this.config.loggerProvider.warn("Invalid regex pattern: ".concat(y),e)}}}catch(e){w={error:e}}finally{try{g&&!g.done&&(_=v.return)&&_.call(v)}finally{if(w)throw w.error}}m=p.concat(h),f.pageUrlAllowlist=m,delete f.pageUrlAllowlistRegex}"boolean"==typeof this.config.autocapture&&(this.config.autocapture=i({attribution:this.config.autocapture,fileDownloads:this.config.autocapture,formInteractions:this.config.autocapture,pageViews:this.config.autocapture,sessions:this.config.autocapture,elementInteractions:this.config.autocapture},d)),"object"==typeof this.config.autocapture&&(this.config.autocapture=i(i({},this.config.autocapture),d))}this.config.defaultTracking=this.config.autocapture}return this.config.loggerProvider.debug("Joined configuration: ",JSON.stringify(this.config,null,2)),null!==(n=(c=this.config).requestMetadata)&&void 0!==n||(c.requestMetadata=new M),(null===(r=this.remoteConfigFetch)||void 0===r?void 0:r.metrics.fetchTimeAPISuccess)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_success",this.remoteConfigFetch.metrics.fetchTimeAPISuccess),(null===(o=this.remoteConfigFetch)||void 0===o?void 0:o.metrics.fetchTimeAPIFail)&&this.config.requestMetadata.recordHistogram("remote_config_fetch_time_API_fail",this.remoteConfigFetch.metrics.fetchTimeAPIFail),[3,4];case 3:return b=u.sent(),this.config.loggerProvider.error("Failed to fetch remote configuration because of error: ",b),[3,4];case 4:return[2,this.config]}}))}))},e}(),tn="[Amplitude] Element Clicked",nn="[Amplitude] Element Tag",rn="[Amplitude] Element Text",on="[Amplitude] Page URL",sn="https://app.amplitude.com",un={US:sn,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"};function an(e){return"function"==typeof e}function cn(e){var t=e((function(e){Error.call(e),e.stack=(new Error).stack}));return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var ln=cn((function(e){return function(t){e(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map((function(e,t){return t+1+") "+e.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=t}}));function dn(e,t){if(e){var n=e.indexOf(t);0<=n&&e.splice(n,1)}}var fn=function(){function e(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}var t;return e.prototype.unsubscribe=function(){var e,t,n,r,i;if(!this.closed){this.closed=!0;var o=this._parentage;if(o)if(this._parentage=null,Array.isArray(o))try{for(var s=a(o),u=s.next();!u.done;u=s.next()){u.value.remove(this)}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}else o.remove(this);var d=this.initialTeardown;if(an(d))try{d()}catch(e){i=e instanceof ln?e.errors:[e]}var f=this._finalizers;if(f){this._finalizers=null;try{for(var p=a(f),h=p.next();!h.done;h=p.next()){var v=h.value;try{vn(v)}catch(e){i=null!=i?i:[],e instanceof ln?i=l(l([],c(i)),c(e.errors)):i.push(e)}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}}if(i)throw new ln(i)}},e.prototype.add=function(t){var n;if(t&&t!==this)if(this.closed)vn(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=null!==(n=this._finalizers)&&void 0!==n?n:[]).push(t)}},e.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},e.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},e.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&dn(t,e)},e.prototype.remove=function(t){var n=this._finalizers;n&&dn(n,t),t instanceof e&&t._removeParent(this)},e.EMPTY=((t=new e).closed=!0,t),e}(),pn=fn.EMPTY;function hn(e){return e instanceof fn||e&&"closed"in e&&an(e.remove)&&an(e.add)&&an(e.unsubscribe)}function vn(e){an(e)?e():e.unsubscribe()}var gn={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1},yn=function(e,t){for(var n=[],r=2;r0},enumerable:!1,configurable:!0}),n.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},n.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},n.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,i=n.isStopped,o=n.observers;return r||i?pn:(this.currentObservers=null,o.push(e),new fn((function(){t.currentObservers=null,dn(o,e)})))},n.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,i=t.isStopped;n?e.error(r):i&&e.complete()},n.prototype.asObservable=function(){var e=new xn;return e.source=this,e},n.create=function(e,t){return new Vn(e,t)},n}(xn),Vn=function(e){function n(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return t(n,e),n.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},n.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},n.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},n.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:pn},n}(Mn);!function(e){function n(t){var n=e.call(this)||this;return n._value=t,n}t(n,e),Object.defineProperty(n.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),n.prototype._subscribe=function(t){var n=e.prototype._subscribe.call(this,t);return!n.closed&&t.next(this._value),n},n.prototype.getValue=function(){var e=this,t=e.hasError,n=e.thrownError,r=e._value;if(t)throw n;return this._throwIfClosed(),r},n.prototype.next=function(t){e.prototype.next.call(this,this._value=t)}}(Mn);var $n={now:function(){return($n.delegate||Date).now()},delegate:void 0};!function(e){function n(t,n,r){void 0===t&&(t=1/0),void 0===n&&(n=1/0),void 0===r&&(r=$n);var i=e.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=r,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}t(n,e),n.prototype.next=function(t){var n=this,r=n.isStopped,i=n._buffer,o=n._infiniteTimeWindow,s=n._timestampProvider,u=n._windowTime;r||(i.push(t),!o&&i.push(s.now()+u)),this._trimBuffer(),e.prototype.next.call(this,t)},n.prototype._subscribe=function(e){this._throwIfClosed(),this._trimBuffer();for(var t=this._innerSubscribe(e),n=this._infiniteTimeWindow,r=this._buffer.slice(),i=0;i0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=Xn.setImmediate(t.flush.bind(t,void 0))))},n.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(Xn.clearImmediate(n),t._scheduled===n&&(t._scheduled=void 0))},n}(Hn),tr=function(){function e(t,n){void 0===n&&(n=e.now),this.schedulerActionCtor=t,this.now=n}return e.prototype.schedule=function(e,t,n){return void 0===t&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},e.now=$n.now,e}(),nr=function(e){function n(t,n){void 0===n&&(n=tr.now);var r=e.call(this,t,n)||this;return r.actions=[],r._active=!1,r}return t(n,e),n.prototype.flush=function(e){var t=this.actions;if(this._active)t.push(e);else{var n;this._active=!0;do{if(n=e.execute(e.state,e.delay))break}while(e=t.shift());if(this._active=!1,n){for(;e=t.shift();)e.unsubscribe();throw n}}},n}(tr),rr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.flush=function(e){this._active=!0;var t=this._scheduled;this._scheduled=void 0;var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},n}(nr);new rr(er);var ir=new nr(Hn),or=ir,sr=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.schedule=function(t,n){return void 0===n&&(n=0),n>0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},n.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},n}(Hn),ur=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n}(nr);new ur(sr);var ar=function(e){function n(t,n){var r=e.call(this,t,n)||this;return r.scheduler=t,r.work=n,r}return t(n,e),n.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!==r&&r>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.actions.push(this),t._scheduled||(t._scheduled=Dn.requestAnimationFrame((function(){return t.flush(void 0)}))))},n.prototype.recycleAsyncId=function(t,n,r){var i;if(void 0===r&&(r=0),null!=r?r>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,t,n,r);var o=t.actions;null!=n&&n===t._scheduled&&(null===(i=o[o.length-1])||void 0===i?void 0:i.id)!==n&&(Dn.cancelAnimationFrame(n),t._scheduled=void 0)},n}(Hn),cr=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.flush=function(e){var t;this._active=!0,e?t=e.id:(t=this._scheduled,this._scheduled=void 0);var n,r=this.actions;e=e||r.shift();do{if(n=e.execute(e.state,e.delay))break}while((e=r[0])&&e.id===t&&r.shift());if(this._active=!1,n){for(;(e=r[0])&&e.id===t&&r.shift();)e.unsubscribe();throw n}},n}(nr);new cr(ar),function(e){function n(t,n){void 0===t&&(t=lr),void 0===n&&(n=1/0);var r=e.call(this,t,(function(){return r.frame}))||this;return r.maxFrames=n,r.frame=0,r.index=-1,r}t(n,e),n.prototype.flush=function(){for(var e,t,n=this.actions,r=this.maxFrames;(t=n[0])&&t.delay<=r&&(n.shift(),this.frame=t.delay,!(e=t.execute(t.state,t.delay))););if(e){for(;t=n.shift();)t.unsubscribe();throw e}},n.frameTimeFactor=10}(nr);var lr=function(e){function n(t,n,r){void 0===r&&(r=t.index+=1);var i=e.call(this,t,n)||this;return i.scheduler=t,i.work=n,i.index=r,i.active=!0,i.index=t.index=r,i}return t(n,e),n.prototype.schedule=function(t,r){if(void 0===r&&(r=0),Number.isFinite(r)){if(!this.id)return e.prototype.schedule.call(this,t,r);this.active=!1;var i=new n(this.scheduler,this.work);return this.add(i),i.schedule(t,r)}return fn.EMPTY},n.prototype.requestAsyncId=function(e,t,r){void 0===r&&(r=0),this.delay=e.frame+r;var i=e.actions;return i.push(this),i.sort(n.sortActions),1},n.prototype.recycleAsyncId=function(e,t,n){},n.prototype._execute=function(t,n){if(!0===this.active)return e.prototype._execute.call(this,t,n)},n.sortActions=function(e,t){return e.delay===t.delay?e.index===t.index?0:e.index>t.index?1:-1:e.delay>t.delay?1:-1},n}(Hn),dr=new xn((function(e){return e.complete()}));function fr(e){return e&&an(e.schedule)}function pr(e){return e[e.length-1]}function hr(e){return fr(pr(e))?e.pop():void 0}var vr=function(e){return e&&"number"==typeof e.length&&"function"!=typeof e};function gr(e){return an(null==e?void 0:e.then)}function yr(e){return an(e[Pn])}function mr(e){return Symbol.asyncIterator&&an(null==e?void 0:e[Symbol.asyncIterator])}function br(e){return new TypeError("You provided "+(null!==e&&"object"==typeof e?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}var wr,_r="function"==typeof Symbol&&Symbol.iterator?Symbol.iterator:"@@iterator";function Er(e){return an(null==e?void 0:e[_r])}function Sr(e){return f(this,arguments,(function(){var t,n,r;return u(this,(function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,d(t.read())];case 3:return n=i.sent(),r=n.value,n.done?[4,d(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,d(r)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}function Ir(e){return an(null==e?void 0:e.getReader)}function Tr(e){if(e instanceof xn)return e;if(null!=e){if(yr(e))return i=e,new xn((function(e){var t=i[Pn]();if(an(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")}));if(vr(e))return r=e,new xn((function(e){for(var t=0;t0&&(t=new Tn({next:function(e){return v.next(e)},error:function(e){l=!0,d(),r=Xr(f,i,e),v.error(e)},complete:function(){c=!0,d(),r=Xr(f,s),v.complete()}}),Tr(e).subscribe(t))}))(e)}}function Xr(e,t){for(var n=[],r=2;rt)return e.slice(0,r)}return e}(function(e){var t=[];if(!e)return t;t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e).map((function(e){return function(e){var t,n,r,i,o,s;if(null===e)return null;var u=String(e.tagName).toLowerCase(),c={tag:u},l=Array.from(null!==(i=null===(r=e.parentElement)||void 0===r?void 0:r.children)&&void 0!==i?i:[]);l.length&&(c.index=l.indexOf(e),c.indexOfType=l.filter((function(t){return t.tagName===e.tagName})).indexOf(e));var d=null===(s=null===(o=e.previousElementSibling)||void 0===o?void 0:o.tagName)||void 0===s?void 0:s.toLowerCase();d&&(c.prevSib=String(d));var f=e.getAttribute("id");f&&(c.id=String(f));var p=Array.from(e.classList);p.length&&(c.classes=p);var h={},v=Array.from(e.attributes).filter((function(e){return!ei.includes(e.name)})),g=!li(e);if(!ri.includes(String(e.getAttribute("type")))&&!ni.includes(u))try{for(var y=a(v),m=y.next();!m.done;m=y.next()){var b=m.value;g&&!ti.includes(b.name)||(h[b.name]=String(b.value).substring(0,128))}}catch(e){t={error:e}}finally{try{m&&!m.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}return Object.keys(h).length&&(c.attrs=h),c}(e)})),1024),t):[]};function oi(e,t){void 0===t&&(t=!1);try{if(null==e)return t?"None":null;if("string"==typeof e)return t?(e=e.replace(/\\/g,"\\\\").replace(/\n/g,"\\n").replace(/\t/g,"\\t").replace(/\r/g,"\\r")).includes('"')?"'".concat(e,"'"):e.includes("'")?'"'.concat(e.replace(/'/g,"\\'"),'"'):"'".concat(e,"'"):e;if("boolean"==typeof e)return e?"True":"False";if(Array.isArray(e)){var n=e.map((function(e){return oi(e,!0)}));return"[".concat(n.join(", "),"]")}if("object"==typeof e){var r=Object.entries(e).filter((function(e){return null!=c(e,1)[0]})).map((function(e){var t=c(e,2),n=t[0],r=t[1];return"".concat(String(oi(n,!0)),": ").concat(String(oi(r,!0)))})),i="{".concat(r.join(", "),"}");return i.includes("\\'")&&(i=i.replace(/'/g,"'").replace(/'/g,"\\'")),i}return e.toString()}catch(e){return null}}var si=["input","select","textarea"],ui=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},ai=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,u=e.pageUrlAllowlist,a=e.shouldTrackEventResolver,c=null===(s=null===(o=null==i?void 0:i.tagName)||void 0===o?void 0:o.toLowerCase)||void 0===s?void 0:s.call(o);if(!c)return!1;if(a)return a(r,i);if(!fi(window.location.href,u))return!1;var l=String(null==i?void 0:i.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}var d=ui(i,r);if(n&&d)return!0;if(t){var f=t.some((function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}));if(!f)return!1}switch(c){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:return!!d||"click"===r}}},ci=function(e){if(null==e)return!1;if("string"==typeof e){if(/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/.test((e||"").replace(/[- ]/g,"")))return!1;if(/(^\d{3}-?\d{2}-?\d{4}$)/.test(e))return!1}return!0},li=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!si.includes(i)&&!o},di=function(e){var t="";return li(e)&&e.childNodes&&e.childNodes.length&&e.childNodes.forEach((function(e){var n,r="";(n=e)&&3===n.nodeType?e.textContent&&(r=e.textContent):r=di(e),t+=r.split(/(\s+)/).filter(ci).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)})),t},fi=function(e,t){return!t||!t.length||t.some((function(t){return"string"==typeof t?e===t:e.match(t)}))},pi=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}),{})},hi=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}if(t){var r=t.textContent||"";return ci(r)?r:""}return hi(n)},vi=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:vi(null==e?void 0:e.parentElement,t):null},gi=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={})[nn]=i,t[rn]=di(e),t[on]=window.location.href.split("?")[0],t);return pi(o)};var yi=function(e){return!(null===e.event.target||!e.closestTrackedAncestor)},mi=function(e,t,n){var r,i,o,s=null===(o=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i),u="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},a=t.getAttribute("aria-label"),c=function(e,t){return e.getAttributeNames().reduce((function(n,r){if(r.startsWith(t)){var i=r.replace(t,""),o=e.getAttribute(r);i&&(n[i]=o||"")}return n}),{})}(t,n),l=hi(t),d=((r={})["[Amplitude] Element ID"]=t.getAttribute("id")||"",r["[Amplitude] Element Class"]=t.getAttribute("class"),r["[Amplitude] Element Hierarchy"]=ii(t),r[nn]=s,r[rn]=di(t),r["[Amplitude] Element Position Left"]=null==u.left?null:Math.round(u.left),r["[Amplitude] Element Position Top"]=null==u.top?null:Math.round(u.top),r["[Amplitude] Element Aria Label"]=a,r["[Amplitude] Element Attributes"]=c,r["[Amplitude] Element Parent Label"]=l,r[on]=window.location.href.split("?")[0],r["[Amplitude] Page Title"]="undefined"!=typeof document&&document.title||"",r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);return"a"===s&&"click"===e&&t instanceof HTMLAnchorElement&&(d["[Amplitude] Element Href"]=t.href),pi(d)},bi=function(e,t,n,r,i){void 0===i&&(i=!1);var o={event:e,timestamp:Date.now(),type:t};if(function(e){return"click"===e.type||"change"===e.type}(o)&&null!==o.event.target){if(i)if(ui(o.event.target,o.type))return o.closestTrackedAncestor=o.event.target,o.targetElementProperties=mi(o.type,o.closestTrackedAncestor,r),o;var s=vi(o.event.target,n);return s&&(o.closestTrackedAncestor=s,o.targetElementProperties=mi(o.type,s,r)),o}return o};var wi=function(){function e(e){var t=(void 0===e?{}:e).origin,n=void 0===t?sn:t,r=this;this.endpoint=sn,this.requestCallbacks={},this.onSelect=function(e){r.notify({action:"element-selected",data:e})},this.onTrack=function(e,t){"selector-mode-changed"===e?r.notify({action:"track-selector-mode-changed",data:t}):"selector-moved"===e&&r.notify({action:"track-selector-moved",data:t})},this.endpoint=n}return e.prototype.notify=function(e){var t,n,r,i;null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message sent: ",JSON.stringify(e)),null===(i=null===(r=window.opener)||void 0===r?void 0:r.postMessage)||void 0===i||i.call(r,e,this.endpoint)},e.prototype.sendRequest=function(e,t,n){var r=this;void 0===n&&(n={timeout:15e3});var i="".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9)),o={id:i,action:e,args:t};return new Promise((function(t,s){r.requestCallbacks[i]={resolve:t,reject:s},r.notify(o),(null==n?void 0:n.timeout)>0&&setTimeout((function(){s(new Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]}),n.timeout)}))},e.prototype.handleResponse=function(e){var t;this.requestCallbacks[e.id]?(this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]):null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id))},e.prototype.setup=function(e){var t=this,n=void 0===e?{}:e,r=n.logger,i=n.endpoint,o=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist;this.logger=r,i&&this.endpoint===sn&&(this.endpoint=i);var a=null;window.addEventListener("message",(function(e){var n,r,i,c,l;if(null===(r=null===(n=t.logger)||void 0===n?void 0:n.debug)||void 0===r||r.call(n,"Message received: ",JSON.stringify(e)),t.endpoint===e.origin){var d,f=null==e?void 0:e.data,p=null==f?void 0:f.action;if(p)if("id"in f)null===(c=null===(i=t.logger)||void 0===i?void 0:i.debug)||void 0===c||c.call(i,"Received Response to previous request: ",JSON.stringify(e)),t.handleResponse(f);else if("ping"===p)t.notify({action:"pong"});else if("initialize-visual-tagging-selector"===p){var h=null==f?void 0:f.data;(d="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",new Promise((function(e,t){var n;try{var r=document.createElement("script");r.type="text/javascript",r.async=!0,r.src=d,r.addEventListener("load",(function(){e({status:!0})}),{once:!0}),r.addEventListener("error",(function(){t({status:!1,message:"Failed to load the script ".concat(d)})})),null===(n=document.head)||void 0===n||n.appendChild(r)}catch(e){t(e)}}))).then((function(){var e;a=null===(e=null===window||void 0===window?void 0:window.amplitudeVisualTaggingSelector)||void 0===e?void 0:e.call(window,{getEventTagProps:gi,isElementSelectable:function(e){return!o||o((null==h?void 0:h.actionType)||"click",e)},onTrack:t.onTrack,onSelect:t.onSelect,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:t,cssSelectorAllowlist:s,actionClickAllowlist:u}),t.notify({action:"selector-loaded"})})).catch((function(){var e;null===(e=t.logger)||void 0===e||e.warn("Failed to initialize visual tagging selector")}))}else"close-visual-tagging-selector"===p&&(null===(l=null==a?void 0:a.close)||void 0===l||l.call(a))}})),this.notify({action:"page-loaded"})},e}();function _i(e){var t,n,r,i=e.amplitude,o=e.allObservables,s=e.options,u=e.shouldTrackEvent,l=e.evaluateTriggers,d=o.clickObservable,f=d.pipe(Nn((function(e,t){var n,r=!1;e.subscribe(Ln(t,(function(e){var i=n;n=e,r&&t.next([i,e]),r=!0})))})),Jr((function(e){var t=c(e,2),n=t[0],r=t[1],i=n.event.target!==r.event.target,o=Math.abs(r.event.screenX-n.event.screenX)<=20&&Math.abs(r.event.screenY-n.event.screenY)<=20;return i&&!o}))),p=Hr(f,d.pipe((t=s.debounceTime,void 0===n&&(n=ir),Nn((function(e,r){var i=null,o=null,s=null,u=function(){if(i){i.unsubscribe(),i=null;var e=o;o=null,r.next(e)}};function a(){var e=s+t,o=n.now();if(o0&&d(i)}),void 0,void 0,(function(){(null==o?void 0:o.closed)||null==o||o.unsubscribe(),u=null}))),!c&&d(null!=r?"number"==typeof r?r:+r-a.now():i)}))}({first:500,with:function(){return dr}}),qr((function(){return e})))},Nn((function(e,t){var n=null,r=0,i=!1,o=function(){return i&&!n&&t.complete()};e.subscribe(Ln(t,(function(e){null==n||n.unsubscribe();var i=0,s=r++;Tr(h(e,s)).subscribe(n=Ln(t,(function(n){return t.next(v?v(e,n,s,i++):n)}),(function(){n=null,o()})))}),(function(){i=!0,o()})))}))));return y.subscribe((function(e){null==t||t.track(tn,i("click",e.closestTrackedAncestor))}))}var Si,Ii=function(e,t){return t.filter((function(t){return t.definition.some((function(t){return t.event_type===e.type&&t.filters.every((function(t){return function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"exact"===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)}))}))}))},Ti=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;return e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector?n.querySelector(e.selector):n}}(e,t);if(!n)return;return"TEXT"===e.elementExtractType?n.textContent:"ATTRIBUTE"===e.elementExtractType&&e.attribute?n.getAttribute(e.attribute):void 0}},ki=function(e,t){e.forEach((function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var n=Ti(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=n}}))};!function(e){e.ClickObservable="clickObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable"}(Si||(Si={}));var Oi,Pi=function(e){var t,n,r,o,d,f,p;void 0===e&&(e={});var h=e.dataAttributePrefix,v=void 0===h?me:h,g=e.visualTaggingOptions,y=void 0===g?{enabled:!0,messenger:new wi}:g;e.cssSelectorAllowlist=null!==(t=e.cssSelectorAllowlist)&&void 0!==t?t:ye,e.actionClickAllowlist=null!==(n=e.actionClickAllowlist)&&void 0!==n?n:be,e.debounceTime=null!==(r=e.debounceTime)&&void 0!==r?r:0;var m="@amplitude/plugin-autocapture-browser",b=[],w=function(){var t,n,r=Kr(document,"click",{capture:!0}).pipe(qr((function(t){return bi(t,"click",e.cssSelectorAllowlist,v)})),Zr()),i=Kr(document,"change",{capture:!0}).pipe(qr((function(t){return bi(t,"change",e.cssSelectorAllowlist,v)})),Zr());window.navigation&&(n=Kr(window.navigation,"navigate").pipe(qr((function(t){return bi(t,"navigate",e.cssSelectorAllowlist,v)})),Zr()));var o=new xn((function(e){var t=new MutationObserver((function(t){e.next(t)}));return t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})).pipe(qr((function(t){return bi(t,"mutation",e.cssSelectorAllowlist,v)})),Zr());return(t={})[Si.ClickObservable]=r,t[Si.ChangeObservable]=i,t[Si.NavigateObservable]=n,t[Si.MutationObservable]=o,t},_=function(e){var t,n,r,i,o,s={click:new Set,change:new Set};if(!e)return s;try{for(var u=a(e),c=u.next();!c.done;c=u.next()){var l=c.value;try{try{for(var d=(r=void 0,a(l.definition)),f=d.next();!f.done;f=d.next())null===(o=s[f.value.event_type])||void 0===o||o.add(l.id)}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}return s}(Object.values(null!==(d=null===(o=e.pageActions)||void 0===o?void 0:o.labeledEvents)&&void 0!==d?d:{})),E=function(e){var t,n,r,i,o=new Map;try{for(var s=a(e),u=s.next();!u.done;u=s.next()){var c=u.value;try{for(var l=(r=void 0,a(c.conditions)),d=l.next();!d.done;d=l.next()){var f=d.value;if("LABELED_EVENT"===f.type){var p=f.match.eventId,h=o.get(p);h||(h=[],o.set(p,h)),h.push(c)}}}catch(e){r={error:e}}finally{try{d&&!d.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o}(null!==(p=null===(f=e.pageActions)||void 0===f?void 0:f.triggers)&&void 0!==p?p:[]),S=function(t){var n,r,i=e.pageActions;if(!i)return t;var o=function(e,t){var n,r,i=new Set;try{for(var o=a(e),s=o.next();!s.done;s=o.next()){var u=s.value,c=t.get(u.id);c&&c.forEach((function(e){return i.add(e)}))}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return Array.from(i)}(Ii(t,Array.from(_[t.type]).map((function(e){return i.labeledEvents[e]}))),E);try{for(var s=a(o),u=s.next();!u.done;u=s.next()){var c=u.value;ki(c.actions,t)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return t};return{name:m,type:"enrichment",setup:function(t,n){return s(void 0,void 0,void 0,(function(){var r,o,s,a,d,f,p,h,g,_;return u(this,(function(u){return"undefined"==typeof document||(r=ai(e,e.cssSelectorAllowlist),o=ai(e,e.actionClickAllowlist),s=w(),a=_i({allObservables:s,options:e,amplitude:n,shouldTrackEvent:r,evaluateTriggers:S}),b.push(a),d=function(e){var t=e.amplitude,n=e.allObservables,r=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers;return n.changeObservable.pipe(Jr(yi),Jr((function(e){return i("change",e.closestTrackedAncestor)})),qr((function(e){return o(e)}))).subscribe((function(e){null==t||t.track("[Amplitude] Element Changed",r("change",e.closestTrackedAncestor))}))}({allObservables:s,getEventProperties:function(){for(var e=[],t=0;t=l&&e<=d)return!0}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return!1}function Ci(e){var t;if(e)try{var n=null===(t=T())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,u=r.host;return r.hash="",r.search="",{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:r.href,host:u}}catch(e){return}}function Ni(e,t){var n;void 0===t&&(t={});var r=Ci(e.url);if(!r)return!1;var i,o=r.host;if(!1!==t.ignoreAmplitudeRequests&&(xi(o,"*.amplitude.com")||xi(o,"amplitude.com")))return!1;if(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find((function(e){return xi(o,e)})))return!1;if(!t.captureRules&&void 0!==e.status&&!Ri(e.status,Ai))return!1;if(t.captureRules&&(l([],c(t.captureRules),!1).reverse().find((function(t){return i=function(e,t,n){if(!e.hosts||e.hosts.find((function(e){return xi(t,e)})))return!((n||0===n)&&!Ri(n,e.statusCodeRange||Ai))}(t,o,e.status),void 0!==i})),!i))return!1;return!0}!function(e){e.NetworkObservable="networkObservable"}(Oi||(Oi={}));var Li=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=[],i=function(){var e,n=new xn((function(e){var n=new Re((function(t){var n=function(e,t){return{event:e,timestamp:Date.now(),type:t}}(t,"network");e.next(n)}));return Ne.subscribe(n,t),function(){Ne.unsubscribe(n)}}));return(e={})[Oi.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(o,a){return s(void 0,void 0,void 0,(function(){var s,c;return u(this,(function(u){return"undefined"==typeof document||(s=i(),c=function(e){var t=e.allObservables,n=e.networkTrackingOptions,r=e.amplitude;return t.networkObservable.pipe(Jr((function(e){return Ni(e.event,n)}))).subscribe((function(e){var t,n,i,o=e.event,s=Ci(o.url);if(s){var u=null===(n=o.responseWrapper)||void 0===n?void 0:n.bodySize,a=null===(i=o.requestWrapper)||void 0===i?void 0:i.bodySize,c=((t={})["[Amplitude] URL"]=s.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=s.query,t["[Amplitude] URL Fragment"]=s.fragment,t["[Amplitude] Request Method"]=o.method,t["[Amplitude] Status Code"]=o.status,t["[Amplitude] Start Time"]=o.startTime,t["[Amplitude] Completion Time"]=o.endTime,t["[Amplitude] Duration"]=o.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=u,t["[Amplitude] Request Type"]=o.type,t);null==r||r.track("[Amplitude] Network Request",c)}}))}({allObservables:s,networkTrackingOptions:e,amplitude:a}),r.push(c),null==(t=null==o?void 0:o.loggerProvider)||t.log("".concat(n," has been successfully added."))),[2]}))}))},execute:function(e){return s(void 0,void 0,void 0,(function(){return u(this,(function(t){return[2,e]}))}))},teardown:function(){return s(void 0,void 0,void 0,(function(){var e,t,n,i;return u(this,(function(o){try{for(e=a(r),t=e.next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]}))}))}}},Ui="dclid",qi="fbclid",ji="gbraid",Di="gclid",Fi="ko_click_id",Mi="li_fat_id",Vi="msclkid",$i="rtd_cid",zi="ttclid",Bi="twclid",Ki="wbraid",Wi={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},Hi=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Ji=function(e,t,n,r,i){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,u=o(e,["referrer","referring_domain"]),a=t||{};a.referrer;var c=a.referring_domain,l=o(a,["referrer","referring_domain"]);if(Yi(n.excludeReferrers,e.referring_domain))return r.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(u)!==JSON.stringify(l),f=Hi(s||"")!==Hi(c||""),p=!t||d||f;return p?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),p},Yi=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}))},Qi=function(){function e(){}return e.prototype.parse=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){return[2,i(i(i(i({},Wi),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=oe();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=oe();return(e={})[Ui]=t[Ui],e[qi]=t[qi],e[ji]=t[ji],e[Di]=t[Di],e[Fi]=t[Fi],e[Mi]=t[Mi],e[Vi]=t[Vi],e[$i]=t[$i],e[zi]=t[zi],e[Bi]=t[Bi],e[Ki]=t[Ki],e},e}(),Gi=function(){function e(e,t){var n,r,o,s,u,a;this.shouldTrackNewCampaign=!1,this.options=i({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(r=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,o=r,o?(o.startsWith(".")&&(o=o.substring(1)),[new RegExp("".concat(o.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(s=t.apiKey,void 0===(u="MKTG")&&(u=""),void 0===a&&(a=10),[v,u,s.substring(0,a)].filter(Boolean).join("_")),this.currentCampaign=Wi,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return s(this,void 0,void 0,(function(){var e,t;return u(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=c.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||ne(this.sessionTimeout,this.lastEventTime),Ji(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}}))}))},e.prototype.fetchCampaign=function(){return s(this,void 0,void 0,(function(){return u(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new Qi).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r,o,s=(t=this.currentCampaign,n=this.options,r=i(i({},Wi),t),o=Object.entries(r).reduce((function(e,t){var r,i=c(t,2),o=i[0],s=i[1];return e.setOnce("initial_".concat(o),null!==(r=null!=s?s:n.initialEmptyValue)&&void 0!==r?r:"EMPTY"),s?e.set(o,s):e.unset(o)}),new w),A(o));return e&&(s.event_id=e),s},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),Zi=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.init=function(e,t,n){var r,o;return void 0===e&&(e=""),arguments.length>2?(r=t,o=n):"string"==typeof t?(r=t,o=void 0):(r=null==t?void 0:t.userId,o=t),x(this._init(i(i({},o),{userId:r,apiKey:e})))},n.prototype._init=function(t){var n,r,o;return s(this,void 0,void 0,(function(){var a,c,l,d,f,p=this;return u(this,(function(h){switch(h.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,bt(t.apiKey,t,this)]);case 1:return(a=h.sent()).fetchRemoteConfig?[4,(g=a,s(void 0,void 0,void 0,(function(){var e;return u(this,(function(t){switch(t.label){case 0:return[4,(e=new en(g)).initialize()];case 1:return t.sent(),[2,e]}}))})))]:[3,4];case 2:return[4,h.sent().generateJoinedConfig()];case 3:a=h.sent(),h.label=4;case 4:return[4,e.prototype._init.call(this,a)];case 5:return h.sent(),this.logBrowserOptions(a),Ue(this.config.defaultTracking)?(c=function(e){return Ue(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?i({},e.defaultTracking.attribution):{}}(this.config),this.webAttribution=new Gi(c,this.config),[4,this.webAttribution.init()]):[3,7];case 6:h.sent(),h.label=7;case 7:return l=oe(),d=Number.isNaN(Number(l.ampSessionId))?void 0:Number(l.ampSessionId),this.setSessionId(null!==(o=null!==(r=null!==(n=t.sessionId)&&void 0!==n?n:d)&&void 0!==r?r:this.config.sessionId)&&void 0!==o?o:Date.now()),(f=ee(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline?[3,9]:[4,this.add(Yt()).promise];case 8:h.sent(),h.label=9;case 9:return[4,this.add(new $).promise];case 10:return h.sent(),[4,this.add(new He).promise];case 11:return h.sent(),[4,this.add(new te).promise];case 12:return h.sent(),function(e){Jt||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(, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),Jt=!0)}(this.config),v=this.config.defaultTracking,Le(v,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Ht()).promise]):[3,14];case 13:h.sent(),h.label=14;case 14:return function(e){return Le(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Bt()).promise]):[3,16];case 15:h.sent(),h.label=16;case 16:return qe(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Mt($e(this.config))).promise]):[3,18];case 17:h.sent(),h.label=18;case 18:return Fe(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Pi(Me(this.config))).promise]):[3,20];case 19:h.sent(),h.label=20;case 20:return De(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Li(Ve(this.config))).promise]):[3,22];case 21:h.sent(),h.label=22;case 22:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 23:return h.sent(),f.eventBridge.setEventReceiver((function(e){p.track(e.eventType,e.eventProperties)})),[2]}var v,g}))}))},n.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},n.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),function(e,t){ee(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},n.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},n.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),function(e,t){ee(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setDeviceId.bind(this,e))},n.prototype.reset=function(){this.setDeviceId(O()),this.setUserId(void 0)},n.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},n.prototype.getOptOut=function(){return this.config.optOut},n.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},n.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),x(Promise.resolve());if(e===this.config.sessionId)return x(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,je(this.config.defaultTracking)&&(r&&i&&n.push(this.track(at,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:r,time:i+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return je(this.config.defaultTracking)&&n.push(this.track(ut,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,x(Promise.all(n))},n.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},n.prototype.setTransport=function(e){this.config?this.config.transportProvider=_t(e):this.q.push(this.setTransport.bind(this,e))},n.prototype.identify=function(t,n){if(Ke(t)){var r=t._q;t._q=[],t=Be(new w,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},n.prototype.groupIdentify=function(t,n,r,i){if(Ke(r)){var o=r._q;r._q=[],r=Be(new w,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},n.prototype.revenue=function(t,n){if(Ke(t)){var r=t._q;t._q=[],t=Be(new C,r)}return e.prototype.revenue.call(this,t,n)},n.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},n.prototype.process=function(t){return s(this,void 0,void 0,(function(){var n,i,o;return u(this,(function(s){return n=Date.now(),i=ne(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===ut||t.event_type===at||t.session_id&&t.session_id!==this.getSessionId()||(i||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),t.event_type===r.IDENTIFY&&t.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(t.user_properties)),[2,e.prototype.process.call(this,t)]}))}))},n.prototype.logBrowserOptions=function(e){try{var t=i(i({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},n}(R),Xi=function(){var e=new Zi;return{init:le(e.init.bind(e),"init",ue(e),ce(e,["config"])),add:le(e.add.bind(e),"add",ue(e),ce(e,["config.apiKey","timeline.plugins"])),remove:le(e.remove.bind(e),"remove",ue(e),ce(e,["config.apiKey","timeline.plugins"])),track:le(e.track.bind(e),"track",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),logEvent:le(e.logEvent.bind(e),"logEvent",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),identify:le(e.identify.bind(e),"identify",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),groupIdentify:le(e.groupIdentify.bind(e),"groupIdentify",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),setGroup:le(e.setGroup.bind(e),"setGroup",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),revenue:le(e.revenue.bind(e),"revenue",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),flush:le(e.flush.bind(e),"flush",ue(e),ce(e,["config.apiKey","timeline.queue.length"])),getUserId:le(e.getUserId.bind(e),"getUserId",ue(e),ce(e,["config","config.userId"])),setUserId:le(e.setUserId.bind(e),"setUserId",ue(e),ce(e,["config","config.userId"])),getDeviceId:le(e.getDeviceId.bind(e),"getDeviceId",ue(e),ce(e,["config","config.deviceId"])),setDeviceId:le(e.setDeviceId.bind(e),"setDeviceId",ue(e),ce(e,["config","config.deviceId"])),reset:le(e.reset.bind(e),"reset",ue(e),ce(e,["config","config.userId","config.deviceId"])),getSessionId:le(e.getSessionId.bind(e),"getSessionId",ue(e),ce(e,["config"])),setSessionId:le(e.setSessionId.bind(e),"setSessionId",ue(e),ce(e,["config"])),extendSession:le(e.extendSession.bind(e),"extendSession",ue(e),ce(e,["config"])),setOptOut:le(e.setOptOut.bind(e),"setOptOut",ue(e),ce(e,["config"])),setTransport:le(e.setTransport.bind(e),"setTransport",ue(e),ce(e,["config"])),getIdentity:le(e.getIdentity.bind(e),"getIdentity",ue(e),ce(e,["config"])),getOptOut:le(e.getOptOut.bind(e),"getOptOut",ue(e),ce(e,["config"]))}},eo=Xi(),to=Object.freeze({__proto__:null,get IdentifyOperation(){return n},get SpecialEventType(){return r},get RevenueProperty(){return S},get LogLevel(){return N},get ServerZone(){return Q},OfflineDisabled:null,DEFAULT_CSS_SELECTOR_ALLOWLIST:ye,DEFAULT_DATA_ATTRIBUTE_PREFIX:me,DEFAULT_ACTION_CLICK_ALLOWLIST:be}),no=eo.add,ro=eo.extendSession,io=eo.flush,oo=eo.getDeviceId,so=eo.getSessionId,uo=eo.getUserId,ao=eo.groupIdentify,co=eo.identify,lo=eo.init,fo=eo.logEvent,po=eo.remove,ho=eo.reset,vo=eo.revenue,go=eo.setDeviceId,yo=eo.setGroup,mo=eo.setOptOut,bo=eo.setSessionId,wo=eo.setTransport,_o=eo.setUserId,Eo=eo.track,So=Object.freeze({__proto__:null,add:no,extendSession:ro,flush:io,getDeviceId:oo,getSessionId:so,getUserId:uo,groupIdentify:ao,identify:co,init:lo,logEvent:fo,remove:po,reset:ho,revenue:vo,setDeviceId:go,setGroup:yo,setOptOut:mo,setSessionId:bo,setTransport:wo,setUserId:_o,track:Eo,createInstance:Xi,AmplitudeBrowser:Zi,runQueuedFunctions:ze,Revenue:C,Identify:w,Types:to});!function(){var e=T();if(e){var t=function(e){var t=Xi(),n=T();return n&&n.amplitude&&n.amplitude._iq&&e&&(n.amplitude._iq[e]=t),t};if(e.amplitude=Object.assign(e.amplitude||{},So,{createInstance:t}),e.amplitude.invoked){var n=e.amplitude._q;e.amplitude._q=[],ze(So,n);for(var r=Object.keys(e.amplitude._iq)||[],i=0;i0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function o(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n0&&(this.queue.forEach((function(t){e(t)})),this.queue=[])},e}(),l=function(){return l=Object.assign||function(e){for(var t,r=1,i=arguments.length;r=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function d(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}"function"==typeof SuppressedError&&SuppressedError;var h=function(e,t){var r,i,n=typeof e;if(n!==typeof t)return!1;try{for(var o=c(["string","number","boolean","undefined"]),a=o.next();!a.done;a=o.next()){if(a.value===n)return e===t}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.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 l=Object.keys(e).sort(),d=Object.keys(t).sort();if(!h(l,d))return!1;var f=!0;return Object.keys(e).forEach((function(r){h(e[r],t[r])||(f=!1)})),f}for(var p=0;p0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function x(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function k(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n>6|192,t[r++]=63&n|128):55296==(64512&n)&&i+1>18|240,t[r++]=n>>12&63|128,t[r++]=n>>6&63|128,t[r++]=63&n|128):(t[r++]=n>>12|224,t[r++]=n>>6&63|128,t[r++]=63&n|128)}return Uint8Array.from(t)}(e),i=r.length,n=i>>2,o=t,a=0;a>>0},G=function(e,t){var r=e,i=t;return r=Math.imul(r,z),r=Q(r,15),r=Math.imul(r,W),i=Q(i^=r,13),(i=Math.imul(i,5))+-430675100|0},H=function(e){var t=e;return t^=t>>>16,t=Math.imul(t,-2048144789),t^=t>>>13,t=Math.imul(t,-1028477387),t^=t>>>16},Q=function(e,t,r){return void 0===r&&(r=32),t>r&&(t%=r),(e<>>0)>>>0>>>r-t>>>0)>>>0},X=function(e,t){void 0===t&&(t=0);var r=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3];return $(r)},$=function(e){return(-16777216&e)>>>24|(16711680&e)>>>8|(65280&e)<<8|(255&e)<<24},Z=function(e,t){var r,i;if(t&&0!==t.length){try{for(var n=S(t),o=n.next();!o.done;o=n.next()){var a=o.value;if(!a||!e||"object"!=typeof e)return;e=e[a]}}catch(e){r={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(r)throw r.error}}return e||void 0}},Y="^".concat("(\\d+)\\.(\\d+)","(\\.").concat("(\\d+)").concat("(-(([-\\w]+\\.?)*))?",")?$"),ee=function(){function e(e,t,r,i){void 0===i&&(i=void 0),this.major=e,this.minor=t,this.patch=r,this.preRelease=i}return e.parse=function(t){if(t){var r=new RegExp(Y).exec(t);if(r){var i=Number(r[1]),n=Number(r[2]);if(!isNaN(i)&&!isNaN(n))return new e(i,n,Number(r[4])||0,r[5]||void 0)}}},e.prototype.compareTo=function(e){return this.major>e.major?1:this.majore.minor?1:this.minore.patch?1:this.patche.preRelease?1:this.preRelease=p&&l=m&&cr;case _:case N:return e>=r;default:return!1}},e.prototype.versionComparator=function(e,t,r){var i=e.compareTo(r);switch(t){case A:case V:return i<0;case C:case j:return i<=0;case I:case T:return i>0;case _:case N:return i>=0;default:return!1}},e.prototype.matchesRegex=function(e,t){return t.some((function(t){return Boolean(new RegExp(t).exec(e))}))},e.prototype.containsNone=function(e){return e.some((function(e){return"(none)"===e}))},e.prototype.containsBooleans=function(e){return e.some((function(e){switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}}))},e.prototype.parseNumber=function(e){var t;return null!==(t=Number(e))&&void 0!==t?t:void 0},e.prototype.coerceString=function(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)},e.prototype.coerceStringArray=function(e){var t=this;if(Array.isArray(e))return e.map((function(e){return t.coerceString(e)})).filter(Boolean);var r=String(e);try{var i=JSON.parse(r);return Array.isArray(i)?e.map((function(e){return t.coerceString(e)})).filter(Boolean):(n=this.coerceString(r))?[n]:void 0}catch(e){var n;return(n=this.coerceString(r))?[n]:void 0}},e.prototype.isSetOperator=function(e){switch(e){case U:case R:case F:case L:case K:case D:return!0;default:return!1}},e.prototype.setEquals=function(e,t){var r=new Set(e),i=new Set(t);return r.size===i.size&&k([],x(i),!1).every((function(e){return r.has(e)}))},e.prototype.matchesSetContainsAll=function(e,t){var r,i;if(e.length{let t={};e.forEach(((e,r)=>t[e]=r))})(ae),String.fromCharCode.bind(String)),ue=("function"==typeof Uint8Array.from&&Uint8Array.from.bind(Uint8Array),e=>e.replace(/=/g,"").replace(/[+\/]/g,(e=>"+"==e?"-":"_"))),le=e=>{let t,r,i,n,o="";const a=e.length%3;for(let a=0;a255||(i=e.charCodeAt(a++))>255||(n=e.charCodeAt(a++))>255)throw new TypeError("invalid character found");t=r<<16|i<<8|n,o+=ae[t>>18&63]+ae[t>>12&63]+ae[t>>6&63]+ae[63&t]}return a?o.slice(0,a-3)+"===".substring(a):o},ce=ie?e=>btoa(e):ne?e=>Buffer.from(e,"binary").toString("base64"):le,de=ne?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,i=e.length;r{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?se(192|t>>>6)+se(128|63&t):se(224|t>>>12&15)+se(128|t>>>6&63)+se(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return se(240|t>>>18&7)+se(128|t>>>12&63)+se(128|t>>>6&63)+se(128|63&t)},fe=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,pe=e=>e.replace(fe,he),ve=ne?e=>Buffer.from(e,"utf8").toString("base64"):oe?e=>de(oe.encode(e)):e=>ce(pe(e)),ye=(e,t=!1)=>t?ue(ve(e)):ve(e),ge=e=>ye(e,!0),be=ge;var me=function(e){function t(r,i){var n=e.call(this,i)||this;return n.statusCode=r,Object.setPrototypeOf(n,t.prototype),n}return g(t,e),t}(Error),we=function(e){function t(r){var i=e.call(this,r)||this;return Object.setPrototypeOf(i,t.prototype),i}return g(t,e),t}(Error),Se=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getVariants=function(e,t){return m(this,void 0,void 0,(function(){var r,i,n,o;return w(this,(function(a){switch(a.label){case 0:return r=be(JSON.stringify(e)),i={Authorization:"Api-Key ".concat(this.deploymentKey),"X-Amp-Exp-User":r},(null==t?void 0:t.flagKeys)&&(i["X-Amp-Exp-Flag-Keys"]=be(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(i["X-Amp-Exp-Track"]=t.trackingOption),n=new URL("".concat(this.serverUrl,"/sdk/v2/vardata?v=0")),(null==t?void 0:t.evaluationMode)&&n.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&n.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod),[4,this.httpClient.request({requestUrl:n.toString(),method:"GET",headers:i,timeoutMillis:null==t?void 0:t.timeoutMillis})];case 1:if(200!=(o=a.sent()).status)throw new me(o.status,"Fetch error response: status=".concat(o.status));return[2,JSON.parse(o.body)]}}))}))},e}(),xe=function(){function e(e,t,r){this.deploymentKey=e,this.serverUrl=t,this.httpClient=r}return e.prototype.getFlags=function(e){return m(this,void 0,void 0,(function(){var t,r;return w(this,(function(i){switch(i.label){case 0:return t={Authorization:"Api-Key ".concat(this.deploymentKey)},(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]="".concat(e.libraryName,"/").concat(e.libraryVersion)),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=be(JSON.stringify(e.user))),[4,this.httpClient.request({requestUrl:"".concat(this.serverUrl,"/sdk/v2/flags")+((null==e?void 0:e.deliveryMethod)?"?delivery_method=".concat(e.deliveryMethod):""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis})];case 1:if(200!=(r=i.sent()).status)throw Error("Flags error response: status=".concat(r.status));return[2,JSON.parse(r.body).reduce((function(e,t){return e[t.key]=t,e}),{})]}}))}))},e}(),ke="undefined"!=typeof globalThis?globalThis:global||self,Ee=function(){return"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:"undefined"!=typeof global?global:void 0},Pe=function(){var e=Ee();if(e)try{var t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){return!1}return!1},Oe=function(){function e(e,t){this.poller=void 0,this.action=e,this.ms=t}return e.prototype.start=function(){this.poller||(this.poller=ke.setInterval(this.action,this.ms),this.action())},e.prototype.stop=function(){this.poller&&(ke.clearInterval(this.poller),this.poller=void 0)},e}(),Me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var Ae,Ce,Ie,_e=(Ae=function(e,t){!function(r,i){var n="function",o="undefined",a="object",s="string",u="model",l="name",c="type",d="vendor",h="version",f="architecture",p="console",v="mobile",y="tablet",g="smarttv",b="wearable",m="embedded",w="Amazon",S="Apple",x="ASUS",k="BlackBerry",E="Browser",P="Chrome",O="Firefox",M="Google",A="Huawei",C="LG",I="Microsoft",_="Motorola",V="Opera",j="Samsung",T="Sharp",N="Sony",U="Xiaomi",R="Zebra",F="Facebook",L=function(e){for(var t={},r=0;r0?2===u.length?typeof u[1]==n?this[u[0]]=u[1].call(this,c):this[u[0]]=u[1]:3===u.length?typeof u[1]!==n||u[1].exec&&u[1].test?this[u[0]]=c?c.replace(u[1],u[2]):i:this[u[0]]=c?u[1].call(this,c,u[2]):i:4===u.length&&(this[u[0]]=c?u[3].call(this,c.replace(u[1],u[2])):i):this[u]=c||i;d+=2}},z=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var n=0;n350?B(e,350):e,this},this.setUA(n),this};G.VERSION="0.7.33",G.BROWSER=L([l,h,"major"]),G.CPU=L([f]),G.DEVICE=L([u,d,c,p,v,g,y,b,m]),G.ENGINE=G.OS=L([l,h]),e.exports&&(t=e.exports=G),t.UAParser=G;var H=typeof r!==o&&(r.jQuery||r.Zepto);if(H&&!H.ua){var Q=new G;H.ua=Q.getResult(),H.ua.get=function(){return Q.getUA()},H.ua.set=function(e){Q.setUA(e);var t=Q.getResult();for(var r in t)H.ua[r]=t[r]}}}("object"==typeof window?window:Me)},Ae(Ie={path:Ce,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&Ie.path)}},Ie.exports),Ie.exports),Ve=function(){function e(e){this.amplitudeInstance=e}return e.prototype.getUser=function(){var e,t,r,i,n,o,a,s,u,l;return{device_id:null===(t=null===(e=this.amplitudeInstance)||void 0===e?void 0:e.options)||void 0===t?void 0:t.deviceId,user_id:null===(i=null===(r=this.amplitudeInstance)||void 0===r?void 0:r.options)||void 0===i?void 0:i.userId,version:null===(o=null===(n=this.amplitudeInstance)||void 0===n?void 0:n.options)||void 0===o?void 0:o.versionName,language:null===(s=null===(a=this.amplitudeInstance)||void 0===a?void 0:a.options)||void 0===s?void 0:s.language,platform:null===(l=null===(u=this.amplitudeInstance)||void 0===u?void 0:u.options)||void 0===l?void 0:l.platform,os:this.getOs(),device_model:this.getDeviceModel()}},e.prototype.getOs=function(){var e,t,r,i,n,o;return[null===(r=null===(t=null===(e=this.amplitudeInstance)||void 0===e?void 0:e._ua)||void 0===t?void 0:t.browser)||void 0===r?void 0:r.name,null===(o=null===(n=null===(i=this.amplitudeInstance)||void 0===i?void 0:i._ua)||void 0===n?void 0:n.browser)||void 0===o?void 0:o.major].filter((function(e){return null!=e})).join(" ")},e.prototype.getDeviceModel=function(){var e,t,r;return null===(r=null===(t=null===(e=this.amplitudeInstance)||void 0===e?void 0:e._ua)||void 0===t?void 0:t.os)||void 0===r?void 0:r.name},e}(),je=function(){function e(e){this.amplitudeInstance=e}return e.prototype.track=function(e){this.amplitudeInstance.logEvent(e.name,e.properties)},e.prototype.setUserProperty=function(e){var t,r;this.amplitudeInstance.setUserProperties(((t={})[e.userProperty]=null===(r=e.variant)||void 0===r?void 0:r.value,t))},e.prototype.unsetUserProperty=function(e){var t;this.amplitudeInstance._logEvent("$identify",null,null,{$unset:(t={},t[e.userProperty]="-",t)})},e}(),Te=function(){return Te=Object.assign||function(e){for(var t,r=1,i=arguments.length;r0&&n[n.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Fe(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function Le(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n=2&&f[1]&&(p=atob(f[1])),{deviceId:f[0],userId:p}}catch(e){return}},De=function(e,t){if(t){if((null==e?void 0:e.length)<10)return;return"AMP_".concat(e.substring(0,10))}if(!((null==e?void 0:e.length)<6))return"amp_".concat(e.substring(0,6))},Be=function(){function e(e,t,r){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=r,this.loadPersistedState(),r<=0&&(this.setup=void 0)}return e.prototype.setup=function(e,t){return Ne(this,void 0,void 0,(function(){return Ue(this,(function(r){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener((function(){null==t||t.fetch()})),[2,this.waitForConnectorIdentity(this.timeoutMillis)]}))}))},e.prototype.getUser=function(){var e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}},e.prototype.track=function(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)},e.prototype.loadPersistedState=function(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;var e=Ke(this.apiKey,!0);return(e||(e=Ke(this.apiKey,!1))||(e=function(e){var t=De(e,!0);try{var r=ke.localStorage.getItem(t);if(!r)return;var i=JSON.parse(r);if("object"!=typeof i)return;return i}catch(e){return}}(this.apiKey))||!!(e=function(e){var t=De(e,!0);try{var r=ke.sessionStorage.getItem(t);if(!r)return;var i=JSON.parse(r);if("object"!=typeof i)return;return i}catch(e){return}}(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)},e.prototype.commitIdentityToConnector=function(e){var t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()},e.prototype.waitForConnectorIdentity=function(e){return Ne(this,void 0,void 0,(function(){var t,r=this;return Ue(this,(function(i){return(t=this.identityStore.getIdentity()).userId||t.deviceId?[2]:[2,Promise.race([new Promise((function(e){var t=function(){e(),r.identityStore.removeIdentityListener(t)};r.identityStore.addIdentityListener(t)})),new Promise((function(t,r){ke.setTimeout(r,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")}))])]}))}))},e}();var qe,ze,We=ke.fetch||function(e,t){return t=t||{},new Promise((function(r,i){var n=new XMLHttpRequest,o=[],a=[],s={},u=function(){return{ok:2==(n.status/100|0),statusText:n.statusText,status:n.status,url:n.responseURL,text:function(){return Promise.resolve(n.responseText)},json:function(){return Promise.resolve(JSON.parse(n.responseText))},blob:function(){return Promise.resolve(new Blob([n.response]))},clone:u,headers:{keys:function(){return o},entries:function(){return a},get:function(e){return s[e.toLowerCase()]},has:function(e){return e.toLowerCase()in s}}}};for(var l in n.open(t.method||"get",e,!0),n.onload=function(){n.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(e,t,r){o.push(t=t.toLowerCase()),a.push([t,r]),s[t]=s[t]?s[t]+","+r:r})),r(u())},n.onerror=i,n.withCredentials="include"==t.credentials,t.headers)n.setRequestHeader(l,t.headers[l]);n.send(t.body||null)}))},Je=function(){function e(e){this.client=e}return e.prototype.request=function(e){return Ne(this,void 0,void 0,(function(){return Ue(this,(function(t){switch(t.label){case 0:return[4,this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)];case 1:return[2,t.sent()]}}))}))},e}(),Ge={request:function(e,t,r,i,n){return function(e,t){return null==t||t<=0?e:new Promise((function(r,i){ke.setTimeout((function(){i(new we("Request timeout after "+t+" milliseconds"))}),t),e.then(r,i)}))}(Ne(void 0,void 0,void 0,(function(){var n,o;return Ue(this,(function(a){switch(a.label){case 0:return[4,We(e,{method:t,headers:r,body:i})];case 1:return n=a.sent(),o={status:n.status},[4,n.text()];case 2:return o.body=a.sent(),[2,o]}}))})),n)}};!function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(qe||(qe={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(ze||(ze={}));var He=function(e){return!e||e===ze.FallbackInline||e===ze.FallbackConfig||e===ze.SecondaryInitialVariants},Qe={debug:!1,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:qe.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:Ge},Xe="1.16.0",$e=function(){function e(e,t){var r,i=this;this.isReady=new Promise((function(e){i.resolve=e})),this.config=e,this.client=t;var n=null!==(r=e.instanceName)&&void 0!==r?r:Qe.instanceName;this.queue=new Ye(n),this.cache=new Ze(n)}return e.prototype.ready=function(){return this.integration?this.isReady:Promise.resolve()},e.prototype.setIntegration=function(e){var t=this;this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then((function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()}),(function(){t.queue.setTracker(t.integration.track.bind(e)),t.resolve()})):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())},e.prototype.getUser=function(){return this.integration?this.integration.getUser():{}},e.prototype.track=function(e){if(this.cache.shouldTrack(e)){var t=this.getExposureEvent(e);this.queue.push(t)}},e.prototype.getExposureEvent=function(e){var t,r,i,n={eventType:"$exposure",eventProperties:e};return(null===(t=e.metadata)||void 0===t?void 0:t.exposureEvent)?n={eventType:null===(r=e.metadata)||void 0===r?void 0:r.exposureEvent,eventProperties:e}:"web"===(null===(i=e.metadata)||void 0===i?void 0:i.deliveryMethod)&&(n={eventType:"$impression",eventProperties:e}),n},e}(),Ze=function(){function e(e){this.isSessionStorageAvailable=et(),this.inMemoryCache={},this.storageKey="EXP_sent_v2_".concat(e),this.isSessionStorageAvailable&&ke.sessionStorage.removeItem("EXP_sent_".concat(e))}return e.prototype.shouldTrack=function(e){var t;if("web"===(null===(t=e.metadata)||void 0===t?void 0:t.deliveryMethod))return!0;this.loadCache();var r=this.inMemoryCache[e.flag_key],i=!1;return r&&r.variant===e.variant||(i=!0,this.inMemoryCache[e.flag_key]=e),this.storeCache(),i},e.prototype.loadCache=function(){if(this.isSessionStorageAvailable){var e=ke.sessionStorage.getItem(this.storageKey);this.inMemoryCache=e?JSON.parse(e):{}}},e.prototype.storeCache=function(){this.isSessionStorageAvailable&&ke.sessionStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))},e}(),Ye=function(){function e(e,t){void 0===t&&(t=512),this.isLocalStorageAvailable=Pe(),this.inMemoryQueue=[],this.storageKey="EXP_unsent_".concat(e),this.maxQueueSize=t}return e.prototype.push=function(e){this.loadQueue(),this.inMemoryQueue.push(e),this.flush(),this.storeQueue()},e.prototype.setTracker=function(e){var t=this;this.tracker=e,this.poller=ke.setInterval((function(){t.loadFlushStore()}),1e3),this.loadFlushStore()},e.prototype.flush=function(){var e,t;if(this.tracker&&0!==this.inMemoryQueue.length){try{for(var r=Re(this.inMemoryQueue),i=r.next();!i.done;i=r.next()){var n=i.value;try{if(!this.tracker(n))return}catch(e){return}}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}this.inMemoryQueue=[],this.poller&&(ke.clearInterval(this.poller),this.poller=void 0)}},e.prototype.loadQueue=function(){if(this.isLocalStorageAvailable){var e=ke.localStorage.getItem(this.storageKey);this.inMemoryQueue=e?JSON.parse(e):[]}},e.prototype.storeQueue=function(){this.isLocalStorageAvailable&&(this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),ke.localStorage.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue)))},e.prototype.loadFlushStore=function(){this.loadQueue(),this.flush(),this.storeQueue()},e}(),et=function(){var e=Ee();if(e)try{var t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){return!1}return!1},tt=function(){function e(){this.globalScope=Ee()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.localStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.localStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.localStorage.removeItem(e)},e}(),rt=function(){function e(e,t,r){this.cache={},this.namespace=e,this.storage=t,this.transformer=r}return e.prototype.get=function(e){return this.cache[e]},e.prototype.getAll=function(){return Te({},this.cache)},e.prototype.put=function(e,t){this.cache[e]=t},e.prototype.putAll=function(e){var t,r;try{for(var i=Re(Object.keys(e)),n=i.next();!n.done;n=i.next()){var o=n.value;this.cache[o]=e[o]}}catch(e){t={error:e}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}},e.prototype.remove=function(e){delete this.cache[e]},e.prototype.clear=function(){this.cache={}},e.prototype.load=function(){var e,t,r,i=this.storage.get(this.namespace);try{r=JSON.parse(i)||{}}catch(e){return}var n={};try{for(var o=Re(Object.keys(r)),a=o.next();!a.done;a=o.next()){var s=a.value;try{var u=void 0;(u=this.transformer?this.transformer(r[s]):r[s])&&(n[s]=u)}catch(e){}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}this.clear(),this.putAll(n)},e.prototype.store=function(e){void 0===e&&(e=this.cache),this.storage.put(this.namespace,JSON.stringify(e))},e}(),it=function(e){if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){var t=e.key,r=e.value,i=e.payload,n=e.metadata,o=e.expKey;n&&n.experimentKey?o=n.experimentKey:o&&((n=n||{}).experimentKey=o);var a={};return t?a.key=t:r&&(a.key=r),r&&(a.value=r),n&&(a.metadata=n),i&&(a.payload=i),o&&(a.expKey=o),a}},nt=function(){function e(){this.globalScope=Ee()}return e.prototype.get=function(e){var t;return null===(t=this.globalScope)||void 0===t?void 0:t.sessionStorage.getItem(e)},e.prototype.put=function(e,t){var r;null===(r=this.globalScope)||void 0===r||r.sessionStorage.setItem(e,t)},e.prototype.delete=function(e){var t;null===(t=this.globalScope)||void 0===t||t.sessionStorage.removeItem(e)},e}(),ot=function(e){return null==e},at=function(e){return!!ot(e)||e&&0===Object.keys(e).length},st=function(e){var t;return"local"===(null===(t=null==e?void 0:e.metadata)||void 0===t?void 0:t.evaluationMode)},ut=function(){function e(e,t,r,i){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=r,this.scalar=i}return e.prototype.start=function(e){return Ne(this,void 0,void 0,(function(){return Ue(this,(function(t){switch(t.label){case 0:if(this.started)throw Error("Backoff already started");return this.started=!0,[4,this.backoff(e,0,this.min)];case 1:return t.sent(),[2]}}))}))},e.prototype.cancel=function(){this.done=!0,clearTimeout(this.timeoutHandle)},e.prototype.backoff=function(e,t,r){return Ne(this,void 0,void 0,(function(){var i=this;return Ue(this,(function(n){return this.done||(this.timeoutHandle=ke.setTimeout((function(){return Ne(i,void 0,void 0,(function(){var i,n;return Ue(this,(function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,e()];case 1:return o.sent(),[3,3];case 2:return o.sent(),(i=t+1)0&&d[0]){var h=d[0],f={group_name:h},p=null===(n=null===(i=e.group_properties)||void 0===i?void 0:i[c])||void 0===n?void 0:n[h];p&&Object.keys(p).length>0&&(f.group_properties=p),s[c]=f}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return Object.keys(s).length>0&&(o.groups=s),delete o.user.groups,delete o.user.group_properties,o}(i),a=this.engine.evaluate(o,n),s={};try{for(var u=Re(Object.keys(a)),l=u.next();!l.done;l=u.next()){var c=l.value;s[c]=ct(a[c])}}catch(e){t={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return s},e.prototype.variantAndSource=function(e,t){var r={};this.config.source===qe.LocalStorage?r=this.localStorageVariantAndSource(e,t):this.config.source===qe.InitialVariants&&(r=this.initialVariantsVariantAndSource(e,t));var i=this.flags.get(e);return(st(i)||!r.variant&&i)&&(r=this.localEvaluationVariantAndSource(e,i,t)),r},e.prototype.localEvaluationVariantAndSource=function(e,t,r){var i,n={},o=this.evaluate([t.key])[e],a=ze.LocalEvaluation,s=null===(i=null==o?void 0:o.metadata)||void 0===i?void 0:i.default;if(!ot(o)&&!s)return{variant:lt(o),source:a,hasDefaultVariant:!1};if(s&&(n={variant:lt(o),source:a,hasDefaultVariant:!0}),!ot(r))return{variant:lt(r),source:ze.FallbackInline,hasDefaultVariant:n.hasDefaultVariant};var u=this.config.initialVariants[e];if(!ot(u))return{variant:lt(u),source:ze.SecondaryInitialVariants,hasDefaultVariant:n.hasDefaultVariant};var l=lt(this.config.fallbackVariant),c={variant:l,source:ze.FallbackConfig,hasDefaultVariant:n.hasDefaultVariant};return at(l)?n:c},e.prototype.localStorageVariantAndSource=function(e,t){var r,i={},n=this.variants.get(e),o=null===(r=null==n?void 0:n.metadata)||void 0===r?void 0:r.default;if(!ot(n)&&!o)return{variant:lt(n),source:ze.LocalStorage,hasDefaultVariant:!1};if(o&&(i={variant:lt(n),source:ze.LocalStorage,hasDefaultVariant:!0}),!ot(t))return{variant:lt(t),source:ze.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var a=this.config.initialVariants[e];if(!ot(a))return{variant:lt(a),source:ze.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};var s=lt(this.config.fallbackVariant),u={variant:s,source:ze.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return at(s)?i:u},e.prototype.initialVariantsVariantAndSource=function(e,t){var r,i={},n=this.config.initialVariants[e];if(!ot(n))return{variant:lt(n),source:ze.InitialVariants,hasDefaultVariant:!1};var o=this.variants.get(e),a=null===(r=null==o?void 0:o.metadata)||void 0===r?void 0:r.default;if(!ot(o)&&!a)return{variant:lt(o),source:ze.LocalStorage,hasDefaultVariant:!1};if(a&&(i={variant:lt(o),source:ze.LocalStorage,hasDefaultVariant:!0}),!ot(t))return{variant:lt(t),source:ze.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};var s=lt(this.config.fallbackVariant),u={variant:s,source:ze.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return at(s)?i:u},e.prototype.fetchInternal=function(e,t,r,i){return Ne(this,void 0,void 0,(function(){var n,o;return Ue(this,(function(a){switch(a.label){case 0:if(!this.apiKey)throw Error("Experiment API key is empty");this.debug("[Experiment] Fetch all: retry=".concat(r)),r&&this.stopRetries(),a.label=1;case 1:return a.trys.push([1,4,,5]),[4,this.doFetch(e,t,i)];case 2:return n=a.sent(),[4,this.storeVariants(n,i)];case 3:return a.sent(),[2,n];case 4:throw o=a.sent(),r&&this.shouldRetryFetch(o)&&this.startRetries(e,i),o;case 5:return[2]}}))}))},e.prototype.cleanUserPropsForFetch=function(e){var t=Te({},e);return delete t.cookie,t},e.prototype.doFetch=function(e,t,r){return Ne(this,void 0,void 0,(function(){var i,n,o,a,s,u,l;return Ue(this,(function(c){switch(c.label){case 0:return[4,this.addContextOrWait(e)];case 1:return e=c.sent(),e=this.cleanUserPropsForFetch(e),this.debug("[Experiment] Fetch variants for user: ",e),[4,this.evaluationApi.getVariants(e,Te({timeoutMillis:t},r))];case 2:i=c.sent(),n={};try{for(o=Re(Object.keys(i)),a=o.next();!a.done;a=o.next())s=a.value,n[s]=ct(i[s])}catch(e){u={error:e}}finally{try{a&&!a.done&&(l=o.return)&&l.call(o)}finally{if(u)throw u.error}}return this.debug("[Experiment] Received variants: ",n),[2,n]}}))}))},e.prototype.doFlags=function(){return Ne(this,void 0,void 0,(function(){var e,t,r;return Ue(this,(function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),e=void 0,this.isWebExperiment?[4,this.addContextOrWait(this.getUser())]:[3,2];case 1:e=i.sent(),i.label=2;case 2:return[4,this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:Xe,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0})];case 3:return t=i.sent(),this.flags.clear(),this.flags.putAll(t),[3,5];case 4:if(!((r=i.sent())instanceof we))throw r;if(this.config.debug&&console.debug(r),this.config.throwOnError)throw r;return[3,5];case 5:try{this.flags.store()}catch(e){}return this.mergeInitialFlagsWithStorage(),[2]}}))}))},e.prototype.storeVariants=function(e,t){return Ne(this,void 0,void 0,(function(){var r,i,n,o;return Ue(this,(function(a){for(o in 0===(r=t&&t.flagKeys?t.flagKeys:[]).length&&this.variants.clear(),i=function(t){r=r.filter((function(e){return e!==t})),n.variants.put(t,e[t])},n=this,e)i(o);for(o in r)this.variants.remove(o);try{this.variants.store()}catch(e){}return this.debug("[Experiment] Stored variants: ",e),[2]}))}))},e.prototype.startRetries=function(e,t){return Ne(this,void 0,void 0,(function(){var r=this;return Ue(this,(function(i){return this.debug("[Experiment] Retry fetch"),this.retriesBackoff=new ut(8,500,1e4,1.5),this.retriesBackoff.start((function(){return Ne(r,void 0,void 0,(function(){return Ue(this,(function(r){switch(r.label){case 0:return[4,this.fetchInternal(e,1e4,!1,t)];case 1:return r.sent(),[2]}}))}))})),[2]}))}))},e.prototype.stopRetries=function(){this.retriesBackoff&&this.retriesBackoff.cancel()},e.prototype.addContext=function(e){var t,r=null===(t=this.userProvider)||void 0===t?void 0:t.getUser(),i=this.integrationManager.getUser(),n=Te(Te(Te({},null==r?void 0:r.user_properties),i.user_properties),null==e?void 0:e.user_properties);return Te(Te(Te(Te({library:"experiment-js-client/".concat(Xe)},r),i),e),{user_properties:n})},e.prototype.addContextOrWait=function(e){return Ne(this,void 0,void 0,(function(){return Ue(this,(function(t){switch(t.label){case 0:return[4,this.integrationManager.ready()];case 1:return t.sent(),[2,this.addContext(e)]}}))}))},e.prototype.sourceVariants=function(){return this.config.source==qe.LocalStorage?this.variants.getAll():this.config.source==qe.InitialVariants?this.config.initialVariants:void 0},e.prototype.secondaryVariants=function(){return this.config.source==qe.LocalStorage?this.config.initialVariants:this.config.source==qe.InitialVariants?this.variants.getAll():void 0},e.prototype.exposureInternal=function(e,t){var r,i,n,o,a,s,u,l,c;if(null===(n=null===(i=null===(r=t.variant)||void 0===r?void 0:r.metadata)||void 0===i?void 0:i.trackExposure)||void 0===n||n){this.legacyExposureInternal(e,t.variant,t.source);var d={flag_key:e},h=He(t.source);if(!h||t.hasDefaultVariant){(null===(o=t.variant)||void 0===o?void 0:o.expKey)&&(d.experiment_key=null===(a=t.variant)||void 0===a?void 0:a.expKey);var f=null===(s=t.variant)||void 0===s?void 0:s.metadata;h||(null==f?void 0:f.default)||((null===(u=t.variant)||void 0===u?void 0:u.key)?d.variant=t.variant.key:(null===(l=t.variant)||void 0===l?void 0:l.value)&&(d.variant=t.variant.value)),f&&(d.metadata=f),null===(c=this.exposureTrackingProvider)||void 0===c||c.track(d),this.integrationManager.track(d)}}},e.prototype.legacyExposureInternal=function(e,t,r){var i,n,o,a,s;if(this.analyticsProvider){var u=function(e,t,r,i){var n,o=null==r?void 0:r.value,a="[Experiment] ".concat(t);return{name:"[Experiment] Exposure",user:e,key:t,variant:r,userProperty:a,properties:{key:t,variant:o,source:i},userProperties:(n={},n[a]=o,n)}}(this.addContext(this.getUser()),e,t,r);He(r)||!(null==t?void 0:t.value)?null===(n=null===(i=this.analyticsProvider)||void 0===i?void 0:i.unsetUserProperty)||void 0===n||n.call(i,u):(null==t?void 0:t.value)&&(null===(a=null===(o=this.analyticsProvider)||void 0===o?void 0:o.setUserProperty)||void 0===a||a.call(o,u),null===(s=this.analyticsProvider)||void 0===s||s.track(u))}},e.prototype.debug=function(e){for(var t=[],r=1;r=500||429===e.statusCode)},e.prototype.addPlugin=function(e){"integration"===e.type&&this.integrationManager.setIntegration(e)},e}(),pt=function(){function e(e,t){var r,i,n;this.globalScope=Ee(),this.userAgent=void 0!==(null===(r=this.globalScope)||void 0===r?void 0:r.navigator)?null===(i=this.globalScope)||void 0===i?void 0:i.navigator.userAgent:void 0,this.ua=new _e.UAParser(this.userAgent).getResult(),this.localStorage=new tt,this.sessionStorage=new nt,this.userProvider=e,this.apiKey=t,this.storageKey="EXP_".concat(null===(n=this.apiKey)||void 0===n?void 0:n.slice(0,10),"_DEFAULT_USER_PROVIDER")}return e.prototype.getUser=function(){var e,t,r,i,n,o=(null===(e=this.userProvider)||void 0===e?void 0:e.getUser())||{};return Te({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!==(r=null===(t=this.ua.device)||void 0===t?void 0:t.type)&&void 0!==r?r:"desktop",referring_url:null===(n=null===(i=this.globalScope)||void 0===i?void 0:i.document)||void 0===n?void 0:n.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)},e.prototype.getLanguage=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},e.prototype.getOs=function(e){var t,r;return[null===(t=e.browser)||void 0===t?void 0:t.name,null===(r=e.browser)||void 0===r?void 0:r.major].filter((function(e){return null!=e})).join(" ")},e.prototype.getDeviceModel=function(e){var t;return null===(t=e.os)||void 0===t?void 0:t.name},e.prototype.getBrowser=function(e){var t,r=null===(t=e.browser)||void 0===t?void 0:t.name;return(null==r?void 0:r.includes("Chrom"))&&(r="Chrome"),(null==r?void 0:r.includes("Firefox"))&&(r="Firefox"),(null==r?void 0:r.includes("Safari"))&&(r="Safari"),(null==r?void 0:r.includes("Edge"))&&(r="Edge"),(null==r?void 0:r.includes("Opera"))&&(r="Opera"),r},e.prototype.getCookie=function(){var e,t,r,i,n;if(null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.document)||void 0===t?void 0:t.cookie)return Object.fromEntries(null===(n=null===(i=null===(r=this.globalScope)||void 0===r?void 0:r.document)||void 0===i?void 0:i.cookie)||void 0===n?void 0:n.split("; ").map((function(e){return e.split("=")})))},e.prototype.getLandingUrl=function(){var e,t;try{var r=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return r.landing_url||(r.landing_url=null===(t=null===(e=this.globalScope)||void 0===e?void 0:e.location)||void 0===t?void 0:t.href.replace(/\/$/,""),this.sessionStorage.put(this.storageKey,JSON.stringify(r))),r.landing_url}catch(e){return}},e.prototype.getFirstSeen=function(){try{var e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}},e.prototype.getUrlParam=function(){var e,t,r;if(this.globalScope){var i={};try{var n=new URL(this.globalScope.location.href);try{for(var o=Re(n.searchParams),a=o.next();!a.done;a=o.next()){var s=Fe(a.value,2),u=s[0],l=s[1];i[u]=Le(Le([],Fe(null!==(r=i[u])&&void 0!==r?r:[]),!1),Fe(l.split(",")),!1)}}catch(t){e={error:t}}finally{try{a&&!a.done&&(t=o.return)&&t.call(o)}finally{if(e)throw e.error}}}catch(e){return}return Object.entries(i).reduce((function(e,t){var r=Fe(t,2),i=r[0],n=r[1];return e[i]=1==n.length?n[0]:n,e}),{})}},e}();ke.experimentInstances={};var vt=ke.experimentInstances,yt=function(e,t){return mt(e,t)},gt=function(e,t){return mt(e,t,(function(){return new Be(e,v.getInstance(bt(t)),1e4)}))},bt=function(e){return(null==e?void 0:e.instanceName)||Qe.instanceName},mt=function(e,t,r){var i=function(e,t){var r=bt(t),i=null==t?void 0:t.internalInstanceNameSuffix;return i?"".concat(r,".").concat(e,".").concat(i):"".concat(r,".").concat(e)}(e,t),n=vt[i];return n||(n=function(e,t){return new ft(e,Te(Te({},t),{userProvider:new pt(null==t?void 0:t.userProvider,e)}))}(e,t),r&&n.addPlugin(r()),vt[i]=n,n)},wt={initialize:yt,initializeWithAmplitudeAnalytics:gt},St=function(){function e(){}return e.prototype.getUser=function(){return{}},e.prototype.start=function(e){return Ne(this,void 0,void 0,(function(){return Ue(this,(function(e){return[2]}))}))},e.prototype.stop=function(){},e.prototype.setUser=function(e){},e.prototype.fetch=function(e,t){return Ne(this,void 0,void 0,(function(){return Ue(this,(function(e){return[2,this]}))}))},e.prototype.getUserProvider=function(){return null},e.prototype.setUserProvider=function(e){return this},e.prototype.variant=function(e,t){return Qe.fallbackVariant},e.prototype.all=function(){return{}},e.prototype.clear=function(){},e.prototype.exposure=function(e){},e}(),xt=Object.freeze({__proto__:null,AmplitudeAnalyticsProvider:je,AmplitudeIntegrationPlugin:Be,AmplitudeUserProvider:Ve,Experiment:wt,ExperimentClient:ft,get Source(){return qe},StubExperimentClient:St,initialize:yt,initializeWithAmplitudeAnalytics:gt}),kt=/^[a-zA-Z:_][a-zA-Z0-9:_.-]*$/,Et={revert:function(){}},Pt=new Map,Ot=new Set;function Mt(e){var t=Pt.get(e);return t||(t={element:e,attributes:{}},Pt.set(e,t)),t}function At(e,t,r,i,n){var o=r(e),a={isDirty:!1,originalValue:o,virtualValue:o,mutations:[],el:e,_positionTimeout:null,rateLimitCount:0,observer:new MutationObserver((function(){if(!(a.rateLimitCount>=10||(a.rateLimitCount++,setTimeout((function(){a.rateLimitCount=a.rateLimitCount-1,a.rateLimitCount<=0&&(a.rateLimitCount=0)}),1e3),"position"===t&&a._positionTimeout))){"position"===t&&(a._positionTimeout=setTimeout((function(){a._positionTimeout=null}),1e3));var i=r(e);"position"===t&&i.parentNode===a.virtualValue.parentNode&&i.insertBeforeNode===a.virtualValue.insertBeforeNode||i!==a.virtualValue&&(a.originalValue=i,n(a))}})),mutationRunner:n,setValue:i,getCurrentValue:r};return"position"===t&&e.parentNode?a.observer.observe(e.parentNode,{childList:!0,subtree:!0,attributes:!1,characterData:!1}):a.observer.observe(e,function(e){return"html"===e?{childList:!0,subtree:!0,attributes:!0,characterData:!0}:{childList:!1,subtree:!1,attributes:!0,attributeFilter:[e]}}(t)),a}function Ct(e,t){var r=t.getCurrentValue(t.el);t.virtualValue=e,e&&"string"!=typeof e?r&&e.parentNode===r.parentNode&&e.insertBeforeNode===r.insertBeforeNode||(t.isDirty=!0,Xt()):e!==r&&(t.isDirty=!0,Xt())}function It(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),Ct(function(e){qt||(qt=document.createElement("div"));return qt.innerHTML=e,qt.innerHTML}(t),e)}function _t(e){var t=new Set(e.originalValue.split(/\s+/).filter(Boolean));e.mutations.forEach((function(e){return e.mutate(t)})),Ct(Array.from(t).filter(Boolean).join(" "),e)}function Vt(e){var t=e.originalValue;e.mutations.forEach((function(e){return t=e.mutate(t)})),Ct(t,e)}function jt(e){var t=e.originalValue;e.mutations.forEach((function(e){var r=function(e){var t=e.parentSelector,r=e.insertBeforeSelector,i=document.querySelector(t);if(!i)return null;var n=r?document.querySelector(r):null;return r&&!n?null:{parentNode:i,insertBeforeNode:n}}(e.mutate());t=r||t})),Ct(t,e)}var Tt=function(e){return e.innerHTML},Nt=function(e,t){return e.innerHTML=t};function Ut(e){var t=Mt(e);return t.html||(t.html=At(e,"html",Tt,Nt,It)),t.html}var Rt=function(e){return{parentNode:e.parentElement,insertBeforeNode:e.nextElementSibling}},Ft=function(e,t){t.insertBeforeNode&&!t.parentNode.contains(t.insertBeforeNode)||t.parentNode.insertBefore(e,t.insertBeforeNode)};function Lt(e){var t=Mt(e);return t.position||(t.position=At(e,"position",Rt,Ft,jt)),t.position}var Kt=function(e,t){return t?e.className=t:e.removeAttribute("class")},Dt=function(e){return e.className};function Bt(e){var t=Mt(e);return t.classes||(t.classes=At(e,"class",Dt,Kt,_t)),t.classes}var qt,zt,Wt=function(e){return function(t){var r;return null!=(r=t.getAttribute(e))?r:null}},Jt=function(e){return function(t,r){return null!==r?t.setAttribute(e,r):t.removeAttribute(e)}};function Gt(e,t){var r=Mt(e);return r.attributes[t]||(r.attributes[t]=At(e,t,Wt(t),Jt(t),Vt)),r.attributes[t]}function Ht(e,t,r){if(r.isDirty){r.isDirty=!1;var i=r.virtualValue;r.mutations.length||function(e,t){var r,i,n=Pt.get(e);if(n)if("html"===t)null==(r=n.html)||null==(i=r.observer)||i.disconnect(),delete n.html;else if("class"===t){var o,a;null==(o=n.classes)||null==(a=o.observer)||a.disconnect(),delete n.classes}else if("position"===t){var s,u;null==(s=n.position)||null==(u=s.observer)||u.disconnect(),delete n.position}else{var l,c,d;null==(l=n.attributes)||null==(c=l[t])||null==(d=c.observer)||d.disconnect(),delete n.attributes[t]}}(e,t),r.setValue(e,i)}}function Qt(e,t){e.html&&Ht(t,"html",e.html),e.classes&&Ht(t,"class",e.classes),e.position&&Ht(t,"position",e.position),Object.keys(e.attributes).forEach((function(r){Ht(t,r,e.attributes[r])}))}function Xt(){Pt.forEach(Qt)}function $t(e){if("position"!==e.kind||1!==e.elements.size){var t=new Set(e.elements);document.querySelectorAll(e.selector).forEach((function(r){t.has(r)||(e.elements.add(r),function(e,t){var r=null;"html"===e.kind?r=Ut(t):"class"===e.kind?r=Bt(t):"attribute"===e.kind?r=Gt(t,e.attribute):"position"===e.kind&&(r=Lt(t)),r&&(r.mutations.push(e),r.mutationRunner(r))}(e,r))}))}}function Zt(e){e.elements.forEach((function(t){return function(e,t){var r=null;if("html"===e.kind?r=Ut(t):"class"===e.kind?r=Bt(t):"attribute"===e.kind?r=Gt(t,e.attribute):"position"===e.kind&&(r=Lt(t)),r){var i=r.mutations.indexOf(e);-1!==i&&r.mutations.splice(i,1),r.mutationRunner(r)}}(e,t)})),e.elements.clear(),Ot.delete(e)}function Yt(){Ot.forEach($t)}function er(e){return"undefined"==typeof document?Et:(Ot.add(e),$t(e),{revert:function(){Zt(e)}})}function tr(e,t){return er({kind:"html",elements:new Set,mutate:t,selector:e})}function rr(e,t){return er({kind:"position",elements:new Set,mutate:t,selector:e})}function ir(e,t){return er({kind:"class",elements:new Set,mutate:t,selector:e})}function nr(e,t,r){return kt.test(t)?"class"===t||"className"===t?ir(e,(function(e){var t=r(Array.from(e).join(" "));e.clear(),t&&t.split(/\s+/g).filter(Boolean).forEach((function(t){return e.add(t)}))})):er({kind:"attribute",attribute:t,elements:new Set,mutate:r,selector:e}):Et}"undefined"!=typeof document&&(zt||(zt=new MutationObserver((function(){Yt()}))),Yt(),zt.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!1,characterData:!1}));var or={html:tr,classes:ir,attribute:nr,position:rr,declarative:function(e){var t=e.selector,r=e.action,i=e.value,n=e.attribute,o=e.parentSelector,a=e.insertBeforeSelector;if("html"===n){if("append"===r)return tr(t,(function(e){return e+(null!=i?i:"")}));if("set"===r)return tr(t,(function(){return null!=i?i:""}))}else if("class"===n){if("append"===r)return ir(t,(function(e){i&&e.add(i)}));if("remove"===r)return ir(t,(function(e){i&&e.delete(i)}));if("set"===r)return ir(t,(function(e){e.clear(),i&&e.add(i)}))}else if("position"===n){if("set"===r&&o)return rr(t,(function(){return{insertBeforeSelector:a,parentSelector:o}}))}else{if("append"===r)return nr(t,n,(function(e){return null!==e?e+(null!=i?i:""):null!=i?i:""}));if("set"===r)return nr(t,n,(function(){return null!=i?i:""}));if("remove"===r)return nr(t,n,(function(){return null}))}return Et}},ar={useDefaultNavigationHandler:!0},sr=function(){function e(){this.messageToSubscriberGroup=new Map,this.subscriberGroupCallback=new Map}return e.prototype.subscribe=function(e,t,r,i){void 0===r&&(r=void 0);var n=this.messageToSubscriberGroup.get(e);n||(n={subscribers:[]},this.messageToSubscriberGroup.set(e,n),i&&this.subscriberGroupCallback.set(e,i));var o={identifier:r,callback:t};n.subscribers.push(o)},e.prototype.publish=function(e,t){var r,i=this.messageToSubscriberGroup.get(e);i&&(i.subscribers.forEach((function(e){t=t||{},e.callback(t)})),null===(r=this.subscriberGroupCallback.get(e))||void 0===r||r(t))},e.prototype.unsubscribeAll=function(){this.messageToSubscriberGroup=new Map,this.subscriberGroupCallback=new Map},e}(),ur=function(){function e(){}return e.setup=function(){var e,t="closed";null===(e=Ee())||void 0===e||e.addEventListener("message",(function(e){var r=/^.*\.amplitude\.com$/;try{if(!e.origin||!r.test(new URL(e.origin).hostname))return}catch(e){return}if("OpenOverlay"===e.data.type){if("closed"!==t||!r.test(new URL(e.data.context.injectSrc).hostname))return;t="opening",lr(e.data.context.injectSrc).then((function(){t="open"})).catch((function(){t="closed"}))}}))},e}(),lr=function(e){return new Promise((function(t,r){var i;try{var n=document.createElement("script");n.type="text/javascript",n.async=!0,n.src=e;var o=document.querySelector("[nonce]");o&&n.setAttribute("nonce",o.nonce||o.nonce||o.getAttribute("nonce")),n.addEventListener("load",(function(){t({status:!0})}),{once:!0}),n.addEventListener("error",(function(){r({status:!1,message:"Failed to load the script ".concat(e)})})),null===(i=document.head)||void 0===i||i.appendChild(n)}catch(e){r(e)}}))};var cr={observerOptions:{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class"]},debounceMs:150},dr=function(){function t(r,i,a,s){void 0===a&&(a=[]),void 0===s&&(s={});var u=this;this.mutationObserver=null,this.pendingMutations=[],this.processMutationsImmediately=function(){if(u.mutationObserver)try{u.pendingMutations.length>0&&u.onMutations(u.pendingMutations)}catch(e){}finally{u.pendingMutations=[]}},this.handleMutations=function(e){var r,i;try{var a=e.filter((function(e){return u.shouldProcessMutation(e)}));if(0===a.length)return;if(u.pendingMutations.length+a.length>t.MAX_PENDING_MUTATIONS)return(r=u.pendingMutations).push.apply(r,o([],n(a),!1)),u.processMutationsDebounced.cancel(),void u.processMutationsImmediately();(i=u.pendingMutations).push.apply(i,o([],n(a),!1)),u.processMutationsDebounced()}catch(e){}},this.target=r,this.onMutations=i,this.filters=a,this.options=e(e({},cr),s),this.processMutationsDebounced=function(e,t,r){void 0===r&&(r={});var i=null,a=null,s=function(){for(var s=[],u=0;u0&&!hr.evaluateConditions({context:{page:{url:u.globalScope.location.href}},result:{}},e.conditions))return!1;switch(e.trigger_type){case"url_change":return!0;case"manual":return t.name===e.trigger_value.name;case"analytics_event":var r=t;return r.event_type===e.trigger_value.event_type&&Object.entries(e.trigger_value.event_properties||{}).every((function(e){var t=n(e,2),i=t[0],o=t[1];return r.event_properties[i]===o}));case"element_appeared":var i=u.globalScope.document.querySelector(e.trigger_value.selector);if(i){var o=window.getComputedStyle(i);return"none"!==o.display&&"hidden"!==o.visibility}return!1;default:return!1}},this.cloneActivePagesMap=function(t){var r={};for(var i in t)for(var n in r[i]={},t[i])r[i][n]=e({},t[i][n]);return r},this.areActivePagesEqual=function(e,t){var r,n,o,a,s=Object.keys(e),u=Object.keys(t);if(s.length!==u.length)return!1;try{for(var l=i(s),c=l.next();!c.done;c=l.next()){var d=c.value,h=e[d],f=t[d];if(!f)return!1;var p=Object.keys(h),v=Object.keys(f);if(p.length!==v.length)return!1;try{for(var y=(o=void 0,i(p)),g=y.next();!g.done;g=y.next()){var b=g.value,m=h[b],w=f[b];if(!w||m.id!==w.id)return!1}}catch(e){o={error:e}}finally{try{g&&!g.done&&(a=y.return)&&a.call(y)}finally{if(o)throw o.error}}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(n=l.return)&&n.call(l)}finally{if(r)throw r.error}}return!0},this.webExperimentClient=t,this.messageBus=r,this.pageObjects=o,this.options=a,this.globalScope=s},pr=function(){var e,t,r=Ee(),o=new URLSearchParams(null==r?void 0:r.location.search),a={};try{for(var s=i(o),u=s.next();!u.done;u=s.next()){var l=n(u.value,2),c=l[0],d=l[1];a[c]=d}}catch(t){e={error:t}}finally{try{u&&!u.done&&(t=s.return)&&t.call(s)}finally{if(e)throw e.error}}return a},vr=function(e){if(!e)return"";var t=new URL(e);return t.search="",t.hash="",t.toString()},yr=function(e,t){var r,n,o=new URL(e);try{for(var a=i(t),s=a.next();!s.done;s=a.next()){var u=s.value;o.searchParams.delete(u)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return o.toString()},gr=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,gr)},br="mutate",mr="inject";ke.Experiment=xt;var wr=function(){function a(t,r,i,n){void 0===n&&(n={});var o,a=this;this.appliedInjections=new Set,this.appliedMutations={},this.previousUrl=void 0,this.urlExposureCache={},this.flagVariantMap={},this.localFlagKeys=[],this.remoteFlagKeys=[],this.isRemoteBlocking=!1,this.isRunning=!1,this.activePages={},this.isVisualEditorMode=!1;var s=Ee();if(!s||!Pe())throw new Error("Amplitude Web Experiment Client could not be initialized.");this.globalScope=s,this.apiKey=t,this.initialFlags=JSON.parse(r),this.pageObjects=JSON.parse(i),this.config=e(e(e({},ar),n),null!==(o=this.globalScope.experimentConfig)&&void 0!==o?o:{});var u=pr();this.initialFlags.forEach((function(e){var t=e.key,r=e.variants,i=e.metadata,n=void 0===i?{}:i;if(a.flagVariantMap[t]={},Object.keys(r).forEach((function(e){a.flagVariantMap[t][e]=function(e){if(!e)return{};var t=void 0;e.metadata&&(t="string"==typeof e.metadata.experimentKey?e.metadata.experimentKey:void 0);var r={};return e.key&&(r.key=e.key),e.value&&(r.value=e.value),e.payload&&(r.payload=e.payload),t&&(r.expKey=t),e.metadata&&(r.metadata=e.metadata),r}(r[e])})),u.PREVIEW&&t in u&&u[t]in r){a.globalScope.history.replaceState({},"",yr(a.globalScope.location.href,["PREVIEW",t]));var o={metadata:{segmentName:"Preview"},variant:u[t]};e.segments=[o],n.evaluationMode="local"}"local"!==n.evaluationMode&&a.remoteFlagKeys.push(t),e.metadata=n}));var l=JSON.stringify(this.initialFlags);this.experimentClient=wt.initialize(this.apiKey,e({internalInstanceNameSuffix:"web",initialFlags:l,fetchTimeoutMillis:1e3,pollOnStart:!1,fetchOnStart:!1,automaticExposureTracking:!1},this.config));var c=this.experimentClient.all();this.localFlagKeys=Object.keys(c).filter((function(e){var t,r;return"local"===(null===(r=null===(t=c[e])||void 0===t?void 0:t.metadata)||void 0===r?void 0:r.evaluationMode)})),this.messageBus=new sr}return a.prototype.start=function(){var o,a,s,u;return t(this,void 0,void 0,(function(){var t,l,c,d,h,f,p,y,g,b,m,w;return r(this,(function(r){switch(r.label){case 0:if(this.isRunning)return[2];if(t=pr(),this.isVisualEditorMode="true"===t.VISUAL_EDITOR,this.subscriptionManager=new fr(this,this.messageBus,this.pageObjects,e(e({},this.config),{isVisualEditorMode:this.isVisualEditorMode}),this.globalScope),this.subscriptionManager.initSubscriptions(),this.isVisualEditorMode)return ur.setup(),this.globalScope.history.replaceState({},"",yr(this.globalScope.location.href,["VISUAL_EDITOR"])),this.messageBus.publish("url_change",{updateActivePages:!0}),this.isRunning=!0,[2];this.messageBus.publish("url_change",{updateActivePages:!0}),l="EXP_".concat(this.apiKey.slice(0,10));try{c=JSON.parse(this.globalScope.localStorage.getItem(l)||"{}")}catch(e){c={}}c.web_exp_id?c.web_exp_id&&c.device_id&&(delete c.device_id,this.globalScope.localStorage.setItem(l,JSON.stringify(c))):(c.web_exp_id=c.device_id||gr(),delete c.device_id,this.globalScope.localStorage.setItem(l,JSON.stringify(c))),d=this.getVariants();try{for(h=i(Object.entries(d)),f=h.next();!f.done;f=h.next())p=n(f.value,2),y=p[0],g=p[1],this.remoteFlagKeys.includes(y)&&(null===(o=g.metadata)||void 0===o?void 0:o.blockingEvaluation)&&Object.keys(this.activePages).includes(y)&&(this.isRemoteBlocking=!0,this.applyAntiFlickerCss())}catch(e){m={error:e}}finally{try{f&&!f.done&&(w=h.return)&&w.call(h)}finally{if(m)throw m.error}}return this.globalScope.experimentIntegration||(b=v.getInstance("$default_instance"),this.globalScope.experimentIntegration=new Be(this.apiKey,b,1e3)),this.globalScope.experimentIntegration.type="integration",this.experimentClient.addPlugin(this.globalScope.experimentIntegration),this.experimentClient.setUser(c),this.isRemoteBlocking||null===(u=null===(s=(a=this.globalScope.document).getElementById)||void 0===s?void 0:s.call(a,"amp-exp-css"))||void 0===u||u.remove(),this.applyVariants({flagKeys:this.localFlagKeys}),0===this.remoteFlagKeys.length?(this.isRunning=!0,[2]):[4,this.fetchRemoteFlags()];case 1:return r.sent(),this.applyVariants({flagKeys:this.remoteFlagKeys}),this.isRunning=!0,[2]}}))}))},a.getInstance=function(e,t,r,i){void 0===i&&(i={});var n=Ee();if(!n)throw new Error("Amplitude Web Experiment Client could not be initialized.");if(null==n?void 0:n.webExperiment)return n.webExperiment;var o=new a(e,t,r,i);return n.webExperiment=o,o},a.prototype.getExperimentClient=function(){return this.experimentClient},a.prototype.applyVariants=function(e){var t,r,i=(e||{}).flagKeys,n=this.getVariants();if(0!==Object.keys(n).length){var o=vr(this.globalScope.location.href);for(var a in(null===(t=this.urlExposureCache)||void 0===t?void 0:t[o])||(this.urlExposureCache={},this.urlExposureCache[o]={}),n)if(!i||i.includes(a)){var s=n[a],u=s.key||"";if(this.appliedMutations[a]){var l=Object.keys(this.appliedMutations[a]);l.length>0&&!l.includes(u)&&(this.revertVariants({flagKeys:[a]}),delete this.appliedMutations[a])}if("web"===(null===(r=s.metadata)||void 0===r?void 0:r.deliveryMethod)){var c=Array.isArray(s.payload);if(("off"===s.key||"control"===s.key)&&(this.isActionActiveOnPage(a,void 0)&&this.exposureWithDedupe(a,s),"off"===s.key)){this.revertVariants({flagKeys:[a]});continue}c&&this.handleVariantAction(a,s)}}}},a.prototype.revertVariants=function(e){var t,r,n,o;if(this.appliedMutations){var a=(e||{}).flagKeys;a||(a=Object.keys(this.appliedMutations));try{for(var s=i(a),u=s.next();!u.done;u=s.next()){var l=u.value,c=this.appliedMutations[l];if(c){for(var d in c){var h=c[d];if(h)for(var f in h)for(var p in h[f])null===(o=null===(n=h[f][p])||void 0===n?void 0:n.revert)||void 0===o||o.call(n)}delete this.appliedMutations[l]}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=s.return)&&r.call(s)}finally{if(t)throw t.error}}}},a.prototype.previewVariants=function(e){var t=e.keyToVariant;if(t)for(var r in this.revertVariants({flagKeys:Object.keys(t)}),t){var i=t[r],n=this.flagVariantMap[r];if(!n)return;var o=n[i];if(!o)return;var a=o.payload;if(!a||!Array.isArray(a))return;this.handleVariantAction(r,o)}},a.prototype.getVariants=function(){var e,t,r={};try{for(var a=i(o(o([],n(this.localFlagKeys),!1),n(this.remoteFlagKeys),!1)),s=a.next();!s.done;s=a.next()){var u=s.value;r[u]=this.experimentClient.variant(u)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}return r},a.prototype.getActiveExperiments=function(){return Object.keys(this.appliedMutations)},a.prototype.getActivePages=function(){return this.activePages},a.prototype.addPageChangeSubscriber=function(e){if(this.subscriptionManager)return this.subscriptionManager.addPageChangeSubscriber(e)},a.prototype.setPageObjects=function(e){var t,r;this.isVisualEditorMode&&(this.pageObjects=e,null===(t=this.subscriptionManager)||void 0===t||t.setPageObjects(e),this.activePages={},this.messageBus.unsubscribeAll(),null===(r=this.subscriptionManager)||void 0===r||r.initSubscriptions(),this.messageBus.publish("url_change",{updateActivePages:!0}))},a.prototype.setRedirectHandler=function(e){this.customRedirectHandler=e},a.prototype.fetchRemoteFlags=function(){return t(this,void 0,void 0,(function(){var e;return r(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.experimentClient.doFlags()];case 1:return t.sent(),[3,3];case 2:return e=t.sent(),console.warn("Error fetching remote flags:",e),[3,3];case 3:return[2]}}))}))},a.prototype.handleVariantAction=function(e,t){var r,n;try{for(var o=i(t.payload),a=o.next();!a.done;a=o.next()){var s=a.value;"redirect"===s.action?this.handleRedirect(s,e,t):s.action===br?this.handleMutate(s,e,t):s.action===mr&&this.handleInject(s,e,t)}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},a.prototype.handleRedirect=function(e,t,r){var i,n,o;if(this.isActionActiveOnPage(t,null===(n=null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.metadata)||void 0===n?void 0:n.scope)){var a=vr(this.previousUrl||this.globalScope.document.referrer),s=null===(o=null==e?void 0:e.data)||void 0===o?void 0:o.url;if(vr(this.globalScope.location.href)!==a){var u=function(e,t){var r=new URL(e),i=new URL(t),n=new URL(t);return r.searchParams.forEach((function(e,t){i.searchParams.has(t)||n.searchParams.append(t,e)})),n.toString()}(this.globalScope.location.href,s);this.globalScope.location.href!==u&&(this.exposureWithDedupe(t,r),this.previousUrl=this.globalScope.location.href,this.customRedirectHandler?this.customRedirectHandler(u):this.globalScope.location.replace(u))}}},a.prototype.handleMutate=function(t,r,i){var n,o,a,s,u,l=this,c=(null===(n=t.data)||void 0===n?void 0:n.mutations)||[],d=i.key||"";if(0!==c.length){var h={};c.forEach((function(e,t){var n,o,a,s,u,c,f,p,v,y,g;l.isActionActiveOnPage(r,null===(n=null==e?void 0:e.metadata)||void 0===n?void 0:n.scope)?(l.exposureWithDedupe(r,i),(null===(g=null===(y=null===(v=l.appliedMutations[r])||void 0===v?void 0:v[d])||void 0===y?void 0:y[br])||void 0===g?void 0:g[t])||(h[t]=or.declarative(e))):(null===(s=null===(a=null===(o=l.appliedMutations[r])||void 0===o?void 0:o[d])||void 0===a?void 0:a[br])||void 0===s?void 0:s[t])&&(null===(p=null===(f=null===(c=null===(u=l.appliedMutations[r])||void 0===u?void 0:u[d])||void 0===c?void 0:c[br])||void 0===f?void 0:f[t])||void 0===p||p.revert(),delete l.appliedMutations[r][d][br][t])})),null!==(o=(s=this.appliedMutations)[r])&&void 0!==o||(s[r]={}),null!==(a=(u=this.appliedMutations[r])[d])&&void 0!==a||(u[d]={}),this.appliedMutations[r][d][br]=e(e({},this.appliedMutations[r][d][br]),h),0===Object.keys(this.appliedMutations[r][d][br]||{}).length&&delete this.appliedMutations[r][d][br],0===Object.keys(this.appliedMutations[r][d]||{}).length&&delete this.appliedMutations[r]}},a.prototype.handleInject=function(e,i,n){var o,a,s,u,l,c,d,h,f,p,v,y,g=this,b=n.key||"";if(this.isActionActiveOnPage(i,null===(o=null==e?void 0:e.metadata)||void 0===o?void 0:o.scope)){var m=e.data.id;if(m&&"string"==typeof m&&0!==m.length&&(m=m.replace(/-/g,""),!this.appliedInjections.has(m))){var w,S=e.data.js;S&&(w=this.globalScope.document.createElement("script"))&&(w.innerHTML="function ".concat(m,"(html, utils, id){").concat(S,"};"),w.id="js-".concat(m),this.globalScope.document.head.appendChild(w));var x,k=e.data.css;k&&(x=this.globalScope.document.createElement("style"))&&(x.innerHTML=k,x.id="css-".concat(m),this.globalScope.document.head.appendChild(x));var E,P=e.data.html;P&&(E=null!==(c=(new DOMParser).parseFromString(P,"text/html").body.firstElementChild)&&void 0!==c?c:void 0);var O={waitForElement:function(e){return t(this,void 0,void 0,(function(){var t;return r(this,(function(r){return(t=document.querySelector(e))?[2,t]:[2,new Promise((function(t){var r=new MutationObserver((function(){var i=document.querySelector(e);i&&(r.disconnect(),t(i))}));r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0})}))]}))}))}};this.appliedInjections.add(m);try{var M=this.globalScope[m];M&&"function"==typeof M&&M(E,O,m)}catch(e){null==w||w.remove(),console.error("Experiment inject failed for ".concat(i," variant ").concat(n.key,". Reason:"),e)}null!==(d=(p=this.appliedMutations)[i])&&void 0!==d||(p[i]={}),null!==(h=(v=this.appliedMutations[i])[b])&&void 0!==h||(v[b]={}),null!==(f=(y=this.appliedMutations[i][b])[mr])&&void 0!==f||(y[mr]={}),this.appliedMutations[i][b][mr][m]={revert:function(){var e;null===(e=O.remove)||void 0===e||e.call(O),null==x||x.remove(),null==w||w.remove(),g.appliedInjections.delete(m)}},this.exposureWithDedupe(i,n)}}else null===(l=null===(u=null===(s=null===(a=this.appliedMutations[i])||void 0===a?void 0:a[b])||void 0===s?void 0:s[mr])||void 0===u?void 0:u[0])||void 0===l||l.revert()},a.prototype.exposureWithDedupe=function(e,t){var r,i,n=vr(this.globalScope.location.href);(null===(i=null===(r=this.urlExposureCache)||void 0===r?void 0:r[n])||void 0===i?void 0:i[e])===t.key||(this.experimentClient.exposure(e),this.urlExposureCache[n][e]=t.key)},a.prototype.applyAntiFlickerCss=function(){if(!this.globalScope.document.getElementById("amp-exp-css")){var e=document.createElement("style");e.id="amp-exp-css",e.innerText="* { visibility: hidden !important; background-image: none !important; }",document.head.appendChild(e),this.globalScope.window.setTimeout((function(){e.remove()}),1e3)}},a.prototype.updateActivePages=function(e,t,r){this.activePages[e]||(this.activePages[e]={}),r?this.activePages[e][t.id]=t:(delete this.activePages[e][t.id],0===Object.keys(this.activePages[e]).length&&delete this.activePages[e])},a.prototype.isActionActiveOnPage=function(e,t){var r=this.activePages[e];return t?t.some((function(e){var t;return null!==(t=null==r?void 0:r[e])&&void 0!==t&&t})):!!r&&Object.values(r).some(Boolean)},a}();wr.getInstance("630e4710abefa73fcc01f80278294574","[]","{}",{serverZone:"EU"}).start().then((function(){var e;null===(e=document.getElementById("amp-exp-css"))||void 0===e||e.remove()}))})); + }catch(e){console.log(e);}try{'use strict';(function(c,k){var d=c.amplitude||{_q:[],_iq:{}};if(d.invoked)c.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var f=function(b,a){b.prototype[a]=function(){this._q.push({name:a,args:Array.prototype.slice.call(arguments,0)});return this}},t=function(b,a,l){return function(m){b._q.push({name:a,args:Array.prototype.slice.call(l,0),resolve:m})}},n=function(b,a,l){b[a]=function(){if(l)return{promise:new Promise(t(b,a,Array.prototype.slice.call(arguments)))}; + var m=Array.prototype.slice.call(arguments);b._q.push({name:a,args:Array.prototype.slice.call(m,0)})}},r=function(b){for(var a=0;a` - : ``; + const amplitudeCdnScript = ``; const amplitudeListenerScript = ``; + const amplitudeCdnScript = ``; const amplitudeListenerScript = `