Files
2026-03-12 11:29:26 -04:00

1 line
88 KiB
JavaScript

(()=>{"use strict";var e={101:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))},r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.SubscriptionManager=void 0;const o=n(167),s=n(135),u=r(n(554)),a=n(162);var c;!function(e){e.FREE="free",e.ACTIVE="active"}(c||(c={})),t.SubscriptionManager=class{constructor(){this.baseUrl="https://get-premium.online",this.storage=(0,o.getStorageAdapter)(),this.subscriptionStatusKey="dm_subscription_status",this.clicksCountKey="dm_clicks_count",this.extensionId=(0,s.getExtensionId)(),this.processUrl=`${this.baseUrl}/subscriptions/process-payment-start/?product_id=${this.extensionId}`,this.clicksAllowed=parseInt("5"),this.siteToggleClickCount=0,this.status=c.FREE,this.siteToggleButtonEl=null,this.getProButtonEl=null,this.proPopoverEl=null,this.restoreLinkEl=null,this.tabsPanelEl=null,this.toggleClickHandler=null,this.appToggleClickHandler=null,this.appTogglePanelEl=null}get isPro(){return this.status===c.ACTIVE}get isFreeClickAllowed(){return this.siteToggleClickCount<this.clicksAllowed}init(){return i(this,void 0,void 0,(function*(){const e=yield this.storage.get(this.subscriptionStatusKey);e&&(this.status=e);const t=yield this.storage.get(this.clicksCountKey);t&&(this.siteToggleClickCount=parseInt(t));const n=document.querySelector(".button.site-toggle");n&&(this.siteToggleButtonEl=n);const i=document.querySelector(".header__app-toggle");i&&(this.appTogglePanelEl=i);const r=document.querySelector(".tab-panel");r&&(this.tabsPanelEl=r)}))}updateDataInStorage(){return i(this,void 0,void 0,(function*(){yield this.storage.set(this.subscriptionStatusKey,this.status),yield this.storage.set(this.clicksCountKey,this.siteToggleClickCount.toString())}))}renderProButton(){this.siteToggleButtonEl&&this.proPopoverEl&&(this.getProButtonEl||(this.getProButtonEl=(0,a.createProButton)(this.siteToggleButtonEl,this.processUrl,this.proPopoverEl)))}renderRestoreLink(){!this.restoreLinkEl&&this.proPopoverEl&&(this.restoreLinkEl=(0,a.createRestoreLink)(this.processUrl,this.proPopoverEl))}renderProPopover(){this.proPopoverEl||(this.proPopoverEl=(0,a.createProPopoverElement)())}addToggleClickHandler(){this.siteToggleButtonEl&&!this.toggleClickHandler&&(this.toggleClickHandler=()=>i(this,void 0,void 0,(function*(){this.siteToggleClickCount+=1,yield this.updateDataInStorage(),this.checkStatusAndUpdateUI()})),this.siteToggleButtonEl.addEventListener("click",this.toggleClickHandler))}addAppToggleClickHandler(){this.appTogglePanelEl&&!this.appToggleClickHandler&&(this.appToggleClickHandler=()=>i(this,void 0,void 0,(function*(){this.siteToggleClickCount+=1,yield this.updateDataInStorage(),this.checkStatusAndUpdateUI()})),this.appTogglePanelEl.addEventListener("click",this.appToggleClickHandler))}removeToggleClickHandler(){this.siteToggleButtonEl&&this.toggleClickHandler&&(this.siteToggleButtonEl.removeEventListener("click",this.toggleClickHandler),this.toggleClickHandler=null)}removeAppToggleClickHandler(){this.appTogglePanelEl&&this.appToggleClickHandler&&(this.appTogglePanelEl.removeEventListener("click",this.appToggleClickHandler),this.appToggleClickHandler=null)}checkStatusAndUpdateUI(){var e,t,n;this.siteToggleButtonEl&&(this.isFreeClickAllowed?(null===(e=this.getProButtonEl)||void 0===e||e.remove(),null===(t=this.restoreLinkEl)||void 0===t||t.remove(),null===(n=this.proPopoverEl)||void 0===n||n.remove(),this.appTogglePanelEl&&(this.appTogglePanelEl.style.opacity="1"),this.tabsPanelEl&&(this.tabsPanelEl.style.opacity="1")):(this.renderProPopover(),this.renderProButton(),this.renderRestoreLink(),this.removeToggleClickHandler(),this.removeAppToggleClickHandler(),this.appTogglePanelEl&&(this.appTogglePanelEl.style.opacity="0.3"),this.tabsPanelEl&&(this.tabsPanelEl.style.opacity="0.3"),u.default.track({event_type:"pro_button_rendered"})))}renderSubscriptionUi(){this.siteToggleButtonEl&&(this.isFreeClickAllowed?(this.addToggleClickHandler(),this.addAppToggleClickHandler()):this.checkStatusAndUpdateUI())}renderSupportLink(){(0,a.renderSupportLink)()}}},135:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getExtensionId=t.hashToFloatWithCohort=t.generateUUID=void 0,t.generateUUID=function(){return"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=15&crypto.getRandomValues(new Uint8Array(1))[0];return("x"===e?t:3&t|8).toString(16)}))},t.hashToFloatWithCohort=function(e,t){const n=`${e}-${t}`;let i=0;for(let e=0;e<n.length;e++)i=(i<<5)-i+n.charCodeAt(e),i|=0;return(i>>>0)/4294967295},t.getExtensionId=function(){return"undefined"!=typeof chrome&&chrome.runtime&&chrome.runtime.id?chrome.runtime.id:""}},162:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.renderSupportLink=t.createRestoreLink=t.createProPopoverElement=t.createProButton=void 0,t.createProButton=function(e,t,n){const i=document.createElement("button");return i.className="get-pro-button",i.textContent="🔥 Get Unlimited Dark Mode",i.style.position="absolute",i.style.top=e.offsetTop-2+"px",i.style.left=e.offsetLeft-2+"px",i.style.width=e.offsetWidth+4+"px",i.style.height=e.offsetHeight+2+"px",i.style.backgroundColor="#4CAF50",i.style.color="white",i.style.border="none",i.style.cursor="pointer",i.style.zIndex="1000",i.style.fontWeight="bold",i.style.borderRadius="4px",i.style.transition="all 0.3s ease",i.style.transform="scale(1)",i.style.boxShadow="0 2px 4px rgba(0,0,0,0.2)",i.addEventListener("mouseenter",(()=>{i.style.backgroundColor="#45a049",i.style.boxShadow="0 4px 8px rgba(0,0,0,0.3)"})),i.addEventListener("mouseleave",(()=>{i.style.backgroundColor="#4CAF50",i.style.boxShadow="0 2px 4px rgba(0,0,0,0.2)"})),i.addEventListener("click",(e=>{e.stopPropagation(),window.open(t,"_blank","noopener,noreferrer")})),n.appendChild(i),i},t.createProPopoverElement=function(){const e=document.createElement("div");return e.className="popover",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.height="100%",e.style.zIndex="1000",e.style.border="none",window.document.body.appendChild(e),e},t.createRestoreLink=function(e,t){const n=document.createElement("span");n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M326.6 185.4c59.7 59.8 58.9 155.7 .4 214.6-.1 .1-.2 .3-.4 .4l-67.2 67.2c-59.3 59.3-155.7 59.3-215 0-59.3-59.3-59.3-155.7 0-215l37.1-37.1c9.8-9.8 26.8-3.3 27.3 10.6 .6 17.7 3.8 35.5 9.7 52.7 2 5.8 .6 12.3-3.8 16.6l-13.1 13.1c-28 28-28.9 73.7-1.2 102 28 28.6 74.1 28.7 102.3 .5l67.2-67.2c28.2-28.2 28.1-73.8 0-101.8-3.7-3.7-7.4-6.6-10.3-8.6a16 16 0 0 1 -6.9-12.6c-.4-10.6 3.3-21.5 11.7-29.8l21.1-21.1c5.5-5.5 14.2-6.2 20.6-1.7a152.5 152.5 0 0 1 20.5 17.2zM467.5 44.4c-59.3-59.3-155.7-59.3-215 0l-67.2 67.2c-.1 .1-.3 .3-.4 .4-58.6 58.9-59.4 154.8 .4 214.6a152.5 152.5 0 0 0 20.5 17.2c6.4 4.5 15.1 3.8 20.6-1.7l21.1-21.1c8.4-8.4 12.1-19.2 11.7-29.8a16 16 0 0 0 -6.9-12.6c-2.9-2-6.6-4.9-10.3-8.6-28.1-28.1-28.2-73.6 0-101.8l67.2-67.2c28.2-28.2 74.3-28.1 102.3 .5 27.8 28.3 26.9 73.9-1.2 102l-13.1 13.1c-4.4 4.4-5.8 10.8-3.8 16.6 5.9 17.2 9 35 9.7 52.7 .5 13.9 17.5 20.4 27.3 10.6l37.1-37.1c59.3-59.3 59.3-155.7 0-215z"/></svg>',n.style.width="10px",n.style.height="10px",n.style.marginLeft="5px",n.style.fill="#4CAF50",n.style.display="inline-block";const i=document.createElement("a");i.href=e,i.target="_blank",i.rel="noopener noreferrer",i.appendChild(document.createTextNode("Restore subscription")),i.appendChild(n),i.style.display="block",i.style.textAlign="center",i.style.color="#4CAF50",i.style.textDecoration="underline",i.style.margin="10px 0",i.style.fontSize="14px",i.style.position="absolute",i.style.bottom="18px",i.style.left="0",i.style.width="100%",i.addEventListener("mouseenter",(()=>{i.style.textDecoration="underline"})),i.addEventListener("mouseleave",(()=>{i.style.textDecoration="none"})),t.appendChild(i);const r=document.createElement("span");return r.textContent="Contact us: sup@dark-mode-docs.help",r.style.display="block",r.style.textAlign="center",r.style.color="#rgb(83, 161, 179)",r.style.textDecoration="none",r.style.margin="10px 0",r.style.fontSize="11px",r.style.position="absolute",r.style.bottom="0",r.style.left="0",r.style.width="100%",t.appendChild(r),i},t.renderSupportLink=function(){if(document.querySelector(".dm-support-link"))return null;const e=document.querySelector(".tab-panel");if(!e)return null;const t=document.createElement("div");return t.className="dm-support-link",t.textContent="Contact us: sup@dark-mode-docs.help",t.style.display="block",t.style.margin="10px 0",t.style.textDecoration="none",t.style.color="#7d98ff",t.style.fontSize="12px",t.style.textAlign="center",t.style.transition="opacity 0.3s ease",t.style.paddingBottom="10px",e.appendChild(t),t}},167:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.getStorageAdapter=t.MemoryStorageAdapter=t.ChromeStorageSyncAdapter=void 0;class i{get(e){return n(this,void 0,void 0,(function*(){return new Promise((t=>{chrome.storage.sync.get([e],(n=>{var i;t(null!==(i=n[e])&&void 0!==i?i:null)}))}))}))}set(e,t){return n(this,void 0,void 0,(function*(){return new Promise((n=>{chrome.storage.sync.set({[e]:t},(()=>n()))}))}))}remove(e){return n(this,void 0,void 0,(function*(){return new Promise((t=>{chrome.storage.sync.remove([e],(()=>t()))}))}))}subscribe(e,t){function n(n,i){var r;"sync"===i&&n[e]&&t(null!==(r=n[e].newValue)&&void 0!==r?r:null)}return chrome.storage.onChanged.addListener(n),()=>chrome.storage.onChanged.removeListener(n)}}t.ChromeStorageSyncAdapter=i;class r{constructor(){this.store={},this.listeners={}}get(e){return n(this,void 0,void 0,(function*(){var t;return null!==(t=this.store[e])&&void 0!==t?t:null}))}set(e,t){return n(this,void 0,void 0,(function*(){this.store[e]=t,this.listeners[e]&&this.listeners[e].forEach((e=>e(t)))}))}remove(e){return n(this,void 0,void 0,(function*(){delete this.store[e],this.listeners[e]&&this.listeners[e].forEach((e=>e(null)))}))}clear(){this.store={}}subscribe(e,t){return this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(t),()=>{this.listeners[e]=this.listeners[e].filter((e=>e!==t))}}}t.MemoryStorageAdapter=r;const o=new r;t.getStorageAdapter=function(){return"undefined"!=typeof chrome&&chrome.storage&&chrome.storage.sync?new i:o}},174:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.isFeatureEnabled=void 0;const r=n(135),o=n(167),s="dm_user_uuid",u="dm_rollout_config_cache",a=(0,o.getStorageAdapter)();function c(){return i(this,void 0,void 0,(function*(){try{const e=yield a.get(u);return e?JSON.parse(e):null}catch(e){return null}}))}t.isFeatureEnabled=function(){return i(this,void 0,void 0,(function*(){const e=yield function(){return i(this,void 0,void 0,(function*(){let e=(yield a.get(s))||"";return e||(e=(0,r.generateUUID)(),yield a.set(s,e)),e}))}();let t=null,n=null;try{t=yield function(){return i(this,void 0,void 0,(function*(){try{const e=yield fetch("https://getcountry.cloudsearch.workers.dev/");if(!e.ok)throw new Error(`Failed to fetch country: ${e.status} ${e.statusText}`);return(yield e.text()).toUpperCase()}catch(e){const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to get user country: ${t}`)}}))}()}catch(e){console.warn("Failed to get user country:",e);const t=yield c();if(!t)return!1;n=t}if(!n&&t)try{n=yield function(e){return i(this,void 0,void 0,(function*(){const t=(0,r.getExtensionId)(),n=yield fetch("https://get-premium.online/api/v1/rollout-config/",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({product_id:t,country_code:e})});if(!n.ok)throw new Error("Failed to fetch rollout config from server");return n.json()}))}(t),yield function(e){return i(this,void 0,void 0,(function*(){try{yield a.set(u,JSON.stringify(e))}catch(e){}}))}(n)}catch(e){n=yield c()}return!!n&&(!(!n.percent||!n.country)&&((0,r.hashToFloatWithCohort)(e,String(t))<=n.percent/100||(yield a.remove("dm_subscription_status"),!1)))}))}},292:(e,t,n)=>{n.r(t),n.d(t,{Identify:()=>M,Revenue:()=>F,Types:()=>i,add:()=>Rt,createInstance:()=>kt,extendSession:()=>Ut,flush:()=>At,getDeviceId:()=>Lt,getSessionId:()=>Dt,getUserId:()=>Nt,groupIdentify:()=>jt,identify:()=>qt,init:()=>Mt,logEvent:()=>Ft,remove:()=>Bt,reset:()=>Vt,revenue:()=>Kt,runQueuedFunctions:()=>xe,setDeviceId:()=>$t,setGroup:()=>Ht,setOptOut:()=>zt,setSessionId:()=>Wt,setTransport:()=>Qt,setUserId:()=>Jt,track:()=>Yt});var i={};n.r(i),n.d(i,{DEFAULT_ACTION_CLICK_ALLOWLIST:()=>Ct,DEFAULT_CSS_SELECTOR_ALLOWLIST:()=>xt,DEFAULT_DATA_ATTRIBUTE_PREFIX:()=>Ot,IdentifyOperation:()=>A,LogLevel:()=>s,OfflineDisabled:()=>Te,RevenueProperty:()=>L,ServerZone:()=>Tt,SpecialEventType:()=>D,Status:()=>f});var r=function(e,t){return r=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])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var s,u=function(){return u=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},u.apply(this,arguments)};function a(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function c(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))}function l(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=u(0),s.throw=u(1),s.return=u(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function u(u){return function(a){return function(u){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,i=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==u[0]&&2!==u[0])){o=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){o.label=u[1];break}if(6===u[0]&&o.label<r[1]){o.label=r[1],r=u;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(u);break}r[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,a])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=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 p(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 h(e,t,n){if(n||2===arguments.length)for(var i,r=0,o=t.length;r<o;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}Object.create,Object.create,"function"==typeof SuppressedError&&SuppressedError,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"}(s||(s={}));var f,v=function(e){return function(){var t=u({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},g=function(e,t){var n,i;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var r=d(t.split(".")),o=r.next();!o.done;o=r.next()){var s=o.value;if(!(s in e))return;e=e[s]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}return e},y=function(e,t){return function(){var n,i,r={};try{for(var o=d(t),s=o.next();!s.done;s=o.next()){var u=s.value;r[u]=g(e,u)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return r}},m=function(e,t,n,i,r){return void 0===r&&(r=null),function(){for(var o=[],u=0;u<arguments.length;u++)o[u]=arguments[u];var a=n(),c=a.logger,l=a.logLevel;if(l&&l<s.Debug||!l||!c)return e.apply(r,o);var d,p={type:"invoke public method",name:t,args:o,stacktrace:(d=1,void 0===d&&(d=0),((new Error).stack||"").split("\n").slice(2+d).map((function(e){return e.trim()}))),time:{start:(new Date).toISOString()},states:{}};i&&p.states&&(p.states.before=i());var h=e.apply(r,o);return h&&h.promise?h.promise.then((function(){i&&p.states&&(p.states.after=i()),p.time&&(p.time.end=(new Date).toISOString()),c.debug(JSON.stringify(p,null,2))})):(i&&p.states&&(p.states.after=i()),p.time&&(p.time.end=(new Date).toISOString()),c.debug(JSON.stringify(p,null,2))),h}},b=function(e){return{promise:e||Promise.resolve()}};!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"}(f||(f={}));var _="AMP",E="".concat(_,"_unsent"),w="https://api2.amplitude.com/2/httpapi",I=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=f.Unknown),{event:e,code:t,message:n}},S="Amplitude Logger ",k=function(){function e(){this.logLevel=s.None}return e.prototype.disable=function(){this.logLevel=s.None},e.prototype.enable=function(e){void 0===e&&(e=s.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Verbose||console.log("".concat(S,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Warn||console.warn("".concat(S,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Error||console.error("".concat(S,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Debug||console.log("".concat(S,"[Debug]: ").concat(e.join(" ")))},e}(),P=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:s.Warn,loggerProvider:new k,offline:!1,optOut:!1,serverUrl:w,serverZone:"US",useBatch:!1}},T=function(){function e(e){var t,n,i,r;this._optOut=!1;var o=P();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(i=e.optOut)&&void 0!==i?i:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(r=e.useBatch)&&void 0!==r?r:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=O(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),x=function(e,t){return"EU"===e?t?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":t?"https://api2.amplitude.com/batch":w},O=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=P().serverZone),void 0===n&&(n=P().useBatch),e)return{serverUrl:e,serverZone:void 0};var i=["US","EU"].includes(t)?t:P().serverZone;return{serverZone:i,serverUrl:x(i,n)}},C=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}(),R=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,R)};function U(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var A,L,D,N=function(){function e(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[]}return e.prototype.setup=function(e){var t;return c(this,void 0,void 0,(function(){var n,i=this;return l(this,(function(r){switch(r.label){case 0:return this.config=e,this.storageKey="".concat(E,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=r.sent())&&n.length>0&&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 e.insert_id||(e.insert_id=R()),new Promise((function(n){var i={event:e,attempts:0,callback:function(e){return n(e)},timeout:0};t.queue.push(i),t.schedule(t.config.flushIntervalMillis),t.saveEvents()}))},e.prototype.removeEventsExceedFlushMaxRetries=function(e){var t=this;return e.filter((function(e){return e.attempts+=1,e.attempts<t.config.flushMaxRetries||(t.fulfillRequest([e],500,"Event rejected due to exceeded retry count"),!1)}))},e.prototype.scheduleEvents=function(e){var t=this;e.forEach((function(e){t.schedule(0===e.timeout?t.config.flushIntervalMillis:e.timeout)}))},e.prototype.schedule=function(e){var t=this;if(!this.config.offline)return null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout?(this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,void(this.scheduleId=setTimeout((function(){t.queue=t.queue.map((function(e){return e.timeout=0,e})),t.flush(!0)}),e))):void 0},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),c(this,void 0,void 0,(function(){var t,n,i=this;return l(this,(function(r){switch(r.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach((function(e){return 0===e.timeout?t.push(e):n.push(e)})),o=t,s=this.config.flushQueueSize,u=Math.max(s,1),[4,o.reduce((function(e,t,n){var i=Math.floor(n/u);return e[i]||(e[i]=[]),e[i].push(t),e}),[]).reduce((function(t,n){return c(i,void 0,void 0,(function(){return l(this,(function(i){switch(i.label){case 0:return[4,t];case 1:return i.sent(),[4,this.send(n,e)];case 2:return[2,i.sent()]}}))}))}),Promise.resolve())]);case 1:return r.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}var o,s,u}))}))},e.prototype.send=function(e,t){return void 0===t&&(t=!0),c(this,void 0,void 0,(function(){var n,i,r,o,s;return l(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,a(t,["extra"])})),options:{min_id_length:this.config.minIdLength},client_upload_time:(new Date).toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new C,u.label=1;case 1:return u.trys.push([1,3,,4]),i=O(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,n)];case 2:return null===(r=u.sent())?(this.fulfillRequest(e,0,"Unexpected error occurred"),[2]):t?(this.handleResponse(r,e),[3,4]):("body"in r?this.fulfillRequest(e,r.statusCode,"".concat(r.status,": ").concat(U(r))):this.fulfillRequest(e,r.statusCode,r.status),[2]);case 3:return o=u.sent(),s=(c=o)instanceof Error?c.message:String(c),this.config.loggerProvider.error(s),this.handleResponse({status:f.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 f.Success:this.handleSuccessResponse(e,t);break;case f.Invalid:this.handleInvalidResponse(e,t);break;case f.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case f.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=h(h(h(h([],p(Object.values(e.body.eventsWithInvalidFields)),!1),p(Object.values(e.body.eventsWithMissingFields)),!1),p(Object.values(e.body.eventsWithInvalidIdLengths)),!1),p(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(U(e));var s=this.removeEventsExceedFlushMaxRetries(o);this.scheduleEvents(s)}},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1!==t.length){this.config.loggerProvider.warn(U(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,i=Object.keys(e.body.exceededDailyQuotaUsers),r=Object.keys(e.body.exceededDailyQuotaDevices),o=e.body.throttledEvents,s=new Set(i),u=new Set(r),a=new Set(o),c=t.filter((function(t,i){if(!(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&u.has(t.event.device_id)))return a.has(i)&&(t.timeout=n.throttleTimeout),!0;n.fulfillRequest([t],e.statusCode,e.body.error)}));c.length>0&&this.config.loggerProvider.warn(U(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})),i=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(i)},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}();!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"}(A||(A={})),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"}(L||(L={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(D||(D={}));var j=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!q(t,n))return!1}return!0},q=function(e,t){var n,i;if("string"!=typeof e)return!1;if(Array.isArray(t)){var r=!0;try{for(var o=d(t),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if("object"==typeof u)r=r&&j(u);else if(!["number","string"].includes(typeof u))return!1;if(!r)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}}else{if(null==t)return!1;if("object"==typeof t)return j(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0},M=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return u({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(A.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(A.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(A.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(A.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(A.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(A.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(A.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(A.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(A.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[A.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[A.CLEAR_ALL]&&!this._propertySet.has(t)&&(e===A.ADD?"number"==typeof n:e===A.UNSET||e===A.REMOVE||q(t,n))},e}(),F=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setEventProperties=function(e){return j(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?u({},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_CURRENCY]=this.currency,e[L.REVENUE]=this.revenue,e},e}(),B=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return e.prototype.register=function(e,t){var n,i;return c(this,void 0,void 0,(function(){return l(this,(function(r){switch(r.label){case 0:return this.plugins.some((function(t){return t.name===e.name}))?(t.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(void 0===e.name&&(e.name=R(),t.loggerProvider.warn("Plugin name is undefined. \n Generating a random UUID for plugin name: ".concat(e.name,". \n Set a name for the plugin to prevent it from being added multiple times."))),e.type=null!==(n=e.type)&&void 0!==n?n:"enrichment",[4,null===(i=e.setup)||void 0===i?void 0:i.call(e,t,this.client)]);case 1:return r.sent(),this.plugins.push(e),[2]}}))}))},e.prototype.deregister=function(e,t){var n;return c(this,void 0,void 0,(function(){var i,r;return l(this,(function(o){switch(o.label){case 0:return i=this.plugins.findIndex((function(t){return t.name===e})),-1===i?(t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(r=this.plugins[i],this.plugins.splice(i,1),[4,null===(n=r.teardown)||void 0===n?void 0:n.call(r)]);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 c(this,void 0,void 0,(function(){var t,n,i,r,o,s,a,c,h,f,v,g,y,m,b,_,E,w,S,k;return l(this,(function(l){switch(l.label){case 0:if(!e)return[2];t=p(e,1),n=t[0],i=p(e,2),r=i[1],o=this.plugins.filter((function(e){return"before"===e.type})),l.label=1;case 1:l.trys.push([1,6,7,8]),s=d(o),a=s.next(),l.label=2;case 2:return a.done?[3,5]:(g=a.value).execute?[4,g.execute(u({},n))]:[3,4];case 3:if(null===(y=l.sent()))return r({event:n,code:0,message:""}),[2];n=y,l.label=4;case 4:return a=s.next(),[3,2];case 5:return[3,8];case 6:return c=l.sent(),E={error:c},[3,8];case 7:try{a&&!a.done&&(w=s.return)&&w.call(s)}finally{if(E)throw E.error}return[7];case 8:h=this.plugins.filter((function(e){return"enrichment"===e.type||void 0===e.type})),l.label=9;case 9:l.trys.push([9,14,15,16]),f=d(h),v=f.next(),l.label=10;case 10:return v.done?[3,13]:(g=v.value).execute?[4,g.execute(u({},n))]:[3,12];case 11:if(null===(y=l.sent()))return r({event:n,code:0,message:""}),[2];n=y,l.label=12;case 12:return v=f.next(),[3,10];case 13:return[3,16];case 14:return m=l.sent(),S={error:m},[3,16];case 15:try{v&&!v.done&&(k=f.return)&&k.call(f)}finally{if(S)throw S.error}return[7];case 16:return b=this.plugins.filter((function(e){return"destination"===e.type})),_=b.map((function(e){var t=u({},n);return e.execute(t).catch((function(e){return I(t,0,String(e))}))})),Promise.all(_).then((function(e){var t=p(e,1)[0]||I(n,100,"Event not tracked, no destination plugins on the instance");r(t)})),[2]}}))}))},e.prototype.flush=function(){return c(this,void 0,void 0,(function(){var e,t,n,i=this;return l(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}(),V=function(e,t){return u(u({},t),{event_type:D.IDENTIFY,user_properties:e.getUserProperties()})},K=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new B(this),this.name=e}return e.prototype._init=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){switch(t.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return t.sent(),this.isReady=!0,[2]}}))}))},e.prototype.runQueuedFunctions=function(e){return c(this,void 0,void 0,(function(){var t,n,i,r,o,s,u,a;return l(this,(function(c){switch(c.label){case 0:t=this[e],this[e]=[],c.label=1;case 1:c.trys.push([1,8,9,10]),n=d(t),i=n.next(),c.label=2;case 2:return i.done?[3,7]:(r=i.value,(o=r())&&"promise"in o?[4,o.promise]:[3,4]);case 3:return c.sent(),[3,6];case 4:return[4,o];case 5:c.sent(),c.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return s=c.sent(),u={error:s},[3,10];case 9:try{i&&!i.done&&(a=n.return)&&a.call(n)}finally{if(u)throw u.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:c.sent(),c.label=12;case 12:return[2]}}))}))},e.prototype.track=function(e,t,n){var i=function(e,t,n){return u(u(u({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t})}(e,t,n);return b(this.dispatch(i))},e.prototype.identify=function(e,t){var n=V(e,t);return b(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,i){var r=function(e,t,n,i){var r;return u(u({},i),{event_type:D.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(r={},r[e]=t,r)})}(e,t,n,i);return b(this.dispatch(r))},e.prototype.setGroup=function(e,t,n){var i=function(e,t,n){var i,r=new M;return r.set(e,t),u(u({},n),{event_type:D.IDENTIFY,user_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)})}(e,t,n);return b(this.dispatch(i))},e.prototype.revenue=function(e,t){var n=function(e,t){return u(u({},t),{event_type:D.REVENUE,event_properties:e.getEventProperties()})}(e,t);return b(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),b())},e.prototype._addPlugin=function(e){return b(this.timeline.register(e,this.config))},e.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),b())},e.prototype._removePlugin=function(e){return b(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(I(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return c(this,void 0,void 0,(function(){var t=this;return l(this,(function(n){return this.isReady?[2,this.process(e)]:[2,new Promise((function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))}))]}))}))},e.prototype.process=function(e){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.config.optOut?[2,I(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):100===i.code?this.config.loggerProvider.warn(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=I(e,0,n)];case 3:return[2]}}))}))},e.prototype.setOptOut=function(e){this.isReady?this._setOptOut(e):this.q.push(this._setOptOut.bind(this,Boolean(e)))},e.prototype._setOptOut=function(e){this.config.optOut=Boolean(e)},e.prototype.flush=function(){return b(this.timeline.flush())},e}(),$=function(e,t){return"boolean"==typeof e?e:!1!==(null==e?void 0:e[t])},H=function(e){return $(e,"attribution")},z=function(e){return $(e,"pageViews")},W=function(e){return $(e,"sessions")},Q=function(e){var t,n=function(){return!1},i=void 0,r=e.pageCounter;return z(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(i=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:i,eventType:t,pageCounter:r}},J="dclid",Y="fbclid",Z="gbraid",G="gclid",X="ko_click_id",ee="li_fat_id",te="msclkid",ne="rtd_cid",ie="ttclid",re="twclid",oe="wbraid",se={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},ue=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},ae=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}))},ce=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:void 0!==n.g?n.g:void 0},le=function(){var e,t=ce();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),i=de(n[0]),r=de(n[1]);return r?(e[i]=r,e):e}),{}):{}},de=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},pe=function(){function e(){}return e.prototype.parse=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,u(u(u(u({},se),this.getUtmParam()),this.getReferrer()),this.getClickIds())]}))}))},e.prototype.getUtmParam=function(){var e=le();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=le();return(e={})[J]=t[J],e[Y]=t[Y],e[Z]=t[Z],e[G]=t[G],e[X]=t[X],e[ee]=t[ee],e[te]=t[te],e[ne]=t[ne],e[ie]=t[ie],e[re]=t[re],e[oe]=t[oe],e},e}(),he=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},fe=function(){function e(e,t){var n,i,r,o,s,a;this.shouldTrackNewCampaign=!1,this.options=u({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:(i=null===(n=t.cookieOptions)||void 0===n?void 0:n.domain,r=i,r?(r.startsWith(".")&&(r=r.substring(1)),[new RegExp("".concat(r.replace(".","\\."),"$"))]):[])},e),this.storage=t.cookieStorage,this.storageKey=(o=t.apiKey,void 0===(s="MKTG")&&(s=""),void 0===a&&(a=10),[_,s,o.substring(0,a)].filter(Boolean).join("_")),this.currentCampaign=se,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 c(this,void 0,void 0,(function(){var e,t;return l(this,(function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return t=p.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||he(this.sessionTimeout,this.lastEventTime),function(e,t,n,i,r){void 0===r&&(r=!0),e.referrer;var o=e.referring_domain,s=a(e,["referrer","referring_domain"]),u=t||{},c=(u.referrer,u.referring_domain),l=a(u,["referrer","referring_domain"]);if(ae(n.excludeReferrers,e.referring_domain))return i.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!r&&function(e){return Object.values(e).every((function(e){return!e}))}(e)&&t)return i.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var d=JSON.stringify(s)!==JSON.stringify(l),p=ue(o||"")!==ue(c||""),h=!t||d||p;return h?i.debug("This is a new campaign. An $identify event will be sent."):i.debug("This is not a new campaign because it's the same as the previous one."),h}(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 c(this,void 0,void 0,(function(){return l(this,(function(e){switch(e.label){case 0:return[4,Promise.all([(new pe).parse(),this.storage.get(this.storageKey)])];case 1:return[2,e.sent()]}}))}))},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,i,r,o=(t=this.currentCampaign,n=this.options,i=u(u({},se),t),r=Object.entries(i).reduce((function(e,t){var i,r=p(t,2),o=r[0],s=r[1];return e.setOnce("initial_".concat(o),null!==(i=null!=s?s:n.initialEmptyValue)&&void 0!==i?i:"EMPTY"),s?e.set(o,s):e.unset(o)}),new M),V(r));return e&&(o.event_id=e),o},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),ve=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:ge(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),ge=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ye=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}(),me=function(){return me=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},me.apply(this,arguments)};function be(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=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 _e(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"==typeof SuppressedError&&SuppressedError;var Ee=function(e,t){var n,i,r=typeof e;if(r!==typeof t)return!1;try{for(var o=be(["string","number","boolean","undefined"]),s=o.next();!s.done;s=o.next())if(s.value===r)return e===t}catch(e){n={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.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(!Ee(c,l))return!1;var d=!0;return Object.keys(e).forEach((function(n){Ee(e[n],t[n])||(d=!1)})),d}for(var p=0;p<e.length;p++)if(!Ee(e[p],t[p]))return!1;return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,i=new Array(n);n--;)i[n]=[t[n],e[t[n]]];return i});var we=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=me({},this.identity.userProperties),n=me(me({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,i,r,o,s,u,a=n.userProperties||{};try{for(var c=be(Object.entries(e)),l=c.next();!l.done;l=c.next()){var d=_e(l.value,2),p=d[0],h=d[1];switch(p){case"$set":try{for(var f=(r=void 0,be(Object.entries(h))),v=f.next();!v.done;v=f.next()){var g=_e(v.value,2),y=g[0],m=g[1];a[y]=m}}catch(e){r={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(r)throw r.error}}break;case"$unset":try{for(var b=(s=void 0,be(Object.keys(h))),_=b.next();!_.done;_=b.next())delete a[y=_.value]}catch(e){s={error:e}}finally{try{_&&!_.done&&(u=b.return)&&u.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":a={}}}}catch(e){t={error:e}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}return n.userProperties=a,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return me({},this.identity)},e.prototype.setIdentity=function(e){var t=me({},this.identity);this.identity=me({},e),Ee(t,this.identity)||this.listeners.forEach((function(t){t(e)}))},e.prototype.addIdentityListener=function(e){this.listeners.add(e)},e.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},e}(),Ie="undefined"!=typeof globalThis?globalThis:void 0!==n.g?n.g:self,Se=function(){function e(){this.identityStore=new we,this.eventBridge=new ye,this.applicationContextProvider=new ve}return e.getInstance=function(t){return Ie.analyticsConnectorInstances||(Ie.analyticsConnectorInstances={}),Ie.analyticsConnectorInstances[t]||(Ie.analyticsConnectorInstances[t]=new e),Ie.analyticsConnectorInstances[t]},e}(),ke=function(e){return void 0===e&&(e="$default_instance"),Se.getInstance(e)},Pe=function(){function e(){this.name="identity",this.type="before",this.identityStore=ke().identityStore}return e.prototype.execute=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]}))}))},e.prototype.setup=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return e.instanceName&&(this.identityStore=ke(e.instanceName).identityStore),[2]}))}))},e}(),Te=null,xe=function(e,t){Oe(e,t)},Oe=function(e,t){for(var n=0;n<t.length;n++){var i=t[n],r=i.name,o=i.args,s=i.resolve,u=e&&e[r];if("function"==typeof u){var a=u.apply(e,o);"function"==typeof s&&s(null==a?void 0:a.promise)}}return e},Ce=function(e){return e&&void 0!==e._q},Re=function(){var e,t,n,i;if("undefined"==typeof navigator)return"";var r=navigator.userLanguage;return null!==(i=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:r)&&void 0!==i?i:""},Ue=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat("2.9.2"),"undefined"!=typeof navigator&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},e.prototype.execute=function(e){var t,n;return c(this,void 0,void 0,(function(){var i,r,o;return l(this,(function(s){return i=(new Date).getTime(),r=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:r+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=i),[2,u(u(u(u(u(u(u(u({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:Re()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:R(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:o,library:this.library,user_agent:this.userAgent})]}))}))},e}(),Ae=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return[2,!0]}))}))},e.prototype.get=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return[2,this.memoryStorage.get(e)]}))}))},e.prototype.getRaw=function(e){return c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return[2,(t=n.sent())?JSON.stringify(t):void 0]}}))}))},e.prototype.set=function(e,t){return c(this,void 0,void 0,(function(){return l(this,(function(n){return this.memoryStorage.set(e,t),[2]}))}))},e.prototype.remove=function(e){return c(this,void 0,void 0,(function(){return l(this,(function(t){return this.memoryStorage.delete(e),[2]}))}))},e.prototype.reset=function(){return c(this,void 0,void 0,(function(){return l(this,(function(e){return this.memoryStorage.clear(),[2]}))}))},e}(),Le=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[_,t,e.substring(0,n)].filter(Boolean).join("_")},De=function(){function e(e){this.options=u({},e)}return e.prototype.isEnabled=function(){return c(this,void 0,void 0,(function(){var t,n;return l(this,(function(i){switch(i.label){case 0:if(!ce())return[2,!1];e.testValue=String(Date.now()),t=new e(this.options),n="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,t.set(n,e.testValue)];case 2:return i.sent(),[4,t.get(n)];case 3:return[2,i.sent()===e.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,t.remove(n)];case 6:return i.sent(),[7];case 7:return[2]}}))}))},e.prototype.get=function(e){var t;return c(this,void 0,void 0,(function(){var n,i;return l(this,(function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:if(!(n=r.sent()))return[2,void 0];try{return void 0===(i=null!==(t=Ne(n))&&void 0!==t?t:je(n))?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(i)]}catch(t){return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}}))}))},e.prototype.getRaw=function(e){var t,n;return c(this,void 0,void 0,(function(){var i,r,o;return l(this,(function(s){return i=ce(),r=null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[],(o=r.find((function(t){return 0===t.indexOf(e+"=")})))?[2,o.substring(e.length+1)]:[2,void 0]}))}))},e.prototype.set=function(e,t){var n;return c(this,void 0,void 0,(function(){var i,r,o,s,u,a,c;return l(this,(function(l){try{i=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,o=void 0,(r=null!==t?i:-1)&&((s=new Date).setTime(s.getTime()+24*r*60*60*1e3),o=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t)))),o&&(u+="; expires=".concat(o.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),(a=ce())&&(a.document.cookie=u)}catch(t){c=t instanceof Error?t.message:String(t),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}return[2]}))}))},e.prototype.remove=function(e){return c(this,void 0,void 0,(function(){return l(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 c(this,void 0,void 0,(function(){return l(this,(function(e){return[2]}))}))},e}(),Ne=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},je=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},qe=function(){function e(){}return e.prototype.send=function(e,t){return Promise.resolve(null)},e.prototype.buildResponse=function(e){var t,n,i,r,o,s,u,a,c,l,d,p,h,v,g,y,m,b,_,E,w,I;if("object"!=typeof e)return null;var S=e.code||0,k=this.buildStatus(S);switch(k){case f.Success:return{status:k,statusCode:S,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(i=e.server_upload_time)&&void 0!==i?i:0}};case f.Invalid:return{status:k,statusCode:S,body:{error:null!==(r=e.error)&&void 0!==r?r:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(u=e.events_with_missing_fields)&&void 0!==u?u:{},eventsWithInvalidIdLengths:null!==(a=e.events_with_invalid_id_lengths)&&void 0!==a?a:{},epsThreshold:null!==(c=e.eps_threshold)&&void 0!==c?c:0,exceededDailyQuotaDevices:null!==(l=e.exceeded_daily_quota_devices)&&void 0!==l?l:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(p=e.silenced_events)&&void 0!==p?p:[],throttledDevices:null!==(h=e.throttled_devices)&&void 0!==h?h:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case f.PayloadTooLarge:return{status:k,statusCode:S,body:{error:null!==(g=e.error)&&void 0!==g?g:""}};case f.RateLimit:return{status:k,statusCode:S,body:{error:null!==(y=e.error)&&void 0!==y?y:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(b=e.throttled_devices)&&void 0!==b?b:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(E=e.exceeded_daily_quota_devices)&&void 0!==E?E:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(I=e.throttled_events)&&void 0!==I?I:[]}};case f.Timeout:default:return{status:k,statusCode:S}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?f.Success:429===e?f.RateLimit:413===e?f.PayloadTooLarge:408===e?f.Timeout:e>=400&&e<500?f.Invalid:e>=500?f.Failed:f.Unknown},e}(),Me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.send=function(e,t){return c(this,void 0,void 0,(function(){var n,i,r;return l(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,(i=o.sent()).text()];case 2:r=o.sent();try{return[2,this.buildResponse(JSON.parse(r))]}catch(e){return[2,this.buildResponse({code:i.status})]}return[2]}}))}))},t}(qe),Fe=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return c(this,void 0,void 0,(function(){var t,n,i;return l(this,(function(r){switch(r.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),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 c(this,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return(t=n.sent())?[2,JSON.parse(t)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}}))}))},e.prototype.getRaw=function(e){var t;return c(this,void 0,void 0,(function(){return l(this,(function(n){return[2,(null===(t=this.storage)||void 0===t?void 0:t.getItem(e))||void 0]}))}))},e.prototype.set=function(e,t){var n;return c(this,void 0,void 0,(function(){return l(this,(function(i){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]}))}))},e.prototype.remove=function(e){var t;return c(this,void 0,void 0,(function(){return l(this,(function(n){try{null===(t=this.storage)||void 0===t||t.removeItem(e)}catch(e){}return[2]}))}))},e.prototype.reset=function(){var e;return c(this,void 0,void 0,(function(){return l(this,(function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]}))}))},e}(),Be=1e3,Ve=function(e){function t(t){var n,i=this;return(i=e.call(this,null===(n=ce())||void 0===n?void 0:n.localStorage)||this).loggerProvider=null==t?void 0:t.loggerProvider,i}return o(t,e),t.prototype.set=function(t,n){var i;return c(this,void 0,void 0,(function(){var r;return l(this,(function(o){switch(o.label){case 0:return Array.isArray(n)&&n.length>Be?(r=n.length-Be,[4,e.prototype.set.call(this,t,n.slice(0,Be))]):[3,2];case 1:return o.sent(),null===(i=this.loggerProvider)||void 0===i||i.error("Failed to save ".concat(r," events because the queue length exceeded ").concat(Be,".")),[3,4];case 2:return[4,e.prototype.set.call(this,t,n)];case 3:o.sent(),o.label=4;case 4:return[2]}}))}))},t}(Fe),Ke=function(e){function t(){var t;return e.call(this,null===(t=ce())||void 0===t?void 0:t.sessionStorage)||this}return o(t,e),t}(Fe),$e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.state={done:4},t}return o(t,e),t.prototype.send=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return[2,new Promise((function(i,r){"undefined"==typeof XMLHttpRequest&&r(new Error("XHRTransport is not supported."));var o=new XMLHttpRequest;o.open("POST",e,!0),o.onreadystatechange=function(){if(o.readyState===n.state.done){var e=o.responseText;try{i(n.buildResponse(JSON.parse(e)))}catch(e){i(n.buildResponse({code:o.status}))}}},o.setRequestHeader("Content-Type","application/json"),o.setRequestHeader("Accept","*/*"),o.send(JSON.stringify(t))}))]}))}))},t}(qe),He=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.send=function(e,t){return c(this,void 0,void 0,(function(){var n=this;return l(this,(function(i){return[2,new Promise((function(i,r){var o=ce();if(!(null==o?void 0:o.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);return i(o.navigator.sendBeacon(e,JSON.stringify(t))?n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}):n.buildResponse({code:500}))}catch(e){r(e)}}))]}))}))},t}(qe),ze=function(e,t,n){return void 0===n&&(n=!0),c(void 0,void 0,void 0,(function(){var i,r,o,s,u,a,c,d,h;return l(this,(function(l){switch(l.label){case 0:return i=function(e){return"".concat(_.toLowerCase(),"_").concat(e.substring(0,6))}(e),[4,t.getRaw(i)];case 1:return(r=l.sent())?n?[4,t.remove(i)]:[3,3]:[2,{optOut:!1}];case 2:l.sent(),l.label=3;case 3:return o=p(r.split("."),6),s=o[0],u=o[1],a=o[2],c=o[3],d=o[4],h=o[5],[2,{deviceId:s,userId:Qe(u),sessionId:We(c),lastEventId:We(h),lastEventTime:We(d),optOut:Boolean(a)}]}}))}))},We=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Qe=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},Je="[Amplitude]",Ye=("".concat(Je," Page Viewed"),"".concat(Je," Form Started")),Ze="".concat(Je," Form Submitted"),Ge="".concat(Je," File Downloaded"),Xe="session_start",et="session_end",tt="".concat(Je," File Extension"),nt="".concat(Je," File Name"),it="".concat(Je," Link ID"),rt="".concat(Je," Link Text"),ot="".concat(Je," Link URL"),st="".concat(Je," Form ID"),ut="".concat(Je," Form Name"),at="".concat(Je," Form Destination"),ct="cookie",lt=function(e){function t(t,n,i,r,o,u,a,c,l,d,p,h,f,v,g,y,m,b,_,E,w,I,S,P,T,x,O,C,R,U,A,L){void 0===i&&(i=new Ae),void 0===r&&(r={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===a&&(a=1e3),void 0===c&&(c=5),void 0===l&&(l=30),void 0===d&&(d=ct),void 0===g&&(g=new k),void 0===y&&(y=s.Warn),void 0===b&&(b=!1),void 0===_&&(_=!1),void 0===I&&(I=""),void 0===S&&(S="US"),void 0===T&&(T=18e5),void 0===x&&(x=new Ve({loggerProvider:g})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===C&&(C="fetch"),void 0===R&&(R=!1);var D=e.call(this,{apiKey:t,storageProvider:x,transportProvider:ht(C)})||this;return D.apiKey=t,D.appVersion=n,D.cookieOptions=r,D.defaultTracking=o,D.flushIntervalMillis=a,D.flushMaxRetries=c,D.flushQueueSize=l,D.identityStorage=d,D.ingestionMetadata=p,D.instanceName=h,D.loggerProvider=g,D.logLevel=y,D.minIdLength=m,D.offline=b,D.partnerId=E,D.plan=w,D.serverUrl=I,D.serverZone=S,D.sessionTimeout=T,D.storageProvider=x,D.trackingOptions=O,D.transport=C,D.useBatch=R,D._optOut=!1,D._cookieStorage=i,D.deviceId=u,D.lastEventId=f,D.lastEventTime=v,D.optOut=_,D.sessionId=P,D.pageCounter=A,D.userId=U,D.debugLogsEnabled=L,D.loggerProvider.enable(L?s.Debug:D.logLevel),D}return o(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(Le(this.apiKey),e)},t}(T),dt=function(e,t,n){return void 0===t&&(t={}),c(void 0,void 0,void 0,(function(){var i,r,o,s,a,c,d,p,h,f,v,g,y,m,b,_,E,w,I,S,k,P,T,x,O,C,U,A,L,D,N,j,q,M,F,B,V,K,$,H,z,W;return l(this,(function(l){switch(l.label){case 0:return i=t.identityStorage||ct,w={},i===ct?[3,1]:(o="",[3,5]);case 1:return null===(S=null===(I=t.cookieOptions)||void 0===I?void 0:I.domain)||void 0===S?[3,2]:(s=S,[3,4]);case 2:return[4,ft()];case 3:s=l.sent(),l.label=4;case 4:o=s,l.label=5;case 5:return r=u.apply(void 0,[(w.domain=o,w.expiration=365,w.sameSite="Lax",w.secure=!1,w.upgrade=!0,w),t.cookieOptions]),a=pt(t.identityStorage,r),[4,ze(e,a,null===(P=null===(k=t.cookieOptions)||void 0===k?void 0:k.upgrade)||void 0===P||P)];case 6:return c=l.sent(),[4,a.get(Le(e))];case 7:return d=l.sent(),p=le(),h=null!==(U=null!==(C=null!==(O=null!==(x=null!==(T=t.deviceId)&&void 0!==T?T:p.ampDeviceId)&&void 0!==x?x:p.deviceId)&&void 0!==O?O:null==d?void 0:d.deviceId)&&void 0!==C?C:c.deviceId)&&void 0!==U?U:R(),f=null!==(A=null==d?void 0:d.lastEventId)&&void 0!==A?A:c.lastEventId,v=null!==(L=null==d?void 0:d.lastEventTime)&&void 0!==L?L:c.lastEventTime,g=null!==(N=null!==(D=t.optOut)&&void 0!==D?D:null==d?void 0:d.optOut)&&void 0!==N?N:c.optOut,y=null!==(j=null==d?void 0:d.sessionId)&&void 0!==j?j:c.sessionId,m=null!==(M=null!==(q=t.userId)&&void 0!==q?q:null==d?void 0:d.userId)&&void 0!==M?M:c.userId,n.previousSessionDeviceId=null!==(F=null==d?void 0:d.deviceId)&&void 0!==F?F:c.deviceId,n.previousSessionUserId=null!==(B=null==d?void 0:d.userId)&&void 0!==B?B:c.userId,b={ipAddress:null===(K=null===(V=t.trackingOptions)||void 0===V?void 0:V.ipAddress)||void 0===K||K,language:null===(H=null===($=t.trackingOptions)||void 0===$?void 0:$.language)||void 0===H||H,platform:null===(W=null===(z=t.trackingOptions)||void 0===z?void 0:z.platform)||void 0===W||W},_=null==d?void 0:d.pageCounter,E=null==d?void 0:d.debugLogsEnabled,[2,new lt(e,t.appVersion,a,r,t.defaultTracking,h,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,i,t.ingestionMetadata,t.instanceName,f,v,t.loggerProvider,t.logLevel,t.minIdLength,t.offline,g,t.partnerId,t.plan,t.serverUrl,t.serverZone,y,t.sessionTimeout,t.storageProvider,b,t.transport,t.useBatch,m,_,E)]}}))}))},pt=function(e,t){switch(void 0===e&&(e=ct),void 0===t&&(t={}),e){case"localStorage":return new Ve;case"sessionStorage":return new Ke;case"none":return new Ae;default:return new De(u(u({},t),{expirationDays:t.expiration}))}},ht=function(e){return"xhr"===e?new $e:"beacon"===e?new He:new Me},ft=function(e){return c(void 0,void 0,void 0,(function(){var t,n,i,r,o,s,u;return l(this,(function(a){switch(a.label){case 0:return[4,(new De).isEnabled()];case 1:if(!a.sent()||!e&&("undefined"==typeof location||!location.hostname))return[2,""];for(t=null!=e?e:location.hostname,n=t.split("."),i=[],r="AMP_TLDTEST",o=n.length-2;o>=0;--o)i.push(n.slice(o).join("."));o=0,a.label=2;case 2:return o<i.length?(s=i[o],[4,(u=new De({domain:"."+s})).set(r,1)]):[3,7];case 3:return a.sent(),[4,u.get(r)];case 4:return a.sent()?[4,u.remove(r)]:[3,6];case 5:return a.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}}))}))},vt=function(e){var t={};for(var n in e){var i=e[n];i&&(t[n]=i)}return t},gt=function(e){var t;void 0===e&&(e={});var n,i,r=ce(),o=void 0,s=e.trackOn,a=e.trackHistoryChanges,d=e.eventType,h=void 0===d?"[Amplitude] Page Viewed":d,f=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},v=function(){return c(void 0,void 0,void 0,(function(){var e,t,n;return l(this,(function(i){switch(i.label){case 0:return e=f("undefined"!=typeof location&&location.href||""),n={event_type:h},t=[{}],[4,yt()];case 1:return[2,(n.event_properties=u.apply(void 0,[u.apply(void 0,t.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&f(location.pathname)||"","[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":e.split("?")[0]}]),n)]}}))}))},g=function(){return void 0===s||"function"==typeof s&&s()},y="undefined"!=typeof location?location.href:null,m=function(){return c(void 0,void 0,void 0,(function(){var e,n,i,r;return l(this,(function(s){switch(s.label){case 0:return e=location.href,n=bt(a,e,y||"")&&g(),y=e,n?(null==o||o.log("Tracking page view event"),null!=t?[3,1]:[3,3]):[3,4];case 1:return r=(i=t).track,[4,v()];case 2:r.apply(i,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}}))}))},b=function(){m()},_={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return c(void 0,void 0,void 0,(function(){var u,a;return l(this,(function(c){switch(c.label){case 0:return t=s,i=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),r&&(r.addEventListener("popstate",b),n=r.history.pushState,r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var i=p(n,3),r=i[0],o=i[1],s=i[2];e.apply(t,[r,o,s]),m()}})),g()?(o.log("Tracking page view event"),a=(u=t).track,[4,v()]):[3,2];case 1:a.apply(u,[c.sent()]),c.label=2;case 2:return[2]}}))}))},execute:function(e){return c(void 0,void 0,void 0,(function(){var t;return l(this,(function(n){switch(n.label){case 0:return"attribution"===s&&mt(e)?(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),[4,v()]):[3,2];case 1:t=n.sent(),e.event_type=t.event_type,e.event_properties=u(u({},e.event_properties),t.event_properties),n.label=2;case 2:return i&&e.event_type===h&&(i.pageCounter=i.pageCounter?i.pageCounter+1:1,e.event_properties=u(u({},e.event_properties),{"[Amplitude] Page Counter":i.pageCounter})),[2,e]}}))}))},teardown:function(){return c(void 0,void 0,void 0,(function(){return l(this,(function(e){return r&&(r.removeEventListener("popstate",b),n&&(r.history.pushState=n)),[2]}))}))}};return _},yt=function(){return c(void 0,void 0,void 0,(function(){var e;return l(this,(function(t){switch(t.label){case 0:return e=vt,[4,(new pe).parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}}))}))},mt=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[A.SET]||{},i=t[A.UNSET]||{},r=h(h([],p(Object.keys(n)),!1),p(Object.keys(i)),!1);return Object.keys(se).every((function(e){return r.includes(e)}))}return!1},bt=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var i=new URL(t),r=new URL(n);return i.origin+i.pathname!==r.origin+r.pathname}return t!==n},_t=function(){var e,t=[],n=function(e,n,i){e.addEventListener(n,i),t.push({element:e,type:n,handler:i})};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(t,i){return c(void 0,void 0,void 0,(function(){var r;return l(this,(function(o){return null===(r=ce())||void 0===r||r.addEventListener("load",(function(){if(i){if("undefined"!=typeof document){var r=function(e){var t=!1;n(e,"change",(function(){var n;t||i.track(Ye,((n={})[st]=Et(e.id),n[ut]=Et(e.name),n[at]=e.action,n)),t=!0})),n(e,"submit",(function(){var n,r;t||i.track(Ye,((n={})[st]=Et(e.id),n[ut]=Et(e.name),n[at]=e.action,n)),i.track(Ze,((r={})[st]=Et(e.id),r[ut]=Et(e.name),r[at]=e.action,r)),t=!1}))};Array.from(document.getElementsByTagName("form")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"FORM"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else t.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.")})),[2]}))}))},execute:function(e){return c(void 0,void 0,void 0,(function(){return l(this,(function(t){return[2,e]}))}))},teardown:function(){return c(void 0,void 0,void 0,(function(){return l(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},Et=function(e){if("string"==typeof e)return e},wt=function(){var e,t=[];return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(n,i){return c(void 0,void 0,void 0,(function(){var r;return l(this,(function(o){return null===(r=ce())||void 0===r||r.addEventListener("load",(function(){if(i){if("undefined"!=typeof document){var r=function(e){var n;try{n=new URL(e.href,window.location.href)}catch(e){return}var r,s,u,a=o.exec(n.href),c=null==a?void 0:a[1];c&&(s="click",u=function(){var t;c&&i.track(Ge,((t={})[tt]=c,t[nt]=n.pathname,t[it]=e.id,t[rt]=e.text,t[ot]=e.href,t))},(r=e).addEventListener(s,u),t.push({element:r,type:s,handler:u}))},o=/\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/;Array.from(document.getElementsByTagName("a")).forEach(r),"undefined"!=typeof MutationObserver&&(e=new MutationObserver((function(e){e.forEach((function(e){e.addedNodes.forEach((function(e){"A"===e.nodeName&&r(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(r)}))}))}))).observe(document.body,{subtree:!0,childList:!0})}}else n.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.")})),[2]}))}))},execute:function(e){return c(void 0,void 0,void 0,(function(){return l(this,(function(t){return[2,e]}))}))},teardown:function(){return c(void 0,void 0,void 0,(function(){return l(this,(function(n){return null==e||e.disconnect(),t.forEach((function(e){var t=e.element,n=e.type,i=e.handler;null==t||t.removeEventListener(n,i)})),t=[],[2]}))}))}}},It=!1,St=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.prototype.init=function(e,t,n){var i,r;return void 0===e&&(e=""),arguments.length>2?(i=t,r=n):"string"==typeof t?(i=t,r=void 0):(i=null==t?void 0:t.userId,r=t),b(this._init(u(u({},r),{userId:i,apiKey:e})))},t.prototype._init=function(t){var n,i,r;return c(this,void 0,void 0,(function(){var o,s,a,d,p,h=this;return l(this,(function(f){switch(f.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,dt(t.apiKey,t,this)]);case 1:return o=f.sent(),[4,e.prototype._init.call(this,o)];case 2:return f.sent(),this.logBrowserOptions(t),H(this.config.defaultTracking)?(b=this.config,s=H(b.defaultTracking)&&b.defaultTracking&&"object"==typeof b.defaultTracking&&b.defaultTracking.attribution&&"object"==typeof b.defaultTracking.attribution?u({},b.defaultTracking.attribution):{},this.webAttribution=new fe(s,this.config),[4,this.webAttribution.init()]):[3,4];case 3:f.sent(),f.label=4;case 4:return a=le(),d=Number.isNaN(Number(a.ampSessionId))?void 0:Number(a.ampSessionId),this.setSessionId(null!==(r=null!==(i=null!==(n=t.sessionId)&&void 0!==n?n:d)&&void 0!==i?i:this.config.sessionId)&&void 0!==r?r:Date.now()),(p=ke(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===Te?[3,6]:[4,this.add((v=ce(),g=[],y=function(e,t){v&&(v.addEventListener(e,t),g.push({type:e,handler:t}))},{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return c(void 0,void 0,void 0,(function(){return l(this,(function(n){return e.offline=!navigator.onLine,y("online",(function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout((function(){t.flush()}),e.flushIntervalMillis)})),y("offline",(function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]}))}))},teardown:function(){return c(void 0,void 0,void 0,(function(){return l(this,(function(e){return g.forEach((function(e){var t=e.type,n=e.handler;v&&v.removeEventListener(t,n)})),g=[],[2]}))}))}})).promise];case 5:f.sent(),f.label=6;case 6:return[4,this.add(new N).promise];case 7:return f.sent(),[4,this.add(new Ue).promise];case 8:return f.sent(),[4,this.add(new Pe).promise];case 9:return f.sent(),function(e){It||void 0!==e.defaultTracking||(e.loggerProvider.warn("`options.defaultTracking` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to `options.defaultTracking`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:\n\namplitude.init(<YOUR_API_KEY>, {\n defaultTracking: true,\n});\n\nVisit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details."),It=!0)}(this.config),m=this.config.defaultTracking,$(m,"fileDownloads")?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(wt()).promise]):[3,11];case 10:f.sent(),f.label=11;case 11:return function(e){return $(e,"formInteractions")}(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(_t()).promise]):[3,13];case 12:f.sent(),f.label=13;case 13:return z(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(gt(Q(this.config))).promise]):[3,15];case 14:f.sent(),f.label=15;case 15:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 16:return f.sent(),p.eventBridge.setEventReceiver((function(e){h.track(e.eventType,e.eventProperties)})),[2]}var v,g,y,m,b}))}))},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){this.config?(this.config.loggerProvider.debug("function setUserId: ",e),e===this.config.userId&&void 0!==e||(this.config.userId=e,function(e,t){ke(t).identityStore.editIdentity().setUserId(e).commit()}(e,this.config.instanceName))):this.q.push(this.setUserId.bind(this,e))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){this.config?(this.config.loggerProvider.debug("function setDeviceId: ",e),this.config.deviceId=e,function(e,t){ke(t).identityStore.editIdentity().setDeviceId(e).commit()}(e,this.config.instanceName)):this.q.push(this.setDeviceId.bind(this,e))},t.prototype.reset=function(){this.setDeviceId(R()),this.setUserId(void 0)},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),b(Promise.resolve());if(e===this.config.sessionId)return b(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",e);var 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,this.config.pageCounter=0,W(this.config.defaultTracking)&&(i&&r&&n.push(this.track(et,void 0,{device_id:this.previousSessionDeviceId,event_id:++o,session_id:i,time:r+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var s=this.trackCampaignEventIfNeeded(++o,n);return W(this.config.defaultTracking)&&n.push(this.track(Xe,void 0,{event_id:s?++o:o,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,b(Promise.all(n))},t.prototype.extendSession=function(){this.config?this.config.lastEventTime=Date.now():this.q.push(this.extendSession.bind(this))},t.prototype.setTransport=function(e){this.config?this.config.transportProvider=ht(e):this.q.push(this.setTransport.bind(this,e))},t.prototype.identify=function(t,n){if(Ce(t)){var i=t._q;t._q=[],t=Oe(new M,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)},t.prototype.groupIdentify=function(t,n,i,r){if(Ce(i)){var o=i._q;i._q=[],i=Oe(new M,o)}return e.prototype.groupIdentify.call(this,t,n,i,r)},t.prototype.revenue=function(t,n){if(Ce(t)){var i=t._q;t._q=[],t=Oe(new F,i)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return c(this,void 0,void 0,(function(){var n,i,r;return l(this,(function(o){return n=Date.now(),i=he(this.config.sessionTimeout,this.config.lastEventTime),r=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===Xe||t.event_type===et||t.session_id&&t.session_id!==this.getSessionId()||(i||r?(this.setSessionId(n),r&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]}))}))},t.prototype.logBrowserOptions=function(e){try{var t=u(u({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t}(K),kt=function(){var e=new St;return{init:m(e.init.bind(e),"init",v(e),y(e,["config"])),add:m(e.add.bind(e),"add",v(e),y(e,["config.apiKey","timeline.plugins"])),remove:m(e.remove.bind(e),"remove",v(e),y(e,["config.apiKey","timeline.plugins"])),track:m(e.track.bind(e),"track",v(e),y(e,["config.apiKey","timeline.queue.length"])),logEvent:m(e.logEvent.bind(e),"logEvent",v(e),y(e,["config.apiKey","timeline.queue.length"])),identify:m(e.identify.bind(e),"identify",v(e),y(e,["config.apiKey","timeline.queue.length"])),groupIdentify:m(e.groupIdentify.bind(e),"groupIdentify",v(e),y(e,["config.apiKey","timeline.queue.length"])),setGroup:m(e.setGroup.bind(e),"setGroup",v(e),y(e,["config.apiKey","timeline.queue.length"])),revenue:m(e.revenue.bind(e),"revenue",v(e),y(e,["config.apiKey","timeline.queue.length"])),flush:m(e.flush.bind(e),"flush",v(e),y(e,["config.apiKey","timeline.queue.length"])),getUserId:m(e.getUserId.bind(e),"getUserId",v(e),y(e,["config","config.userId"])),setUserId:m(e.setUserId.bind(e),"setUserId",v(e),y(e,["config","config.userId"])),getDeviceId:m(e.getDeviceId.bind(e),"getDeviceId",v(e),y(e,["config","config.deviceId"])),setDeviceId:m(e.setDeviceId.bind(e),"setDeviceId",v(e),y(e,["config","config.deviceId"])),reset:m(e.reset.bind(e),"reset",v(e),y(e,["config","config.userId","config.deviceId"])),getSessionId:m(e.getSessionId.bind(e),"getSessionId",v(e),y(e,["config"])),setSessionId:m(e.setSessionId.bind(e),"setSessionId",v(e),y(e,["config"])),extendSession:m(e.extendSession.bind(e),"extendSession",v(e),y(e,["config"])),setOptOut:m(e.setOptOut.bind(e),"setOptOut",v(e),y(e,["config"])),setTransport:m(e.setTransport.bind(e),"setTransport",v(e),y(e,["config"]))}};const Pt=kt();var Tt;!function(e){e.US="US",e.EU="EU"}(Tt||(Tt={}));var xt=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Ot="data-amp-track-",Ct=["div","span","h1","h2","h3","h4","h5","h6"],Rt=Pt.add,Ut=Pt.extendSession,At=Pt.flush,Lt=Pt.getDeviceId,Dt=Pt.getSessionId,Nt=Pt.getUserId,jt=Pt.groupIdentify,qt=Pt.identify,Mt=Pt.init,Ft=Pt.logEvent,Bt=Pt.remove,Vt=Pt.reset,Kt=Pt.revenue,$t=Pt.setDeviceId,Ht=Pt.setGroup,zt=Pt.setOptOut,Wt=Pt.setSessionId,Qt=Pt.setTransport,Jt=Pt.setUserId,Yt=Pt.track},554:function(e,t,n){var i=this&&this.__createBinding||(Object.create?function(e,t,n,i){void 0===i&&(i=n);var r=Object.getOwnPropertyDescriptor(t,n);r&&!("get"in r?!t.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,i,r)}:function(e,t,n,i){void 0===i&&(i=n),e[i]=t[n]}),r=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)"default"!==n&&Object.prototype.hasOwnProperty.call(e,n)&&i(t,e,n);return r(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const s=o(n(292)),u=(["US","EU"].includes("US"),"US");s.init("39d277da47b4f68f0f19f9e32ba89bce",{defaultTracking:{sessions:!1,pageViews:!1,formInteractions:!1,fileDownloads:!1},fetchRemoteConfig:!0,autocapture:!1,serverZone:u}),t.default=s},859:function(e,t,n){var i=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function s(e){try{a(i.next(e))}catch(e){o(e)}}function u(e){try{a(i.throw(e))}catch(e){o(e)}}function a(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,u)}a((i=i.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const r=n(174),o=n(101),s=n(971);!function(e){if(document.querySelector(".tab-panel"))return void e();const t=new MutationObserver((()=>{document.querySelector(".tab-panel")&&(t.disconnect(),e())}));t.observe(document.body,{childList:!0,subtree:!0})}((()=>{!function(){i(this,void 0,void 0,(function*(){const e=new o.SubscriptionManager;yield e.init(),e.isPro?(e.renderSupportLink(),(0,s.amplitudeStart)()):(yield(0,r.isFeatureEnabled)())&&(e.renderSubscriptionUi(),(0,s.amplitudeStart)(),(0,s.handleFeatureEnabled)())}))}()}))},971:function(e,t,n){var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.amplitudeStart=t.handleFeatureEnabled=t.handleProButtonClick=t.handleChangeSiteThemeMode=t.handleChangeEnableApp=t.handleChangeDisableApp=t.handlePopupOpen=void 0;const r=i(n(554)),o=n(167),s=(e,t)=>{new MutationObserver(((n,i)=>{const o=document.querySelector(e);o&&(i.disconnect(),o.addEventListener("click",(()=>{r.default.track({event_type:t})})))})).observe(document.body,{childList:!0,subtree:!0})};t.handlePopupOpen=()=>{r.default.track({event_type:"popup_opened"})},t.handleChangeDisableApp=()=>{s(".header__app-toggle .toggle__off","app_disabled")},t.handleChangeEnableApp=()=>{s(".header__app-toggle .toggle__on","app_enabled")},t.handleChangeSiteThemeMode=()=>{s(".header__site-toggle .site-toggle","site_theme_mode_changed")},t.handleProButtonClick=()=>{s(".get-pro-button","pro_button_clicked")},t.handleFeatureEnabled=()=>{r.default.track({event_type:"feature_enabled"})},t.amplitudeStart=()=>{(()=>{const e=(0,o.getStorageAdapter)();e.get("deviceId").then((e=>{e&&r.default.setDeviceId(e)})),e.get("welcomePageOpened").then((t=>{t&&(r.default.track({event_type:"welcome_page_opened"}),e.remove("welcomePageOpened"))}))})(),(0,t.handlePopupOpen)(),(0,t.handleChangeDisableApp)(),(0,t.handleChangeEnableApp)(),(0,t.handleChangeSiteThemeMode)(),(0,t.handleProButtonClick)()}}},t={};function n(i){var r=t[i];if(void 0!==r)return r.exports;var o=t[i]={exports:{}};return e[i].call(o.exports,o,o.exports,n),o.exports}n.d=(e,t)=>{for(var i in t)n.o(t,i)&&!n.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n(859)})();