PageSourceSearch

https://jobply.ai/_next/static/chunks/4865-e8fa885afb447f2c.js

js jobply.ai collected 2026-10-02 00:25:42 UTC 304,656 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4865],{19115:function(e,t,n){"use strict";let r;n.d(t,{IH:function(){return ia},yV:function(){return iu},S1:function(){return il},mc:function(){return ic},$z:function(){return id},Iv:function(){return ig},j:function(){return iv}});var i,o,s,a,u,l,c,d,f,g,v,h,p,m,y,_,b,w,S,E,k,I,T,C,P,R,O=n(5853);(i=p||(p={}))[i.None=0]="None",i[i.Error=1]="Error",i[i.Warn=2]="Warn",i[i.Verbose=3]="Verbose",i[i.Debug=4]="Debug";var A=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},x=function(e){return function(){var t=(0,O.__assign)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},D=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,O.__values)(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},L=function(e,t){return function(){var n,r,i={};try{for(var o=(0,O.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=D(e,a)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},N=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=n(),u=a.logger,l=a.logLevel;if(l&&l<p.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:A(1),time:{start:new Date().toISOString()},states:{}};r&&c.states&&(c.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))}):(r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))),d}},M=function(e){return{promise:e||Promise.resolve()}},U="Amplitude Logger ",q=function(){function e(){this.logLevel=p.None}return e.prototype.disable=function(){this.logLevel=p.None},e.prototype.enable=function(e){void 0===e&&(e=p.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Verbose||console.log("".concat(U,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Warn||console.warn("".concat(U,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Error||console.error("".concat(U,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<p.Debug||console.log("".concat(U,"[Debug]: ").concat(e.join(" ")))},e}(),F=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),j=function(){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},B=(0,O.__spreadArray)([],(0,O.__read)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),H=function(e){var t,n=j();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,H);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,O.__spreadArray)([],(0,O.__read)(r.entries()),!1).map(function(e){var t=(0,O.__read)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(B[r]):B[r]}).join("")},W={INVALID_API_KEY:401,RATE_LIMIT:429},z=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvali
1dApiKey=!1,this.apiKey=e,this.serverUrl=r||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new F(e,t)}return e.prototype.subscribe=function(e,t,n){var r=H(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return -1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,O.__generator)(this,function(n){switch(n.label){case 0:if(this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5)return this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2];return[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise||(this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null})):this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null})),this.fetchPromise},e.prototype.subscribeAll=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending c
1allback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return(0,O.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,O.__generator)(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,O.__awaiter)(this,void 0,void 0,function(){var n,r,i,o,s,a,u=this;return(0,O.__generator)(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,l,c,d;return(0,O.__generator)(this,function(f){switch(f.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),f.label=1;case 1:return f.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:s.signal})];case 2:if((l=f.sent()).ok)return[3,4];return[4,l.text()];case 3:return c=f.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(c)),l.status===W.INVALID_API_KEY?(o.logger.error("Remote config client fetch failed with ".concat(W.INVALID_API_KEY,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&l.status!==W.RATE_LIMIT&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:f.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=f.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(a),[7];case 9:if(!i)return[2,"break"];if(!(r<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(n))})];case 10:f.sent(),f.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];if("break"===a)return[3,4];l.label=3;case 3:return s++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}(),V={TAGS:"tags",COUNTERS:"counters",HISTOGRAMS:"histograms",EVENTS:"events",INTERNAL:"internal"},K={LAST_FLUSH_TIMESTAMP:"last_flush_timestamp"},$=function(){function e(e,t){this.dbPromise=null,this.logger=t,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return e.isSupported=function(){var e;return(null===(e=j())||void 0===e?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var e=this;return new Promise(function(t,n){var r=indexedDB.open(e.dbName,1);r.onerror=function(){e.dbPromise=null,n(Error("Failed to open IndexedDB"))},r.onsuccess=function(){var n=r.result;
1n.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},n.onerror=function(t){e.logger.debug("DiagnosticsStorage: A global database error occurred.",t),n.close()},t(n)},r.onupgradeneeded=function(t){var n=t.target.result;e.createTables(n)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(V.TAGS)||e.createObjectStore(V.TAGS,{keyPath:"key"}),e.objectStoreNames.contains(V.COUNTERS)||e.createObjectStore(V.COUNTERS,{keyPath:"key"}),e.objectStoreNames.contains(V.HISTOGRAMS)||e.createObjectStore(V.HISTOGRAMS,{keyPath:"key"}),e.objectStoreNames.contains(V.EVENTS)||e.createObjectStore(V.EVENTS,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(V.INTERNAL)||e.createObjectStore(V.INTERNAL,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([V.TAGS],"readwrite")).objectStore(V.TAGS),[2,new Promise(function(r){var o=Object.entries(e);t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tags",e),r()},o.forEach(function(e){var t=(0,O.__read)(e,2),r=t[0],o=t[1];n.put({key:r,value:o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set tag",r,o,e)}})})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",r),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([V.COUNTERS],"readwrite")).objectStore(V.COUNTERS),[2,new Promise(function(r){var o=Object.entries(e);t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to increment counters",e),r()},o.forEach(function(e){var t=(0,O.__read)(e,2),r=t[0],o=t[1],s=n.get(r);s.onsuccess=function(){var e=s.result,t=e?e.value:0;n.put({key:r,value:t+o}).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to update counter",r,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing counter",r,e)}})})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",r),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===Object.entries(e).length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([V.HISTOGRAMS],"readwrite")).objectStore(V.HISTOGRAMS),[2,new Promise(function(r){var o=Object.entries(e);t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",e),r()},o.forEach(function(e){var t=(0,O.__read)(e,2),r=t[0],o=t[1],s=n.get(r);s.onsuccess=function(){var e,t=s.result;e=t?{key:r,count:t.count+o.count,min:Math.min(t.min,o.min),max:Math.max(t.max,o.max),sum:t.sum+o.sum}:{key:r,count:o.count,min:o.min,max:o.max,sum:o.sum},n.put(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to set histogram stats",r,e)}},s.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",r,e)}})})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",r),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(o.trys.push([0,2,,3]),0===e.length)return[2];return[4,this.getDB()];case 1:return n=(t=o.sent().transaction([V.EVENTS],"readwrite")).objectStore(V.EVENTS),[2,new Promise(function(r){t.oncomplete=function(){r()},t.onabort=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event records",e),r()};var o=n.count();o.onsuccess=function(){var t=Math.max(0,10-o.result);t<e.length&&i.logger.debug("DiagnosticsStorage: Only added ".concat(t," of ").concat(e.length," events due to storage limit")),e.slice(0,t).forEach(function(e){n.add(e).onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to add event record",e)}})},o.onerror=function(e){i.logger.debug("DiagnosticsStorage: Failed to count existing events",e)}})];case 2:return r=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",r),[3,3];case 3:return[2]}})})},e.prototype.setInternal=function(e,t){return(0,O.__awaiter)(this,void 0,void 0,function(){var n,r,i;return(0,O.__generator)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=(n=o.sent().transaction([V.INTERNAL],"readwrite")).objectStore(V.INTERNAL),[2,new Promise(function(i,o){n.onabort=function(){return o(Error("Failed to set internal value"))};var s=r.put({key:e,value:t});s.onsuccess=function(){return i()},s.onerror=function(){return o(Error("Failed to set internal value"))}})];case 2:return i=o.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",i),[3,3];case 3:return[2]}})})},e.prototype.getInternal=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r;return(0,O.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=(t=i.sent().transaction([V.INTERNAL],"readonly")).objectStore(V.INTERNAL),[2,new Promise(function(r,i){t.onabort=function(){return i(Error("Failed to get internal value"))};var o=n.get(e);o.onsuccess=function(){return r(o.result)},o.onerror=function(){return i(Error("Failed to get internal value"))}})];case 2:return r=i.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",r),[2,void 0];case 3:return[2]}})})},e.prototype.getLastFlushTimestamp=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(K.LAST_FLUSH_TIMESTAMP)];case 1:return[2,(e=n.sent())?parseInt(e.value,10):void 0];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",t),[2,void 0];case 3:return[2]}})})},e.prototype.setLastFlushTimestamp=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(K.LAST_FLUSH_TIMESTAMP,e.toString())];case 1:return n.sent(),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",t),[3,3];case 3:return[2]}})})},e.prototype.clearTable=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).clear();i.onsuccess=function(){return n()},i.onerror=function(){return r(Error("Failed to clear table ".concat(t)))}})},e.prototype.getAllAndClear=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return(0,O.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=a.sent().transaction([V.TAGS,V.COUNTERS,V.HISTOGRAMS,V.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(e,V.TAGS),this.getAllFromStore(e,V.COUNTERS),this.getAllFromStore(e,V.HISTOGRAMS),this.getAllFromStore(e,V.EVENTS)])];case 2:return n=(t=O.__read.apply(void 0,[a.sent(),4]))[0],r=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,V.COUNTERS),this.clearTable(e,V.HISTOGRAMS),this.clearTable(e,V.EVENTS)])];case 3:return a.sent(),[2,{tags:n,counters:r,histogramStats:i,events:o}];case 4:return s=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",s),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(e,t){return new Promise(function(n,r){var i=e.objectStore(t).getAll();i.onsuccess=function(){return n(i.result)},i.onerror=function(){return r(Error("Failed to get all from ".concat(t)))}})},e}(),J=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}
1,G=function(e,t){return 31*Math.abs(J(e.toString()))%1e5/1e5<t},Y=function(){var e=j();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},Q=function(e){var t=j();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",(0,O.__assign)({type:t.type,message:t.message,filename:t.filename,error_name:t.errorName,stack:t.stack},t.metadata))};t.addEventListener("error",function(e){var t=e.error instanceof Error?e.error:void 0,r=null==t?void 0:t.stack,i=Z({filename:e.filename,stack:r});i&&n({type:"error",message:e.message,stack:r,filename:e.filename,errorName:null==t?void 0:t.name,metadata:{colno:e.colno,lineno:e.lineno,isTrusted:e.isTrusted,matchReason:i}})},!0),t.addEventListener("unhandledrejection",function(e){var t,r=e.reason instanceof Error?e.reason:void 0,i=null==r?void 0:r.stack,o=X(i),s=Z({filename:o,stack:i});s&&n({type:"unhandledrejection",message:null!==(t=null==r?void 0:r.message)&&void 0!==t?t:ee(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},Z=function(e){var t,n,r=Y();if(0!==r.length)try{for(var i=(0,O.__values)(r),o=i.next();!o.done;o=i.next()){var s=o.value;if(e.filename&&e.filename.includes(s))return"filename";if(e.stack&&e.stack.includes(s))return"stack"}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}},X=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},ee=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},et=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=(0,O.__assign)({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=G(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,$.isSupported()?this.storage=new $(e,t):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),Q(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=1e4){this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");return}this.inMemoryTags[e]=t,this.startTimersIfNeeded()}},e.prototype.increment=function(e,t){if(void 0===t&&(t=1),this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=1e4){this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");return}this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4){this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");return}var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,t),n.max=Math.max(n.max,t),n.sum+=t):this.inMemoryHistograms[e]={count:1,min:t,max:t,sum:t},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(e,t){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=10){this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");return}this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},3e5))},e.prototype.saveAllDataToStorage=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t,n,r;return(0,O.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,O.__assign)({},this.inMemoryTags),t=(0,O.__assign)({},this.inMemoryCounters),n=(0,O.__assign)({},this.inMemoryHistograms),r=(0,O.__spreadArray)([],(0,O.__read)(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(t),this.storage.setHistogramStats(n),this.storage.addEventRecords(r)])];case 1:return i.sent(),[2]}})})},e.prototype._flush=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,l;return(0,O.__generator)(this,function(c){switch(c.label){case 0:if(!this.storage)return[2];return[4,this.saveAllDataToStorage()];case 1:return c.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:if(t=(e=c.sent()).tags,n=e.counters,r=e.histogramStats,i=e.events,this.storage.setLastFlushTimestamp(Date.now()),o={},t.forEach(function(e){o[e.key]=e.value}),s={}
1,n.forEach(function(e){s[e.key]=e.value}),a={},r.forEach(function(e){a[e.key]={count:e.count,min:e.min,max:e.max,avg:Math.round(e.sum/e.count*100)/100}}),u=i.map(function(e){return{event_name:e.event_name,time:e.time,event_properties:e.event_properties}}),0===Object.keys(s).length&&0===Object.keys(a).length&&0===u.length)return[2];return l={tags:o,histogram:a,counters:s,events:u},this.fetch(l),[2]}})})},e.prototype.fetch=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!j())throw Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:if(!n.sent().ok)return this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2];return this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3];case 2:return t=n.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",t),[3,3];case 3:return[2]}})})},e.prototype.initializeFlushInterval=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t,n;return(0,O.__generator)(this,function(r){switch(r.label){case 0:if(!this.storage)return[2];return e=Date.now(),[4,this.storage.getLastFlushTimestamp()];case 1:if(-1===(t=r.sent()||-1))return this.storage.setLastFlushTimestamp(e),this._setFlushTimer(3e5),[2];return(n=e-t)>=3e5?this._flush():this._setFlushTimer(3e5-n),[2]}})})},e.prototype._setFlushTimer=function(e){var t=this;this.flushTimer=setTimeout(function(){t._flush().catch(function(e){t.logger.debug("DiagnosticsClient: Failed to flush",e)}).finally(function(){t.flushTimer=null})},e)},e.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=G(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),en=function(){var e,t=j();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=er(n[0]),i=er(n[1]);return i&&(e[r]=i),e},{}):{}},er=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}},ei=n(83199),eo=n(57870),es=function(e){return void 0===e&&(e=eo.JE),ei.V.getInstance(e)},ea=function(e,t){es(t).identityStore.editIdentity().setUserId(e).commit()},eu=function(e,t){es(t).identityStore.editIdentity().setDeviceId(e).commit()};(o=m||(m={})).Unknown="unknown",o.Skipped="skipped",o.Success="success",o.RateLimit="rate_limit",o.PayloadTooLarge="payload_too_large",o.Invalid="invalid",o.Failed="failed",o.Timeout="Timeout",o.SystemError="SystemError";var el=function(e,t){var n=Math.max(t,1);return e.reduce(function(e,t,r){var i=Math.floor(r/n);return e[i]||(e[i]=[]),e[i].push(t),e},[])},ec=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=m.Unknown),{event:e,code:t,message:n}},ed=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:eo.JE,logLevel:p.Warn,loggerProvider:new q,offline:!1,optOut:!1,serverUrl:eo.EG,serverZone:"US",useBatch:!1}},ef=function(){function e(e){this._optOut=!1;var t,n,r,i,o=ed();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=eg(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}
1,enumerable:!1,configurable:!0}),e}(),eg=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=ed().serverZone),void 0===n&&(n=ed().useBatch),e)return{serverUrl:e,serverZone:void 0};var r,i=["US","EU"].includes(t)?t:ed().serverZone;return{serverZone:i,serverUrl:(r=n,"EU"===i?r?eo.RE:eo.y_:r?eo.h8:eo.EG)}},ev=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function eh(e){return e>=200&&e<300}var ep=new Set([eo.EG,eo.y_,eo.h8,eo.RE]);function em(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var ey=function(){function e(e){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduleId=null,this.scheduledTimeout=0,this.flushId=null,this.queue=[],this.diagnosticsClient=null==e?void 0:e.diagnosticsClient}return e.prototype.setup=function(e){var t;return(0,O.__awaiter)(this,void 0,void 0,function(){var n,r=this;return(0,O.__generator)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(eo.f1,"_").concat(this.config.apiKey.substring(0,10)),[4,null===(t=this.config.storageProvider)||void 0===t?void 0:t.get(this.storageKey)];case 1:return(n=i.sent())&&n.length>0&&Promise.all(n.map(function(e){return r.execute(e)})).catch(),[2,Promise.resolve(void 0)]}})})},e.prototype.execute=function(e){var t=this;return e.insert_id||(e.insert_id=H()),new Promise(function(n){t.queue.push({event:e,attempts:0,callback:function(e){return n(e)},timeout:0}),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&&(null===this.scheduleId||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){t.queue=t.queue.map(function(e){return e.timeout=0,e}),t.flush(!0)},e);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r=this;return(0,O.__generator)(this,function(i){switch(i.label){case 0:if(this.config.offline)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2];if(this.flushId)return this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2];return this.flushId=this.scheduleId,this.resetSchedule(),t=[],n=[],this.queue.forEach(function(e){return 0===e.timeout?t.push(e):n.push(e)}),[4,el(t,this.config.flushQueueSize).reduce(function(t,n){return(0,O.__awaiter)(r,void 0,void 0,function(){return(0,O.__generator)(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]}})})},e.prototype.send=function(e,t){var n;return void 0===t&&(t=!0),(0,O.__awaiter)(this,void 0,void 0,function(){var r,i,o,s,a;return(0,O.__generator)(this,function(u){var l,c,d;switch(u.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,"Event rejected due to missing API key")];r={api_key:this.config.apiKey,events:e.map(function(e){var t=e.event;return t.extra,(0,O.__rest)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new ev,u.label=1;case 1:return u.trys.push([1,3,,4]),l=i=eg(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(c=this.config.enableRequestBodyCompression)&&(c=!1),o=!!ep.has(l)||c,[4,this.config.transportProvider.send(i,r,this.config._enableRequestBodyCompressionExperimental&&o)];case 2:if(null===(s=u.sent()))return this.fulfillRequest(e,0,"Unexpected error occurred"),[2];if(!t)return"body"in s?this.fulfillRequest(e,s.statusCode,"".concat(s.status,": ").concat(em(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:return a=(d=u.sent())instanceof Error?d.message:String(d),this.config.loggerProvider.error(a),null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:a,stack_trace:A()}),this.handleResponse({status:m.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){eh(e.statusCode)||null===(n=this.diagnosticsClient)||void 0===n||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:em(e),stack_trace:A()});var n,r=e.status;switch(r){case m.Success:this.handleSuccessResponse(e,t);break;case m.Invalid:this.handleInvalidResponse(e,t);break;case m.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case m.RateLimit:this.handleRateLimitResponse(e,t);break;default:this.config.loggerProvider.warn("{code: 0, error: \"Status '".concat(r,"' provided for ").concat(t.length,' events"}')),this.handleOtherResponse(t)}},e.prototype.handleSuccessResponse=function(e,t){this.fulfillRequest(t,e.statusCode,"Event tracked successfully")},e.prototype.handleInvalidResponse=function(e,t){var n=this;if(e.body.missingField||e.body.error.startsWith("Invalid API key")){this.fulfillRequest(t,e.statusCode,e.body.error);return}var r=new Set((0,O.__spreadArray)((0,O.__spreadArray)((0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,O.__read)(Object.values(e.body.eventsWithMissingFields)),!1),(0,O.__read)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,O.__read)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){if(r.has(i)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return!0});i.length>0&&this.config.loggerProvider.warn(em(e));
1var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length){this.fulfillRequest(t,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(em(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(t);this.scheduleEvents(n)},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),a=new Set(i),u=new Set(o),l=t.filter(function(t,r){if(t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)){n.fulfillRequest([t],e.statusCode,e.body.error);return}return u.has(r)&&(t.timeout=n.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(em(e));var c=this.removeEventsExceedFlushMaxRetries(l);this.scheduleEvents(c)},e.prototype.handleOtherResponse=function(e){var t=this,n=e.map(function(e){return e.timeout=e.attempts*t.retryTimeout,e}),r=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(r)},e.prototype.fulfillRequest=function(e,t,n){var r,i,o;eh(t)?null===(o=this.diagnosticsClient)||void 0===o||o.increment("analytics.events.sent",e.length):(null===(r=this.diagnosticsClient)||void 0===r||r.increment("analytics.events.dropped",e.length),null===(i=this.diagnosticsClient)||void 0===i||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:A()})),this.removeEvents(e),e.forEach(function(e){return e.callback(ec(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}(),e_=function(){function e(){this.name="identity",this.type="before",this.identityStore=es().identityStore}return e.prototype.execute=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return e.instanceName&&(this.identityStore=es(e.instanceName).identityStore),[2]})})},e}(),eb=n(95828);(s=y||(y={})).SET="$set",s.SET_ONCE="$setOnce",s.ADD="$add",s.APPEND="$append",s.PREPEND="$prepend",s.REMOVE="$remove",s.PREINSERT="$preInsert",s.POSTINSERT="$postInsert",s.UNSET="$unset",s.CLEAR_ALL="$clearAll",(a=_||(_={})).IDENTIFY="$identify",a.GROUP_IDENTIFY="$groupidentify",a.REVENUE="revenue_amount";var ew=function(e,t){return(0,O.__assign)((0,O.__assign)({},t),{event_type:_.IDENTIFY,user_properties:e.getUserProperties()})},eS=function(e,t,n,r){var i;return(0,O.__assign)((0,O.__assign)({},r),{event_type:_.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:((i={})[e]=t,i)})},eE=function(e,t,n){var r,i=new eb.h2;return i.set(e,t),(0,O.__assign)((0,O.__assign)({},n),{event_type:_.IDENTIFY,user_properties:i.getUserProperties(),groups:((r={})[e]=t,r)})},ek=n(28672),eI=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(0,ek.L)(e)&&(this.properties=e),this},e.prototype.getEventProperties=function(){var e=this.properties?(0,O.__assign)({},this.properties):{};return e[b.REVENUE_PRODUCT_ID]=this.productId,e[b.REVENUE_QUANTITY]=this.quantity,e[b.REVENUE_PRICE]=this.price,e[b.REVENUE_TYPE]=this.revenueType,e[b.REVENUE_CURRENCY]=this.currency,e[b.REVENUE]=this.revenue,e[b.RECEIPT]=this.receipt,e[b.RECEIPT_SIG]=this.receiptSig,e},e}();(u=b||(b={})).REVENUE_PRODUCT_ID="$productId",u.REVENUE_QUANTITY="$quantity",u.REVENUE_PRICE="$price",u.REVENUE_TYPE="$revenueType",u.REVENUE_CURRENCY="$currency",u.REVENUE="$revenue",u.RECEIPT="$receipt",u.RECEIPT_SIG="$receiptSig";var eT=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},eC=n(54173),eP=n.n(eC)()||eC,eR=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(i){switch(i.label){case 0:if(this.plugins.some(function(t){return t.name===e.name}))return this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2];return void 0===e.name&&(e.name=H(),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(0,O.__awaiter)(this,void 0,void 0,function(){var r,i;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(-1===(r=this.plugins.findIndex(function(t){return t.name===e})))return t.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2];return i=this.plugins[r],this.plugins.splice(r,1),[4,null===(n=i.teardown)||void 0===n?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},e.prototype.reset=function(e){this._clearOptOutListeners(),this.applying=!1,this.plugins.map(function(e){var t;return null===(t=e.teardown)||void 0===t?void 0:t.call(e)}),this.plugins=[],this.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(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s,a,u,l,c,d,f,g,v,h;return(0,O.__generator)(this,function(p){switch(p.label){case 0:if(!e)return[2];t=(0,O.__read)(e,1)[0],n=(0,O.__read)(e,2)[1],this.loggerProvider.log("Timeline.apply: Initial event",t),r=this.plugins.filter(function(e){return"before"===e.type}),p.label=1;case 1:p.trys.push([1,6,7,8]),o=(i=(0,O.__values)(r)).next(),p.label=2;case 2:if(o.done)return[3,5];if(!(s=o.value).execute)return[3,4];return[4,s.execute((0,O.__assign)({},t))];case 3:if(null===(a=p.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),n({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),p.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return f={error:p.sent()},[3,8];case 7:try{o&&!o.done&&(g=i.return)&&g.call(i)}finally{if(f)throw f.error}
1return[7];case 8:u=this.plugins.filter(function(e){return"enrichment"===e.type||void 0===e.type}),p.label=9;case 9:p.trys.push([9,14,15,16]),c=(l=(0,O.__values)(u)).next(),p.label=10;case 10:if(c.done)return[3,13];if(!(s=c.value).execute)return[3,12];return[4,s.execute((0,O.__assign)({},t))];case 11:if(null===(a=p.sent()))return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),n({event:t,code:0,message:""}),[2];t=a,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(s.name),"', event: ").concat(JSON.stringify(t))),p.label=12;case 12:return c=l.next(),[3,10];case 13:return[3,16];case 14:return v={error:p.sent()},[3,16];case 15:try{c&&!c.done&&(h=l.return)&&h.call(l)}finally{if(v)throw v.error}return[7];case 16:return d=this.plugins.filter(function(e){return"destination"===e.type}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(t))),Promise.all(d.map(function(e){var n=(0,O.__assign)({},t);return e.execute(n).catch(function(e){return ec(n,0,String(e))})})).then(function(e){var r=(0,O.__read)(e,1)[0]||ec(t,100,"Event not tracked, no destination plugins on the instance");n(r)}),[2]}})})},e.prototype.flush=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,O.__generator)(this,function(n){switch(n.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(e){return t.apply(e)}))];case 1:return n.sent(),[4,Promise.all(this.plugins.filter(function(e){return"destination"===e.type}).map(function(e){return e.flush&&e.flush()}))];case 2:return n.sent(),[2]}})})},e.prototype.addOptOutListener=function(e){this._optOutListeners.push(e)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onIdentityChanged)||void 0===n||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onSessionIdChanged)||void 0===n||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null===(n=t.onOptOutChanged)||void 0===n||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,O.__generator)(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=(t=(0,O.__values)(this._optOutListeners)).next(),a.label=1;case 1:if(n.done)return[3,6];r=n.value,a.label=2;case 2:return a.trys.push([2,4,,5]),[4,r(e)];case 3:return a.sent(),[3,5];case 4:return i=a.sent(),this.loggerProvider.error("Error calling optOut listener",i),[3,5];case 5:return n=t.next(),[3,1];case 6:return[3,9];case 7:return o={error:a.sent()},[3,9];case 8:try{n&&!n.done&&(s=t.return)&&s.call(t)}finally{if(o)throw o.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(e){var t;null===(t=e.onReset)||void 0===t||t.call(e)})},e}(),eO=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 eR(this),this.name=e}return e.prototype._init=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(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(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,O.__generator)(this,function(a){switch(a.label){case 0:t=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,8,9,10]),r=(n=(0,O.__values)(t)).next(),a.label=2;case 2:if(r.done)return[3,7];if(!((i=(0,r.value)())&&"promise"in i))return[3,4];return[4,i.promise];case 3:return a.sent(),[3,6];case 4:return[4,i];case 5:a.sent(),a.label=6;case 6:return r=n.next(),[3,2];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}
1return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e)];case 11:a.sent(),a.label=12;case 12:return[2]}})})},e.prototype.track=function(e,t,n){var r=(0,O.__assign)((0,O.__assign)((0,O.__assign)({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),M(this.dispatch(r))},e.prototype.identify=function(e,t){var n=ew(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),M(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=eS(e,t,n,r);return M(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=eE(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),M(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=(0,O.__assign)((0,O.__assign)({},t),{event_type:_.REVENUE,event_properties:e.getEventProperties()});return M(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),M())},e.prototype._addPlugin=function(e){return M(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)),M())},e.prototype._removePlugin=function(e){return M(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(ec(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t=this;return(0,O.__generator)(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(n){t.dispatchQ.push(t.dispatchWithCallback.bind(t,e,n))})]})})},e.prototype.getOperationAppliedUserProperties=function(e){var t,n=null!==(t=this.userProperties)&&void 0!==t?t:{},r=(0,O.__assign)({},n);if(void 0===e)return r;var i={};return Object.keys(e).forEach(function(t){Object.values(y).includes(t)||(i[t]=e[t])}
vendor: 8,400 bytes, line 1
1),eb.rk.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case y.CLEAR_ALL:Object.keys(r).forEach(function(e){delete r[e]});break;case y.UNSET:Object.keys(n).forEach(function(e){delete r[e]});break;case y.SET:Object.assign(r,n)}}}),Object.assign(r,i),r},e.prototype.process=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n;return(0,O.__generator)(this,function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),this.config.optOut)return[2,ec(e,0,"Event skipped due to optOut config")];return e.event_type===_.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)];case 1:return 200===(t=r.sent()).code?this.config.loggerProvider.log(t.message):100===t.code?this.config.loggerProvider.warn(t.message):this.config.loggerProvider.error(t.message),[2,t];case 2:return n=String(r.sent()),this.config.loggerProvider.error(n),[2,t=ec(e,0,n)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!e));return}this._setOptOut(e)},e.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.config.optOut=!!e,this.timeline.onOptOutChanged(e))},e.prototype.flush=function(){return M(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});if(void 0===t){this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e));return}return t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),eA=function(e,t){return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1},ex=function(e){return eA(e,"attribution")},eD=function(e){return eA(e,"formInteractions")},eL=function(e){return eA(e,"pageViews")},eN=function(e){return eA(e,"sessions")},eM=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},eU=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},eq=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},eF=function(e){if(eU(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},ej=function(e){if(eq(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},eB=function(e){var t;if(eM(e.autocapture)){var n=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.networkTracking?n=e.autocapture.networkTracking:e.networkTrackingOptions&&(n=e.networkTrackingOptions),(0,O.__assign)((0,O.__assign)({},n),{captureRules:null===(t=null==n?void 0:n.captureRules)||void 0===t?void 0:t.map(function(t){var n,r,i;if((null===(n=t.urls)||void 0===n?void 0:n.length)&&(null===(r=t.hosts)||void 0===r?void 0:r.length)){var o=JSON.stringify(t.hosts),s=JSON.stringify(t.urls);return null===(i=e.loggerProvider)||void 0===i||i.warn("Found network capture rule with both urls='".concat(s,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,O.__assign)((0,O.__assign)({},t),{hosts:void 0})}return t})})}},eH=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return eL(e.defaultTracking)&&(n=void 0,t=void 0,e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.pageViews&&"object"==typeof e.defaultTracking.pageViews&&("trackOn"in e.defaultTracking.pageViews&&(n=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(t=e.defaultTracking.pageViews.eventType))),{trackOn:n,trackHistoryChanges:r,eventType:t,pageCounter:i}},eW=function(e){return ex(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&e.defaultTracking.attribution&&"object"==typeof e.defaultTracking.attribution?(0,O.__assign)({},e.defaultTracking.attribution):{}},ez=function(e){if(eD(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},eV=function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.name,o=r.args,s=r.resolve,a=e&&e[i];if("function"==typeof a){var u=a.apply(e,o);"function"==typeof s&&s(null==u?void 0:u.promise)}}return e},eK=function(e){return e&&void 0!==e._q},e$=function(){if("undefined"==typeof navigator)return"";var e,t,n,r,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:""},eJ="2.36.5",eG="amplitude-ts",eY=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(eG,"/").concat(eJ),"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(0,O.__awaiter)(this,void 0,void 0,function(){var r,i,o;return(0,O.__generator)(this,function(s){return r=new Date().getTime(),i=null!==(t=this.config.lastEventId)&&void 0!==t?t:-1,o=null!==(n=e.event_id)&&void 0!==n?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[2,(0,O.__assign)((0,O.__assign)((0,O.__assign)((0,O.__assign)((0,O.__assign)((0,O.__assign)((0,O.__assign)((0,O.__assign)({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:r},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:"Web"}),this.config.trackingOptions.language&&{language:e$()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:H(),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}(),eQ=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(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(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),eZ=function(){var e,t=j();return null===(e=null==t?void 0:t.navigator)||void 0===e?void 0:e.locks},eX=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,O.__assign)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:return t="AMP_TEST",n=new e((0,O.__assign)({},this.options)),r=String(Date.now()),[4,n.transaction(t,function(e){var n,o;try{e.set(r);var s=e.get()===r;return!s&&i.config.diagnosticsClient&&(null===(n=i.config.diagnosticsClient)||void 0===n||n.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:r,sync:!0})),s}catch(e){if(i.config.diagnosticsClient){var a=e instanceof Error?e.message:String(e);null===(o=i.config.diagnosticsClient)||void 0===o||o.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:r,error:a,sync:!0})}return!1}
1finally{e.set(null)}})];case 1:return[2,o.sent()]}})})},e.prototype.get=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getRaw(e)];case 1:return t=n.sent(),[2,this.decodeCookieValue(e,t)]}})})},e.prototype.decodeCookieValue=function(e,t){if(t)try{var n=e2(t);if(void 0===n){console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t));return}return JSON.parse(n)}catch(n){console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(t));return}},e.prototype.getSync=function(e){var t=this.getRawSync(e);return this.decodeCookieValue(e,t)},e.prototype.getRaw=function(e){var t,n;return(0,O.__awaiter)(this,void 0,void 0,function(){var r,i,o,s,a,u,l,c;return(0,O.__generator)(this,function(d){switch(d.label){case 0:r=j(),d.label=1;case 1:if(d.trys.push([1,4,,5]),!(i=null==r?void 0:r.cookieStore))return[3,3];return[4,i.getAll(e)];case 2:if(o=d.sent()){o.length>1&&(null===(t=this.config.diagnosticsClient)||void 0===t||t.recordEvent("cookies.duplicate",{cookies:o.map(function(e){return e.domain})}),null===(n=this.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(s=(0,O.__values)(o)).next();!a.done;a=s.next())if(u=a.value,e3(u.domain,this.options.domain))return[2,u.value]}catch(e){l={error:e}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(l)throw l.error}}}d.label=3;case 3:return[3,5];case 4:return d.sent(),[3,5];case 5:return[2,this.getRawSync(e)]}})})},e.prototype.getRawSync=function(e){var t,n,r=this,i=j(),o=(null!==(n=null===(t=null==i?void 0:i.document)||void 0===t?void 0:t.cookie.split("; "))&&void 0!==n?n:[]).filter(function(t){return 0===t.indexOf(e+"=")}),s=void 0,a=this.config.duplicateResolverFn;if("function"==typeof a&&o.length>1&&(s=o.find(function(t){var n;try{var i=a(t.substring(e.length+1));return i||null===(n=r.config.diagnosticsClient)||void 0===n||n.increment("cookies.duplicate.occurrence.document.cookie"),i}catch(e){return!1}})),s||(s=o[0]),s)return s.substring(e.length+1)},e.prototype.set=function(e,t){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=null!==(n=this.options.expirationDays)&&void 0!==n?n:0,i=null!==t?r:-1,o=void 0;if(i){var s=new Date;s.setTime(s.getTime()+864e5*i),o=s}var a="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(t))));o&&(a+="; expires=".concat(o.toUTCString())),a+="; path=/",this.options.domain&&(a+="; domain=".concat(this.options.domain)),this.options.secure&&(a+="; Secure"),this.options.sameSite&&(a+="; SameSite=".concat(this.options.sameSite));var u=j();(null==u?void 0:u.document)&&(u.document.cookie=a)}catch(t){var l=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(l))}},e.prototype.remove=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(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(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return[2]})})},e.isDomainWritable=function(t){return(0,O.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,O.__generator)(this,function(i){switch(i.label){case 0:if(e.cachedTlds[t])return[2,!0];n="AMP_TLDTEST",r=new e({domain:"."+t}),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,r.transaction(n,function(n){if(e.cachedTlds[t])return!0;try{n.set(1);var r=!!n.get();return r&&(e.cachedTlds[t]=!0),r}finally{n.set(null)}})];case 2:return[2,!!i.sent()];case 3:return i.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(e,t){return(0,O.__awaiter)(this,void 0,void 0,function(){var n,r,i=this;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(n=eZ(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];return[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 1:return[2,o.sent()]}})})},e.cachedTlds={},e}(),e0=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},e1=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},e2=function(e){var t;return null!==(t=e0(e))&&void 0!==t?t:e1(e)},e3=function(e,t){if(""===e&&""===t)return!0;
1if(!e||!t)return!1;var n=e.startsWith(".")?e.substring(1):e,r=t.startsWith(".")?t.substring(1):t;return n.toLowerCase()===r.toLowerCase()},e4=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[eo.xp,t,e.substring(0,n)].filter(Boolean).join("_")},e5=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r;return(0,O.__generator)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),n=new e(this.storage),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,n.set(r,t)];case 2:return i.sent(),[4,n.get(r)];case 3:return[2,i.sent()===t];case 4:return i.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:if(!(t=n.sent()))return[2,void 0];return[2,JSON.parse(t)];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(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(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(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(r){try{null===(n=this.storage)||void 0===n||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(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(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(t){try{null===(e=this.storage)||void 0===e||e.clear()}catch(e){}return[2]})})},e}(),e6=function(e){function t(t){var n,r,i,o=this;try{i=null===(n=j())||void 0===n?void 0:n.localStorage}catch(e){null===(r=null==t?void 0:t.loggerProvider)||void 0===r||r.debug("Failed to access localStorage. error=".concat(JSON.stringify(e))),i=void 0}return(o=e.call(this,i)||this).loggerProvider=null==t?void 0:t.loggerProvider,o}return(0,O.__extends)(t,e),t.prototype.set=function(t,n){var r;return(0,O.__awaiter)(this,void 0,void 0,function(){var i;return(0,O.__generator)(this,function(o){switch(o.label){case 0:if(!(Array.isArray(n)&&n.length>1e3))return[3,2];return i=n.length-1e3,[4,e.prototype.set.call(this,t,n.slice(0,1e3))];case 1:return o.sent(),null===(r=this.loggerProvider)||void 0===r||r.error("Failed to save ".concat(i," events because the queue length exceeded ").concat(1e3,".")),[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}(e5),e8=function(e){function t(){var t;return e.call(this,null===(t=j())||void 0===t?void 0:t.sessionStorage)||this}return(0,O.__extends)(t,e),t}(e5);function e9(){return"undefined"!=typeof CompressionStream}function e7(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:if(void 0===(t=CompressionStream))return[2,void 0];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,new Response(new Blob([e]).stream().pipeThrough(new t("gzip"))).arrayBuffer()];case 2:return[2,n.sent()];case 3:return n.sent(),[2,void 0];case 4:return[2]}})})}var te=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,n,r,i,o,s,a,u,l,c,d,f,g,v,h,p,y,_,b,w,S,E,k=e.code||0,I=this.buildStatus(k);switch(I){case m.Success:return{status:I,statusCode:k,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case m.Invalid:return{status:I,statusCode:k,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invali
1d_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(c=e.exceeded_daily_quota_devices)&&void 0!==c?c:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case m.PayloadTooLarge:return{status:I,statusCode:k,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case m.RateLimit:return{status:I,statusCode:k,body:{error:null!==(p=e.error)&&void 0!==p?p:"",epsThreshold:null!==(y=e.eps_threshold)&&void 0!==y?y:0,throttledDevices:null!==(_=e.throttled_devices)&&void 0!==_?_:{},throttledUsers:null!==(b=e.throttled_users)&&void 0!==b?b:{},exceededDailyQuotaDevices:null!==(w=e.exceeded_daily_quota_devices)&&void 0!==w?w:{},exceededDailyQuotaUsers:null!==(S=e.exceeded_daily_quota_users)&&void 0!==S?S:{},throttledEvents:null!==(E=e.throttled_events)&&void 0!==E?E:[]}};case m.Timeout:default:return{status:I,statusCode:k}}},e.prototype.buildStatus=function(e){return eh(e)?m.Success:429===e?m.RateLimit:413===e?m.PayloadTooLarge:408===e?m.Timeout:e>=400&&e<500?m.Invalid:e>=500?m.Failed:m.Unknown},e}(),tt=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=t,n}return(0,O.__extends)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,O.__awaiter)(this,void 0,void 0,function(){var r=this;return(0,O.__generator)(this,function(i){return[2,new Promise(function(i,o){"undefined"==typeof XMLHttpRequest&&o(Error("XHRTransport is not supported."));var s=new XMLHttpRequest;s.open("POST",e,!0),s.onreadystatechange=function(){if(s.readyState===r.state.done){var e=s.responseText;try{i(r.buildResponse(JSON.parse(e)))}catch(e){i(r.buildResponse({code:s.status}))}}};var a={"Content-Type":"application/json",Accept:"*/*"},u=JSON.stringify(t),l=n&&u.length>=2048&&e9(),c=function(e){var t,n;a=(0,O.__assign)((0,O.__assign)({},r.customHeaders),a);try{for(var i=(0,O.__values)(Object.entries(a)),o=i.next();!o.done;o=i.next()){var u=(0,O.__read)(o.value,2),l=u[0],c=u[1];s.setRequestHeader(l,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}s.send(e)};(0,O.__awaiter)(r,void 0,void 0,function(){var e;return(0,O.__generator)(this,function(t){switch(t.label){case 0:if(!l)return[3,2];return[4,e7(u)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(u),[3,3];case 2:c(u),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(te),tn=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return(0,O.__extends)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,O.__awaiter)(this,void 0,void 0,function(){var r,i,o,s,a,u,l;return(0,O.__generator)(this,function(c){switch(c.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");if(r=JSON.stringify(t),i=n&&r.length>=2048&&e9(),o=r,s={"Content-Type":"application/json",Accept:"*/*"},!i)return[3,2];return[4,e7(r)];case 1:(a=c.sent())&&(s["Content-Encoding"]="gzip",o=a),c.label=2;case 2:return[4,fetch(e,{headers:s=(0,O.__assign)((0,O.__assign)({},this.customHeaders),s),body:o,method:"POST"})];case 3:return[4,(u=c.sent()).text()];case 4:l=c.sent();try{return[2,this.buildResponse(JSON.parse(l))]}catch(e){return[2,this.buildResponse({code:u.status})]}return[2]}})})},t}(te),tr=function(e){function t(){return e.call(this)||this}return(0,O.__extends)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,O.__awaiter)(this,void 0,void 0,function(){var n=this;return(0,O.__generator)(this,function(r){return[2,new Promise(function(r,i){var o=j();if(!(null==o?void 0:o.navigator.sendBeacon))throw Error("SendBeaconTransport is not supported");try{var s=JSON.stringify(t);if(o.navigator.sendBeacon(e,s))return r(n.buildResponse({code:200,events_ingested:t.events.length,payload_size_bytes:s.length,server_upload_time:Date.now()}));return r(n.buildResponse({code:500}))}catch(e){i(e)}})]})})},t}(te),ti=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},to=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},ts="[Amplitude]",ta="".concat(ts," Form Started"),tu="".concat(ts," Form Submitted"),tl="".concat(ts," File Downloaded"),tc="session_start",td="session_end",tf="".concat(ts," File Extension"),tg="".concat(ts," File Name"),tv="".concat(ts," Link ID"),th="".concat(ts," Link Text"),tp="".concat(ts," Link URL"),tm="".concat(ts," Form ID"),ty="".concat(ts," Form Name"),t_="".concat(ts," Form Destination"),tb="cookie",tw={always:"always",ifEmptyCampaign:"ifEmptyCampaign"},tS=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},tE=function(e,t,n,r,i,o){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,a=(0,O.__rest)(e,["referrer","referring_domain"]),u=t||{},l=(u.referrer,u.referring_domain),c=(0,O.__rest)(u,["referrer","referring_domain"]),d=n.excludeInternalReferrers;if(d){var f=tC(d,r);if(!(f instanceof TypeError)&&e.referring_domain&&tO(e.referring_domain,o)&&("always"===f||"ifEmptyCampaign"===f&&Object.values((0,O.__assign)((0,O.__assign)({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e})))return function(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}(f,e.referring_domain,r),!1}if(tk(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&&Object.values(e).every(function(e){return!e})&&t)return r.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var g=JSON.stringify(a)!==JSON.stringify(c),v=tS(s||"")!==tS(l||""),h=!t||g||v;return h?r.debug("This is a new campaign. An $identify event will be sent."):r.debug("This is not a new campaign because it's the same as the previous one."),h},tk=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})},tI=function(e,t){var n=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(n)},tT=function(e){var t=e;
1return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},tC=function(e,t){if(!0===e)return tw.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(tw).includes(n))return n;if(void 0===n)return tw.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),TypeError(r)},tP=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],tR=function(e){var t,n,r=e||(null===(n=null===(t=j())||void 0===t?void 0:t.location)||void 0===n?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],s=i[i.length-2];return(tP.find(function(e){return r.endsWith(".".concat(e))})&&(o=i[i.length-2]+"."+i[i.length-1],s=i[i.length-3]),s)?"".concat(s,".").concat(o):o},tO=function(e,t){var n=j();return!!n&&tI(e,(t||"").trim()||tR(n.location.hostname))},tA=function(e){function t(t,n,r,i,o,s,a,u,l,c,d,f,g,v,h,m,y,_,b,w,S,E,k,I,T,C,P,R,O,A,x,D,L,N,M,U,F,j,B,H,W,z,V,K){void 0===r&&(r=new eQ),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===l&&(l=5),void 0===c&&(c=30),void 0===d&&(d=tb),void 0===m&&(m=new q),void 0===y&&(y=p.Warn),void 0===b&&(b=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===I&&(I="US"),void 0===P&&(P=18e5),void 0===R&&(R=new e6({loggerProvider:m})),void 0===O&&(O={ipAddress:!0,language:!0,platform:!0}),void 0===A&&(A="fetch"),void 0===x&&(x=!1),void 0===D&&(D=!0),void 0===j&&(j=!0),void 0===B&&(B=0),void 0===V&&(V=!1),void 0===K&&(K=!1);var $,J=this;(J=e.call(this,{apiKey:t,storageProvider:R,transportProvider:tL(A)})||this).apiKey=t,J.appVersion=n,J.cookieOptions=i,J.defaultTracking=o,J.autocapture=s,J.flushIntervalMillis=u,J.flushMaxRetries=l,J.flushQueueSize=c,J.identityStorage=d,J.ingestionMetadata=f,J.instanceName=g,J.loggerProvider=m,J.logLevel=y,J.minIdLength=_,J.offline=b,J.partnerId=S,J.plan=E,J.serverUrl=k,J.serverZone=I,J.sessionTimeout=P,J.storageProvider=R,J.trackingOptions=O,J.transport=A,J.useBatch=x,J.fetchRemoteConfig=D,J.networkTrackingOptions=U,J.identify=F,J.enableDiagnostics=j,J.diagnosticsSampleRate=B,J.diagnosticsClient=H,J.remoteConfig=W,J.topLevelDomain=z,J.enableRequestBodyCompression=V,J._enableRequestBodyCompressionExperimental=K,J.version=eJ,J._optOut=!1,J._cookieStorage=r,J.deviceId=a,J.lastEventId=v,J.lastEventTime=h,J.optOut=w,J.deferredSessionId=C,J.sessionId=T,J.pageCounter=N,J.userId=L,J.debugLogsEnabled=M,J.loggerProvider.enable(M?p.Debug:J.logLevel),J.networkTrackingOptions=U,J.identify=F,J.enableDiagnostics=j,J.diagnosticsSampleRate=B,J.diagnosticsClient=H;var G=null!==($=null==W?void 0:W.fetchRemoteConfig)&&void 0!==$?$:D;return J.remoteConfig=J.remoteConfig||{},J.remoteConfig.fetchRemoteConfig=G,J.fetchRemoteConfig=G,J.topLevelDomain=z||tR(),J}return(0,O.__extends)(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())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof eX&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(e4(this.apiKey),e)},t}(ef),tx=function(e,t,n){switch(void 0===e&&(e=tb),void 0===t&&(t={}),e){case"localStorage":return new e6;case"sessionStorage":return new e8;case"none":return new eQ;default:return new eX((0,O.__assign)((0,O.__assign)({},t),{expirationDays:t.expiration}),n)}},tD=function(e){var t,n;return void 0===e&&(e={}),(null===(t=e.remoteConfig)||void 0===t?void 0:t.fetchRemoteConfig)===!0||(null===(n=e.remoteConfig)||void 0===n?void 0:n.fetchRemoteConfig)!==!1&&!1!==e.fetchRemoteConfig},tL=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0;return"xhr"===t?new tt(n):"beacon"===t?new tr:new tn(n)},tN="data-amp-mask",tM="*****",tU=/\b(?:\d[ -]*?){13,16}\b/,tq=/(\d{3}-?\d{2}-?\d{4})/g,tF=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,tj=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var n,r,i=e;i=(i=(i=i.replace(tU,tM)).replace(tq,tM)).replace(tF,tM);try{for(var o=(0,O.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,tM)}catch(e){}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i},tB=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(tN)?tM:e?e(document.title):document.title},tH=function(){function e(){}return e.prototype.parse=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return[2,(0,O.__assign)((0,O.__assign)((0,O.__assign)((0,O.__assign)({},eo.Lo),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=en();return{utm_campaign:e[eo.VX],utm_content:e[eo.fZ],utm_id:e[eo.KI],utm_medium:e[eo.lP],utm_source:e[eo.b3],utm_term:e[eo.NE]}},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=en();return(e={})[eo.ah]=t[eo.ah],e[eo.rV]=t[eo.rV],e[eo.fC]=t[eo.fC],e[eo.Ji]=t[eo.Ji],e[eo.bz]=t[eo.bz],e[eo.tS]=t[eo.tS],e[eo.pr]=t[eo.pr],e[eo.Kh]=t[eo.Kh],e[eo.cl]=t[eo.cl],e[eo.oZ]=t[eo.oZ],e[eo.pG]=t[eo.pG],e},e}(),tW=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},tz=function(e){void 0===e&&(e={});var t,n,r=j(),i=void 0,o=!1,s=e.trackOn,a=e.trackHistoryChanges,u=e.eventType,l=void 0===u?"[Amplitude] Page Viewed":u,c=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==i||i.error("Malformed URI sequence: ",e)}return t},d=function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n;return(0,O.__generator)(this,function(r){switch(r.label){case 0:return e=c("undefined"!=typeof location&&location.href||""),n={event_type:l},t=[{}],[4,tV()];case 1:return[2,(n.event_properties=O.__assign.apply(void 0,[O.__assign.apply(void 0,t.concat([r.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":e,"[Amplitude] Page Path":"undefined"!=typeof location&&c(location.pathname)||"","[Amplitude] Page Title":tB(tj),"[Amplitude] Page URL":e.split("?")[0]}]),n)]}})})},f=function(){return void 0===s||"function"==typeof s&&s()},g="undefined"!=typeof location?location.href:null,v=function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,n,r,o;return(0,O.__generator)(this,function(s){switch(s.label){case 0:if(n=t$(a,e=location.href,g||"")&&f(),g=e,!n)return[3,4];if(null==i||i.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return o=(r=t).track,[4,d()];case 2:o.apply(r,[s.sent()]),s.label=3;case 3:s.label=4;case 4:return[2]}})})},h=function(){v()};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,s){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var a,u;return(0,O.__generator)(this,function(l){switch(l.label){case 0:if(t=s,n=e,(i=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),o=!0,r&&(r.addEventListener("popstate",h),r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=(0,O.__read)(n,3),i=r[0],s=r[1],a=r[2];e.apply(t,[i,s,a]),o&&v()}})),!f())return[3,2];return i.log("Tracking page view event"),u=(a=t).track,[4,d()];case 1:u.apply(a,[l.sent()]),l.label=2;case 2:return[2]}})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(r){switch(r.label){case 0:if(!("attribution"===s&&tK(e)))return[3,2];
1return null==i||i.log("Enriching campaign event to page view event with campaign parameters"),[4,d()];case 1:t=r.sent(),e.event_type=t.event_type,e.event_properties=(0,O.__assign)((0,O.__assign)({},e.event_properties),t.event_properties),r.label=2;case 2:return n&&e.event_type===l&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=(0,O.__assign)((0,O.__assign)({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return r&&(r.removeEventListener("popstate",h),o=!1),[2]})})}}},tV=function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,O.__generator)(this,function(t){switch(t.label){case 0:return e=tW,[4,new tH().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},tK=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[y.SET]||{},r=t[y.UNSET]||{},i=(0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(Object.keys(n)),!1),(0,O.__read)(Object.keys(r)),!1);return Object.keys(eo.Lo).every(function(e){return i.includes(e)})}return!1},t$=function(e,t,n){if("pathOnly"===e){if(""==n)return!0;var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname}return t!==n},tJ=function(){var e,t,n=[],r=function(e,t,r){e.addEventListener(t,r),n.push({element:e,type:t,handler:r})},i=function(){n.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),n=[]};return{name:"@amplitude/plugin-form-interaction-tracking-browser",type:"enrichment",setup:function(n,i){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,O.__generator)(this,function(a){return t=ez(n),o=function(){if(!i){n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if("undefined"!=typeof document){var o=new WeakSet,s=function(e){if(!o.has(e)){o.add(e);var s=!1;r(e,"change",function(){var t,n=tY(e);s||i.track(ta,((t={})[tm]=tG(e.id),t[ty]=tG(e.name),t[t_]=n,t)),s=!0}),r(e,"submit",function(r){var o,a,u=tY(e);if(s||i.track(ta,((o={})[tm]=tG(e.id),o[ty]=tG(e.name),o[t_]=u,o)),s=!0,(null==t?void 0:t.shouldTrackSubmit)!==void 0){if("function"==typeof t.shouldTrackSubmit&&"undefined"!=typeof SubmitEvent&&r instanceof SubmitEvent)try{if(!t.shouldTrackSubmit(r))return}catch(e){n.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else n.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.")}i.track(tu,((a={})[tm]=tG(e.id),a[ty]=tG(e.name),a[t_]=u,a)),s=!1})}};Array.from(document.getElementsByTagName("form")).forEach(s),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("form")).map(s)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=j())?s.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},tG=function(e){if("string"==typeof e)return e},tY=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},tQ=function(){var e,t=[],n=function(e,n,r){e.addEventListener(n,r),t.push({element:e,type:n,handler:r})},r=function(){t.forEach(function(e){var t=e.element,n=e.type,r=e.handler;null==t||t.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-file-download-tracking-browser",type:"enrichment",setup:function(t,r){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var i,o;return(0,O.__generator)(this,function(s){return i=function(){if(!r){t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if("undefined"!=typeof document){var i=function(e){try{t=new URL(e.href,window.location.href)}catch(e){return}var t,i=o.exec(t.href),s=null==i?void 0:i[1];s&&n(e,"click",function(){var n;s&&r.track(tl,((n={})[tf]=s,n[tg]=t.pathname,n[tv]=e.id,n[th]=e.text,n[tp]=e.href,n))})},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)(\?.+)?$/;
1Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){"A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("a")).map(i)})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=j())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},tZ=!1,tX=function(e){tZ||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."),tZ=!0)},t0=function(){var e=j(),t=[],n=function(n,r){(null==e?void 0:e.addEventListener)&&(null==e||e.addEventListener(n,r),t.push({type:n,handler:r}))},r=function(){t.forEach(function(t){var n=t.type,r=t.handler;null==e||e.removeEventListener(n,r)}),t=[]};return{name:"@amplitude/plugin-network-checker-browser",type:"before",setup:function(e,t){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(r){return"undefined"==typeof navigator?(e.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),e.offline=!1):(e.offline=!navigator.onLine,n("online",function(){e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis)}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return r(),[2]})})}}};function t1(e,t,n){var r,i,o=[];try{for(var s=(0,O.__values)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var u=a.value;try{o.push(new RegExp(u))}catch(e){n.loggerProvider.warn("Invalid regex pattern: ".concat(u),e)}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return e.concat(o)}var t2=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],t3="data-amp-track-",t4=["div","span","h1","h2","h3","h4","h5","h6"],t5=n(58675),t6=n.n(t5);function t8(e,t){return new(t6())(function(n){e.subscribe({next:function(e){t(e).then(function(e){return n.next(e)}).catch(function(e){return n.error(e)})},error:function(e){n.error(e)},complete:function(){n.complete()}})})}function t9(e,t){return new(t6())(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=(0,O.__values)(i),o=n.next();!o.done;o=n.next()){var s=o.value;try{s.unsubscribe()}catch(e){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}i.clear()},s=function(e){var t=e.subscribe({next:function(e){r||n.next(e)},error:function(e){r||(r=!0,n.error(e),o())},complete:function(){i.delete(t),r||0!==i.size||(n.complete(),o(),r=!0)}});i.add(t)};return s(e),s(t),o})}function t7(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new(t6())(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){try{for(var n,r,i,o=(0,O.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=a.next)||void 0===i||i.call(a,e)}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}},error:function(e){try{for(var n,i,o,s=(0,O.__values)(t),a=s.next();!a.done;a=s.next()){var u=a.value;null===(o=u.error)||void 0===o||o.call(u,e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}r()},complete:function(){try{for(var e,n,i,o=(0,O.__values)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null===(i=a.complete)||void 0===i||i.call(a)}}catch(t){e={error:t}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(e)throw e.error}}r()}})),function(){t.delete(i),0===t.size&&n&&(n.unsubscribe(),n=null)}})}var ne="https://app.amplitude.com",nt={US:ne,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},nn="__AMPLITUDE_MESSENGER_INSTANCE__",nr="__AMPLITUDE_MESSENGER__",ni=function(){function e(e){var t=(void 0===e?{}:e).origin;this[w]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=void 0===t?ne:t}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),n.timeout>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var n,r,i,o,s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=(0,O.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;t(l)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return(0,O.__awaiter)(this,void 0,void 0,function(){var t,n,r;return(0,O.__generator)(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=(document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===ne&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var t,n,i,o,s,a=e.data,u=null==a?void 0:a.action;if(u){if("id"in a&&a.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a
1);else{if("ping"===u){r.notify({action:"pong"});return}var l=r.actionHandlers.get(u);if(l)l(a.data);else{var c=null!==(s=r.pendingMessages.get(u))&&void 0!==s?s:[];c.push(a.data),r.pendingMessages.set(u,c)}}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=j();(null==e?void 0:e[nr])===this&&delete e[nr]},e}();w=nn;var no="__AMPLITUDE_BACKGROUND_CAPTURE__",ns="1.23.5",na="[Amplitude] Element Clicked",nu="[Amplitude] Element Tag",nl="[Amplitude] Element Text",nc="[Amplitude] Page URL",nd="data-amp-mask-attributes",nf=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},ng=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},nv=["input","select","textarea"],nh=function(e,t){var n,r=null===(n=null==window?void 0:window.getComputedStyle)||void 0===n?void 0:n.call(window,e);return(null==r?void 0:r.getPropertyValue("cursor"))==="pointer"&&"click"===t},np=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&nf(window.location.href,n))&&!!nf(window.location.href,t)},nm=function(e,t,n){return void 0===n&&(n=!1),function(r,i){var o,s,a=e.shouldTrackEventResolver,u=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(!u)return!1;if(a)return a(r,i);if(!np(e))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 c=nh(i,r);if(n&&c)return!0;if(t&&!t.some(function(e){var t;return!!(null===(t=null==i?void 0:i.matches)||void 0===t?void 0:t.call(i,e))}))return!1;switch(u){case"input":case"select":case"textarea":return"change"===r||"click"===r;default:if(c)return!0;return"click"===r}}},ny=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&&(null===(r=e.getAttribute("contenteditable"))||void 0===r?void 0:r.toLowerCase())==="true";return!nv.includes(i)&&!o},n_=function(e){return Object.keys(e).reduce(function(t,n){var r=e[n];return null==r||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&0===r.trim().length||(t[n]=r),t},{})},nb=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:nb(null==e?void 0:e.parentElement,t):null},nw=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};(l=S||(S={}))[l.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",l[l.MIDDLE=1]="MIDDLE",l[l.RIGHT=2]="RIGHT";var nS="__AMPLITUDE_VISUAL_TAGGING__",nE=j(),nk=null==nE?void 0:nE.console,nI={},nT={},nC=!1,nP=function(e,t){if(!nk||"function"!=typeof nk[e]||!nT[e]&&(nT[e]=nk[e],nk[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if(nI[e]&&!nC){nC=!0;var r=nI[e];r&&r.forEach(function(n){try{n(e,t)}catch(e){}})}}catch(e){}return nC=!1,nT[e].apply(nk,t)},0))return Error("Console override failed");nI[e]?nI[e].push(t):nI[e]=[t]},nR=function(e){var t,n;try{for(var r=(0,O.__values)(Object.values(nI)),i=r.next();!i.done;i=r.next())for(var o=i.value,s=o.length-1;s>=0;s--)if(o[s]===e){o.splice(s,1);break}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},nO=j(),nA=function(){return new(t6())(function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},nx=function(e){return void 0===e&&(e="click"),new(t6())(function(t){var n=function(e){t.next(e)};return nO.document.addEventListener(e,n,{capture:!0}),function(){nO.document.removeEventListener(e,n,{capture:!0})}})},nD=function(){var e=t9(new(t6())(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=(0,O.__assign)((0,O.__assign)({},n),{message:t.error.message,stack:t.error.stack,filename:t.filename,lineNumber:t.lineno,columnNumber:t.colno}):"string"==typeof t.error&&(n.message=t.error),e.next(n)}};return nO.addEventListener("error",t),function(){nO.removeEventListener("error",t)}}),new(t6())(function(e){var t=function(t){var n={kind:"unhandledrejection"};t.reason instanceof Error||t.reason instanceof DOMException?(n.message=t.reason.message,n.stack=t.reason.stack):"string"==typeof t.reason&&(n.message=t.reason),e.next(n)};return nO.addEventListener("unhandledrejection",t),function(){nO.removeEventListener("unhandledrejection",t)}}));return t9(e,new(t6())(function(e){var t=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=void 0;Array.isArray(n[0])&&"string"==typeof n[0][0]&&(i=n[0][0]),e.next({kind:"console",message:i})};return nP("error",t),function(){nR(t)}}))},nL=function(e,t){try{if("[Amplitude] Element Text"===t.subprop_key)return"is"===t.subprop_op&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if("[Amplitude] Element Hierarchy"===t.subprop_key)return"autotrack css match"===t.subprop_op&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(e){console.error("Error matching event to filter",e)}return!1},nN=function(e,t){try{if("DOM_ELEMENT"===e.sourceType){var n=document.documentElement;if(e.scope&&t&&(n=t.closest(e.scope)),n&&e.selector)return n.querySelector(e.selector);return n}}catch(e){}},nM=function(e,t,n){e.forEach(function(e){if("string"!=typeof e&&"ATTACH_EVENT_PROPERTY"===e.actionType){var r=n.extractDataFromDataSource(e.dataSource,t.closestTrackedAncestor);t.targetElementProperties[e.destinationKey]=r}})},nU={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},nq=function(e){var t,n,r,i,o=Object.values(nU).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,O.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{try{for(var l=(r=void 0,(0,O.__values)(u.definition)),c=l.next();!c.done;c=l.next()){var d=nU[c.value.event_type];d&&o[d].add(u.id)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==u?void 0:u.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},nF=function(e){var t,n,r,i,o=new Map;try{for(var s=(0,O.__values)(e),a=s.next();!a.done;a=s.next()){var u=a.value;try{for(var l=(r=void 0,(0,O.__values)(u.conditions)),c=l.next();!c.done;c=l.next()){var d=c.value;if("LABELED_EVENT"===d.type){var f=d.match.eventId,g=o.get(f);g||(g=[],o.set(f,g)),g.push(u)}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},nj=function(e,t){var n,r,i,o,s=new Set;try{for(var a=(0,O.__values)(e),u=a.next();!u.done;u=a.next()){var l=u.value,c=t.get(l.id);if(c)try{for(var d=(i=void 0,(0,O.__values)(c)),f=d.next();!f.done;f=d.next()){var g=f.value;s.add(g)}}catch(e){i={error:e}}
1finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return Array.from(s)},nB=function(){function e(e,t,n,r){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.dataExtractor=n,this.options=r}return e.prototype.evaluate=function(e){var t,n,r=this.options.pageActions;if(!r)return e;var i=nj(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return nU[t.event_type]===e.type&&t.filters.every(function(t){return nL(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,O.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;nM(a.actions,e,this.dataExtractor)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return e},e.prototype.update=function(e,t,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=t,this.options=n},e}(),nH=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",nd,tN]),nW=["type"],nz=["svg","path","g"],nV=["password","hidden"],nK=function(e,t){var n,r,i,o=this;this.replaceSensitiveString=function(e){return tj(e,o.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,s=performance.now(),a=[];if(!e)return[];for(var u=function(e){var t=[];if(!e)return t;
1t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e),l=new Map,c=u.length-1;c>=0;c--){var d=u[c];if(d){var f,g=(f=d.getAttribute(nd))?f.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],v=c===u.length-1?[]:null!==(r=l.get(u[c+1]))&&void 0!==r?r:new Set,h=new Set((0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(v),!1),(0,O.__read)(g),!1));l.set(d,h)}}a=u.map(function(e){var t;return function(e,t){if(null===e)return null;var n,r,i,o,s,a,u=String(e.tagName).toLowerCase(),l={tag:u},c=Array.from(null!==(o=null===(i=e.parentElement)||void 0===i?void 0:i.children)&&void 0!==o?o:[]);c.length&&(l.index=c.indexOf(e),l.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null===(a=null===(s=e.previousElementSibling)||void 0===s?void 0:s.tagName)||void 0===a?void 0:a.toLowerCase();d&&(l.prevSib=String(d));var f=e.getAttribute("id");f&&(l.id=String(f));var g=Array.from(e.classList);g.length&&(l.classes=g);var v={},h=Array.from(e.attributes).filter(function(e){return!nH.has(e.name)}),p=!ny(e);if(!nV.includes(String(e.getAttribute("type")))&&!nz.includes(u))try{for(var m=(0,O.__values)(h),y=m.next();!y.done;y=m.next()){var _=y.value;if(!p||nW.includes(_.name)){if(t.has(_.name)){v[_.name]=tM;continue}v[_.name]=String(_.value).substring(0,128)}}}catch(e){n={error:e}}finally{try{y&&!y.done&&(r=m.return)&&r.call(m)}finally{if(n)throw n.error}}return Object.keys(v).length&&(l.attrs=v),l}(e,null!==(t=l.get(e))&&void 0!==t?t:new Set)});var p=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=(0,O.__read)(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=o.replaceSensitiveString(i))})};try{for(var m=(0,O.__values)(a),y=m.next();!y.done;y=m.next()){var _=y.value;p(_)}}catch(e){t={error:e}}finally{try{y&&!y.done&&(n=m.return)&&n.call(m)}finally{if(t)throw t.error}}var b=performance.now();return null===(i=o.diagnosticsClient)||void 0===i||i.recordHistogram("autocapturePlugin.getHierarchy",b-s),a},this.getNearestLabel=function(e){var t,n=e.parentElement;if(!n)return"";try{t=n.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch(e){t=null}return t?o.getText(t):o.getNearestLabel(n)},this.getEventProperties=function(e,t,n){var r,i,s,a,u=null===(s=null===(i=null==t?void 0:t.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===s?void 0:s.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},c=o.getHierarchy(t),d=null===(a=c[0])||void 0===a?void 0:a.attrs,f=o.getNearestLabel(t),g=Object.entries(null!=d?d:{}).reduce(function(e,t){var r=(0,O.__read)(t,2),i=r[0],o=r[1];if(i.startsWith(n)){var s=i.replace(n,"");s&&(e[s]=o||"")}return e},{}),v=((r={})["[Amplitude] Element Hierarchy"]=c,r[nu]=u,r[nl]=o.getText(t),r["[Amplitude] Element Position Left"]=null==l.left?null:Math.round(l.left),r["[Amplitude] Element Position Top"]=null==l.top?null:Math.round(l.top),r["[Amplitude] Element Attributes"]=g,r["[Amplitude] Element Parent Label"]=f,r[nc]=ng(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=tB(o.replaceSensitiveString),r["[Amplitude] Viewport Height"]=window.innerHeight,r["[Amplitude] Viewport Width"]=window.innerWidth,r);if(v["[Amplitude] Element ID"]=t.getAttribute("id")||"",v["[Amplitude] Element Class"]=t.getAttribute("class"),v["[Amplitude] Element Aria Label"]=null==d?void 0:d["aria-label"],"a"===u&&"click"===e&&t instanceof HTMLAnchorElement){var h=t.href.substring(0,128);v["[Amplitude] Element Href"]=o.replaceSensitiveString(h)}return n_(v)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var s=o.addTypeAndTimestamp(e,t);if(("click"===s.type||"change"===s.type)&&null!==s.event.target){if(i&&nh(s.event.target,s.type))return s.closestTrackedAncestor=s.event.target,s.targetElementProperties=o.getEventProperties(s.type,s.closestTrackedAncestor,r),s;var a=nb(s.event.target,n);a&&(s.closestTrackedAncestor=a,s.targetElementProperties=o.getEventProperties(s.type,a,r))}return s},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=nN(e,t);if(n){if("TEXT"===e.elementExtractType)return o.getText(n);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return n.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(tN,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",s=Array.from(e.childNodes);try{for(var a=(0,O.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;if(l.nodeType===Node.TEXT_NODE){i+=l.textContent||"";continue}if(l instanceof Element){if(l.hasAttribute(tN)||l.hasAttribute("contenteditable")){i+=tM;continue}i+=o.getTextWithMaskedDescendants(l)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return i},this.getText=function(e){if(null!==e.closest("[".concat(tN,"]")))return tM;var t="";return t=e.querySelector("[".concat(tN,"], [contenteditable]"))?o.getTextWithMaskedDescendants(e):e.innerText||"",o.replaceSensitiveStr
1ing(t.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(e){if(!e)return{};var t,n,r,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);return n_(((t={})[nu]=i,t[nl]=o.getText(e),t[nc]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient;var s=null!==(i=e.maskTextRegex)&&void 0!==i?i:[],a=[];try{for(var u=(0,O.__values)(s),l=u.next();!l.done;l=u.next()){var c=l.value;if(a.length>=25)break;if(c instanceof RegExp)a.push(c);else if("pattern"in c&&"string"==typeof c.pattern)try{a.push(RegExp(c.pattern,"i"))}catch(e){}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=a};(c=E||(E={})).ClickObservable="clickObservable",c.ChangeObservable="changeObservable",c.NavigateObservable="navigateObservable",c.MutationObservable="mutationObservable",c.BrowserErrorObservable="browserErrorObservable",c.SelectionObservable="selectionObservable",c.MouseMoveObservable="mouseMoveObservable";var n$=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",ns);var n,r,i,o,s,a,u,l,c=e.dataAttributePrefix,d=void 0===c?t3:c,f=e.visualTaggingOptions,g=void 0===f?{enabled:!0}:f;e.cssSelectorAllowlist=null!==(n=e.cssSelectorAllowlist)&&void 0!==n?n:t2,e.actionClickAllowlist=null!==(r=e.actionClickAllowlist)&&void 0!==r?r:t4,e.debounceTime=null!==(i=e.debounceTime)&&void 0!==i?i:0,e.pageUrlExcludelist=null===(o=e.pageUrlExcludelist)||void 0===o?void 0:o.reduce(function(e,t){if("string"==typeof t&&e.push(t),t instanceof RegExp&&e.push(t),"object"==typeof t&&null!==t&&"pattern"in t)try{e.push(new RegExp(t.pattern))}catch(e){console.warn("Invalid regex pattern: ".concat(t.pattern),e)}return e},[]);var v="@amplitude/plugin-autocapture-browser",h=[],p=new nK(e,t),m=function(){var t,n,r=t7(nx().map(function(t){return p.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,d)})),i=t7(new(t6())(function(t){var n,r=function(n){var r=p.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,d);t.next(r)};return null===(n=j())||void 0===n||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null===(e=j())||void 0===e?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=t7(new(t6())(function(t){var n=function(n){var r=p.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,d);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=t7(nA().map(function(t){return p.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,d)}));return(t={})[E.ChangeObservable]=i,t[E.ClickObservable]=r,t[E.MutationObservable]=o,t[E.NavigateObservable]=n,t},y=nq(Object.values(null!==(a=null===(s=e.pageActions)||void 0===s?void 0:s.labeledEvents)&&void 0!==a?a:{})),_=nF(null!==(l=null===(u=e.pageActions)||void 0===u?void 0:u.triggers)&&void 0!==l?l:[]),b=new nB(y,_,p,e),w=function(t){var n,r;t&&(e.pageActions=(0,O.__assign)((0,O.__assign)({},e.pageActions),t),y=nq(Object.values(null!==(n=e.pageActions.labeledEvents)&&void 0!==n?n:{})),_=nF(null!==(r=e.pageActions.triggers)&&void 0!==r?r:[]),b.update(y,_,e))};return{name:v,type:"enrichment",setup:function(t,n){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var r,i,o,s,a,u,l,c,f,y;return(0,O.__generator)(this,function(_){var S,E,k,I,T,C,P,R,A,x,D,L,N,M,U,q,F,B,H,W,z,V,K,$,J,G;return"undefined"==typeof document||(t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){w(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),r=nm(e,e.cssSelectorAllowlist),i=nm(e,e.actionClickAllowlist),E=(S={allObservables:o=m(),amplitude:n,shouldTrackEvent:r,evaluateTriggers:b.evaluate.bind(b)}).amplitude,k=S.allObservables,I=S.shouldTrackEvent,T=S.evaluateTriggers,s=k.clickObservable.filter(nw).filter(function(e){return I("click",e.closestTrackedAncestor)}).map(function(e){return T(e)}).subscribe(function(e){null==E||E.track(na,e.targetElementProperties)}),h.push(s),P=(C={allObservables:o,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];
1return p.getEventProperties.apply(p,(0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(e),!1),[d],!1))},amplitude:n,shouldTrackEvent:r,evaluateTriggers:b.evaluate.bind(b)}).amplitude,R=C.allObservables,A=C.getEventProperties,x=C.shouldTrackEvent,D=C.evaluateTriggers,a=R.changeObservable.filter(nw).filter(function(e){return x("change",e.closestTrackedAncestor)}).map(function(e){return D(e)}).subscribe(function(e){null==P||P.track("[Amplitude] Element Changed",A("change",e.closestTrackedAncestor))}),h.push(a),N=(L={allObservables:o,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return p.getEventProperties.apply(p,(0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(e),!1),[d],!1))},amplitude:n,shouldTrackEvent:r,shouldTrackActionClick:i}).amplitude,M=L.allObservables,U=L.options,q=L.getEventProperties,F=L.shouldTrackEvent,B=L.shouldTrackActionClick,H=M.clickObservable,W=M.mutationObservable,z=M.navigateObservable,V=H.filter(function(e){return!F("click",e.closestTrackedAncestor)}).map(function(e){var t=nb(e.event.target,U.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=q(e.type,e.closestTrackedAncestor)),e}).filter(nw).filter(function(e){return B("click",e.closestTrackedAncestor)}),K=z?t9(W,z):W,$=t9(V,K),J=null,G=null,(u=t8($,function(e){if(J&&(clearTimeout(J),J=null),"click"===e.type)G=e,J=setTimeout(function(){J=null,G=null},500);else if(G){var t=G;return G=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==N||N.track(na,q("click",e.closestTrackedAncestor)))}))&&h.push(u),null===(y=null==t?void 0:t.loggerProvider)||void 0===y||y.log("".concat(v," has been successfully added.")),window.opener&&g.enabled&&(l=e.cssSelectorAllowlist,c=e.actionClickAllowlist,function(e,t){if(!0!==e[nS]){e[nS]=!0;var n=t.dataExtractor,r=t.isElementSelectable,i=t.cssSelectorAllowlist,o=t.actionClickAllowlist,s=null,a=function(t){e.notify({action:"element-selected",data:t})},u=function(t,n){"selector-mode-changed"===t?e.notify({action:"track-selector-mode-changed",data:n}):"selector-moved"===t&&e.notify({action:"track-selector-moved",data:n})};e.registerActionHandler("initialize-visual-tagging-selector",function(t){e.loadScriptOnce("https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz").then(function(){var l;s=null===(l=null==window?void 0:window.amplitudeVisualTaggingSelector)||void 0===l?void 0:l.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(e){return!r||r((null==t?void 0:t.actionType)||"click",e)},onTrack:u,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:i,actionClickAllowlist:o,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:ns}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var e;null===(e=null==s?void 0:s.close)||void 0===e||e.call(s)})}}(f=function(e){var t=j(),n=null==t?void 0:t[nr];if("object"==typeof n&&null!==n&&nn in n&&!0===n[nn])return n;var r=new ni(void 0);return t&&(t[nr]=r),r}(),{dataExtractor:p,isElementSelectable:nm(e,(0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(l),!1),(0,O.__read)(c),!1)),cssSelectorAllowlist:l,actionClickAllowlist:c}),function(e,t){if(!0!==e[no]){e[no]=!0;var n=null,r=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){null===(i=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===i||i.call(t,"Initializing background capture (external script)");var t,i,o=new URL("https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.2.js.gz",e.endpoint).toString();e.loadScriptOnce(o).then(function(){var t,i,o;null===(i=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===i||i.call(t,"Backgroun
1d capture script loaded (external)"),n=null===(o=null==window?void 0:window.amplitudeBackgroundCapture)||void 0===o?void 0:o.call(window,{messenger:e,onBackgroundCapture:r}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==n?void 0:n.close)||void 0===e||e.call(n),n=null})}}(f),f.setup((0,O.__assign)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:nt[t.serverZone]})))),[2]})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,O.__generator)(this,function(i){try{for(t=(e=(0,O.__values)(h)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(r=e.return)&&r.call(e)}finally{if(n)throw n.error}}return[2]})})}}},nJ=(0,O.__spreadArray)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,O.__read)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),nG=["*"],nY=["mutation","navigate"];function nQ(e,t){var n,r,i,o,s=t.event,a=s.pageX,u=s.pageY;e.yMin=Math.min(null!==(n=e.yMin)&&void 0!==n?n:u,u),e.yMax=Math.max(null!==(r=e.yMax)&&void 0!==r?r:u,u),e.xMin=Math.min(null!==(i=e.xMin)&&void 0!==i?i:a,a),e.xMax=Math.max(null!==(o=e.xMax)&&void 0!==o?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function nZ(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:(0,O.__assign)({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}(d=k||(k={})).INCREASING="increasing",d.DECREASING="decreasing",(f=I||(I={})).X="x",f.Y="y";var nX=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new(t6())(function(e){var n=null,r=null,i=null;return t.subscribe(function(t){var o={x:t.clientX,y:t.clientY};if(null===n){n=o;return}o.x>n.x?(r===k.DECREASING&&e.next(I.X),r=k.INCREASING):o.x<n.x&&(r===k.INCREASING&&e.next(I.X),r=k.DECREASING),o.y>n.y?(i===k.DECREASING&&e.next(I.Y),i=k.INCREASING):o.y<n.y&&(i===k.INCREASING&&e.next(I.Y),i=k.DECREASING),n=o})})};function n0(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function n1(e){e.changes=[],e.startTime=void 0}function n2(e){for(var t=e.changes,n=e.thresholdMs,r=0,i=t[t.length-1];r<t.length&&!(i-t[r]<n);r++);0!==r&&(e.startTime=t[r],e.changes.splice(0,r))}var n3=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?10:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new(t6())(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},s=void 0,a=null;function u(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),n1(n),n1(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===I.X?n:i,r=+Date.now(),t.startTime=t.startTime||r,l=t.changes,c=t.changesThreshold,l.push(r),l.length>c&&l.shift();var t,r,l,c,d=function(e,t){var n=void 0;if(n0(e)&&(n=e.startTime),n0(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return d?(s=s||d,a=setTimeout(function(){u(),a=null},o)):u(),n2(n),n2(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},n4=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=e.thresholdMs;return n3({mouseDirectionChangeObservable:nX({allWindowObservables:r}),directionChanges:void 0===i?10:i,thresholdMs:void 0===o?2e3:o}).subscribe(function(e){np(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function n5(e,t,n,r){if(!r)return[];var i=e[t];return"object"==typeof i&&null!==i&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:n}var n6=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-frustration-browser",r=[],i=!1!==e.errorClicks;e.errorClicks||(i=!1);var o=!1!==e.deadClicks&&null!==e.deadClicks,s=!1!==e.rageClicks&&null!==e.rageClicks,a=!1!==e.thrashedCursor&&null!==e.thrashedCursor;e.thrashedCursor||(a=!1);var u=n5(e,"rageClicks",nG,s),l=n5(e,"deadClicks",nJ,o),c=n5(e,"errorClicks",nJ,i),d=null!==(t=e.dataAttributePrefix)&&void 0!==t?t:t3,f=new nK(e),g=(0,O.__spreadArray)([],(0,O.__read)(new Set((0,O.__spreadArray)((0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(u),!1),(0,O.__read)(l),!1),(0,O.__read)(c),!1))),!1),v=function(){var e,t,n=t7(nx("pointerdown").map(function(e){return f.addAdditionalEventProperties(e,"click",g,d,!0)})),r=t7(nD().map(function(e){return f.addTypeAndTimestamp(e,"error")})),i=t7(nA().map(function(e){return f.addAdditionalEventProperties(e,"mutation",g,d)}));window.navigation&&(t=t7(new(t6())(function(e){var t=function(t){e.next((0,O.__assign)((0,O.__assign)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return f.addAdditionalEventProperties(e,"navigate",g,d)})));var o=t7(new(t6())(function(e){var t=function(){var t=document.activeElement;if(t&&("TEXTAREA"===t.tagName||"INPUT"===t.tagName)){var n=void 0,r=void 0;try{if(n=t.selectionStart,r=t.selectionEnd,n===r)return}catch(e){return}return e.next()}var i=window.getSelection();if(i&&!i.isCollapsed)return e.next()};return window.document.addEventListener("selectionchange",t),function(){window.document.removeEventListener("selectionchange",t)}})),s=t7(new(t6())(function(e){var t=function(t){e.next(t)},n={capture:!0};return nO.document.addEventListener("mousemove",t,n),function(){nO.document.removeEventListener("mousemove",t,n)}}));return(e={})[E.ClickObservable]=n,e[E.MutationObservable]=i,e[E.NavigateObservable]=t,e[E.BrowserErrorObservable]=r,e[E.SelectionObservable]=o,e[E.MouseMoveObservable]=s,e};return{name:n,type:"enrichment",setup:function(t,g){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var h,p,m,y,_,b,w,E;return(0,O.__generator)(this,function(k){var I,T,C,P,R,A,x,D,L,N,M,U,q,F,j,B,H,W,z,V,K,$;return"undefined"==typeof document||(h=v(),s&&(p=function(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.clickObservable,s=r.selectionObservable,a=[],u={},l=null;function c(e){a=[],u={},e&&(nQ(u,e),a.push(e))}var d=t8(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,O.__awaiter)(t,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){var r,i,o,s;return(nQ(u,e),t=null,0===a.length||(r=a).length>0&&r[r.length-1].closestTrackedAncestor!==e.closestTrackedAncestor||(o=Math.max(0,(i=a).length-4+1),s=i[o],e.timestamp-s.timestamp>=1e3)||u.isOutOfBounds)?(l&&(t=nZ(a)),c(e)):a.push(e),(l&&(clearTimeout(l.timerId),l.resolve(t),l=null),a.length>=4)?[2,new Promise(function(e){l={resolve:e,timerId:setTimeout(function(){e(nZ(a))},1e3)}})]:[2,null]})})}),f=null==s?void 0:s.subscribe(function(){c()}),g=d.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){g.unsubscribe(),null==f||f.unsubscribe()}}}({allObservables:h,amplitude:g,shouldTrackRageClick:nm(e,u)}),r.push(p)),o&&(T=(I={amplitude:g,allObservables:h,getEventProperties:function(e,t){return f.getEventProperties(e,t,d)},shouldTrackDeadClick:nm(e,l)}).amplitude,C=I.allObservables,P=I.getEventProperties,R=I.shouldTrackDeadClick,A=C.clickObservable,x=C.mutationObservable,D=C.navigateObservable,L=A.filter(function(e){return nw(e)&&R("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===S.LEFT_OR_TOUCH_CONTACT}),N=D?t9(x,D):x,M=t9(L,N),U=null,m=t8(M,function(e){if(U&&nY.includes(e.type))clearTimeout(U),U=null;else if("click"===e.type)return U?Promise.resolve(null):new Promise(function(t){U=setTimeout(function(){t(e),U=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};T.track("[Amplitude] Dead Click",(0,O.__assign)((0,O.__assign)({},P("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),r.push(m)),i&&(F=(q={amplitude:g,allObservables:h,shouldTrackErrorClick:nm(e,c)}).amplitude,j=q.allObservables,B=q.shouldTrackErrorClick,H=j.clickObservable,W
1=j.browserErrorObservable,z=H.filter(function(e){return nw(e)&&B("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===S.LEFT_OR_TOUCH_CONTACT}),V=null,K=null,$=function(){null!==V&&(clearTimeout(V),V=null),K=null},y=t9(z,W).subscribe(function(e){var t;if("click"===e.type){$(),K=e,V=setTimeout($,2e3);return}"error"===e.type&&K&&(F.track("[Amplitude] Error Click",(0,O.__assign)(((t={})["[Amplitude] Kind"]=e.event.kind,t["[Amplitude] Message"]=e.event.message,t["[Amplitude] Stack"]=e.event.stack,t["[Amplitude] Filename"]=e.event.filename,t["[Amplitude] Line Number"]=e.event.lineNumber,t["[Amplitude] Column Number"]=e.event.columnNumber,t),K.targetElementProperties)),$())}),r.push(y)),a&&(_=void 0,b=void 0,"object"==typeof e.thrashedCursor&&(_=e.thrashedCursor.directionChanges,b=e.thrashedCursor.threshold,_&&_<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(_," is below the minimum of ").concat(5,", setting to ").concat(5)),_=5),b&&b>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(b," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),b=4e3)),w=n4({amplitude:g,options:e,allObservables:h,directionChanges:_,thresholdMs:b}),r.push(w)),null===(E=null==t?void 0:t.loggerProvider)||void 0===E||E.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,i;return(0,O.__generator)(this,function(o){try{for(t=(e=(0,O.__values)(r)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){n={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(n)throw n.error}}return[2]})})}}};function n8(e,t,n){e&&function e(t){var n,r,i=t.json,o=t.targetObject,s=t.allowlist,a=t.excludelist,u=t.ancestors,l=t.parentObject,c=t.targetKey;o||(o=i);var d=Object.keys(o);try{for(var f=(0,O.__values)(d),g=f.next();!g.done;g=f.next()){var v,h=g.value,p=(0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(u),!1),[h],!1);(v=o[h],"string"==typeof v||"number"==typeof v||"boolean"==typeof v||null==v)?(!n7(p,s)||n7(p,a))&&delete o[h]:e({json:i,targetObject:o[h],allowlist:s,excludelist:a,ancestors:p,parentObject:o,targetKey:h})}}catch(e){n={error:e}}finally{try{g&&!g.done&&(r=f.return)&&r.call(f)}finally{if(n)throw n.error}}0===Object.keys(o).length&&l&&c&&delete l[c]}({json:e,allowlist:t.map(n9),excludelist:n.map(n9),ancestors:[]})}function n9(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function n7(e,t){return t.some(function(t){return function e(t,n,r,i){if(void 0===r&&(r=0),void 0===i&&(i=0),i===n.length)return r===t.length;if(r===t.length){for(;i<n.length&&"**"===n[i];)i++;return i===n.length}var o=n[i];if("**"===o){if(i+1===n.length)return!0;for(var s=r;s<=t.length;s++)if(e(t,n,s,i+1))return!0;return!1}return("*"===o||o===t[r])&&e(t,n,r+1,i+1)}(e,t)})}var re=function(){function e(e){this.request=e}return e.prototype.headers=function(e){void 0===e&&(e=[]);var t,n,r=this.request.headers,i={};if(Array.isArray(r))r.forEach(function(e){var t=(0,O.__read)(e,2),n=t[0],r=t[1];i[n]=r});else if(r instanceof Headers)r.forEach(function(e,t){i[t]=e});else if("object"==typeof r&&null!==r)try{for(var o=(0,O.__values)(Object.entries(r)),s=o.next();!s.done;s=o.next()){var a=(0,O.__read)(s.value,2),u=a[0],l=a[1];i[u]=l}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return ra(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=j();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=rn(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null}
1,enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(n){return 0===e.length?[2,null]:[2,ro(this.body,e,t)]})})},e}(),rt=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),ra(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return rn(this.bodyRaw,100)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.bodyRaw?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(n){return 0===e.length?[2,null]:[2,ro(this.body,e,t)]})})},e}();function rn(e,t){var n,r,i,o,s=j(),a=null==s?void 0:s.TextEncoder;if(a){if("string"==typeof e)o=e,i=new a().encode(o).length;else if(e instanceof Blob)i=(o=e).size;else if(e instanceof URLSearchParams)o=e,i=new a().encode(o.toString()).length;else if(ArrayBuffer.isView(e))i=(o=e).byteLength;else if(e instanceof ArrayBuffer)i=(o=e).byteLength;else if(e instanceof FormData){var u=0,l=0;try{for(var c=(0,O.__values)(e.entries()),d=c.next();!d.done;d=c.next()){var f=(0,O.__read)(d.value,2),g=f[0],v=f[1];if(u+=g.length,"string"==typeof v)u+=new a().encode(v).length;else{if(!(v instanceof Blob))return;u+=v.size}if(++l>=t)return}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}i=u}else if(e instanceof ReadableStream){o=e;return}return i}}var rr=function(){function e(e){this.response=e}return e.prototype.headers=function(e){var t;if(void 0===e&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,r={};return null===(t=null==n?void 0:n.forEach)||void 0===t||t.call(n,function(e,t){r[t]=e}),ra(r,{allow:e})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(void 0!==this._bodySize)return this._bodySize;var e,t,n=null===(t=null===(e=this.response.headers)||void 0===e?void 0:e.get)||void 0===t?void 0:t.call(e,"content-length"),r=n?parseInt(n,10):void 0;return this._bodySize=r,r},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(e){switch(e.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,Promise.race([this.clonedResponse.text(),new Promise(function(e){return setTimeout(function(){return e(null)},500)})])];case 2:return[2,e.sent()];case 3:return e.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,O.__awaiter)(this,void 0,void 0,function(){return(0,O.__generator)(this,function(n){switch(n.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,ro(n.sent(),e,t)]}})})},e}(),ri=function(){function e(e,t,n,r){this.statusCode=e,this.headersString=t,this.size=n,this.getJson=r}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(e){if(void 0===e&&(e=[]),!this.headersString)return{};var t,n,r={},i=this.headersString.split("\r\n");try{for(var o=(0,O.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,O.__read)(a.split(": "),2),l=u[0],c=u[1];l&&c&&(r[l]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return ra(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,O.__awaiter)(this,void 0,void 0,function(){var n;return(0,O.__generator)(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?(n8(n,e,t),[2,n]):[2,null]})})},e}();function ro(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return n8(r,t,n),r}catch(e){return null}}(g=T||(T={})).REDACT="redact",g.REMOVE="remove";var rs="[REDACTED]",ra=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?T.REMOVE:s,u=(0,O.__spreadArray)([],(0,O.__read)(eo.EK),!1),l={};try{for(var c=(0,O.__values)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var f=d.value;!function(t){var n=t.toLowerCase();u.find(function(e){return e.toLowerCase()===n})?a===T.REDACT&&(l[t]=rs):o.find(function(e){return e.toLowerCase()===n})?l[t]=e[t]:a===T.REDACT&&(l[t]=rs)}(f)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return l},ru=function(){function e(e,t,n,r,i,o,s,a,u,l,c){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=a,this.responseWrapper=u,this.error=l,this.endTime=c}return e.prototype.toSerializable=function(){var e,t,n,r;
1return Object.fromEntries(Object.entries({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((0,O.__spreadArray)([],(0,O.__read)(eo.Wb),!1)),requestBodySize:null===(t=this.requestWrapper)||void 0===t?void 0:t.bodySize,responseHeaders:null===(n=this.responseWrapper)||void 0===n?void 0:n.headers((0,O.__spreadArray)([],(0,O.__read)(eo.Wb),!1)),responseBodySize:null===(r=this.responseWrapper)||void 0===r?void 0:r.bodySize}).filter(function(e){var t=(0,O.__read)(e,2);return void 0!==(t[0],t[1])}))},e}(),rl=function(e,t){void 0===t&&(t=H()),this.callback=e,this.id=t};function rc(e){try{e()}catch(e){}}var rd=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=j();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=j();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,a,u,l,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var f=null===(i=null===(r=null===(n=this.globalScope)||void 0===n?void 0:n.XMLHttpRequest)||void 0===r?void 0:r.prototype)||void 0===i?void 0:i.open,g=null===(a=null===(s=null===(o=this.globalScope)||void 0===o?void 0:o.XMLHttpRequest)||void 0===s?void 0:s.prototype)||void 0===a?void 0:a.send,v=null===(c=null===(l=null===(u=this.globalScope)||void 0===u?void 0:u.XMLHttpRequest)||void 0===l?void 0:l.prototype)||void 0===c?void 0:c.setRequestHeader;f&&g&&v&&this.observeXhr(f,g,v);var h=null===(d=this.globalScope)||void 0===d?void 0:d.fetch;h&&this.observeFetch(h),this.isObserving=!0}},e.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},e.prototype.triggerEventCallbacks=function(e){var t=this;this.eventCallbacks.forEach(function(n){try{n.callback(e)}catch(e){rc(function(){var n;null===(n=t.logger)||void 0===n||n.debug("an unexpected error occurred while triggering event callbacks",e)})}})},e.prototype.handleNetworkRequestEvent=function(e,t,n,r,i,o,s){if(void 0!==o&&void 0!==s){var a,u,l,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(u=t.url,d=t.method):u=null===(a=null==t?void 0:t.toString)||void 0===a?void 0:a.call(t),u)try{var f=new URL(u);u="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(l=r.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},l=0);var g=Math.floor(performance.now()-s),v=Math.floor(o+g),h=new ru(e,d,o,o,u,n,l,g,r,c,v);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.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(0,O.__awaiter)(t,void 0,void 0,function(){var t,i,o,s=this;return(0,O.__generator)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){rc(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while retrieving timestamps",e)})}a.label=1;case 1:return a.trys.push([1,3,,4]),[4,e(n,r)];case 2:return i=a.sent(),[3,4];case 3:return o=a.sent(),[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,r?new re(r):void 0,i?new rr(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){rc(function(){var t;return null===(t=s.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling fetch",e)})}if(i)return[2,i];throw o}})})})},e.createXhrJsonParser=function(e,t){return function(){var n;try{if("json"===e.responseType){if(null===(n=t.globalScope)||void 0===n?void 0:n.structuredClone)return t.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(n){n instanceof Error&&"InvalidStateError"===n.name&&rc(function(){var n;return null===(n=t.logger)||void 0===n?void 0:n.debug("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))})}return null}},e.prototype.observeXhr=function(t,n,r){if(this.globalScope&&t&&n){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var e,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=(0,O.__read)(n,2),s=i[0],a=i[1];try{this.$$AmplitudeAnalyticsEvent=(0,O.__assign)({method:s,url:null===(e=null==a?void 0:a.toString)||void 0===e?void 0:e.call(a),headers:{}},o.getTimestamps())}catch(e){rc(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr open",e)})}return t.apply(this,n)},i.send=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];var i=this,s=e.createXhrJsonParser(this,o),a=t[0],u=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new ri(i.status,e,t?parseInt(t,10):void 0,s),r=i.$$AmplitudeAnalyticsEvent.headers,l=new rt(a,r);u.status=i.status,o.handleNetworkRequestEvent("xhr",{url:u.url,method:u.method},l,n,void 0,u.startTime,u.durationStart)}catch(e){rc(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while handling xhr send",e)})}}),n.apply(i,t)},i.setRequestHeader=function(e,t){try{var n=this.$$AmplitudeAnalyticsEvent;n&&(n.headers[e]=t)}catch(e){rc(function(){var t;return null===(t=o.logger)||void 0===t?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}()),rf="[Amplitude] Network Request",rg="500-599";function rv(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function rh(e,t){var n,r,i=t.split(",");try{for(var o=(0,O.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value,u=(0,O.__read)(a.split("-").map(Number),2),l=u[0],c=u[1];if(e===l&&void 0===c||e>=l&&e<=c)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 rp(e){var t;if(e)try{var n=null===(t=j())||void 0===t?void 0:t.location.href,r=new URL(e,n),i=r.searchParams.toString(),o=r.hash.replace("#",""),s=r.href,a=r.host;r.hash="",r.search="";var u=r.href;return{query:i,fragment:o,href:s,hrefWithoutQueryOrHash:u,host:a}}catch(e){return}}function rm(e){return"object"!=typeof e||null===e?e?(0,O.__spreadArray)([],(0,O.__read)(eo.Wb),!1):void 0:0!==e.length?e:void 0}function ry(e){var t,n;return!(null===(t=null==e?void 0:e.allowlist)||void 0===t?void 0:t.length)&&!(null===(n=null==e?void 0:e.blocklist)||void 0===n?void 0:n.length)}(C||(C={})).NetworkObservable="networkObservable";var r_=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new(t6())(function(e){var n=new rl(function(t){var n={event:t,timestamp:Date.now(),type:"network"};e.next(n)});return rd.subscribe(n,t),function(){rd.unsubscribe(n)}});return(e={})[C.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var s;return(0,O.__generator)(this,function(a){var u,l,c,d,f;return"undefined"==typeof document||(s=r(),t=null==i?void 0:i.loggerProvider,l=(u={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,c=u.networkTrackingOptions,d=u.amplitude,f=u.loggerProvider,P=l.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var n,r,i=rp(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(rv(o,"*.amplitude.com")||rv(o,"amplitude.com"))||(null===(n=t.ignoreHosts)||void 0===n?void 0:n.find(function(e){return rv(o,e)}))||!t.captureRules&&void 0!==e.status&&!rh(e.status,rg)||t.captureRules&&((0,O.__spreadArray)([],(0,O.__read)(t.captureRules),!1).reverse().find(function(t){var n,i,s;if(n=e.status,i=e.url,s=e.method,r=t.hosts&&!t.hosts.find(function(e){return rv(o,e)})||i&&t.urls&&!nf(i,t.urls)||s&&t.methods&&!t.methods.find(function(e){return s.toLowerCase()===e.toLowerCase()||"*"===e})?void 0:!n&&0!==n||!!rh(n,t.statusCodeRange||rg)){var a=rm(t.responseHeaders);if(e.responseWrapper&&a){var u=e.responseWrapper.headers(a);u&&(e.responseHeaders=u)}var l=rm(t.requestHeaders);if(e.requestWrapper&&l){var c=e.requestWrapper.headers(l);c&&(e.requestHeaders=c)}e.responseWrapper&&t.responseBody&&!ry(t.responseBody)&&(e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,t.responseBody.blocklist)),e.requestWrapper&&t.requestBody&&!ry(t.requestBody)&&(e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,t.requestBody.blocklist))}return void 0!==r}),!r)||e.requestWrapper&&function(e,t){if(e.includes("amplitude.com"))try{var n=t.body;if("string"!=typeof n)return!1;if(JSON.parse(n).events.find(function(e){return e.event_type===rf}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,c)}).subscribe(function(e){var t,n,r,i=e.event,o=rp(i.url);if(o){var s=null===(n=i.responseWrapper)||void 0===n?void 0:n.bodySize,a=null===(r=i.requestWrapper)||void 0===r?void 0:r.bodySize;(function(e,t,n,r){(0,O.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,O.__generator)(this,function(a){switch(a.label){case 0:if(!(t.requestBodyJson||t.responseBodyJson))return[3,2];return[4,Promise.all([t.requestBodyJson,t.responseBodyJson])];case 1:if(o=(i=O.__read.apply(void 0,[a.sent(),2]))[0],s=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(e){null==r||r.debug("Failed to stringify request body",e)}if(s)try{e["[Amplitude] Response Body"]=JSON.stringify(s)}catch(e){null==r||r.debug("Failed to stringify response body")}a.label=2;case 2:return null==n||n.track(rf,e),[2]}})})})(((t={})["[Amplitude] URL"]=o.hrefWithoutQueryOrHash,t["[Amplitude] URL Query"]=o.query,t["[Amplitude] URL Fragment"]=o.fragment,t["[Amplitude] Request Method"]=i.method,t["[Amplitude] Status Code"]=i.status,t["[Amplitude] Start Time"]=i.startTime,t["[Amplitude] Completion Time"]=i.endTime,t["[Amplitude] Duration"]=i.duration,t["[Amplitude] Request Body Size"]=a,t["[Amplitude] Response Body Size"]=s,t["[Amplitude] Request Type"]=i.type,t["[Amplitude] Request Headers"]=i.requestHeaders,t["[Amplitude] Response Headers"]=i.responseHeaders,t),i,d,f)}}),null==t||t.log("".concat(n," has been successfully added."))),[2]})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(e){return P.unsubscribe(),[2]})})}}};let rb=-1,rw=e=>{addEventListener("pageshow",t=>{t.persisted&&(rb=t.timeStamp,e(t))},!0)},rS=(e,t,n,r)=>{let i,o;return s=>{let a;t.value>=0&&(s||r)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=(a=t.value)>n[1]?"poor":a>n[0]?"needs-improvement":"good",e(t))}},rE=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},rk=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},rI=()=>{let e=rk();return e?.activationStart??0},rT=(e,t=-1)=>{let n=rk(),r="navigate";return rb>=0?r="back-forward-cache":n&&(document.prerendering||rI()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:r}},rC=new WeakMap;function rP(e,t){return rC.get(e)||rC.set(e,new t),rC.get(e)}class rR{t;i=0;o=[];h(e){if(e.hadRecentInput)return;let t=this.o[0],n=this.o.at(-1);this.i&&t&&n&&e.startTime-n.startTime<1e3&&e.startTime-t.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),this.t?.(e)}}let rO=(e,t,n={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(e)){let r=new PerformanceObserver(e=>{Promise.resolve().then(()=>{t(e.getEntries())})});return r.observe({type:e,buffered:!0,...n}),r}}catch{}},rA=e=>{let t=!1;return()=>{t||(e(),t=!0)}},rx=-1,rD=new Set,rL=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,rN=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of rD)e();isFinite(rx)||(rx="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",rN,!0))}},rM=()=>
1{if(rx<0){let e=rI();rx=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").filter(t=>"hidden"===t.name&&t.startTime>e)[0]?.startTime)??rL(),addEventListener("visibilitychange",rN,!0),addEventListener("prerenderingchange",rN,!0),rw(()=>{setTimeout(()=>{rx=rL()})})}return{get firstHiddenTime(){return rx},onHidden(e){rD.add(e)}}},rU=e=>{document.prerendering?addEventListener("prerenderingchange",()=>e(),!0):e()},rq=[1800,3e3],rF=(e,t={})=>{rU(()=>{let n=rM(),r,i=rT("FCP"),o=rO("paint",e=>{for(let t of e)"first-contentful-paint"===t.name&&(o.disconnect(),t.startTime<n.firstHiddenTime&&(i.value=Math.max(t.startTime-rI(),0),i.entries.push(t),r(!0)))});o&&(r=rS(e,i,rq,t.reportAllChanges),rw(n=>{r=rS(e,i=rT("FCP"),rq,t.reportAllChanges),rE(()=>{i.value=performance.now()-n.timeStamp,r(!0)})}))})},rj=[.1,.25],rB=(e,t={})=>{let n=rM();rF(rA(()=>{let r,i=rT("CLS",0),o=rP(t,rR),s=e=>{for(let t of e)o.h(t);o.i>i.value&&(i.value=o.i,i.entries=o.o,r())},a=rO("layout-shift",s);a&&(r=rS(e,i,rj,t.reportAllChanges),n.onHidden(()=>{s(a.takeRecords()),r(!0)}),rw(()=>{o.i=0,r=rS(e,i=rT("CLS",0),rj,t.reportAllChanges),rE(()=>r())}),setTimeout(r))}))},rH=0,rW=1/0,rz=0,rV=e=>{for(let t of e)t.interactionId&&(rW=Math.min(rW,t.interactionId),rH=(rz=Math.max(rz,t.interactionId))?(rz-rW)/7+1:0)},rK=()=>r?rH:performance.interactionCount??0,r$=()=>{"interactionCount"in performance||r||(r=rO("event",rV,{type:"event",buffered:!0,durationThreshold:0}))},rJ=0;class rG{u=[];l=new Map;m;p;v(){rJ=rK(),this.u.length=0,this.l.clear()}L(){let e=Math.min(this.u.length-1,Math.floor((rK()-rJ)/50));return this.u[e]}h(e){if(this.m?.(e),!e.interactionId&&"first-input"!==e.entryType)return;let t=this.u.at(-1),n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>t.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort((e,t)=>t.P-e.P),this.u.length>10)for(let e of this.u.splice(10))this.l.delete(e.id);this.p?.(n)}}}let rY=e=>{let t=globalThis.requestIdleCallback||setTimeout;"hidden"===document.visibilityState?e():(addEventListener("visibilitychange",e=rA(e),{once:!0,capture:!0}),t(()=>{e(),removeEventListener("visibilitychange",e,{capture:!0})}))},rQ=[200,500],rZ=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=rM();rU(()=>{r$();let r,i=rT("INP"),o=rP(t,rG),s=e=>{rY(()=>{for(let t of e)o.h(t);let t=o.L();t&&t.P!==i.value&&(i.value=t.P,i.entries=t.entries,r())})},a=rO("event",s,{durationThreshold:t.durationThreshold??40});r=rS(e,i,rQ,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),n.onHidden(()=>{s(a.takeRecords()),r(!0)}),rw(()=>{o.v(),r=rS(e,i=rT("INP"),rQ,t.reportAllChanges)}))})};class rX{m;h(e){this.m?.(e)}}let r0=[2500,4e3],r1=(e,t={})=>{rU(()=>{let n=rM(),r,i=rT("LCP"),o=rP(t,rX),s=e=>{for(let s of(t.reportAllChanges||(e=e.slice(-1)),e))o.h(s),s.startTime<n.firstHiddenTime&&(i.value=Math.max(s.startTime-rI(),0),i.entries=[s],r())},a=rO("largest-contentful-paint",s);if(a){r=rS(e,i,r0,t.reportAllChanges);let n=rA(()=>{s(a.takeRecords()),a.disconnect(),r(!0)}),o=e=>{e.isTrusted&&(rY(n),removeEventListener(e.type,o,{capture:!0}))};for(let e of["keydown","click","visibilitychange"])addEventListener(e,o,{capture:!0});rw(n=>{r=rS(e,i=rT("LCP"),r0,t.reportAllChanges),rE(()=>{i.value=performance.now()-n.timeStamp,r(!0)})})}})},r2=[800,1800],r3=e=>{document.prerendering?rU(()=>r3(e)):"complete"!==document.readyState?addEventListener("load",()=>r3(e),!0):setTimeout(e)},r4=(e,t={})=>{let n=rT("TTFB"),r=rS(e,n,r2,t.reportAllChanges);r3(()=>{let i=rk();i&&(n.value=Math.max(i.responseStart-rI(),0),n.entries=[i],r(!0),rw(()=>{(r=rS(e,n=rT("TTFB",0),r2,t.reportAllChanges))(!0)}))})};function r5(e){var t,n;return{value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor((n=(null===(t=e.entries[0])||void 0===t?void 0:t.startTime)||0,performance.timeOrigin+n)),navigationStart:Math.floor(performance.timeOrigin)}}var r6=function(){var e=null,t=j(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:"web-vitals-browser",type:"enrichment",setup:function(t,i){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var o,s;return(0,O.__generator)(this,function(a){return void 0===n||(o=ng((null==r?void 0:r.href)||"",t.loggerProvider),s={"[Amplitude] Page Domain":(null==r?void 0:r.hostname)||"","[Amplitude] Page Location":o,"[Amplitude] Page Path":ng((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":ng(o.split("?")[0],t.loggerProvider)},r1(function(e){s["[Amplitude] LCP"]=r5(e)}),rF(function(e){s["[Amplitude] FCP"]=r5(e)}),rZ(function(e){s["[Amplitude] INP"]=r5(e)}),rB(function(e){s["[Amplitude] CLS"]=r5(e)}),r4(function(e){s["[Amplitude] TTFB"]=r5(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track("[Amplitude] Web Vitals",s),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return[2,e]})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},r8=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),[eo.xp,t,e.substring(0,n)].filter(
1Boolean).join("_")},r9=function(){function e(e,t){var n;this.shouldTrackNewCampaign=!1,this.options=(0,O.__assign)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:tT((null===(n=t.cookieOptions)||void 0===n?void 0:n.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=r8(t.apiKey,"MKTG"),this.webExpStorageKey=r8(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=eo.Lo,this.sessionTimeout=t.sessionTimeout,this.lastEventTime=t.lastEventTime,this.logger=t.loggerProvider,this.topLevelDomain=t.topLevelDomain,t.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=O.__read.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||eT(this.sessionTimeout,this.lastEventTime),!tE(this.currentCampaign,this.previousCampaign,this.options,this.logger,e,this.topLevelDomain))return[3,3];return this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return(0,O.__awaiter)(this,void 0,void 0,function(){var e;return(0,O.__generator)(this,function(t){switch(t.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:if(!(e=t.sent()))return[3,3];return[4,this.storage.remove(this.webExpStorageKey)];case 2:t.sent(),t.label=3;case 3:return[4,Promise.all([e||new tH().parse(),this.storage.get(this.storageKey)])];case 4:return[2,t.sent()]}})})},e.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var t,n,r=(t=this.currentCampaign,n=this.options,ew(Object.entries((0,O.__assign)((0,O.__assign)({},eo.Lo),t)).reduce(function(e,t){var r,i=(0,O.__read)(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 eb.h2)));return e&&(r.event_id=e),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),r7="AMP_CURRENT_PAGE",ie="AMP_PREVIOUS_PAGE",it="AMP_URL_INFO";(v=R||(R={})).Direct="direct",v.Internal="internal",v.External="external";var ir=new Set([_.IDENTIFY,_.GROUP_IDENTIFY,_.REVENUE]),ii=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=j(),i=void 0,o=!1,s=void 0,a=!1,u=!1,l=function(e){var t;try{var n=ng(e,s);t=new URL(n).hostname}catch(e){null==s||s.error("Could not parse URL: ",e)}return t},c=function(e){var t="undefined"!=typeof location&&location.hostname||"",r=e?l(e):void 0;if(!r)return R.Direct;var i=n.some(function(e){return -1!==t.indexOf(e)}),o=n.some(function(e){return -1!==r.indexOf(e)});return t===r||o&&i?R.Internal:R.External},d=function(){(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,s;return(0,O.__generator)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(it)];case 1:return e=a.sent(),t=ng("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[r7])||"",r=void 0,r=t===n?(null==e?void 0:e[ie])||"":n||document.referrer||"",[4,i.set(it,((s={})[r7]=t,s[ie]=r,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(t){switch(t.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!r)return[3,2];return[4,(i=new e5(r.sessionStorage)).isEnabled()];case 1:o=t.sent(),r.addEventListener("popstate",d),a||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=(0,O.__read)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),u&&d()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=(0,O.__read)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),u&&d()}}),a=!0),t.label=2;case 2:return[2]}})})},execute:function(e){return(0,O.__awaiter)(void 0,void 0,void 0,function(){var t,n,r,s,a;return(0,O.__generator)(this,function(u){switch(u.label){case 0:if(t=ng("undefined"!=typeof location&&location.href||""),!(i&&o))return[3,5];return[4,i.get(it)];case 1:if(null==(n=u.sent())?void 0:n[r7])return[3,3];return[4,i.set(it,((a={})[r7]=t,a[ie]=document.referrer||"",a))];case 2:u.sent(),u.label=3;case 3:return[4,i.get(it)];case 4:if(r=u.sent(),s="",r&&(s=r[ie]||""),ir.has(e.event_type))return[2,e];e.event_properties=(0,O.__assign)((0,O.__assign)({},e.event_properties||{}),{"[Amplitude] Page Domain":io(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":io(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":io(e,"[Amplitude] Page Path","undefined"!=typeof location&&ng(location.pathname)||""),"[Amplitude] Page Title":io(e,"[Amplitude] Page Title",tB(tj)),"[Amplitude] Page URL":io(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":s,"[Amplitude] Previous Page Type":c(s)}),u.label=5;case 5:return[2,e]}})})},teardown:function(){return(0,O.__awaiter)(void 0,void 0,void 0,function(){return(0,O.__generator)(this,function(e){switch(e.label){case 0:if(r&&(r.removeEventListener("popstate",d),u=!1),!(i&&o))return[3,2];return[4,i.set(it,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function io(e,t,n){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?n:e.event_properties[t]}var is={init:N((h=new(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t._enableRequestBodyCompressionExperimentalValue=!1,t}return(0,O.__extends)(t,e),t.prototype.init=function(e,t,n){var r,i;return void 0===e&&(e=""),arguments.length>
12?(r=t,i=n):"string"==typeof t?(r=t,i=void 0):(r=null==t?void 0:t.userId,i=t),M(this._init((0,O.__assign)((0,O.__assign)({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,o,s,a,u,l;return(0,O.__awaiter)(this,void 0,void 0,function(){var c,d,f,g,v,h,m,y,_,b,w,S,E,k,I=this;return(0,O.__generator)(this,function(T){var C,P,R,A,x,D;switch(T.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,c=tD(t),d=null!==(n=t.loggerProvider)&&void 0!==n?n:new q,t.loggerProvider||d.enable(null!==(r=t.logLevel)&&void 0!==r?r:p.Warn),f=null!==(i=t.serverZone)&&void 0!==i?i:"US",v=this._diagnosticsSampleRate,h=null===(o=t.enableDiagnostics)||void 0===o||o,!c)return[3,2];return g=new z(t.apiKey,d,f,null===(s=t.remoteConfig)||void 0===s?void 0:s.serverUrl),[4,new Promise(function(e){null==g||g.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(d.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(v=i);var o=t.enabled;"boolean"==typeof o&&(h=o)}e()})})];case 1:T.sent(),T.label=2;case 2:return(m=new et(t.apiKey,d,f,{enabled:h,sampleRate:v})).setTag("library","".concat(eG,"/").concat(eJ)),"undefined"!=typeof navigator&&m.setTag("user_agent",navigator.userAgent),[4,(C=t.apiKey,P=t,R=this,A=m,x={loggerProvider:d,serverZone:f,enableDiagnostics:h,diagnosticsSampleRate:v},void 0===P&&(P={}),(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u,l,c,d,f,g,v,h,p,m,y,_,b,w,S,E,k,I,T,D,L,N,M,U,q,F,j,B,W,z,V,K,$,J,G,Y,Q,Z,X,ee,et,er,ei;return(0,O.__generator)(this,function(es){var ea,eu,el;switch(es.label){case 0:if(e=P.identityStorage||tb,t="",!(e===tb&&!(null===(w=P.cookieOptions)||void 0===w?void 0:w.domain)&&(null===(S=P.cookieOptions)||void 0===S?void 0:S.domain)!==""))return[3,2];return[4,(ea=void 0,(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s;return(0,O.__generator)(this,function(a){switch(a.label){case 0:return[4,new eX(void 0,{diagnosticsClient:A}).isEnabled()];case 1:if(!a.sent()||!ea&&("undefined"==typeof location||!location.hostname)||1===(t=(e=null!=ea?ea:location.hostname).split(".")).length)return[2,""];for(n=[],r=1,tP.find(function(t){return e.endsWith(".".concat(t))})&&(r=2),i=t.length-r-1;i>=0;--i)n.push(t.slice(i).join("."));i=0,a.label=2;case 2:if(!(i<n.length))return[3,7];o=n[i],a.label=3;case 3:return a.trys.push([3,5,,6]),[4,eX.isDomainWritable(o)];case 4:if(a.sent())return[2,"."+o];return[3,6];case 5:return s=a.sent(),A&&A.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(o),error:s instanceof Error?s.message:String(s)}),[3,6];case 6:return i++,[3,2];case 7:return A&&A.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=es.sent(),es.label=2;case 2:return n=(0,O.__assign)({domain:null!==(k=null===(E=P.cookieOptions)||void 0===E?void 0:E.domain)&&void 0!==k?k:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},P.cookieOptions),r={duplicateResolverFn:function(e){var t=e2(e);return!!t&&e3(JSON.parse(t).cookieDomain,n.domain)},diagnosticsClient:A},[4,(eu=i=tx(P.identityStorage,n,r),void 0===(el=null===(T=null===(I=P.cookieOptions)||void 0===I?void 0:I.upgrade)||void 0===T||T)&&(el=!0),(0,O.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,u;return(0,O.__generator)(this,function(l){switch(l.label){case 0:return e="".concat(eo.xp.toLowerCase(),"_").concat(C.substring(0,6)),[4,eu.getRaw(e)];case 1:if(!(t=l.sent()))return[2,{optOut:!1}];if(!el)return[3,3];
1return[4,eu.remove(e)];case 2:l.sent(),l.label=3;case 3:return r=(n=(0,O.__read)(t.split("."),6))[0],i=n[1],o=n[2],s=n[3],a=n[4],u=n[5],[2,{deviceId:r,userId:to(i),sessionId:ti(s),lastEventId:ti(u),lastEventTime:ti(a),optOut:!!o}]}})}))];case 3:return o=es.sent(),[4,i.get(e4(C))];case 4:return s=es.sent(),l=!(u=(a=en()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<u,c=null!==(U=null!==(M=null!==(N=null!==(D=P.deviceId)&&void 0!==D?D:l?null!==(L=a.ampDeviceId)&&void 0!==L?L:a.deviceId:void 0)&&void 0!==N?N:null==s?void 0:s.deviceId)&&void 0!==M?M:o.deviceId)&&void 0!==U?U:H(),d=null!==(q=null==s?void 0:s.lastEventId)&&void 0!==q?q:o.lastEventId,f=null!==(F=null==s?void 0:s.lastEventTime)&&void 0!==F?F:o.lastEventTime,g=null!==(B=null!==(j=P.optOut)&&void 0!==j?j:null==s?void 0:s.optOut)&&void 0!==B?B:o.optOut,v=null!==(W=null==s?void 0:s.sessionId)&&void 0!==W?W:o.sessionId,h=null==s?void 0:s.deferredSessionId,p=null!==(V=null!==(z=P.userId)&&void 0!==z?z:null==s?void 0:s.userId)&&void 0!==V?V:o.userId,R.previousSessionDeviceId=null!==(K=null==s?void 0:s.deviceId)&&void 0!==K?K:o.deviceId,R.previousSessionUserId=null!==($=null==s?void 0:s.userId)&&void 0!==$?$:o.userId,m={ipAddress:null===(G=null===(J=P.trackingOptions)||void 0===J?void 0:J.ipAddress)||void 0===G||G,language:null===(Q=null===(Y=P.trackingOptions)||void 0===Y?void 0:Y.language)||void 0===Q||Q,platform:null===(X=null===(Z=P.trackingOptions)||void 0===Z?void 0:Z.platform)||void 0===X||X},y=null==s?void 0:s.pageCounter,_=null==s?void 0:s.debugLogsEnabled,void 0!==P.autocapture&&(P.defaultTracking=P.autocapture),[4,(b=new tA(C,P.appVersion,i,n,P.defaultTracking,P.autocapture,c,P.flushIntervalMillis,P.flushMaxRetries,P.flushQueueSize,e,P.ingestionMetadata,P.instanceName,d,f,null!==(ee=null==x?void 0:x.loggerProvider)&&void 0!==ee?ee:P.loggerProvider,P.logLevel,P.minIdLength,P.offline,g,P.partnerId,P.plan,P.serverUrl,null!==(et=null==x?void 0:x.serverZone)&&void 0!==et?et:P.serverZone,v,h,P.sessionTimeout,P.storageProvider,m,P.transport,P.useBatch,P.fetchRemoteConfig,p,y,_,P.networkTrackingOptions,P.identify,null!==(er=null==x?void 0:x.enableDiagnostics)&&void 0!==er?er:P.enableDiagnostics,null!==(ei=null==x?void 0:x.diagnosticsSampleRate)&&void 0!==ei?ei:R._diagnosticsSampleRate,A,P.remoteConfig,t,P.enableRequestBodyCompression,R._enableRequestBodyCompressionExperimentalValue)).storageProvider.isEnabled()];case 5:return es.sent()||(b.loggerProvider.warn("Storage provider ".concat(b.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),b.storageProvider=new eQ),[2,b]}})}))];case 3:if(y=T.sent(),!(c&&g))return[3,5];return[4,new Promise(function(e){null==g||g.subscribe("configs.analyticsSDK.browserSDK","all",function(t,n,r){y.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t&&function(e,t){if(e){!function e(t){if(!("object"!=typeof t||null===t||Array.isArray(t))){var n,r,i,o,s,a,u,l,c,d,f,g=Object.keys(t);try{for(var v=(0,O.__values)(g),h=v.next();!h.done;h=v.next()){var p=h.value;try{var m=t[p];"boolean"==typeof(null==m?void 0:m.enabled)&&(m.enabled?(delete m.enabled,0===Object.keys(m).length&&(t[p]=!0)):t[p]=!1),e(m)}catch(e){}}}catch(e){n={error:e}}finally{try{h&&!h.done&&(r=v.return)&&r.call(v)}finally{if(n)throw n.error}}try{if(null===(c=null===(l=null===(u=t.autocapture)||void 0===u?void 0:u.networkTracking)||void 0===l?void 0:l.captureRules)||void 0===c?void 0:c.length)try{for(var y=(0,O.__values)(t.autocapture.networkTracking.captureRules),_=y.next();!_.done;_=y.next()){var b=_.value;try{for(var w=(s=void 0,(0,O.__values)(["responseHeaders","requestHeaders"])),S=w.next();!S.done;S=w.next()){var E=S.value,k=null!==(d=b[E])&&void 0!==d?d:{},I=k.captureSafeHeaders,T=k.allowlist;if(I||T){if(void 0!==T&&!Array.isArray(T)){delete b[E];continue}b[E]=(0,O.__spreadArray)((0,O.__spreadArray)([],(0,O.__read)(I?eo.Wb:[]),!1),(0,O.__read)(null!=T?T:[]),!1)}}}catch(e){s={error:e}}finally{try{S&&!S.done&&(a=w.return)&&a.call(w)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}finally{try{_&&!_.done&&(o=y.return)&&o.call(y)}finally{if(i)throw i.error}}}catch(e){}var C=null===(f=t.autocapture)||void 0===f?void 0:f.frustrationInteractions;C&&(C.rageClick&&(C.rageClicks=C.rageClick,delete C.rageClick),C.deadClick&&(C.deadClicks=C.deadClick,delete C.deadClick))}}(e);try{var n,r,i,o,s,a,u;if(t.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var l=(0,O.__assign)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null===(i=e.autocapture.elementInteractions.pageUrlAllowlistRegex)||void 0===i?void 0:i.length)){l.elementInteractions=(0,O.__assign)({},e.autocapture.elementInteractions);var c=l.elementInteractions,d=null!==(o=c.pageUrlAllowlist)&&void 0!==o?o:[],f=e.autocapture.elementInteractions.pageUrlAllowlistRegex;c.pageUrlAllowlist=t1(d,f,t),delete c.pageUrlAllowlistRegex}
1if("object"==typeof e.autocapture.networkTracking&&null!==e.autocapture.networkTracking&&(null===(s=e.autocapture.networkTracking.captureRules)||void 0===s?void 0:s.length)){l.networkTracking=(0,O.__assign)({},e.autocapture.networkTracking);var g=l.networkTracking,v=null!==(a=g.captureRules)&&void 0!==a?a:[];try{for(var h=(0,O.__values)(v),p=h.next();!p.done;p=h.next()){var m=p.value;m.urls=t1(null!==(u=m.urls)&&void 0!==u?u:[],m.urlsRegex,t),delete m.urlsRegex}}catch(e){n={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}}"boolean"==typeof t.autocapture&&(t.autocapture=(0,O.__assign)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},l)),"object"==typeof t.autocapture&&(t.autocapture=(0,O.__assign)((0,O.__assign)({},t.autocapture),l))}t.defaultTracking=t.autocapture}t.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(t))}catch(e){t.loggerProvider.error("Failed to apply remote configuration because of error: ",e)}}}(t,y),e()})})];case 4:T.sent(),T.label=5;case 5:return[4,e.prototype._init.call(this,y)];case 6:if(T.sent(),this.logBrowserOptions(y),this.config.remoteConfigClient=g,!ex(this.config.defaultTracking))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,O.__awaiter)(I,void 0,void 0,function(){var t;return(0,O.__generator)(this,function(n){switch(n.label){case 0:if(e)return[3,2];return t=eW(this.config),this.webAttribution=new r9(t,this.config),[4,this.webAttribution.init()];case 1:n.sent(),n.label=2;case 2:return[2]}})})}),_=eW(this.config),this.webAttribution=new r9(_,this.config),[4,this.webAttribution.init()];case 7:T.sent(),T.label=8;case 8:if(S=!(!(w=(b=en()).ampTimestamp?Number(b.ampTimestamp):void 0)||Date.now()<w)||Number.isNaN(Number(b.ampSessionId))?void 0:Number(b.ampSessionId),-1!==(E=this.config.deferredSessionId)||this.config.optOut||(E=Date.now()),this.setSessionId(null!==(l=null!==(u=null!==(a=t.sessionId)&&void 0!==a?a:S)&&void 0!==u?u:E)&&void 0!==l?l:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,O.__awaiter)(I,void 0,void 0,function(){return(0,O.__generator)(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(k=es(t.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),!(null!==this.config.offline))return[3,10];return[4,this.add(t0()).promise];case 9:T.sent(),T.label=10;case 10:return[4,this.add(new ey({diagnosticsClient:m})).promise];case 11:return T.sent(),[4,this.add(new eY).promise];case 12:return T.sent(),[4,this.add(new e_).promise];case 13:if(T.sent(),tX(this.config),!eA(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(tQ()).promise];case 14:T.sent(),T.label=15;case 15:if(!eD(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(tJ()).promise];case 16:T.sent(),T.label=17;case 17:if(!eL(this.config.defaultTracking))return[3,20];if(this.config.optOut)return[3,19];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(tz(eH(this.config))).promise];case 18:return T.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return(0,O.__awaiter)(I,void 0,void 0,function(){return(0,O.__generator)(this,function(t){switch(t.label){case 0:if(e)return[2];return this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(tz(eH(this.config))).promise];case 1:return t.sent(),[2]}})})}),T.label=20;case 20:if(!eU(this.config.autocapture))return[3,22];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(n$(eF(this.config),{diagnosticsClient:m})).promise];case 21:T.sent(),T.label=22;case 22:if(!eq(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(n6(ej(this.config))).promise];case 23:T.sent(),T.label=24;case 24:if(!eM(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(r_(eB(this.config))).promise];case 25:T.sent(),T.label=26;case 26:if(!("boolean"==typeof(D=this.config.autocapture)?D:"object"==typeof D&&!0===D.webVitals))return[3,28];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(r6()).promise];case 27:T.sent(),T.label=28;case 28:if(!eA(this.config.autocapture,"pageUrlEnrichment"))return[3,30];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(ii()).promise];case 29:T.sent(),T.label=30;case 30:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];
1case 31:return T.sent(),k.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=(0,O.__rest)(t,["time"]);I.track(e.eventType,r,"number"==typeof n?{time:n}:void 0)}),[2]}})})},t.prototype.getUserId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.userId},t.prototype.setUserId=function(e){if(!this.config){this.q.push(this.setUserId.bind(this,e));return}this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),ea(e,this.config.instanceName))},t.prototype.getDeviceId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.deviceId},t.prototype.setDeviceId=function(e){if(!this.config){this.q.push(this.setDeviceId.bind(this,e));return}this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),eu(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(H()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null===(e=this.config)||void 0===e?void 0:e.deviceId,userId:null===(t=this.config)||void 0===t?void 0:t.userId,userProperties:this.userProperties}},t.prototype.setIdentity=function(e){if("userId"in e&&this.setUserId(e.userId),"deviceId"in e&&e.deviceId&&this.setDeviceId(e.deviceId),"userProperties"in e){this.userProperties=e.userProperties;var t,n,r,i=new eb.h2,o=null!==(r=e.userProperties)&&void 0!==r?r:{};try{for(var s=(0,O.__values)(Object.entries(o)),a=s.next();!a.done;a=s.next()){var u=(0,O.__read)(a.value,2),l=u[0],c=u[1];i.set(l,c)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}this.identify(i)}},t.prototype.getOptOut=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.optOut},t.prototype.getSessionId=function(){var e;return null===(e=this.config)||void 0===e?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),M(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,M(Promise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return M(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,eN(this.config.defaultTracking)&&(r&&i&&n.push(this.track(td,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 this.config.identify&&n.push(this.track(ew(this.config.identify)).promise),eN(this.config.defaultTracking)&&n.push(this.track(tc,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,M(Promise.all(n))},t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(e){if(!this.config){this.q.push(this.setTransport.bind(this,e));return}this.config.transportProvider=tL(e)},t.prototype.identify=function(t,n){if(eK(t)){var r=t._q;t._q=[],t=eV(new eb.h2,r)}return(null==n?void 0:n.user_id)&&this.setUserId(n.user_id),(null==n?void 0:n.device_id)&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,t,n)},t.prototype.groupIdentify=function(t,n,r,i){if(eK(r)){var o=r._q;r._q=[],r=eV(new eb.h2,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(eK(t)){var r=t._q;t._q=[],t=eV(new eI,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var n=this.webAttribution.generateCampaignEvent(e);
1return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,O.__awaiter)(this,void 0,void 0,function(){var n,r,i;return(0,O.__generator)(this,function(o){return n=Date.now(),r=eT(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type===tc||t.event_type===td||t.session_id&&t.session_id!==this.getSessionId()||(r||i?(this.setSessionId(n),i&&this.config.loggerProvider.log("Created a new session for new campaign.")):r||this.trackCampaignEventIfNeeded()),[2,e.prototype.process.call(this,t)]})})},t.prototype.logBrowserOptions=function(e){try{var t=(0,O.__assign)((0,O.__assign)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",eP(t))}catch(e){this.config.loggerProvider.error("Error logging browser config",e)}},t.prototype._setDiagnosticsSampleRate=function(e){if(!(e>1)&&!(e<0)&&!this.config){this._diagnosticsSampleRate=e;return}},t.prototype._enableRequestBodyCompressionExperimental=function(e){if(!this.config){this._enableRequestBodyCompressionExperimentalValue=e;return}},t}(eO))).init.bind(h),"init",x(h),L(h,["config"])),add:N(h.add.bind(h),"add",x(h),L(h,["config.apiKey","timeline.plugins"])),remove:N(h.remove.bind(h),"remove",x(h),L(h,["config.apiKey","timeline.plugins"])),track:N(h.track.bind(h),"track",x(h),L(h,["config.apiKey","timeline.queue.length"])),logEvent:N(h.logEvent.bind(h),"logEvent",x(h),L(h,["config.apiKey","timeline.queue.length"])),identify:N(h.identify.bind(h),"identify",x(h),L(h,["config.apiKey","timeline.queue.length"])),groupIdentify:N(h.groupIdentify.bind(h),"groupIdentify",x(h),L(h,["config.apiKey","timeline.queue.length"])),setGroup:N(h.setGroup.bind(h),"setGroup",x(h),L(h,["config.apiKey","timeline.queue.length"])),revenue:N(h.revenue.bind(h),"revenue",x(h),L(h,["config.apiKey","timeline.queue.length"])),flush:N(h.flush.bind(h),"flush",x(h),L(h,["config.apiKey","timeline.queue.length"])),getUserId:N(h.getUserId.bind(h),"getUserId",x(h),L(h,["config","config.userId"])),setUserId:N(h.setUserId.bind(h),"setUserId",x(h),L(h,["config","config.userId"])),getDeviceId:N(h.getDeviceId.bind(h),"getDeviceId",x(h),L(h,["config","config.deviceId"])),setDeviceId:N(h.setDeviceId.bind(h),"setDeviceId",x(h),L(h,["config","config.deviceId"])),reset:N(h.reset.bind(h),"reset",x(h),L(h,["config","config.userId","config.deviceId"])),getSessionId:N(h.getSessionId.bind(h),"getSessionId",x(h),L(h,["config"])),setSessionId:N(h.setSessionId.bind(h),"setSessionId",x(h),L(h,["config"])),extendSession:N(h.extendSession.bind(h),"extendSession",x(h),L(h,["config"])),setOptOut:N(h.setOptOut.bind(h),"setOptOut",x(h),L(h,["config"])),setTransport:N(h.setTransport.bind(h),"setTransport",x(h),L(h,["config"])),getIdentity:N(h.getIdentity.bind(h),"getIdentity",x(h),L(h,["config"])),setIdentity:N(h.setIdentity.bind(h),"setIdentity",x(h),L(h,["config","config.userId","config.deviceId"])),getOptOut:N(h.getOptOut.bind(h),"getOptOut",x(h),L(h,["config"])),_setDiagnosticsSampleRate:N(h._setDiagnosticsSampleRate.bind(h),"_setDiagnosticsSampleRate",x(h),L(h,["config"])),_enableRequestBodyCompressionExperimental:N(h._enableRequestBodyCompressionExperimental.bind(h),"_enableRequestBodyCompressionExperimental",x(h),L(h,["config"]))},ia=is.add,iu=(is.extendSession,is.flush,is.getDeviceId,is.getIdentity,is.getOptOut,is.getSessionId,is.getUserId,is.groupIdentify,is.identify),il=is.init,ic=(is.logEvent,is.remove,is.reset),id=(is.revenue,is.setDeviceId,is.setGroup,is.setIdentity,is.setOptOut),ig=(is.setSessionId,is.setTransport,is.setUserId),iv=is.track;is._setDiagnosticsSampleRate,is._enableRequestBodyCompressionExperimental},83199:function(e,t,n){"use strict";n.d(t,{V:function(){return f}});var r=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:i(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),i=function(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},o=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}(),s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function a(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
1if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw 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 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 l=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=a(["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||e.length!==t.length)return!1;var u=Array.isArray(e),c=Array.isArray(t);if(u!==c)return!1;if(u&&c){for(var d=0;d<e.length;d++)if(!l(e[d],t[d]))return!1}else{if(!l(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var f=!0;return Object.keys(e).forEach(function(n){l(e[n],t[n])||(f=!1)}),f}return!0};Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),n=t.length,r=Array(n);n--;)r[n]=[t[n],e[t[n]]];return r});var c=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=s({},this.identity.userProperties),n=s(s({},this.identity),{userProperties:t});return{setUserId:function(e){return n.userId=e,this},setDeviceId:function(e){return n.deviceId=e,this},setUserProperties:function(e){return n.userProperties=e,this},setOptOut:function(e){return n.optOut=e,this},updateUserProperties:function(e){var t,r,i,o,s,l,c=n.userProperties||{};try{for(var d=a(Object.entries(e)),f=d.next();!f.done;f=d.next()){var g=u(f.value,2),v=g[0],h=g[1];switch(v){case"$set":try{for(var p=(i=void 0,a(Object.entries(h))),m=p.next();!m.done;m=p.next()){var y=u(m.value,2),_=y[0],b=y[1];c[_]=b}}catch(e){i={error:e}}finally{try{m&&!m.done&&(o=p.return)&&o.call(p)}finally{if(i)throw i.error}}break;case"$unset":try{for(var w=(s=void 0,a(Object.keys(h))),S=w.next();!S.done;S=w.next()){var _=S.value;delete c[_]}}catch(e){s={error:e}}finally{try{S&&!S.done&&(l=w.return)&&l.call(w)}finally{if(s)throw s.error}}break;case"$clearAll":c={}}}}catch(e){t={error:e}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}return n.userProperties=c,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return s({},this.identity)},e.prototype.setIdentity=function(e){var t=s({},this.identity);this.identity=s({},e),l(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}(),d="undefined"!=typeof globalThis?globalThis:void 0!==n.g?n.g:self,f=function(){function e(){this.identityStore=new c,this.eventBridge=new o,this.applicationContextProvider=new r}return e.getInstance=function(t){return d.analyticsConnectorInstances||(d.analyticsConnectorInstances={}),d.analyticsConnectorInstances[t]||(d.analyticsConnectorInstances[t]=new e),d.analyticsConnectorInstances[t]},e}()},95828:function(e,t,n){"use strict";n.d(t,{h2:function(){return u},rk:function(){return l}});var r,i,o=n(5853),s=n(57870),a=n(28672),u=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,o.__assign)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(i.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(i.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(i.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(i.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(i.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(i.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(i.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(i.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(i.UNSET,e,s.q$),this},e.prototype.clearAll=function(){return this._properties={},this._properties[i.CLEAR_ALL]=s.q$,this}
1,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[i.CLEAR_ALL]||this._propertySet.has(t))&&(e===i.ADD?"number"==typeof n:e===i.UNSET||e===i.REMOVE||(0,a.T)(t,n))},e}();(r=i||(i={})).SET="$set",r.SET_ONCE="$setOnce",r.ADD="$add",r.APPEND="$append",r.PREPEND="$prepend",r.REMOVE="$remove",r.PREINSERT="$preInsert",r.POSTINSERT="$postInsert",r.UNSET="$unset",r.CLEAR_ALL="$clearAll";var l=[i.CLEAR_ALL,i.UNSET,i.SET,i.SET_ONCE,i.ADD,i.APPEND,i.PREPEND,i.PREINSERT,i.POSTINSERT,i.REMOVE]},57870:function(e,t,n){"use strict";n.d(t,{EG:function(){return a},EK:function(){return O},JE:function(){return s},Ji:function(){return b},KI:function(){return g},Kh:function(){return k},Lo:function(){return P},NE:function(){return p},RE:function(){return c},VX:function(){return d},Wb:function(){return R},ah:function(){return m},b3:function(){return h},bz:function(){return w},cl:function(){return I},f1:function(){return o},fC:function(){return _},fZ:function(){return f},h8:function(){return l},lP:function(){return v},oZ:function(){return T},pG:function(){return C},pr:function(){return E},q$:function(){return r},rV:function(){return y},tS:function(){return S},xp:function(){return i},y_:function(){return u}});var r="-",i="AMP",o="".concat(i,"_unsent"),s="$default_instance",a="https://api2.amplitude.com/2/httpapi",u="https://api.eu.amplitude.com/2/httpapi",l="https://api2.amplitude.com/batch",c="https://api.eu.amplitude.com/batch",d="utm_campaign",f="utm_content",g="utm_id",v="utm_medium",h="utm_source",p="utm_term",m="dclid",y="fbclid",_="gbraid",b="gclid",w="ko_click_id",S="li_fat_id",E="msclkid",k="rdt_cid",I="ttclid",T="twclid",C="wbraid",P={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rdt_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0},R=["access-control-allow-origin","access-control-allow-credentials","access-control-expose-headers","access-control-max-age","access-control-allow-methods","access-control-allow-headers","accept-patch","accept-ranges","age","allow","alt-svc","cache-control","connection","content-disposition","content-encoding","content-language","content-length","content-location","content-md5","content-range","content-type","date","delta-base","etag","expires","im","last-modified","link","location","permanent","p3p","pragma","proxy-authenticate","public-key-pins","retry-after","server","status","strict-transport-security","trailer","transfer-encoding","tk","upgrade","vary","via","warning","www-authenticate","x-b3-traceid","x-frame-options"],O=["authorization","cookie","set-cookie"]},28672:function(e,t,n){"use strict";n.d(t,{L:function(){return i},T:function(){return o}});var r=n(5853),i=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];if(!o(t,n))return!1}return!0},o=function(e,t){var n,o;if("string"!=typeof e)return!1;if(Array.isArray(t)){var s=!0;try{for(var a=(0,r.__values)(t),u=a.next();!u.done;u=a.next()){var l=u.value;if(Array.isArray(l))return!1;if("object"==typeof l)s=s&&i(l);else if(!["number","string"].includes(typeof l))return!1;if(!s)return!1}}catch(e){n={error:e}}finally{try{u&&!u.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}}else if(null==t)return!1;else if("object"==typeof t)return i(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0}},82459:function(e,t,n){"use strict";n.d(t,{kG:function(){return tq}});var r,i,o,s,a,u,l,c,d,f,g,v,h,p,m,y,_,b,w,S,E,k,I,T,C,P,R,O,A,x,D,L,N,M,U,q=n(5853);(r=E||(E={})).SET="$set",r.SET_ONCE="$setOnce",r.ADD="$add",r.APPEND="$append",r.PREPEND="$prepend",r.REMOVE="$remove",r.PREINSERT="$preInsert",r.POSTINSERT="$postInsert",r.UNSET="$unset",r.CLEAR_ALL="$clearAll",(i=k||(k={})).IDENTIFY="$identify",i.GROUP_IDENTIFY="$groupidentify",i.REVENUE="revenue_amount";var F=function(){var e="ampIntegrationContext";return"undefined"!=typeof globalThis&&void 0!==globalThis[e]?globalThis[e]:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof self?self:void 0!==n.g?n.g:void 0};(o=I||(I={}))[o.None=0]="None",o[o.Error=1]="Error",o[o.Warn=2]="Warn",o[o.Verbose
1=3]="Verbose",o[o.Debug=4]="Debug";var j=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=n(),u=a.logger,l=a.logLevel;if(l&&l<I.Debug||!l||!u)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:(Error().stack||"").split("\n").slice(3).map(function(e){return e.trim()}),time:{start:new Date().toISOString()},states:{}};r&&c.states&&(c.states.before=r());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))}):(r&&c.states&&(c.states.after=r()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))),d}},B="Amplitude Logger ",H=function(){function e(){this.logLevel=I.None}return e.prototype.disable=function(){this.logLevel=I.None},e.prototype.enable=function(e){void 0===e&&(e=I.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<I.Verbose||console.log("".concat(B,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<I.Warn||console.warn("".concat(B,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<I.Error||console.error("".concat(B,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<I.Debug||console.log("".concat(B,"[Debug]: ").concat(e.join(" ")))},e}();(s=T||(T={})).Unknown="unknown",s.Skipped="skipped",s.Success="success",s.RateLimit="rate_limit",s.PayloadTooLarge="payload_too_large",s.Invalid="invalid",s.Failed="failed",s.Timeout="Timeout",s.SystemError="SystemError";var W=function(){function e(){}return e.prototype.send=function(e,t,n){return Promise.resolve(null)},e.prototype.buildResponse=function(e){if("object"!=typeof e)return null;var t,n,r,i,o,s,a,u,l,c,d,f,g,v,h,p,m,y,_,b,w,S,E=e.code||0,k=this.buildStatus(E);switch(k){case T.Success:return{status:k,statusCode:E,body:{eventsIngested:null!==(t=e.events_ingested)&&void 0!==t?t:0,payloadSizeBytes:null!==(n=e.payload_size_bytes)&&void 0!==n?n:0,serverUploadTime:null!==(r=e.server_upload_time)&&void 0!==r?r:0}};case T.Invalid:return{status:k,statusCode:E,body:{error:null!==(i=e.error)&&void 0!==i?i:"",missingField:null!==(o=e.missing_field)&&void 0!==o?o:"",eventsWithInvalidFields:null!==(s=e.events_with_invalid_fields)&&void 0!==s?s:{},eventsWithMissingFields:null!==(a=e.events_with_missing_fields)&&void 0!==a?a:{},eventsWithInvalidIdLengths:null!==(u=e.events_with_invalid_id_lengths)&&void 0!==u?u:{},epsThreshold:null!==(l=e.eps_threshold)&&void 0!==l?l:0,exceededDailyQuotaDevices:null!==(c=e.exceeded_daily_quota_devices)&&void 0!==c?c:{},silencedDevices:null!==(d=e.silenced_devices)&&void 0!==d?d:[],silencedEvents:null!==(f=e.silenced_events)&&void 0!==f?f:[],throttledDevices:null!==(g=e.throttled_devices)&&void 0!==g?g:{},throttledEvents:null!==(v=e.throttled_events)&&void 0!==v?v:[]}};case T.PayloadTooLarge:return{status:k,statusCode:E,body:{error:null!==(h=e.error)&&void 0!==h?h:""}};case T.RateLimit:return{status:k,statusCode:E,body:{error:null!==(p=e.error)&&void 0!==p?p:"",epsThreshold:null!==(m=e.eps_threshold)&&void 0!==m?m:0,throttledDevices:null!==(y=e.throttled_devices)&&void 0!==y?y:{},throttledUsers:null!==(_=e.throttled_users)&&void 0!==_?_:{},exceededDailyQuotaDevices:null!==(b=e.exceeded_daily_quota_devices)&&void 0!==b?b:{},exceededDailyQuotaUsers:null!==(w=e.exceeded_daily_quota_users)&&void 0!==w?w:{},throttledEvents:null!==(S=e.throttled_events)&&void 0!==S?S:[]}};case T.Timeout:default:return{status:k,statusCode:E}}},e.prototype.buildStatus=function(e){return e>=200&&e<300?T.Success:429===e?T.RateLimit:413===e?T.PayloadTooLarge:408===e?T.Timeout:e>=400&&e<500?T.Invalid:e>=500?T.Failed:T.Unknown},e}(),z=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return(0,q.__extends)(t,e),t.prototype.send=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,q.__assign)({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(t),method:"POST"})];case 1:return[4,(n=i.sent()).text()];case 2:r=i.sent();try{return[2,this.buildResponse(JSON.parse(r))]}catch(e){return[2,this.buildResponse({code:n.status})]}return[2]}})})},t}(W),V="$default_instance",K="https://api2.amplitude.com/2/httpapi",$=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:V,logLevel:I.Warn,loggerProvider:new H,offline:!1,optOut:!1,serverUrl:K,serverZone:"US",useBatch:!1}},J=function(){function e(e){this._optOut=!1;var t,n,r,i,o=$();this.apiKey=e.apiKey,this.flushIntervalMillis=null!==(t=e.flushIntervalMillis)&&void 0!==t?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=e.instanceName||o.instanceName,this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!==(n=e.logLevel)&&void 0!==n?n:o.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=void 0!==e.offline?e.offline:o.offline,this.optOut=null!==(r=e.optOut)&&void 0!==r?r:o.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||o.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=null!==(i=e.useBatch)&&void 0!==i?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=G(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}
1,enumerable:!1,configurable:!0}),e}(),G=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=$().serverZone),void 0===n&&(n=$().useBatch),e)return{serverUrl:e,serverZone:void 0};var r,i=["US","EU"].includes(t)?t:$().serverZone;return{serverZone:i,serverUrl:(r=n,"EU"===i?r?"https://api.eu.amplitude.com/batch":"https://api.eu.amplitude.com/2/httpapi":r?"https://api2.amplitude.com/batch":K)}};(function(){this.sdk={metrics:{histogram:{}}}}).prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},(a=C||(C={})).US="US",a.EU="EU",a.STAGING="STAGING";var Y="[Amplitude]",Q="".concat(Y," Session Replay ID"),Z=C.US,X={enabled:!0},ee="".concat(Y," Session Replay Debug"),et="amp-mask",en="https://api-sr.amplitude.com/sessions/v2/track",er="https://api-sr.eu.amplitude.com/sessions/v2/track",ei="https://api-sr.stag2.amplitude.com/sessions/v2/track";(u=P||(P={})).GET_SR_PROPS="get-sr-props",u.DEBUG_INFO="debug-info",u.FETCH_REQUEST="fetch-request",u.METADATA="metadata",u.TARGETING_DECISION="targeting-decision";var eo=function(){function e(e){this.logger=e,this.log=this.getSafeMethod("log"),this.warn=this.getSafeMethod("warn"),this.error=this.getSafeMethod("error"),this.debug=this.getSafeMethod("debug")}return e.prototype.getSafeMethod=function(e){if(!this.logger)return function(){};var t,n=this.logger[e];return"function"==typeof n?(null!==(t=n.__rrweb_original__)&&void 0!==t?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),es=n(2359),ea="medium",eu=function(e,t,n){switch(t){case"light":if("input"!==e)return!0;var r,i=n?(r=n.type,n.hasAttribute("data-rr-is-password")?"password":r?r.toLowerCase():null):"";if(!i)return!1;if(["password","hidden","email","tel"].includes(i)||n.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":case"conservative":return!0;default:return eu(e,ea,n)}},el=function(e,t,n){var r,i,o;if(void 0===t&&(t={defaultMaskLevel:ea}),n){if(n.closest("."+et)||(null!==(r=t.maskSelector)&&void 0!==r?r:[]).some(function(e){return n.closest(e)}))return!0;if(n.closest(".amp-unmask")||(null!==(i=t.unmaskSelector)&&void 0!==i?i:[]).some(function(e){return n.closest(e)}))return!1}return eu(e,null!==(o=t.defaultMaskLevel)&&void 0!==o?o:ea,n)},ec=function(e,t){return function(n,r){return el(e,t,r)?n.replace(/[^\s]/g,"*"):n}},ed=function(){var e=(0,es.l)();return(null==e?void 0:e.location)?e.location.href:""},ef=function(e){var t=e.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".");return new RegExp("^".concat(t,"$"))},eg=function(e){if(!e.every(function(e){return"string"==typeof e.selector&&"string"==typeof e.replacement}))throw Error("ugcFilterRules must be an array of objects with selector and replacement properties");if(!e.every(function(e){var t;return"string"==typeof(t=e.selector)&&""!==t.trim()&&!!/^\/|^https?:\/\/[^\s]+$/.test(t)}))throw Error("ugcFilterRules must be an array of objects with valid globs")},ev=function(e,t){var n,r;try{for(var i=(0,q.__values)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=ef(s.selector);if(a.test(e))return e.replace(a,s.replacement)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return e},eh=function(){return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,es.l)()))return[3,2];return[4,e.navigator.storage.estimate()];case 1:return n=(t=i.sent()).usage,r=t.quota,[2,{totalStorageSize:n?Math.round(n/1024):0,percentOfQuota:n&&r?Math.round((n/r+Number.EPSILON)*1e3)/1e3:0,usageDetails:JSON.stringify(t.usageDetails)}];case 2:return[3,4];case 3:return i.sent(),[3,4];case 4:return[2,{totalStorageSize:0,percentOfQuota:0,usageDetails:""}]}})})},ep=function(e){var t=(0,q.__assign)({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},em=function(){return{flushMaxRetries:2,logLevel:I.Warn,loggerProvider:new H,transportProvider:new z}},ey=function(e){function t(t,n){var r,i,o,s,a,u,l=this,c=em();return(l=e.call(this,(0,q.__assign)((0,q.__assign)({transportProvider:c.transportProvider,loggerProvider:new eo(n.loggerProvider||c.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=c.flushMaxRetries?n.flushMaxRetries:c.flushMaxRetries,l.apiKey=t,l.sampleRate=n.sampleRate||0,l.serverZone=n.serverZone||Z,l.configServerUrl=n.configServerUrl,l.trackServerUrl=n.trackServerUrl,l.shouldInlineStylesheet=n.shouldInlineStylesheet,l.version=n.version,l.performanceConfig=n.performanceConfig||X,l.storeType=null!==(r=n.storeType)&&void 0!==r?r:"idb",l.applyBackgroun
1dColorToBlockedElements=null!==(i=n.applyBackgroundColorToBlockedElements)&&void 0!==i&&i,l.enableUrlChangePolling=null!==(o=n.enableUrlChangePolling)&&void 0!==o&&o,l.urlChangePollingInterval=null!==(s=n.urlChangePollingInterval)&&void 0!==s?s:1e3,l.captureDocumentTitle=null!==(a=n.captureDocumentTitle)&&void 0!==a&&a,n.privacyConfig&&(l.privacyConfig=n.privacyConfig),n.interactionConfig&&(l.interactionConfig=n.interactionConfig,l.interactionConfig.ugcFilterRules&&eg(l.interactionConfig.ugcFilterRules)),n.debugMode&&(l.debugMode=n.debugMode),void 0!==n.useWebWorker?l.useWebWorker=n.useWebWorker:(null===(u=n.experimental)||void 0===u?void 0:u.useWebWorker)!==void 0&&(l.useWebWorker=n.experimental.useWebWorker),n.omitElementTags&&(l.omitElementTags=n.omitElementTags),l}return(0,q.__extends)(t,e),t}(J);(l=R||(R={})).SET="$set",l.SET_ONCE="$setOnce",l.ADD="$add",l.APPEND="$append",l.PREPEND="$prepend",l.REMOVE="$remove",l.PREINSERT="$preInsert",l.POSTINSERT="$postInsert",l.UNSET="$unset",l.CLEAR_ALL="$clearAll",(c=O||(O={})).IDENTIFY="$identify",c.GROUP_IDENTIFY="$groupidentify",c.REVENUE="revenue_amount";var e_=function(e){return{promise:e||Promise.resolve()}},eb="https://app.amplitude.com",ew={US:eb,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},eS="__AMPLITUDE_MESSENGER_INSTANCE__",eE="__AMPLITUDE_MESSENGER__",ek=function(){function e(e){var t=(void 0===e?{}:e).origin;this[A]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=void 0===t?eb:t}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),n.timeout>0&&setTimeout(function(){s(Error("".concat(e," timed out (id: ").concat(i,")"))),delete r.requestCallbacks[i]},n.timeout)})},e.prototype.handleResponse=function(e){var t;if(!this.requestCallbacks[e.id]){null===(t=this.logger)||void 0===t||t.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},e.prototype.registerActionHandler=function(e,t){this.actionHandlers.has(e)&&(null===(o=null===(i=this.logger)||void 0===i?void 0:i.warn)||void 0===o||o.call(i,"Overwriting existing action handler for: ".concat(e))),this.actionHandlers.set(e,t);var n,r,i,o,s=this.pendingMessages.get(e);if(s){this.pendingMessages.delete(e);try{for(var a=(0,q.__values)(s),u=a.next();!u.done;u=a.next()){var l=u.value;t(l)}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){var t,n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:if(t=this.scriptLoadPromises.get(e))return[2,t];n=(document.querySelector('script[src="'.concat(CSS.escape(e),'"]'))?Promise.resolve({status:!0}):new Promise(function(t,n){var r;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=e,i.addEventListener("load",function(){t({status:!0})},{once:!0}),i.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),null===(r=document.head)||void 0===r||r.appendChild(i)}catch(e){n(e)}})).then(function(){}),this.scriptLoadPromises.set(e,n),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,n];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.scriptLoadPromises.delete(e),r;case 4:return[2]}})})},e.prototype.setup=function(e){var t,n,r=this,i=void 0===e?{}:e,o=i.logger,s=i.endpoint;o&&(this.logger=o),s&&this.endpoint===eb&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null===(n=null===(t=this.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null===(n=null===(t=r.logger)||void 0===t?void 0:t.debug)||void 0===n||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var t,n,i,o,s,a=e.data,u=null==a?void 0:a.action;if(u){if("id"in a&&a.id)null===(o=null===(i=r.logger)||void 0===i?void 0:i.debug)||void 0===o||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a
1);else{if("ping"===u){r.notify({action:"pong"});return}var l=r.actionHandlers.get(u);if(l)l(a.data);else{var c=null!==(s=r.pendingMessages.get(u))&&void 0!==s?s:[];c.push(a.data),r.pendingMessages.set(u,c)}}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var e=(0,es.l)();(null==e?void 0:e[eE])===this&&delete e[eE]},e}();A=eS;var eI="__AMPLITUDE_BACKGROUND_CAPTURE__",eT=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t},eC=n(83199),eP=((d=eP||{})[d.DomContentLoaded=0]="DomContentLoaded",d[d.Load=1]="Load",d[d.FullSnapshot=2]="FullSnapshot",d[d.IncrementalSnapshot=3]="IncrementalSnapshot",d[d.Meta=4]="Meta",d[d.Custom=5]="Custom",d[d.Plugin=6]="Plugin",d),eR=((f=eR||{})[f.Mutation=0]="Mutation",f[f.MouseMove=1]="MouseMove",f[f.MouseInteraction=2]="MouseInteraction",f[f.Scroll=3]="Scroll",f[f.ViewportResize=4]="ViewportResize",f[f.Input=5]="Input",f[f.TouchMove=6]="TouchMove",f[f.MediaInteraction=7]="MediaInteraction",f[f.StyleSheetRule=8]="StyleSheetRule",f[f.CanvasMutation=9]="CanvasMutation",f[f.Font=10]="Font",f[f.Log=11]="Log",f[f.Drag=12]="Drag",f[f.StyleDeclaration=13]="StyleDeclaration",f[f.Selection=14]="Selection",f[f.AdoptedStyleSheet=15]="AdoptedStyleSheet",f[f.CustomElement=16]="CustomElement",f),eO=((g=eO||{})[g.MouseUp=0]="MouseUp",g[g.MouseDown=1]="MouseDown",g[g.Click=2]="Click",g[g.ContextMenu=3]="ContextMenu",g[g.DblClick=4]="DblClick",g[g.Focus=5]="Focus",g[g.Blur=6]="Blur",g[g.TouchStart=7]="TouchStart",g[g.TouchMove_Departed=8]="TouchMove_Departed",g[g.TouchEnd=9]="TouchEnd",g[g.TouchCancel=10]="TouchCancel",g),eA=((v=eA||{})[v.Mouse=0]="Mouse",v[v.Pen=1]="Pen",v[v.Touch=2]="Touch",v),ex=((h=ex||{})[h["2D"]=0]="2D",h[h.WebGL=1]="WebGL",h[h.WebGL2=2]="WebGL2",h),eD=((p=eD||{})[p.Play=0]="Play",p[p.Pause=1]="Pause",p[p.Seeked=2]="Seeked",p[p.VolumeChange=3]="VolumeChange",p[p.RateChange=4]="RateChange",p),eL=((m=eL||{}).Start="start",m.Pause="pause",m.Resume="resume",m.Resize="resize",m.Finish="finish",m.FullsnapshotRebuilded="fullsnapshot-rebuilded",m.LoadStylesheetStart="load-stylesheet-start",m.LoadStylesheetEnd="load-stylesheet-end",m.SkipStart="skip-start",m.SkipEnd="skip-end",m.MouseInteraction="mouse-interaction",m.EventCast="event-cast",m.CustomEvent="custom-event",m.Flush="flush",m.StateChange="state-change",m.PlayBack="play-back",m.Destroy="destroy",m),eN=((y=eN||{})[y.Document=0]="Document",y[y.DocumentType=1]="DocumentType",y[y.Element=2]="Element",y[y.Text=3]="Text",y[y.CDATA=4]="CDATA",y[y.Comment=5]="Comment",y),eM=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(e){return this.logger.debug("Remote config localstorage failed to access: ",e),Promise.resolve(t)}if(null===e)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(t);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(e){return this.logger.debug("Remote config localstorage failed to parse: ",e),localStorage.removeItem(this.key),Promise.resolve(t)}},e.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(e){this.logger.debug("Remote config localstorage failed to set: ",e)}return Promise.resolve(!1)},e}(),eU=(0,q.__spreadArray)([],(0,q.__read)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),eq=function(e){var t,n=(0,es.l)();if(!(null===(t=null==n?void 0:n.crypto)||void 0===t?void 0:t.getRandomValues))return e?(e^16*Math.random()>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,eq);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,q.__spreadArray)([],(0,q.__read)(r.entries()),!1).map(function(e){var t=(0,q.__read)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(eU[r]):eU[r]}).join("")}
1,eF={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},ej=function(){function e(e,t,n,r){void 0===n&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=e,this.serverUrl=r||("US"===n?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=t,this.storage=new eM(e,t)}return e.prototype.subscribe=function(e,t,n){var r=eq(),i={id:r,key:e,deliveryMode:t,callback:n};return this.callbackInfos.push(i),"all"===t?this.subscribeAll(i):this.subscribeWaitForRemote(i,t.timeout),r},e.prototype.unsubscribe=function(e){var t=this.callbackInfos.findIndex(function(t){return t.id===e});return -1===t?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(t,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},e.prototype.updateConfigs=function(){return(0,q.__awaiter)(this,void 0,void 0,function(){var e,t=this;return(0,q.__generator)(this,function(n){switch(n.label){case 0:if(this.lastSuccessfulFetch&&Date.now()-this.lastSuccessfulFetch<3e5)return this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2];return[4,this.getOrCreateFetchPromise()];case 1:return e=n.sent(),this.storage.setConfig(e),this.callbackInfos.forEach(function(n){t.sendCallback(n,e,"remote")}),[2]}})})},e.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise||(this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){e.fetchPromise=null})):this.fetchPromise=this.fetch().then(function(t){return null!==t.remoteConfig&&(e.lastSuccessfulFetch=Date.now()),t}).finally(function(){e.fetchPromise=null})),this.fetchPromise},e.prototype.subscribeAll=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,q.__generator)(this,function(o){switch(o.label){case 0:return t=this.getOrCreateFetchPromise().then(function(t){i.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(t))),i.sendCallback(e,t,"remote"),i.storage.setConfig(t)}),n=this.storage.fetchConfig().then(function(e){return e}),[4,Promise.race([t,n])];case 1:return void 0!==(r=o.sent())&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(r))),null!==r.remoteConfig?this.sendCallback(e,r,"cache"):this.logger.debug("Remote config client skips sending c
1allback because cache is empty (first time user).")),[4,t];case 2:return o.sent(),[2]}})})},e.prototype.subscribeWaitForRemote=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){var n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:n=new Promise(function(e,n){setTimeout(function(){n("Timeout exceeded")},t)}),i.label=1;case 1:return i.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return r=i.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,r,"remote"),this.storage.setConfig(r),[3,5];case 3:return i.sent(),this.logger.debug("Remote config client subscription wait for remote mode exceeded timeout. Try to fetch from cache."),[4,this.storage.fetchConfig()];case 4:return null!==(r=i.sent()).remoteConfig?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,r,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,r,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(e,t,n){var r;e.lastCallback=new Date,r=e.key?e.key.split(".").reduce(function(e,t){return null===e?e:t in e?e[t]:null},t.remoteConfig):t.remoteConfig,e.callback(r,n,t.lastFetch)},e.prototype.fetch=function(e,t){return void 0===e&&(e=3),void 0===t&&(t=1e3),(0,q.__awaiter)(this,void 0,void 0,function(){var n,r,i,o,s,a,u=this;return(0,q.__generator)(this,function(l){switch(l.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,l,c,d;return(0,q.__generator)(this,function(f){switch(f.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),f.label=1;case 1:return f.trys.push([1,7,8,9]),[4,fetch(o.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:s.signal})];case 2:if((l=f.sent()).ok)return[3,4];return[4,l.text()];case 3:return c=f.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(l.status,": ").concat(c)),l.status===eF.INVALID_API_KEY||l.status===eF.FORBIDDEN?(o.logger.error("Remote config client fetch failed with ".concat(l.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):l.status>=400&&l.status<500&&l.status!==eF.RATE_LIMIT&&(i=!1),[3,6];case 4:return[4,l.json()];case 5:return[2,{value:{remoteConfig:f.sent(),lastFetch:new Date}}];case 6:return[3,9];case 7:return(d=f.sent())instanceof Error&&"AbortError"===d.name?o.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(t,"ms")):o.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),d),[3,9];case 8:return clearTimeout(a),[7];case 9:if(!i)return[2,"break"];if(!(r<e-1))return[3,11];return[4,new Promise(function(e){return setTimeout(e,u.getJitterDelay(n))})];case 10:f.sent(),f.label=11;case 11:return[2]}})},o=this,s=0,l.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=l.sent()))return[2,a.value];if("break"===a)return[3,4];l.label=3;case 3:return s++,[3,1];case 4:return[2,r]}})})},e.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),n=new URLSearchParams;return n.append("config_group",e.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(t,"?").concat(n.toString())},e.CONFIG_GROUP="browser",e}(),eB=function(e,t){var n=document.createDocumentFragment(),r=function(e){if(void 0===e&&(e=[]),"string"==typeof e&&(e=[e]),0!==(e=e.filter(function(e){try{n.querySelector(e)}catch(n){return t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid')),!1}return!0})).length)return e};return e.blockSelector=r(e.blockSelector),e.maskSelector=r(e.maskSelector),e.unmaskSelector=r(e.unmaskSelector),e},eH=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,n,r,i;return(0,q.__awaiter)(this,void 0,void 0,function(){var o,s,a,u,l,c,d,f,g,v,h,p,m,y,_,b,w,S=this;return(0,q.__generator)(this,function(E){switch(E.label){case 0:(o=(0,q.__assign)({},this.localConfig)).optOut=this.localConfig.optOut,o.captureEnabled=!0,E.label=1;case 1:return E.trys.push([1,3,,4]),[4,new Promise(function(e,t){S.remoteConfigClient.subscribe("configs.sessionReplay","all",function(n,r){if(S.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(r,":"),JSON.stringify(n,null,2)),!n){t(Error("No remote config received"));return}var i,a=n.sr_sampling_config,u=n.sr_privacy_config,l=n.sr_targeting_config,c=null===(i=o.interactionConfig)||void 0===i?void 0:i.ugcFilterRules;o.interactionConfig=n.sr_interaction_config,o.interactionConfig&&c&&(o.interactionConfig.ugcFilterRules=c),o.loggingConfig=n.sr_logging_config,(a||u||l)&&(s={},a&&(s.sr_sampling_config=a),u&&(s.sr_privacy_config=u),l&&(s.sr_targeting_config=l)),e()})})];case 2:return E.sent(),[3,4];case 3:return a=E.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",a),o.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:void 0}];case 4:if(!s)return[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:s}];if(u=s.sr_sampling_config,l=s.sr_privacy_config,c=s.sr_targeting_config,u&&Object.keys(u).length>0?(Object.prototype.hasOwnProperty.call(u,"capture_enabled")?o.captureEnabled=u.capture_enabled:o.captureEnabled=!1,Object.prototype.hasOwnProperty.call(u,"sample_rate")&&(o.sampleRate=u.sample_rate)):(o.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),l){d=null!==(e=o.privacyConfig)&&void 0!==e?e:{},f={defaultMaskLevel:null!==(n=null!==(t=l.defaultMaskLevel)&&void 0!==t?t:d.defaultMaskLevel)&&void 0!==n?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,q.__spreadArray)([],(0,q.__read)(new Set((0,q.__spreadArray)((0,q.__spreadArray)([],(0,q.__read)(null!==(r=d.maskAttributes)&&void 0!==r?r:[]),!1),(0,q.__read)(null!==(i=l.maskAttributes)&&void 0!==i?i:[]),!1))),!1)},g=function(e){var t,n,r,i,o,s,a,u,l,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,q.__values)(null!==(a=e.blockSelector)&&void 0!==a?a:[]),f=d.next();!f.done;f=d.next()){var g=f.value;c[g]="block"}}catch(e){t={error:e}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}try{for(var v=(0,q.__values)(null!==(u=e.maskSelector)&&void 0!==u?u:[]),h=v.next();!h.done;h=v.next()){var g=h.value;c[g]="mask"}}catch(e){r={error:e}}finally{try{h&&!h.done&&(i=v.return)&&i.call(v)}finally{if(r)throw r.error}}try{for(var p=(0,q.__values)(null!==(l=e.unmaskSelector)&&void 0!==l?l:[]),m=p.next();!m.done;m=p.next()){var g=m.value;c[g]="unmask"}}catch(e){o={error:e}}finally{try{m&&!m.done&&(s=p.return)&&s.call(p)}finally{if(o)throw o.error}}return c},v=(0,q.__assign)((0,q.__assign)({},g(d)),g(l));try{for(p=(h=(0,q.__values)(Object.entries(v))).next();!p.done;p=h.next())y=(m=(0,q.__read)(p.value,2))[0],_=m[1],"mask"===_?f.maskSelector.push(y):"block"===_?f.blockSelector.push(y):"unmask"===_&&f.unmaskSelector.push(y)}catch(e){b={error:e}}finally{try{p&&!p.done&&(w=h.return)&&w.call(h)}finally{if(b)throw b.error}}o.privacyConfig=eB(f,this.localConfig.loggerProvider)}return c&&Object.keys(c).length>0&&(o.targetingConfig=c),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:ep(o)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:o,remoteConfig:s}]}})})},e}();function eW(e,t){return t||("STAGING"===e?ei:"EU"===e?er:en)}var ez=function(){function e(e,t,n,r,i){var o,s=this;this.taskQueue=[],this.isProcessing=!1,this.compressEvent=function(e){var t=e.type,n=e.timestamp,r=e.delay,i=e.data;return null!=r?JSON.stringify({type:t,timestamp:n,delay:r,data:i}):JSON.stringify({type:t,timestamp:n,data:i})},this.addCompressedEventToManager=function(e,t){s.eventsManager&&s.deviceId&&s.eventsManager.addEvent({event:{type:"replay",data:e},sessionId:t,deviceId:s.deviceId})},this.addCompressedEvent=function(e,t){if(s.worker)try{s.worker.postMessage({event:e,sessionId:t})}catch(n){"DataCloneError"===n.name?s.worker.postMessage(JSON.stringify({event:e,sessionId:t})):s.config.loggerProvider.warn("Unexpected error while posting message to worker:",n)}else{var n=s.compressEvent(e);s.addCompressedEventToManager(n,t)}},this.terminate=function(){var e;null===(e=s.worker)||void 0===e||e.terminate()};var a=(0,es.l)();if(this.canUseIdleCallback=a&&"requestIdleCallback"in a,this.eventsManager=e,this.config=t,this.deviceId=n,this.timeout=(null===(o=t.performanceConfig)||void 0===o?void 0:o.timeout)||2e3,this.onFullSnapshotProcessed=i,r){t.loggerProvider.log("Enabling web worker for compression");try{var u=new Blob([r],{type:"application/javascript"}),l=URL.createObjectURL(u),c=new Worker(l);c.onerror=function(e){e.preventDefault(),t.loggerProvider.error("Worker failed, falling back to non-worker compression: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),c.terminate(),s.worker=void 0},c.onmessage=function(e){var t=e.data,n=t.compressedEvent,r=t.sessionId;s.addCompressedEventToManager(n,r)},this.worker=c}catch(e){t.loggerProvider.error("Failed to create worker, falling back to non-worker compression:",e)}}}return e.prototype.scheduleIdleProcessing=function(){var e=this;this.isProcessing||(this.isProcessing=!0,requestIdleCallback(function(t){e.processQueue(t)},{timeout:this.timeout}))},e.prototype.enqueueEvent=function(e,t){if(e.type===eP.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0){try{for(var n,r,i,o,s=(0,q.__values)(this.taskQueue.splice(0)),a=s.next();!a.done;a=s.next()){var u=a.value,l=this.compressEvent(u.event);this.addCompressedEventToManager(l,u.sessionId)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}this.isProcessing=!1}var c=this.compressEvent(e);this.addCompressedEventToManager(c,t),null===(i=this.onFullSnapshotProcessed)||void 0===i||i.call(this);return}this.canUseIdleCallback&&(null===(o=this.config.performanceConfig)||void 0===o?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.taskQueue.push({event:e,sessionId:t}),this.scheduleIdleProcessing()):(this.config.loggerProvider.debug("Processing event without idle callback."),this.addCompressedEvent(e,t))},e.prototype.processQueue=function(e){for(var t=this;this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var n=this.taskQueue.shift();if(n){var r=n.event,i=n.sessionId;this.addCompressedEvent(r,i)}}this.taskQueue.length>0?requestIdleCallback(function(e){t.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e}(),eV="Session replay event batch rejected due to exceeded retry count",eK="Failed to store session replay events in IndexedDB",e$="1.36.0",eJ=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher,i=e.workerScript,o=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.loggerProvider=n,this.payloadBatcher=r||function(e){return e},this.trackServerUrl=t,i)try{var s=new Blob([i],{type:"application/javascript"}),a=URL.createObjectURL(s),u=new Worker(a);u.onerror=function(e){var t,r;e.preventDefault(),n.error("Track destination worker failed, falling back to main-thread sending: ".concat(e.message," (").concat(e.filename,":").concat(e.lineno,")")),u.terminate(),o.worker=void 0;
1try{for(var i=(0,q.__values)(o.pendingWorkerRequests),s=i.next();!s.done;s=i.next()){var a=(0,q.__read)(s.value,2)[1];n.warn("Session replay event send failed due to worker crash: ".concat(e.message)),a.resolve()}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}o.pendingWorkerRequests.clear()},u.onmessage=function(e){var t=e.data;if("log"===t.type)n.log(t.message);else if("warn"===t.type)n.warn(t.message);else if("complete"===t.type){var r=o.pendingWorkerRequests.get(t.id);r&&(o.completeRequest({context:r.context}),r.resolve(),o.pendingWorkerRequests.delete(t.id))}},this.worker=u}catch(e){n.error("Failed to create track destination worker, falling back to main-thread sending:",e)}}return e.prototype.sendEventsList=function(e){this.addToQueue((0,q.__assign)((0,q.__assign)({},e),{attempts:0,timeout:0}))},e.prototype.sendBeacon=function(e){var t,n,r=e.events,i=e.sessionId,o=e.deviceId,s=e.apiKey,a=e.serverZone,u=function(e){return new Blob([e]).size},l=r,c=JSON.stringify({version:2,events:l});if(u(c)>65536){for(var d=0,f=l.length;d<f;){var g=Math.floor((d+f+1)/2);65536>=u(JSON.stringify({version:2,events:l.slice(0,g)}))?d=g:f=g-1}c=JSON.stringify({version:2,events:l=l.slice(0,d)}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(r.length," to ").concat(l.length," events"))}if(0!==l.length){var v=new URLSearchParams({device_id:o,session_id:String(i),type:"replay",api_key:s}),h="".concat(eW(a,this.trackServerUrl),"?").concat(v.toString()),p=(0,es.l)();try{var m=new Blob([c],{type:"application/json"}),y=null===(n=null===(t=null==p?void 0:p.navigator)||void 0===t?void 0:t.sendBeacon)||void 0===n?void 0:n.call(t,h,m);!1===y&&this.loggerProvider.warn("sendBeacon failed to queue session replay payload")}catch(e){}}},e.prototype.addToQueue=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.filter(function(t){return t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:eV}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;this.scheduled||(this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},e))},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,q.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,q.__generator)(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),a.label=1;case 1:a.trys.push([1,6,7,8]),r=(n=(0,q.__values)(t)).next(),a.label=2;case 2:if(r.done)return[3,5];return i=r.value,[4,this.send(i,e)];case 3:a.sent(),a.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return o={error:a.sent()},[3,8];case 7:try{r&&!r.done&&(s=n.return)&&s.call(n)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,q.__awaiter)(this,void 0,void 0,function(){var n,r,i,o;return(0,q.__generator)(this,function(s){return(n=e.apiKey)?(r=e.deviceId)?0===(i=this.payloadBatcher({version:1,events:e.events})).events.length?(this.completeRequest({context:e}),[2]):(o=this.worker)?[2,this.sendViaWorker(o,e,i,t)]:[2,this.sendOnMainThread(n,r,e,i,t)]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing device ID"})]:[2,this.completeRequest({context:e,err:"Session replay event batch not sent due to missing api key"})]})})},e.prototype.sendViaWorker=function(e,t,n,r){return(0,q.__awaiter)(this,void 0,void 0,function(){var i,o=this;return(0,q.__generator)(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a;o.pendingWorkerRequests.set(i,{context:t,resolve:s}),e.postMessage({type:"send",id:i,payload:n,useRetry:r,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!==(a=t.flushMaxRetries)&&void 0!==a?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:ed(),sdkVersion:e$}})})]})})},e.prototype.sendOnMainThread=function(e,t,n,r,i){var o,s,a,u;return(0,q.__awaiter)(this,void 0,void 0,function(){var l,c,d,f,g,v,h,p,m,y,_,b,w;return(0,q.__generator)(this,function(S){switch(S.label){case 0:l=ed(),c=e$,d=n.sampleRate,f=new 
1URLSearchParams({device_id:t,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),g="".concat(null!==(s=null===(o=n.version)||void 0===o?void 0:o.type)&&void 0!==s?s:"standalone","/").concat(null!==(u=null===(a=n.version)||void 0===a?void 0:a.version)&&void 0!==u?u:c),S.label=1;case 1:if(S.trys.push([1,9,,10]),v=JSON.stringify(r),!((h=(0,es.l)())&&"CompressionStream"in h))return[3,3];return[4,function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){var n,r,i,o,s,a,u,l,c,d,f,g,v=this;return(0,q.__generator)(this,function(h){switch(h.label){case 0:return h.trys.push([0,4,,5]),r=(n=new t.CompressionStream("gzip")).writable.getWriter(),i=n.readable.getReader(),o=[],s=(0,q.__awaiter)(v,void 0,void 0,function(){var e,t,n;return(0,q.__generator)(this,function(r){switch(r.label){case 0:return[4,i.read()];case 1:if(t=(e=r.sent()).done,n=e.value,t)return[3,3];o.push(n),r.label=2;case 2:return[3,0];case 3:return[2]}})}),[4,r.write(new TextEncoder().encode(e))];case 1:return h.sent(),[4,r.close()];case 2:return h.sent(),[4,s];case 3:h.sent(),a=new Uint8Array(o.reduce(function(e,t){return e+t.length},0)),u=0;try{for(c=(l=(0,q.__values)(o)).next();!c.done;c=l.next())d=c.value,a.set(d,u),u+=d.length}catch(e){f={error:e}}finally{try{c&&!c.done&&(g=l.return)&&g.call(l)}finally{if(f)throw f.error}}return[2,a];case 4:return h.sent(),[2,null];case 5:return[2]}})})}(v,h)];case 2:return m=S.sent(),[3,4];case 3:m=null,S.label=4;case 4:return p=m,y={headers:(0,q.__assign)({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":c,"X-Client-Library":g,"X-Client-Url":l.substring(0,1e3),"X-Client-Sample-Rate":"".concat(d),"X-Sampling-Hash-Alg":"xxhash32"},p?{"Content-Encoding":"gzip"}:{}),body:null!=p?p:v,method:"POST"},[4,fetch("".concat(eW(n.serverZone,this.trackServerUrl),"?").concat(f.toString()),y)];case 5:if(null===(_=S.sent()))return this.completeRequest({context:n,err:"Unexpected error occurred"}),[2];if(i)return[3,6];b="";try{b=JSON.stringify(_.body,null,2)}catch(e){}return this.completeRequest({context:n,success:"".concat(_.status,": ").concat(b)}),[3,8];case 6:return[4,this.handleReponse(_.status,n)];case 7:S.sent(),S.label=8;case 8:return[3,10];case 9:return w=S.sent(),this.completeRequest({context:n,err:w}),[3,10];case 10:return[2]}})})},e.prototype.handleReponse=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){switch(n.label){case 0:switch(new W().buildStatus(e)){case T.Success:return[3,1];case T.Failed:return[3,2]}return[3,4];case 1:return this.handleSuccessResponse(t),[3,5];case 2:return[4,this.handleOtherResponse(t)];case 3:return n.sent(),[3,5];case 4:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),n.label=5;case 5:return[2]}})})},e.prototype.handleSuccessResponse=function(e){var t=Math.round(new Blob(e.events).size/1024);this.completeRequest({context:e,success:"Session replay event batch tracked successfully for session id ".concat(e.sessionId,", size of events: ").concat(t," KB")})},e.prototype.handleOtherResponse=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){var t;return(0,q.__generator)(this,function(n){switch(n.label){case 0:if(t=Math.random()*e.attempts*this.retryTimeout,e.attempts++,e.attempts>(e.flushMaxRetries||0))return this.completeRequest({context:e,err:eV}),[2];return[4,new Promise(function(e){return setTimeout(e,t)})];case 1:return n.sent(),[4,this.send(e,!0)];case 2:return n.sent(),[2]}})})},e.prototype.completeRequest=function(e){var t=e.context,n=e.err,r=e.success;t.onComplete(),n?this.loggerProvider.warn(n):r&&this.loggerProvider.log(r)},e}(),eG=n(90960),eY=function(){function e(e){var t,n,r,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=1e6,this.interval=this.minInterval,this._timeAtLastSplit=Date.now(),this.shouldSplitEventsList=function(e,t){var n=i.getStringSize(t);return i.getEventsArraySize(e)+n>=i.maxPersistedEventsSize||Date.now()-i.timeAtLastSplit>i.interval&&!!e.length&&(i.interval=Math.min(i.maxInterval,i.interval+i.minInterval),i._timeAtLastSplit=Date.now(),!0)},this.loggerProvider=e.loggerProvider,this.minInterval=null!==(t=e.minInterval)&&void 0!==t?t:this.minInterval,this.maxInterval=null!==(n=e.maxInterval)&&void 0!==n?n:this.maxInterval,this.maxPer
1sistedEventsSize=null!==(r=e.maxPersistedEventsSize)&&void 0!==r?r:this.maxPersistedEventsSize}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit},enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){return e.length},e.prototype.getEventsArraySize=function(e){var t,n,r=0;try{for(var i=(0,q.__values)(e),o=i.next();!o.done;o=i.next()){var s=o.value;r+=this.getStringSize(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return r+(2+Math.max(0,e.length-1)+2*e.length)},e}(),eQ=function(e,t,n){"object"==typeof n&&null!==n&&"AbortError"===n.name?e.debug(t):e.warn(t)},eZ="sessionCurrentSequence",eX="sequencesToSend",e0=function(e){var t,n;return e.objectStoreNames.contains(eZ)||(n=e.createObjectStore(eZ,{keyPath:"sessionId"})),e.objectStoreNames.contains(eX)||(t=e.createObjectStore(eX,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},e1=function(e){function t(t){var n=e.call(this,t)||this;return n.getSequencesToSend=function(){return(0,q.__awaiter)(n,void 0,void 0,function(){var e,t,n,r,i,o;return(0,q.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,5,,6]),e=[],[4,this.db.transaction("sequencesToSend").store.openCursor()];case 1:t=s.sent(),s.label=2;case 2:if(!t)return[3,4];return r=(n=t.value).sessionId,i=n.events,e.push({events:i,sequenceId:t.key,sessionId:r}),[4,t.continue()];case 3:return t=s.sent(),[3,2];case 4:return[2,e];case 5:return o=s.sent(),eQ(this.loggerProvider,"".concat(eK,": ").concat(o),o),[3,6];case 6:return[2,void 0]}})})},n.storeCurrentSequence=function(e){return(0,q.__awaiter)(n,void 0,void 0,function(){var t,n,r;return(0,q.__generator)(this,function(i){switch(i.label){case 0:return i.trys.push([0,4,,5]),[4,this.db.get(eZ,e)];case 1:if(!(t=i.sent()))return[2,void 0];return[4,this.db.put(eX,{sessionId:e,events:t.events})];case 2:return n=i.sent(),[4,this.db.put(eZ,{sessionId:e,events:[]})];case 3:return i.sent(),[2,(0,q.__assign)((0,q.__assign)({},t),{sessionId:e,sequenceId:n})];case 4:return r=i.sent(),eQ(this.loggerProvider,"".concat(eK,": ").concat(r),r),[3,5];case 5:return[2,void 0]}})})},n.addEventToCurrentSequence=function(e,t){return(0,q.__awaiter)(n,void 0,void 0,function(){var n,r,i,o,s,a;return(0,q.__generator)(this,function(u){switch(u.label){case 0:return u.trys.push([0,10,,11]),[4,(n=this.db.transaction(eZ,"readwrite")).store.get(e)];case 1:if(r=u.sent())return[3,3];return[4,n.store.put({sessionId:e,events:[t]})];case 2:return u.sent(),[2];case 3:if(i=void 0,!this.shouldSplitEventsList(r.events,t))return[3,5];return i=r.events,[4,n.store.put({sessionId:e,events:[t]})];case 4:return u.sent(),[3,7];case 5:return o=r.events.concat(t),[4,n.store.put({sessionId:e,events:o})];case 6:u.sent(),u.label=7;case 7:return[4,n.done];case 8:if(u.sent(),!i)return[2,void 0];return[4,this.storeSendingEvents(e,i)];case 9:if(!(s=u.sent()))return[2,void 0];return[2,{events:i,sessionId:e,sequenceId:s}];case 10:return a=u.sent(),eQ(this.loggerProvider,"".concat(eK,": ").concat(a),a),[3,11];case 11:return[2,void 0]}})})},n.storeSendingEvents=function(e,t){return(0,q.__awaiter)(n,void 0,void 0,function(){var n;return(0,q.__generator)(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.db.put(eX,{sessionId:e,events:t})];case 1:return[2,r.sent()];case 2:return n=r.sent(),eQ(this.loggerProvider,"".concat(eK,": ").concat(n),n),[3,3];case 3:return[2,void 0]}})})},n.cleanUpSessionEventsStore=function(e,t){return(0,q.__awaiter)(n,void 0,void 0,function(){var e;return(0,q.__generator)(this,function(n){switch(n.label){case 0:if(!t)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this.db.delete(eX,t)];case 2:return n.sent(),[3,4];case 3:return e=n.sent(),eQ(this.loggerProvider,"".concat(eK,": ").concat(e),e),[3,4];case 4:return[2]}})})},n.db=t.db,n}return(0,q.__extends)(t,e),t.new=function(e,n){return(0,q.__awaiter)(this,void 0,void 0,function(){var r,i,o;return(0,q.__generator)(this,function(s){switch(s.label){case 0:var a;return s.trys.push([0,2,,3]),r="replay"===e?"":"_".concat(e),[4,(a="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(r),(0,q.__awaiter)(void 0,void 0,void 0,function(){return(0,q.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,eG.X3)(a,1,{upgrade:e0})];case 1:return[2,e.sent()]}})}))];case 1:return i=s.sent(),[2,new t((0,q.__assign)((0,q.__assign)({},n),{db:i}))];case 2:return o=s.sent(),eQ(n.loggerProvider,"".concat(eK,": ").concat(o),o),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,q.__generator)(this,function(a){switch(a.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=a.sent()))return[2,void 0];return[2,[t]];case 2:n=[],a.label=3;case 3:return a.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:i=(r=q.__values.apply(void 0,[a.sent()])).next(),a.label=5;case 5:if(i.done)return[3,7];
1t=i.value,n.push(t),a.label=6;case 6:return i=r.next(),[3,5];case 7:return[3,10];case 8:return o={error:a.sent()},[3,10];case 9:try{i&&!i.done&&(s=r.return)&&s.call(r)}finally{if(o)throw o.error}return[7];case 10:return[2,n]}})})},t}(eY),e2=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t}return(0,q.__extends)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=(0,q.__spreadArray)([],(0,q.__read)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,sessionId:e}},t.prototype.getSequencesToSend=function(){return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(e){return[2,Object.entries(this.finalizedSequences).map(function(e){var t=(0,q.__read)(e,2),n=t[0],r=t[1],i=r.sessionId,o=r.events;return{sequenceId:Number(n),sessionId:i,events:o}})]})})},t.prototype.storeCurrentSequence=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(t){return this.sequences[e]?[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){var n;return(0,q.__generator)(this,function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(n=this.addSequence(e)),this.sequences[e].push(t),[2,n]})})},t.prototype.storeSendingEvents=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(eY),e3=function(e){var t=e.config,n=e.minInterval,r=e.maxInterval,i=e.type,o=e.payloadBatcher,s=e.storeType,a=e.trackDestinationWorkerScript;return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e,u,l,c,d,f,g,v,h;function p(t){return void 0===t&&(t=!1),(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){return[2,e.flush(t)]})})}return(0,q.__generator)(this,function(m){switch(m.label){case 0:if(e=new eJ((0,q.__assign)((0,q.__assign)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:o,workerScript:a})),u=function(){return new e2({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n})},l=function(){return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,q.__generator)(this,function(o){switch(o.label){case 0:return[4,e1.new(i,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,apiKey:t.apiKey})];case 1:if(!(e=o.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,u()];return[2,e]}})})},"idb"!==s)return[3,2];return[4,l()];case 1:return d=m.sent(),[3,3];case 2:d=u(),m.label=3;case 3:return c=d,f=[],g=0,v=function(e){if(!(e<=g)){var t=Math.min(e-g,f.length);t>0&&(f.splice(0,t),g=e)}},h=function(n){var r=n.events,o=n.sessionId,s=n.deviceId,a=n.sequenceId;t.debugMode&&eh().then(function(e){var n=e.totalStorageSize,r=e.percentOfQuota,i=e.usageDetails;t.loggerProvider.debug("Total storage size: ".concat(n," KB, percentage of quota: ").concat(r,"%, usage details: ").concat(i))}).catch(function(){}),e.sendEventsList({events:r,sessionId:o,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:i,onComplete:function(){return(0,q.__awaiter)(void 0,void 0,void 0,function(){return(0,q.__generator)(this,function(e){switch(e.label){case 0:return[4,c.cleanUpSessionEventsStore(o,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var n=e.sessionId,r=e.deviceId,i=g+f.length;c.storeCurrentSequence(n).then(function(e){e&&(v(i),h({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r}))}).catch(function(e){t.loggerProvider.warn("Failed to get current sequence of session replay events for session:",e)})},addEvent:function(e){var n=e.event,r=e.sessionId,i=e.deviceId,o=g+f.length;f.push(n.data),c.addEventToCurrentSequence(r,n.data).then(function(e){e&&(v(o),h({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:i}))}).catch(function(e){t.loggerProvider.warn("Failed to add event to session replay capture:",e)})},sendStoredEvents:function(e){var t=e.deviceId;return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e;return(0,q.__generator)(this,function(n){switch(n.label){case 0:return[4,c.getSequencesToSend()];case 1:return(e=n.sent())&&e.forEach(function(e){h({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:t})}),[2]}})})},flush:p,getBeaconEvents:function(){return(0,q.__spreadArray)([],(0,q.__read)(f),!1)},trackDestination:e}]}})})},e4=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=new Map;e.forEach(function(e){n.set(e.name,e.manager)}),this.managers=n}return e.prototype.sendStoredEvents=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){var t;return(0,q.__generator)(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEac
1h(function(n){t.push(n.sendStoredEvents(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e.prototype.addEvent=function(e){var t,n=e.sessionId,r=e.event,i=e.deviceId;null===(t=this.managers.get(r.type))||void 0===t||t.addEvent({sessionId:n,event:r,deviceId:i})},e.prototype.sendCurrentSequenceEvents=function(e){var t=e.sessionId,n=e.deviceId;this.managers.forEach(function(e){e.sendCurrentSequenceEvents({sessionId:t,deviceId:n})})},e.prototype.flush=function(e){return(0,q.__awaiter)(this,void 0,void 0,function(){var t;return(0,q.__generator)(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(function(n){t.push(n.flush(e))}),[4,Promise.all(t)];case 1:return n.sent(),[2]}})})},e}();function e5(e,t,n){for(var r=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,u,l,c=new Date().getTime()-L.getTime();if(void 0!==x.timeoutMs&&c>x.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=tr((e=o.getAttribute("id"))&&x.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||tr.apply(void 0,(0,q.__spreadArray)([],(0,q.__read)(Array.from(o.attributes).filter(function(e){return x.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||tr.apply(void 0,(0,q.__spreadArray)([],(0,q.__read)(Array.from(o.classList).filter(x.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||tr((a=o.tagName.toLowerCase(),x.tagName(a)?{name:a,penalty:2}:null))||[te()],f=function(e){var t=e.parentNode;if(!t)return null;var n=t.firstChild;if(!n)return null;for(var r=0;n&&(n.nodeType===Node.ELEMENT_NODE&&r++,n!==e);)n=n.nextSibling;return r}(o);if("all"==t)f&&(d=d.concat(d.filter(tn).map(function(e){return tt(e,f)})));else if("two"==t)d=d.slice(0,1),f&&(d=d.concat(d.filter(tn).map(function(e){return tt(e,f)})));else if("one"==t){var g=(0,q.__read)(d=d.slice(0,1),1)[0];f&&tn(g)&&(d=[tt(g,f)])}else"none"==t&&(d=[te()],f&&(d=[tt(d[0],f)]));try{for(var v=(u=void 0,(0,q.__values)(d)),h=v.next();!h.done;h=v.next()){var g=h.value;g.level=s}}catch(e){u={error:e}}finally{try{h&&!h.done&&(l=v.return)&&l.call(v)}finally{if(u)throw u.error}}if(i.push(d),i.length>=x.seedMinLength&&(r=e6(i,n)))return"break";o=o.parentElement,s++}(););return(r||(r=e6(i,n)),!r&&n)?n():r}function e6(e,t){var n,r,i=to(function e(t,n){var r,i,o,s,a;return void 0===n&&(n=[]),(0,q.__generator)(this,function(u){switch(u.label){case 0:if(!(t.length>0))return[3,9];u.label=1;case 1:u.trys.push([1,6,7,8]),i=(r=(0,q.__values)(t[0])).next(),u.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,q.__values)(e(t.slice(1,t.length),n.concat(o)))];case 3:u.sent(),u.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s={error:u.sent()},[3,8];case 7:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}return[7];case 8:return[3,11];case 9:return[4,n];case 10:u.sent(),u.label=11;case 11:return[2]}})}(e));if(i.length>x.threshold)return t?t():null;try{for(var o=(0,q.__values)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(e7(a))return a}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null}function e8(e){for(var t=e[0],n=t.name,r=1;r<e.length;r++){var i=e[r].level||0;n=t.level===i-1?"".concat(e[r].name," > ").concat(n):"".concat(e[r].name," ").concat(n),t=e[r]}return n}function e9(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function e7(e){var t=e8(e);switch(D.querySelectorAll(t).length){case 0:throw Error("Can't select any node with this selector: ".concat(t));case 1:return!0;default:return!1}}function te(){return{name:"*",penalty:3}}function tt(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function tn(e){return"html"!==e.name&&!e.name.startsWith("#")}function tr(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(ti);return n.length>0?n:null}function ti(e){return null!=e}function to(e){return(0,q.__spreadArray)([],(0,q.__read)(e),!1).sort(function(e,t){return e9(e)-e9(t)})}var ts=function(e){var t=e.version,n=e.events,r=[];
1return n.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)}),{version:t,events:r}},ta=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);"click"===t.type&&r.push(t)}),{version:t,events:Object.values(r.reduce(function(e,t){var n=t.x,r=t.y,i=t.selector,o=t.timestamp,s=o-o%36e5,a="".concat(n,":").concat(r,":").concat(null!=i?i:"",":").concat(s);return e[a]?e[a].count+=1:e[a]=(0,q.__assign)((0,q.__assign)({},t),{timestamp:s,count:1}),e},{}))}},tu=function(e,t){var n=this;this.createHook=function(e){var t=e.eventsManager,r=e.sessionId,i=e.deviceIdFn,o=e.mirror,s=e.ugcFilterRules,a=e.performanceOptions;return function(e){if(e.type===eO.Click){var u,l=(0,es.l)();if(l){var c=l.location,d=l.innerHeight,f=l.innerWidth;if(c){var g=e.x,v=e.y;if(void 0!==g&&void 0!==v){var h=o.getNode(e.id);if(h)try{u=function(e,t){if(L=new Date,e.nodeType!==Node.ELEMENT_NODE)throw Error("Can't generate CSS selector for non-element node type.");if("html"===e.tagName.toLowerCase())return"html";var n,r={root:document.body,idName:function(e){return!0},className:function(e){return!0},tagName:function(e){return!0},attr:function(e,t){return!1},seedMinLength:1,optimizedMinLength:2,threshold:1e3,maxNumberOfTries:1e4,timeoutMs:void 0};D=(n=(x=(0,q.__assign)((0,q.__assign)({},r),t)).root).nodeType===Node.DOCUMENT_NODE?n:n===r.root?n.ownerDocument:n;var i=e5(e,"all",function(){return e5(e,"two",function(){return e5(e,"one",function(){return e5(e,"none")})})});if(i){var o=to(function e(t,n,r){var i,o,s;return void 0===r&&(r={counter:0,visited:new Map}),(0,q.__generator)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>x.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var u;if(!(i<t.length-1))return[3,5];if(r.counter>x.maxNumberOfTries||(r.counter+=1,(o=(0,q.__spreadArray)([],(0,q.__read)(t),!1)).splice(i,1),s=e8(o),r.visited.has(s)))return[2];if(!(e7(o)&&(u=o,D.querySelector(e8(u))===n)))return[3,4];return[4,o];case 2:return a.sent(),r.visited.set(s,!0),[5,(0,q.__values)(e(o,n,r))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(i,e));return o.length>0&&(i=o[0]),e8(i)}throw Error("Selector was not found.")}(h,a)}catch(e){n.logger.debug("error resolving selector from finder")}var p=ev(c.href,s),m={x:g+n.scrollWatcher.currentScrollX,y:v+n.scrollWatcher.currentScrollY,selector:u,viewportHeight:d,viewportWidth:f,pageUrl:p,timestamp:Date.now(),type:"click"},y=i();y&&t.addEvent({sessionId:r,event:{type:"interaction",data:JSON.stringify(m)},deviceId:y})}}}}}},this.logger=e,this.scrollWatcher=t};function tl(){var e=(0,es.l)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function tc(){var e=(0,es.l)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var td=function(){function e(e,t){var n=(0,es.l)();n&&n.navigator&&"function"==typeof n.navigator.sendBeacon?this.sendBeacon=function(e,t){try{if(n.navigator.sendBeacon(e,JSON.stringify(t)))return!0}catch(e){}return!1}:this.sendBeacon=function(){return!1},this.sendXhr=function(e,t){var n=new XMLHttpRequest;return n.open("POST",e,!0),n.setRequestHeader("Accept","*/*"),n.send(JSON.stringify(t)),!0},this.basePageUrl=eW(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e}return e.prototype.send=function(e,t){var n=this.context,r=n.sessionId,i=n.type,o=new URLSearchParams({device_id:e,session_id:String(r),type:String(i),api_key:this.apiKey}),s="".concat(this.basePageUrl,"?").concat(o.toString());this.sendBeacon(s,t)||this.sendXhr(s,t)},e}(),tf=function(){function e(e,t){var n=this;this.timestamp=Date.now(),this.hook=function(e){n.update(e)},this.send=function(e){return function(t){var r,i,o,s,a=e(),u=(0,es.l)();if(u&&a){var l=null!==(r=u.scrollX)&&void 0!==r?r:0,c=null!==(i=u.scrollY)&&void 0!==i?i:0;(l>0||c>0)&&n.update({id:1,x:l,y:c}),n.transport.send(a,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHe
1ight:tl(),viewportWidth:tc(),pageUrl:ev(u.location.href,null!==(s=null===(o=n.config.interactionConfig)||void 0===o?void 0:o.ugcFilterRules)&&void 0!==s?s:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=tc(),this._maxScrollHeight=tl(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new td(t,n),n)},Object.defineProperty(e.prototype,"maxScrollX",{get:function(){return this._maxScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollY",{get:function(){return this._maxScrollY},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollWidth",{get:function(){return this._maxScrollWidth},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"maxScrollHeight",{get:function(){return this._maxScrollHeight},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollX",{get:function(){return this._currentScrollX},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentScrollY",{get:function(){return this._currentScrollY},enumerable:!1,configurable:!0}),e.prototype.update=function(e){var t=Date.now();if(this._currentScrollX=e.x,this._currentScrollY=e.y,e.x>this._maxScrollX){var n=tc();this._maxScrollX=e.x;var r=e.x+n;r>this._maxScrollWidth&&(this._maxScrollWidth=r),this.timestamp=t}if(e.y>this._maxScrollY){var i=tl();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),tg=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId="".concat(n,"/").concat(t))},tv=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,q.__awaiter)(e,void 0,void 0,function(){return(0,q.__generator)(this,function(e){switch(e.label){case 0:return[4,(0,eG.X3)(t,1,{upgrade:function(e){e.objectStoreNames.contains("sessionTargetingMatch")||e.createObjectStore("sessionTargetingMatch",{keyPath:"sessionId"})}})];case 1:return[2,e.sent()]}})})},this.openOrCreateDB=function(t){return(0,q.__awaiter)(e,void 0,void 0,function(){var e,n;return(0,q.__generator)(this,function(r){switch(r.label){case 0:if(this.dbs&&this.dbs[t])return[2,this.dbs[t]];return e="".concat(t.substring(0,10),"_amp_session_replay_targeting"),[4,this.createStore(e)];case 1:return n=r.sent(),this.dbs[t]=n,[2,n]}})})},this.getTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId;return(0,q.__awaiter)(e,void 0,void 0,function(){var e,t,o,s;return(0,q.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),[4,e.get("sessionTargetingMatch",t)];case 2:return[2,null==(o=a.sent())?void 0:o.targetingMatch];case 3:return s=a.sent(),eQ(n,"Failed to get targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.storeTargetingMatchForSession=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.sessionId,o=t.targetingMatch;return(0,q.__awaiter)(e,void 0,void 0,function(){var e,t,s;return(0,q.__generator)(this,function(a){switch(a.label){case 0:return a.trys.push([0,3,,4]),[4,this.openOrCreateDB(r)];case 1:return e=a.sent(),t=String(i),[4,e.put("sessionTargetingMatch",{targetingMatch:o,sessionId:t,lastUpdated:Date.now()})];case 2:return[2,a.sent()];case 3:return s=a.sent(),eQ(n,"Failed to store targeting match for session id ".concat(i,": ").concat(s),s),[3,4];case 4:return[2,void 0]}})})},this.clearStoreOfOldSessions=function(t){var n=t.loggerProvider,r=t.apiKey,i=t.currentSessionId;return(0,q.__awaiter)(e,void 0,void 0,function(){var e,t,o,s,a,u,l,c;return(0,q.__generator)(this,function(d){switch(d.label){case 0:return d.trys.push([0,8,,9]),[4,this.openOrCreateDB(r)];case 1:return e=d.sent(),t=String(i),[4,(o=e.transaction("sessionTargetingMatch","readwrite")).store.getAll()];case 2:s=d.sent(),a=0,d.label=3;case 3:if(!(a<s.length))return[3,6];if(u=s[a],l=Date.now()-u.lastUpdated,!(u.sessionId!==t&&l>1728e5))return[3,5];return[4,o.store.delete(u.sessionId)];case 4:d.sent(),d.label=5;case 5:return a++,[3,3];case 6:return[4,o.done];case 7:return d.sent(),[3,9];case 8:return c=d.sent(),eQ(n,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},th=function(e){var t=e.sessionId,r=e.targetingConfig,i=e.loggerProvider,o=e.apiKey,s=e.targetingParams,a=e.urlChange,u=void 0!==a&&a;return(0,q.__awaiter)(void 0,void 0,void 0,function(){var e,a,l;return(0,q.__generator)(this,function(c){switch(c.label){case 0:return[4,tv.clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:t})];case 1:return c.sent(),[4,tv.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t})];case 2:if(!0===c.sent()&&!u)return[2,!0];e=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,Promise.all([n.e(6434),n.e(8401)]).then(n.bind(n,18401))];case 4:return[4,(0,c.sent().evaluateTargeting)((0,q.__assign)((0,q.__assign)({},s),{flag:r,sessionId:"string"==typeof t?parseInt(t,10):t,apiKey:o,loggerProvider:i}))];case 5:return(a=c.sent())&&a.sr_targeting_config&&(e="on"===a.sr_targeting_config.key),tv.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t,targetingMatch:e}),[3,7];case 6:return l=c.sent(),i.warn(l.message),[3,7];case 7:return[2,e]}})})};function tp(e,t){return(e<<t|e>>>32-t)>>>0}function tm(e,t){return e=Math.imul(e=tp(e=e+Math.imul(t,2246822519)>>>0,13),2654435761)>>>0}function ty(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var t_="__amplitude_url_tracking_patched__",tb=new WeakMap;function tw(e,t,n){if(void 0===n&&(n={}),!(null==e?void 0:e.location))return function(){};var r=n.enablePolling,i=n.pollingInterval;if(void 0!==r&&r){var o=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""},s=o(),a=e.setInterval(function(){var e=o();e!==s&&(s=e,t(e))},void 0===i?1e3:i);return function(){null!=a&&e.clearInterval(a)}}var u=tb.get(e);if(!u){var l=void 0,c=new Set,d=function(){var t;return null!==(t=e.location.href)&&void 0!==t?t:""},f=function(){var e=d();
1(void 0===l||e!==l)&&(l=e,c.forEach(function(t){return t(e)}))},g=function(e){var t=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var r=e.apply(this,t);return f(),r};return t[t_]=!0,t},v=e.history;if(null==v?void 0:v.pushState){var h=Reflect.get(v,"pushState");h[t_]||(v.pushState=g(h))}if(null==v?void 0:v.replaceState){var p=Reflect.get(v,"replaceState");p[t_]||(v.replaceState=g(p))}u={callbacks:c,notify:f,onPopStateOrHashChange:function(){return f()},listenersAttached:!1},tb.set(e,u)}var m=u;return m.listenersAttached||(e.addEventListener("popstate",m.onPopStateOrHashChange),e.addEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!0),m.callbacks.add(t),function(){m.callbacks.delete(t),0===m.callbacks.size&&m.listenersAttached&&(e.removeEventListener("popstate",m.onPopStateOrHashChange),e.removeEventListener("hashchange",m.onPopStateOrHashChange),m.listenersAttached=!1)}}function tS(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,o,s,a=(0,q.__assign)((0,q.__assign)({},e),r),u=a.ugcFilterRules||[],l=null!==(i=a.enablePolling)&&void 0!==i&&i,c=null!==(o=a.pollingInterval)&&void 0!==o?o:1e3,d=null!==(s=a.captureDocumentTitle)&&void 0!==s&&s;if(!n)return function(){};var f=void 0,g=function(){return n.location&&n.location.href||""},v=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=g(),o="";return d&&(o=(null==r?void 0:r.title)||""),{href:u.length>0?ev(i,u):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},h=function(){var e=g();(void 0===f||e!==f)&&(f=e,t(v()))},p=tw(n,function(){return h()},l?{enablePolling:!0,pollingInterval:c}:{});return h(),function(){return p()}},options:e}}tS();var tE=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.recordFunction=null,this.urlChangeCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var n=(0,es.l)();n&&(n.removeEventListener("blur",e.blurListener),n.removeEventListener("focus",e.focusListener),t||n.addEventListener("blur",e.blurListener),t||n.addEventListener("focus",e.focusListener),n.self&&"onpagehide"in n.self?(n.removeEventListener("pagehide",e.pageLeaveListener),t||n.addEventListener("pagehide",e.pageLeaveListener)):(n.removeEventListener("beforeunload",e.pageLeaveListener),t||n.addEventListener("beforeunload",e.pageLeaveListener)))},this.blurListener=function(){e.sendEvents()},this.focusListener=function(){e.recordEvents(!1)},this.pageLeaveListener=function(t){e.pageLeaveFns.forEach(function(e){e(t)})},this.evaluateTargetingAndCapture=function(t,n,r,i){return void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===i&&(i=!1),(0,q.__awaiter)(e,void 0,void 0,function(){var e,o,s,a,u,l,c,d,f,g,v,h;return(0,q.__generator)(this,function(p){switch(p.label){case 0:if(!this.identifiers||!this.identifiers.sessionId||!this.config)return this.identifiers&&!this.identifiers.sessionId?this.loggerProvider.log("Session ID has not been set yet, cannot evaluate targeting for Session Replay."):this.loggerProvider.warn("Session replay init has not been called, cannot evaluate targeting."),[2];if(!this.config.targetingConfig){if(!n)return this.loggerProvider.log("No targeting config set, skipping initialization/recording for event."),[2];this.loggerProvider.log("Targeting config has not been set yet, cannot evaluate targeting.")}if(this.lastTargetingParams=t,!((e=this.config.targetingConfig)&&!this.sessionTargetingMatch))return[3,2];return o=i?this.latestUrlChangeTargetingEvaluationId:void 0,(s=t.event)&&Object.values(O).includes(s.event_type)&&(s=void 0),a=null!==(v=null!==(d=null===(c=t.page)||void 0===c?void 0:c.url)&&void 0!==d?d:null===(g=null===(f=(0,es.l)())||void 0===f?void 0:f.location)||void 0===g?void 0:g.href)&&void 0!==v?v:"",u=null!==(h=t.page)&&void 0!==h?h:""!==a?{url:a}:void 0,[4,th({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:u},urlChange:i})];case 1:if(l=p.sent(),i&&void 0!==o&&o!==this.latestUrlChangeTargetingEvaluationId)return this.loggerProvider.debug("Ignoring stale URL-change targeting result #".concat(o,"; latest is #").concat(this.latestUrlChangeTargetingEvaluationId,".")),[2];this.sessionTargetingMatch=this.sessionTargetingMatch||l,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),p.label=2;case 2:if(!n)return[3,3];return this.initialize(!0),[3,5];case 3:if(!(r||!this.recordCancelCallback))return[3,5];return this.loggerProvider.log("Recording events for session due to forceRestart or no ongoing recording."),[4,this.recordEvents()];case 4:p.sent(),p.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r=!0),(0,q.__awaiter)(e,void 0,void 0,function(){var e,i,o,s;return(0,q.__generator)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==P.METADATA)||(e={config:ep(i),version:e$},!r))return[3,2];return[4,eh()];case 1:o=a.sent(),e=(0,q.__assign)((0,q.__assign)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,q.__assign)((0,q.__assign)({},n),e)):this.loggerProvider.debug("Not able to add custom replay capture event ".concat(t," due to no ongoing recording.")),[3,4];case 3:return s=a.sent(),this.loggerProvider.debug("Error while adding custom replay capture event: ",s),[3,4];case 4:return[2]}})})},this.stopRecordingEvents=function(){var t;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null===(t=e.networkObservers)||void 0===t||t.stop()}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new eo(new H)}return e.prototype.init=function(e,t){return e_(this._init(e,t))},e.prototype.setupUrlChangeListenerForTargeting=function(){var e,t=this;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this);var n=(0,es.l)();if(null==n?void 0:n.location){var r=tw(n,function(e){var n=++t.latestUrlChangeTargetingEvaluationId;t.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}}
1,!1,!1,!0),t.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(n," for ").concat(e,"."))});this.urlChangeCleanup=function(){r(),t.urlChangeCleanup=null}}},e.prototype.getCurrentPageForTargeting=function(){var e,t,n=null===(t=null===(e=(0,es.l)())||void 0===e?void 0:e.location)||void 0===t?void 0:t.href;return null!=n?{url:n}:void 0},e.prototype._init=function(e,t){var r,i,o,s,a,u,l,c;return(0,q.__awaiter)(this,void 0,void 0,function(){var d,f,g,v,h,p,m,y,_,b,w,S,E,k,I,T,C,P,R,O=this;return(0,q.__generator)(this,function(A){switch(A.label){case 0:return null===(r=this.urlChangeCleanup)||void 0===r||r.call(this),this.loggerProvider=new eo(t.loggerProvider||new H),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.identifiers=new tg({sessionId:t.sessionId,deviceId:t.deviceId}),d=this,[4,(0,q.__awaiter)(void 0,void 0,void 0,function(){var n;return(0,q.__generator)(this,function(r){return n=new ey(e,t),[2,new eH(new ej(e,n.loggerProvider,n.serverZone,t.configServerUrl),n)]})})];case 1:return d.joinedConfigGenerator=A.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:if(g=(f=A.sent()).joinedConfig,v=f.localConfig,h=f.remoteConfig,this.config=g,this.setMetadata(t.sessionId,g,v,h,null===(i=t.version)||void 0===i?void 0:i.version,e$,null===(o=t.version)||void 0===o?void 0:o.type),this.pageLeaveFns=[],t.sessionId&&(null===(s=this.config.interactionConfig)||void 0===s?void 0:s.enabled)&&(p=tf.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[p.send(this.getDeviceId.bind(this)).bind(p)],this.scrollHook=p.hook.bind(p),this.clickHandler=new tu(this.loggerProvider,p)),m=[],"idb"!==(y=this.config.storeType)||(null===(a=(0,es.l)())||void 0===a?void 0:a.indexedDB)||(y="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(y," for event storage.")),w=(0,es.l)(),!(this.config.useWebWorker&&w&&w.Worker))return[3,4];return[4,n.e(7058).then(n.bind(n,57058))];case 3:E=(S=A.sent()).compressionScript,k=S.trackDestinationScript,_=E,b=k,A.label=4;case 4:return A.trys.push([4,6,,7]),[4,e3({config:this.config,type:"replay",storeType:y,trackDestinationWorkerScript:b})];case 5:return I=A.sent(),m.push({name:"replay",manager:I}),[3,7];case 6:return T=A.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(T.toString())),[3,7];case 7:if(!(null===(u=this.config.interactionConfig)||void 0===u?void 0:u.enabled))return[3,11];C=this.config.interactionConfig.batch?ta:ts,A.label=8;case 8:return A.trys.push([8,10,,11]),[4,e3({config:this.config,type:"interaction",minInterval:null!==(l=this.config.interactionConfig.trackEveryNms)&&void 0!==l?l:3e4,maxInterval:6e4,payloadBatcher:C,storeType:y,trackDestinationWorkerScript:b})];case 9:return P=A.sent(),m.push({name:"interaction",manager:P}),[3,11];case 10:return T=A.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(T.toString())),[3,11];case 11:return this.eventsManager=new(e4.bind.apply(e4,(0,q.__spreadArray)([void 0],(0,q.__read)(m),!1))),this.eventCompressor&&this.eventCompressor.terminate(),this.eventCompressor=new ez(this.eventsManager,this.config,this.getDeviceId(),_,function(){return O.sendEvents()}),this.pageLeaveFns=(0,q.__spreadArray)((0,q.__spreadArray)([],(0,q.__read)(this.pageLeaveFns),!1),[function(){if(O.config&&(null===(e=O.identifiers)||void 0===e?void 0:e.sessionId)&&I){var e,t=I.getBeaconEvents();if(t.length){var n=O.getDeviceId();n&&I.trackDestination.sendBeacon({events:t,sessionId:O.identifiers.sessionId,deviceId:n,apiKey:O.config.apiKey,serverZone:O.config.serverZone})}}}],!1),[4,this.initializeNetworkObservers()];case 12:return A.sent(),(null===(c=(0,es.l)())||void 0===c?void 0:c.opener)&&(function(e,t){if(!0!==e[eI]){e[eI]=!0;var n=null,r=function(t,n){var r,i;"background-capture-complete"===t&&(null===(i=null===(r=e.logger)||void 0===r?void 0:r.debug)||void 0===i||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(){null===(i=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===i||i.call(t,"Initializing background capture (external script)");var t,i,o=new URL("https://cdn.amplitude.com/libs/background-capture-1.0.0-alpha.3.js.gz",e.endpoint).toString();e.loadScriptOnce(o).then(function(){var t,i,o;null===(i=null===(t=e.logger)||void 0===t?void 0:t.debug)||void 0===i||i.call(t,"Backgroun
1d capture script loaded (external)"),n=null===(o=null==window?void 0:window.amplitudeBackgroundCapture)||void 0===o?void 0:o.call(window,{messenger:e,onBackgroundCapture:r}),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null===(t=e.logger)||void 0===t||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null===(e=null==n?void 0:n.close)||void 0===e||e.call(n),n=null})}}(R=function(e){var t=(0,es.l)(),n=null==t?void 0:t[eE];if("object"==typeof n&&null!==n&&eS in n&&!0===n[eS])return n;var r=new ek(void 0);return t&&(t[eE]=r),r}()),R.setup((0,q.__assign)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:ew[this.config.serverZone]}))),this.loggerProvider.log("Installing @amplitude/session-replay-browser."),this.teardownEventListeners(!1),[4,this.evaluateTargetingAndCapture({userProperties:t.userProperties,page:this.getCurrentPageForTargeting()},!0)];case 13:return A.sent(),this.config.targetingConfig&&this.setupUrlChangeListenerForTargeting(),[2]}})})},e.prototype.setSessionId=function(e,t){return e_(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){var r;return(0,q.__awaiter)(this,void 0,void 0,function(){var i,o,s;return(0,q.__generator)(this,function(a){switch(a.label){case 0:if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,(i=this.identifiers&&this.identifiers.sessionId)&&this.sendEvents(i),o=t||this.getDeviceId(),this.identifiers=new tg({sessionId:e,deviceId:o}),!(this.joinedConfigGenerator&&i))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:s=a.sent().joinedConfig,this.config=s,a.label=2;case 2:if(!(null===(r=this.config)||void 0===r?void 0:r.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==n?void 0:n.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return a.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:a.sent(),a.label=6;case 6:return[2]}})})},e.prototype.getSessionReplayProperties=function(){var e,t=this.config,n=this.identifiers;if(!t||!n)return this.loggerProvider.warn("Session replay init has not been called, cannot get session replay properties."),{};var r=this.getShouldRecord(),i={};return r&&((e={})[Q]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[ee]=JSON.stringify({appHash:eT(t.apiKey).toString()}))),this.addCustomRRWebEvent(P.GET_SR_PROPS,{shouldRecord:r,eventProperties:i},10===this.eventCount),10===this.eventCount&&(this.eventCount=0),this.eventCount++,i},e.prototype.sendEvents=function(e){var t,n=e||(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId),r=this.getDeviceId();this.eventsManager&&n&&r&&this.eventsManager.sendCurrentSequenceEvents({sessionId:n,deviceId:r})},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,q.__awaiter)(this,void 0,void 0,function(){var n;return(0,q.__generator)(this,function(r){return(null===(t=this.identifiers)||void 0===t?void 0:t.sessionId)?(n=this.getDeviceId())?(this.eventsManager&&e&&this.eventsManager.sendStoredEvents({deviceId:n}),[2,this.recordEvents()]):(this.loggerProvider.log("Session is not being recorded due to lack of device id."),[2,Promise.resolve()]):(this.loggerProvider.log("Session is not being recorded due to lack of session id."),[2,Promise.resolve()])})})},e.prototype.shouldOptOut=function(){if(null===(t=this.config)||void 0===t?void 0:t.instanceName){var e,t,n,r;r=(void 0===(e=this.config.instanceName)&&(e=V),eC.V.getInstance(e)).identityStore.getIdentity().optOut}return void 0!==r?r:null===(n=this.config)||void 0===n?void 0:n.optOut},e.prototype.getShouldRecord=function(){if(!this.identifiers||!this.config||!this.identifiers.sessionId)return this.loggerProvider.warn("Session is not being recorded due to lack of config, please call sessionReplay.init."),!1;if(!this.config.captureEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured due to capture being disabled for project or because the remote config could not be fetched.")),!1;if(this.shouldOptOut())return this.loggerProvider.log("Opting session ".concat(this.identifiers.sessionId," out of recording due to optOut config.")),!1;var e,t,n=!1,r="",i=!1;return this.config.targetingConfig?this.sessionTargetingMatch?(r="Capturing replays for session ".concat(this.identifiers.sessionId," due to matching targeting conditions."),this.loggerProvider.log(r),n=!0,i=!0):(r="Not capturing replays for session ".concat(this.identifiers.sessionId," due to not matching targeting conditions."),this.loggerProvider.log(r),n=!1,i=!1):(e=this.identifiers.sessionId,t=this.config.sampleRate,function(e,t){void 0===t&&(t=0);var n,r=function(e){for(var t=[],n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r>=55296&&r<=56319&&n+1<e.length){var i=e.charCodeAt(n+1);i>=56320&&i<=57343&&(r=(r-55296<<10)+(i-56320)+65536,n++)}r<128?t.push(r):r<2048?t.push(192|r>>6,128|63&r):r<65536?t.push(224|r>>12,128|r>>6&63,128|63&r):t.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r)}return new Uint8Array(t)}(e),i=r.length,o=0;if(i>=16){for(var s=t+2654435761+2246822519>>>0,a=t+2246822519>>>0,u=t>>>0,l=t-2654435761>>>0;o<=i-16;
1)s=tm(s,ty(r,o)),o+=4,a=tm(a,ty(r,o)),o+=4,u=tm(u,ty(r,o)),o+=4,l=tm(l,ty(r,o)),o+=4;n=tp(s,1)+tp(a,7)+tp(u,12)+tp(l,18)>>>0}else n=t+374761393>>>0;for(n=n+i>>>0;o<=i-4;)n=Math.imul(tp(n=n+Math.imul(ty(r,o),3266489917)>>>0,17),668265263)>>>0,o+=4;for(;o<i;)n=Math.imul(tp(n=n+Math.imul(r[o],374761393)>>>0,11),2654435761)>>>0,o++;return n^=n>>>15,n=Math.imul(n,2246822519)>>>0,n^=n>>>13,n=Math.imul(n,3266489917)>>>0,(n^=n>>>16)>>>0}(e.toString())%1e6/1e6<t)?(n=!0,i=!0):(r="Opting session ".concat(this.identifiers.sessionId," out of recording due to sample rate."),this.loggerProvider.log(r),n=!1,i=!1),this.lastShouldRecordDecision!==n&&this.config.targetingConfig&&(this.addCustomRRWebEvent(P.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=n),n},e.prototype.getBlockSelectors=function(){var e,t,n,r=null!==(n=null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.blockSelector)&&void 0!==n?n:[];if(0!==r.length)return r},e.prototype.getMaskTextSelectors=function(){if((null===(t=null===(e=this.config)||void 0===e?void 0:e.privacyConfig)||void 0===t?void 0:t.defaultMaskLevel)==="conservative")return"*";var e,t,n,r,i=null===(r=null===(n=this.config)||void 0===n?void 0:n.privacyConfig)||void 0===r?void 0:r.maskSelector;if(i)return i},e.prototype.getRecordingPlugins=function(e){var t,r,i,o,s,a;return(0,q.__awaiter)(this,void 0,void 0,function(){var u,l,c,d;return(0,q.__generator)(this,function(f){switch(f.label){case 0:u=[];try{l=tS({ugcFilterRules:(null===(r=null===(t=this.config)||void 0===t?void 0:t.interactionConfig)||void 0===r?void 0:r.ugcFilterRules)||[],enablePolling:(null===(i=this.config)||void 0===i?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null===(o=this.config)||void 0===o?void 0:o.urlChangePollingInterval,captureDocumentTitle:null===(s=this.config)||void 0===s?void 0:s.captureDocumentTitle}),u.push(l)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null===(a=null==e?void 0:e.console)||void 0===a?void 0:a.enabled))return[3,4];f.label=1;case 1:return f.trys.push([1,3,,4]),[4,Promise.all([n.e(9721),n.e(6434)]).then(n.bind(n,85809))];case 2:return c=f.sent().getRecordConsolePlugin,u.push(c({level:e.console.levels})),[3,4];case 3:return d=f.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,u.length>0?u:void 0]}})})},e.prototype.getRecordFunction=function(){return(0,q.__awaiter)(this,void 0,void 0,function(){var e,t;return(0,q.__generator)(this,function(r){switch(r.label){case 0:if(this.recordFunction)return[2,this.recordFunction];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,Promise.all([n.e(2215),n.e(6434)]).then(n.bind(n,39465))];case 2:return e=r.sent().record,this.recordFunction=e,[2,e];case 3:return t=r.sent(),this.loggerProvider.warn("Failed to load rrweb-record module:",t),[2,null];case 4:return[2]}})})},e.prototype.recordEvents=function(e){var t,n,r,i,o,s,a,u;return void 0===e&&(e=!0),(0,q.__awaiter)(this,void 0,void 0,function(){var l,c,d,f,g,v,h,p,m,y,_,b,w,S,E,k=this;return(0,q.__generator)(this,function(I){switch(I.label){case 0:if(l=this.config,c=this.getShouldRecord(),d=null===(t=this.identifiers)||void 0===t?void 0:t.sessionId,!c||!d||!l)return[2];return this.stopRecordingEvents(),[4,this.getRecordFunction()];case 1:if(!(f=I.sent()))return[2];return[4,this.initializeNetworkObservers()];case 2:I.sent(),g=null===(n=l.loggingConfig)||void 0===n?void 0:n.network,v=[en,er,ei,eW(l.serverZone,l.trackServerUrl)],null===(r=this.networkObservers)||void 0===r||r.start(function(e){v.some(function(t){return e.url.startsWith(t)})||k.addCustomRRWebEvent(P.FETCH_REQUEST,e)},g),h=l.privacyConfig,p=l.interactionConfig,m=l.loggingConfig,y=(null==p?void 0:p.enabled)?{mouseInteraction:this.eventsManager&&(null===(i=this.clickHandler)||void 0===i?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:f.mirror,ugcFilterRules:null!==(o=p.ugcFilterRules)&&void 0!==o?o:[],performanceOptions:null===(s=l.performanceConfig)||void 0===s?void 0:s.interaction})),scroll:this.scrollHook}:{},_=(null==p?void 0:p.enabled)&&p.ugcFilterRules?p.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),I.label=3;case 3:var T;return I.trys.push([3,5,,6]),b=this,w=f,E={emit:function(e){if(k.shouldOptOut()){k.loggerProvider.log("Opting session ".concat(d," out of recording due to optOut config.")),k.stopRecordingEvents(),k.sendEvents();return}e.type===eP.Meta&&(e.data.href=ev(e.data.href,_)),k.eventCompressor&&k.eventCompressor.enqueueEvent(e,d)},inlineStylesheet:l.shouldInlineStylesheet,hooks:y,maskAllInputs:!0,maskTextClass:et,blockClass:"amp-block",blockSelector:this.getBlockSelectors(),applyBackgroun
1dColorToBlockedElements:l.applyBackgroundColorToBlockedElements,maskInputFn:ec("input",h),maskTextFn:ec("text",h),maskAttributeFn:(T=h,function(e,t,n){var r;return"style"!==e&&(null!==(r=null==T?void 0:T.maskAttributes)&&void 0!==r?r:[]).includes(e)&&el("text",T,n)?t.replace(/[^\s]/g,"*"):t}),maskTextSelector:this.getMaskTextSelectors(),recordCanvas:!1,slimDOMOptions:{script:null===(a=l.omitElementTags)||void 0===a?void 0:a.script,comment:null===(u=l.omitElementTags)||void 0===u?void 0:u.comment},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return k.loggerProvider.warn("Error while capturing replay: ",e.toString()),!0}},[4,this.getRecordingPlugins(m)];case 4:return b.recordCancelCallback=w.apply(void 0,[(E.plugins=I.sent(),E)]),this.addCustomRRWebEvent(P.DEBUG_INFO),e&&this.addCustomRRWebEvent(P.METADATA,this.metadata),[3,6];case 5:return S=I.sent(),this.loggerProvider.warn("Failed to initialize session replay:",S),[3,6];case 6:return[2]}})})},e.prototype.getDeviceId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null===(e=this.identifiers)||void 0===e?void 0:e.sessionId},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){return[2,null===(t=this.eventsManager)||void 0===t?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e;null===(e=this.urlChangeCleanup)||void 0===e||e.call(this),this.teardownEventListeners(!0),this.stopRecordingEvents(),this.sendEvents()},e.prototype.mapSDKType=function(e){return"plugin"===e?"@amplitude/plugin-session-replay-browser":"segment"===e?"@amplitude/segment-session-replay-plugin":null},e.prototype.setMetadata=function(e,t,n,r,i,o,s){var a=(null==e?void 0:e.toString())?eT(e.toString()):void 0;this.metadata={joinedConfig:t,localConfig:n,remoteConfig:r,sessionId:e,hashValue:a,sampleRate:t.sampleRate,replaySDKType:this.mapSDKType(s),replaySDKVersion:i,standaloneSDKType:"@amplitude/session-replay-browser",standaloneSDKVersion:o}},e.prototype.initializeNetworkObservers=function(){var e,t,r;return(0,q.__awaiter)(this,void 0,void 0,function(){var i,o;return(0,q.__generator)(this,function(s){switch(s.label){case 0:if(!((null===(r=null===(t=null===(e=this.config)||void 0===e?void 0:e.loggingConfig)||void 0===t?void 0:t.network)||void 0===r?void 0:r.enabled)&&!this.networkObservers))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.e(2708).then(n.bind(n,52708))];case 2:return i=s.sent().NetworkObservers,this.networkObservers=new i,[3,4];case 3:return o=s.sent(),this.loggerProvider.warn("Failed to import or instantiate NetworkObservers:",o),[3,4];case 4:return[2]}})})},e}(),tk=function(e){return function(){var t=e.config||em();return{logger:t.loggerProvider,logLevel:t.logLevel}}},tI={init:j((_=new tE).init.bind(_),"init",tk(_)),evaluateTargetingAndCapture:j(_.evaluateTargetingAndCapture.bind(_),"evaluateTargetingAndRecord",tk(_)),setSessionId:j(_.setSessionId.bind(_),"setSessionId",tk(_)),getSessionId:j(_.getSessionId.bind(_),"getSessionId",tk(_)),getSessionReplayProperties:j(_.getSessionReplayProperties.bind(_),"getSessionReplayProperties",tk(_)),flush:j(_.flush.bind(_),"flush",tk(_)),shutdown:j(_.shutdown.bind(_),"shutdown",tk(_))},tT=tI.init,tC=tI.setSessionId,tP=tI.getSessionId,tR=tI.getSessionReplayProperties,tO=tI.flush,tA=tI.shutdown,tx=tI.evaluateTargetingAndCapture;(b=N||(N={})).SET="$set",b.SET_ONCE="$setOnce",b.ADD="$add",b.APPEND="$append",b.PREPEND="$prepend",b.REMOVE="$remove",b.PREINSERT="$preInsert",b.POSTINSERT="$postInsert",b.UNSET="$unset",b.CLEAR_ALL="$clearAll",(w=M||(M={})).REVENUE_PRODUCT_ID="$productId",w.REVENUE_QUANTITY="$quantity",w.REVENUE_PRICE="$price",w.REVENUE_TYPE="$revenueType",w.REVENUE_CURRENCY="$currency",w.REVENUE="$revenue",(S=U||(U={})).IDENTIFY="$identify",S.GROUP_IDENTIFY="$groupidentify",S.REVENUE="revenue_amount";var tD=[N.SET,N.SET_ONCE,N.ADD,N.APPEND,N.PREPEND,N.POSTINSERT],tL=function(e){if(e.user_properties){var t={};
1return Object.keys(e.user_properties).forEach(function(n){if(tD.includes(n)){var r=e.user_properties&&e.user_properties[n];t=(0,q.__assign)((0,q.__assign)({},t),r)}}),t}},tN="1.27.7",tM="".concat("[Amplitude]"," Session Replay ID"),tU=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:tO,getSessionId:tP,getSessionReplayProperties:tR,init:tT,setSessionId:tC,shutdown:tA,evaluateTargetingAndCapture:tx},this.options=(0,q.__assign)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,o,s,a,u,l;return(0,q.__awaiter)(this,void 0,void 0,function(){var t,c;return(0,q.__generator)(this,function(d){switch(d.label){case 0:var f;return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(tN,".")),this.config=e,this.options.forceSessionTracking&&("boolean"==typeof e.defaultTracking?!1===e.defaultTracking&&(e.defaultTracking={pageViews:!1,formInteractions:!1,fileDownloads:!1,sessions:!0}):e.defaultTracking=(0,q.__assign)((0,q.__assign)({},e.defaultTracking),{sessions:!0})),t=(void 0===(f=this.config.instanceName)&&(f="$default_instance"),eC.V.getInstance(f)).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!==(n=this.options.deviceId)&&void 0!==n?n:this.config.deviceId,optOut:this.config.optOut,sessionId:this.options.customSessionId?void 0:this.config.sessionId,loggerProvider:this.config.loggerProvider,logLevel:this.config.logLevel,flushMaxRetries:this.config.flushMaxRetries,serverZone:this.config.serverZone,configServerUrl:this.options.configServerUrl||(null===(r=this.config.remoteConfig)||void 0===r?void 0:r.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null===(i=this.options.privacyConfig)||void 0===i?void 0:i.blockSelector,maskSelector:null===(o=this.options.privacyConfig)||void 0===o?void 0:o.maskSelector,unmaskSelector:null===(s=this.options.privacyConfig)||void 0===s?void 0:s.unmaskSelector,defaultMaskLevel:null===(a=this.options.privacyConfig)||void 0===a?void 0:a.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,version:{type:"plugin",version:tN},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!==(u=this.options.useWebWorker)&&void 0!==u?u:null===(l=this.options.experimental)||void 0===l?void 0:l.useWebWorker,userProperties:t,omitElementTags:this.options.omitElementTags,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval},[4,this.sessionReplay.init(e.apiKey,this.srInitOptions).promise];case 1:return d.sent(),[3,3];case 2:return c=d.sent(),null==e||e.loggerProvider.error("Session Replay: Failed to initialize due to ".concat(c.message)),[3,3];case 3:return[2]}})})},e.prototype.onSessionIdChanged=function(e){var t;return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){switch(n.label){case 0:return null===(t=this.config)||void 0===t||t.loggerProvider.debug("Analytics session id is changed to ".concat(e,", SR session id is ").concat(String(this.sessionReplay.getSessionId()),".")),[4,this.sessionReplay.setSessionId(e).promise];case 1:return n.sent(),[2]}})})},e.prototype.onOptOutChanged=function(e){var t;return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(n){switch(n.label){case 0:if(null===(t=this.config)||void 0===t||t.loggerProvider.debug("optOut is changed to ".concat(String(e),", calling ").concat(e?"sessionReplay.shutdown()":"sessionReplay.init()",".")),!e)return[3,1];return this.sessionReplay.shutdown(),[3,4];case 1:if(!(null!=this.config))return[3,3];return[4,this.sessionReplay.init(this.config.apiKey,this.srInitOptions).promise];case 2:n.sent(),n.label=3;case 3:n.label=4;case 4:return[2]}})})},e.prototype.execute=function(e){var t,n,r;return(0,q.__awaiter)(this,void 0,void 0,function(){var i,o,s,a,u;return(0,q.__generator)(this,function(l){switch(l.label){case 0:if(l.trys.push([0,9,,10]),!this.options.customSessionId)return[3,4];if(!(i=this.options.customSessionId(e)))return[3,3];if(!(i!==this.sessionReplay.getSessionId()))return[3,2];return[4,this.sessionReplay.setSessionId(i).promise];case 1:l.sent(),l.label=2;case 2:o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,q.__assign)((0,q.__assign)({},e.event_properties),o),l.label=3;case 3:return[3,8];case 4:if(!((i=null===(t=this.config)||void 0===t?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(i).promise];case 5:l.sent(),l.label=6;case 6:if(!(i&&i===e.session_id))return[3,8];return s=void 0,e.event_type===k.IDENTIFY&&(s=tL(e)),a=F(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:s,page:(null===(n=null==a?void 0:a.location)||void 0===n?void 0:n.href)!=null?{url:a.location.href}:void 0})];case 7:l.sent(),o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,q.__assign)((0,q.__assign)({},e.event_properties),o),l.label=8;case 8:return e.event_type===k.IDENTIFY&&e.event_properties&&delete e.event_properties[tM],[2,Promise.resolve(e)];case 9:return u=l.sent(),null===(r=this.config)||void 0===r||r.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(u.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,q.__awaiter)(this,void 0,void 0,function(){return(0,q.__generator)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null===(e=this.config)||void 0===e||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),tq=function(e){return new tU(e)}},2359:function(e,t,n){"use strict";n.d(t,{l:function(){return r}});var r=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}},54173:function(e){var t=Object.prototype.hasOwnProperty;function n(e){return"[Throws: "+(e?e.message:"?")+"]"}function r(e){var r=[];return function e(i){if(null===i||"object"!=typeof i)return i;if(-1!==r.indexOf(i))return"[Circular]";if(r.push(i),"function"==typeof i.toJSON)try{var o=e(i.toJSON());return r.pop(),o}catch(e){return n(e)}if(Array.isArray(i)){var s=i.map(e);return r.pop(),s}var a=Object.keys(i).reduce(function(r,o){return r[o]=e(function(e,r){if(t.call(e,r))try{return e[r]}catch(e){return n(e)}return e[r]}(i,o)),r},{});return r.pop(),a}(e)}e.exports=function(e,t,n){return JSON.stringify(r(e),t,n)},e.exports.ensureProperties=r},58675:function(e,t,n){e.exports=n(68343).Observable},68343:function(e,t){"use strict";t.Observable=void 0;let n=e=>!!Symbol[e],r=e=>n(e)?Symbol[e]:"@@"+e,i=r("iterator"),o=r("observable"),s=r("species");function a(e,t){let n=e[t];if(null!=n){if("function"!=typeof n)throw TypeError(n+" is not a function");return n}}function u(e){let t=e.constructor;return void 0!==t&&null===(t=t[s])&&(t=void 0),void 0!==t?t:p}function l(e){l.log?l.log(e):setTimeout(()=>{throw e})}function c(e){Promise.resolve().then(()=>{try{e()}catch(e){l(e)}})}function d(e){let t=e._cleanup;if(void 0!==t){if(e._cleanup=void 0,!t)return;try{if("function"==typeof t)t();else{let e=a(t,"unsubscribe");e&&e.call(t)}}catch(e){l(e)}}}function f(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function g(e,t,n){e._state="running";let r=e._observer;try{let i=a(r,t);switch(t){case"next":i&&i.call(r,n);break;case"error":if(f(e),i)i.call(r,n);else throw n;break;case"complete":f(e),i&&i.call(r)}}catch(e){l(e)}"closed"===e._state?d(e):"running"===e._state&&(e._state="ready")}function v(e,t,n){if("closed"!==e._state){if("buffering"===e._state){e._queue.push({type:t,value:n});return}if("ready"!==e._state){e._state="buffering",e._queue=[{type:t,value:n}],c(()=>(function(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let n=0;n<t.length&&(g(e,t[n].type,t[n].value),"closed"!==e._state);++n);}})(e));return}g(e,t,n)}}class h{constructor(e,t){this._cleanup=void 0,this._observer=e,this._queue=void 0,this._state="initializing";let n=this,r={get closed(){return"closed"===n._state},next(e){v(n,"next",e)},error(e){v(n,"error",e)},complete(){v(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}
1unsubscribe(){"closed"!==this._state&&(f(this),d(this))}}class p{constructor(e){if(!(this instanceof p))throw TypeError("Observable cannot be called as a function");if("function"!=typeof e)throw TypeError("Observable initializer must be a function");this._subscriber=e}subscribe(e){return("object"!=typeof e||null===e)&&(e={next:e,error:arguments[1],complete:arguments[2]}),new h(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e){n(TypeError(e+" is not a function"));return}function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(n){try{n=e(n)}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}filter(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(u(this))(t=>this.subscribe({next(n){try{if(!e(n))return}catch(e){return t.error(e)}t.next(n)},error(e){t.error(e)},complete(){t.complete()}}))}reduce(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=u(this),n=arguments.length>1,r=!1,i=arguments[1],o=i;return new t(t=>this.subscribe({next(i){let s=!r;if(r=!0,!s||n)try{o=e(o,i)}catch(e){return t.error(e)}else o=i},error(e){t.error(e)},complete(){if(!r&&!n)return t.error(TypeError("Cannot reduce an empty sequence"));t.next(o),t.complete()}}))}async all(){let e=[];return await this.forEach(t=>e.push(t)),e}concat(...e){let t=u(this);return new t(n=>{let r;let i=0;return!function o(s){r=s.subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){i===e.length?(r=void 0,n.complete()):o(t.from(e[i++]))}})}(this),()=>{r&&(r.unsubscribe(),r=void 0)}})}flatMap(e){if("function"!=typeof e)throw TypeError(e+" is not a function");let t=u(this);return new t(n=>{let r=[],i=this.subscribe({next(i){if(e)try{i=e(i)}catch(e){return n.error(e)}let s=t.from(i).subscribe({next(e){n.next(e)},error(e){n.error(e)},complete(){let e=r.indexOf(s);e>=0&&r.splice(e,1),o()}});r.push(s)},error(e){n.error(e)},complete(){o()}});function o(){i.closed&&0===r.length&&n.complete()}return()=>{r.forEach(e=>e.unsubscribe()),i.unsubscribe()}})}[o](){return this}static from(e){let t="function"==typeof this?this:p;if(null==e)throw TypeError(e+" is not an object");let r=a(e,o);if(r){let n=r.call(e);if(Object(n)!==n)throw TypeError(n+" is not an object");return n instanceof p&&n.constructor===t?n:new t(e=>n.subscribe(e))}if(n("iterator")&&(r=a(e,i)))return new t(t=>{c(()=>{if(!t.closed){for(let n of r.call(e))if(t.next(n),t.closed)return;t.complete()}})});if(Array.isArray(e))return new t(t=>{c(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})});throw TypeError(e+" is not observable")}static of(...e){return new("function"==typeof this?this:p)(t=>{c(()=>{if(!t.closed){for(let n=0;n<e.length;++n)if(t.next(e[n]),t.closed)return;t.complete()}})})}static get[s](){return this}}t.Observable=p,Object.defineProperty(p,Symbol("extensions"),{value:{symbol:o,hostReportError:l},configurable:!0})},90960:function(e,t,n){"use strict";let r,i,o,s;n.d(t,{X3:function(){return v}});let a=(e,t)=>t.some(t=>e instanceof t),u=new WeakMap,l=new WeakMap,c=new WeakMap,d={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return u.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return f(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function f(e){var t;if(e instanceof IDBRequest)return function(e){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(f(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return c.set(t,e),t}(e);if(l.has(e))return l.get(e);let n="function"==typeof(t=e)?(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(g(this),e),f(this.request)}:function(...e){return f(t.apply(g(this),e))}:(t instanceof IDBTransaction&&function(e){if(u.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",o),e.removeEventListener("abort",o)},i=()=>{t(),r()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",o),e.addEventListener("abort",o)});u.set(e,t)}(t),a(t,r||(r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(t,d):t;return n!==e&&(l.set(e,n),c.set(n,e)),n}let g=e=>c.get(e);function v(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){let s=indexedDB.open(e,t),a=f(s);return r&&s.addEventListener("upgradeneeded",e=>{r(f(s.result),e.oldVersion,e.newVersion,f(s.transaction),e)}),n&&s.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a}let h=["get","getKey","getAll","getAllKeys","count"],p=["put","add","delete","clear"],m=new Map;function y(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(m.get(t))return m.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=p.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||h.includes(n)))return;let o=async function(e,...t){let o=this.transaction(e,i?"readwrite":"readonly"),s=o.store;
1return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return m.set(t,o),o}d={...o=d,get:(e,t,n)=>y(e,t)||o.get(e,t,n),has:(e,t)=>!!y(e,t)||o.has(e,t)};let _=["continue","continuePrimaryKey","advance"],b={},w=new WeakMap,S=new WeakMap,E={get(e,t){if(!_.includes(t))return e[t];let n=b[t];return n||(n=b[t]=function(...e){w.set(this,S.get(this)[t](...e))}),n}};async function*k(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let n=new Proxy(t,E);for(S.set(n,t),c.set(n,g(t));t;)yield n,t=await (w.get(n)||t.continue()),w.delete(n)}function I(e,t){return t===Symbol.asyncIterator&&a(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&a(e,[IDBIndex,IDBObjectStore])}d={...s=d,get:(e,t,n)=>I(e,t)?k:s.get(e,t,n),has:(e,t)=>I(e,t)||s.has(e,t)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.