PageSourceSearch

https://scaniverse.nianticspatial.com/_next/static/chunks/9422-16f3bf8ecb588844.js

js nianticspatial.com collected 2026-10-09 22:39:21 UTC 434,751 bytes, 1 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9422],{2821:(e,t,n)=>{"use strict";n.d(t,{A:()=>r});let r=function(){for(var e,t,n=0,r="",i=arguments.length;n<i;n++)(e=arguments[n])&&(t=function e(t){var n,r,i="";if("string"==typeof t||"number"==typeof t)i+=t;else if("object"==typeof t)if(Array.isArray(t)){var o=t.length;for(n=0;n<o;n++)t[n]&&(r=e(t[n]))&&(i&&(i+=" "),i+=r)}else for(r in t)t[r]&&(i&&(i+=" "),i+=r);return i}(e))&&(r&&(r+=" "),r+=t);return r}},4828:e=>{e.exports={style:{fontFamily:"'Figtree', 'Figtree Fallback'",fontStyle:"normal"},className:"__className_2ca027"}},25293: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},51602:(e,t,n)=>{"use strict";n.d(t,{D7:()=>i});var r=n(71450);function i(e,t,n){e&&function e(t){var n,i,o=t.json,a=t.targetObject,l=t.allowlist,u=t.excludelist,c=t.ancestors,d=t.parentObject,h=t.targetKey;a||(a=o);var f=Object.keys(a);try{for(var g=(0,r.Ju)(f),v=g.next();!v.done;v=g.next()){var p,m=v.value,y=(0,r.fX)((0,r.fX)([],(0,r.zs)(c),!1),[m],!1);(p=a[m],"string"==typeof p||"number"==typeof p||"boolean"==typeof p||null==p)?(!s(y,l)||s(y,u))&&delete a[m]:e({json:o,targetObject:a[m],allowlist:l,excludelist:u,ancestors:y,parentObject:a,targetKey:m})}}catch(e){n={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(n)throw n.error}}0===Object.keys(a).length&&d&&h&&delete d[h]}({json:e,allowlist:t.map(o),excludelist:n.map(o),ancestors:[]})}function o(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function s(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)})}},55063:(e,t,n)=>{"use strict";let r,i,o;n.d(t,{Yi:()=>uA});var s,a,l,u,c,d,h,f,g,v,p,m,y,b,S,w,E,I,k,C,T,_,x,P,A,O,R,N,M,D=n(71450),L=function(e){return{promise:e||Promise.resolve()}};!function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"}(s||(s={}));var H="Amplitude Logger ",F=function(){function e(){this.logLevel=s.None}return e.prototype.disable=function(){this.logLevel=s.None},e.prototype.enable=function(e){void 0===e&&(e=s.Warn),this.logLevel=e},e.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Verbose||console.log("".concat(H,"[Log]: ").concat(e.join(" ")))},e.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Warn||console.warn("".concat(H,"[Warn]: ").concat(e.join(" ")))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Error||console.error("".concat(H,"[Error]: ").concat(e.join(" ")))},e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.logLevel<s.Debug||console.log("".concat(H,"[Debug]: ").concat(e.join(" ")))},e}(),U=n(25293),j=n.n(U)()||U,q=function(){function e(e,t){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=t;try{this.isSupported="undefined"!=typeof localStorage}catch(e){this.logger.debug("Remote config localstorage failed to access: ",e),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var e=null,t={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(t);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(j(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){if(!this.isSupported)return Promise.resolve(!1);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}(),z=n(87449),B=(0,D.fX)([],(0,D.zs)(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),Y=function(e){var t,n=(0,z.m)();if(!(null==(t=null==n?void 0:n.crypto)?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,Y);var r=n.crypto.getRandomValues(new Uint8Array(16));return r[6]=15&r[6]|64,r[8]=63&r[8]|128,(0,D.fX)([],(0,D.zs)(r.entries()),!1).map(function(e){var t=(0,D.zs)(e,2),n=t[0],r=t[1];return[4,6,8,10].includes(n)?"-".concat(B[r]):B[r]}).join("")}
1,V={INVALID_API_KEY:401,FORBIDDEN:403,RATE_LIMIT:429},W=function(){function e(t,n,r,i,o,s,a){void 0===r&&(r="US"),void 0===s&&(s=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=s,this.serverUrl=i||("US"===r?"https://sr-client-cfg.amplitude.com/config":"https://sr-client-cfg.eu.amplitude.com/config"),this.logger=n,this.storage=a||new q(t,n),this.customFetch=o}return e.prototype.subscribe=function(e,t,n){var r=Y(),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,D.sH)(this,void 0,void 0,function(){var e,t=this;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var n,r;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var n,r,i,o,s,a,l=this;return(0,D.YH)(this,function(u){switch(u.label){case 0:n=t/e,r={remoteConfig:null,lastFetch:new Date},i=function(r){var i,s,a,u,c,d,h,f,g;return(0,D.YH)(this,function(v){switch(v.label){case 0:i=!0,s=new AbortController,a=setTimeout(function(){return s.abort()},t),v.label=1;case 1:var p,m;if(v.trys.push([1,10,11,12]),u=o.getUrlParams(),c={Accept:"*/*"},!o.customFetch)return[3,3];return[4,(p=o.customFetch({url:u,method:"GET",headers:c,signal:s.signal}),m=s.signal,new Promise(function(e,t){var n=function(){var e=Error("Remote config custom fetch aborted by timeout");e.name="AbortError",t(e)};m.addEventListener("abort",n,{once:!0}),p.then(function(t){m.removeEventListener("abort",n),e(t)},function(e){m.removeEventListener("abort",n),t(e)})}))];case 2:return h=v.sent(),[3,5];case 3:return[4,fetch(u,{method:"GET",headers:c,signal:s.signal})];case 4:h=v.sent(),v.label=5;case 5:if((d=h).ok||d.status>=200&&d.status<300)return[3,7];return[4,d.text()];case 6:return f=v.sent(),o.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(d.status,": ").concat(f)),d.status===V.INVALID_API_KEY||d.status===V.FORBIDDEN?(o.logger.error("Remote config client fetch failed with ".concat(d.status,". Invalid API key; future fetches will be skipped.")),o.isLastFetchInvalidApiKey=!0,i=!1):d.status>=400&&d.status<500&&d.status!==V.RATE_LIMIT&&(i=!1),[3,9];case 7:return[4,d.json()];case 8:return[2,{value:{remoteConfig:v.sent(),lastFetch:new Date}}];case 9:return[3,12];case 10:return(g=v.sent())instanceof Error&&"AbortError"===g.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: "),g),[3,12];case 11:return clearTimeout(a),[7];case 12:if(!i)return[2,"break"];if(!(r<e-1))return[3,14];return[4,new Promise(function(e){return setTimeout(e,l.getJitterDelay(n))})];case 13:v.sent(),v.label=14;case 14:return[2]}})},o=this,s=0,u.label=1;case 1:if(!(s<e))return[3,4];return[5,i(s)];case 2:if("object"==typeof(a=u.sent()))return[2,a.value];if("break"===a)return[3,4];u.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 e=encodeURIComponent(this.apiKey),t=new URLSearchParams;return t.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(e,"?").concat(t.toString())},e.DEFAULT_CONFIG_GROUP="browser",e}(),J={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=(0,z.m)())?void 0:e.indexedDB)!==void 0},e.prototype.getDB=function(){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(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(){var t=r.result;if(!t)return void e.logger.debug("DiagnosticsStorage: Missing DB during upgrade.");e.createTables(t)}})},e.prototype.createTables=function(e){e.objectStoreNames.contains(J.TAGS)||e.createObjectStore(J.TAGS,{keyPath:"key"}),e.objectStoreNames.contains(J.COUNTERS)||e.createObjectStore(J.COUNTERS,{keyPath:"key"}),e.objectStoreNames.contains(J.HISTOGRAMS)||e.createObjectStore(J.HISTOGRAMS,{keyPath:"key"}),e.objectStoreNames.contains(J.EVENTS)||e.createObjectStore(J.EVENTS,{keyPath:"id",autoIncrement:!0}).createIndex("time_idx","time",{unique:!1}),e.objectStoreNames.contains(J.INTERNAL)||e.createObjectStore(J.INTERNAL,{keyPath:"key"})},e.prototype.setTags=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,D.YH)(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([J.TAGS],"readwrite")).objectStore(J.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,D.zs)(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,D.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,D.YH)(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([J.COUNTERS],"readwrite")).objectStore(J.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,D.zs)(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,D.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,D.YH)(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([J.HISTOGRAMS],"readwrite")).objectStore(J.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,D.zs)(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,D.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,D.YH)(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([J.EVENTS],"readwrite")).objectStore(J.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,D.sH)(this,void 0,void 0,function(){var n,r,i;return(0,D.YH)(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([J.INTERNAL],"readwrite")).objectStore(J.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,D.sH)(this,void 0,void 0,function(){var t,n,r;return(0,D.YH)(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([J.INTERNAL],"readonly")).objectStore(J.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,D.sH)(this,void 0,void 0,function(){var e,t;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var e,t,n,r,i,o,s;return(0,D.YH)(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([J.TAGS,J.COUNTERS,J.HISTOGRAMS,J.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(e,J.TAGS),this.getAllFromStore(e,J.COUNTERS),this.getAllFromStore(e,J.HISTOGRAMS),this.getAllFromStore(e,J.EVENTS)])];case 2:return n=(t=D.zs.apply(void 0,[a.sent(),4]))[0],r=t[1],i=t[2],o=t[3],[4,Promise.all([this.clearTable(e,J.COUNTERS),this.clearTable(e,J.HISTOGRAMS),this.clearTable(e,J.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}(),G=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,X=function(e,t){return 31*Math.abs(G(e.toString()))%1e5/1e5<t},Q=function(){var e=(0,z.m)();if(!e)return[];var t=e.__AMPLITUDE_SCRIPT_URL__;return Array.isArray(t)?t:"string"==typeof t?[t]:[]},Z=function(e){var t=(0,z.m)();if(t&&"function"==typeof t.addEventListener){var n=function(t){e.recordEvent("sdk.error.uncaught",(0,D.Cl)({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=ee({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=et(i),s=ee({filename:o,stack:i});s&&n({type:"unhandledrejection",message:null!=(t=null==r?void 0:r.message)?t:en(e.reason),stack:i,filename:o,errorName:null==r?void 0:r.name,metadata:{isTrusted:e.isTrusted,matchReason:s}})},!0)}},ee=function(e){var t,n,r=Q();if(0!==r.length)try{for(var i=(0,D.Ju)(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}}},et=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},en=function(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(e){return"[object Object]"}},er=function(){function e(e,t,n,r,i){void 0===n&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=t,this.serverUrl="US"===n?"https://diagnostics.prod.us-west-2.amplitude.com/v1/capture":"https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(r,null,2)),this.config=(0,D.Cl)({enabled:!0,sampleRate:0},r),this.startTimestamp=Date.now(),this.shouldTrack=X(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,i?this.storage=i:$.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"),Z(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)return void this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");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)return void this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+t,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(e,t){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=1e4)return void this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");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)return void this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:t}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",t)}).finally(function(){e.saveTimer=null})},1e3)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(t){e.logger.debug("DiagnosticsClient: Failed to flush",t)}).finally(function(){e.flushTimer=null})},3e5))},e.prototype.saveAllDataToStorage=function(){return(0,D.sH)(this,void 0,void 0,function(){var e,t,n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:if(!this.storage)return[2];return e=(0,D.Cl)({},this.inMemoryTags),t=(0,D.Cl)({},this.inMemoryCounters),n=(0,D.Cl)({},this.inMemoryHistograms),r=(0,D.fX)([],(0,D.zs)(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,D.sH)(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,l,u;return(0,D.YH)(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}}),l=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===l.length)return[2];return u={tags:o,histogram:a,counters:s,events:l},this.fetch(u),[2]}})})},e.prototype.fetch=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(this,function(n){switch(n.label){case 0:if(n.trys.push([0,2,,3]),!(0,z.m)())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,D.sH)(this,void 0,void 0,function(){var e,t,n;return(0,D.YH)(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=X(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e}(),ei=function(){var e,t=(0,z.m)();return(null==(e=null==t?void 0:t.location)?void 0:e.search)?t.location.search.substring(1).split("&").filter(Boolean).reduce(function(e,t){var n=t.split("=",2),r=eo(n[0]),i=eo(n[1]);return i&&(e[r]=i),e},{}):{}},eo=function(e){void 0===e&&(e="");try{return decodeURIComponent(e)}catch(e){return""}};class es{getApplicationContext(){return{versionName:this.versionName,language:ea(),platform:"Web",os:void 0,deviceModel:void 0}}}let ea=()=>"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||"";class el{constructor(){this.queue=[]}logEvent(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)}setEventReceiver(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(t=>{e(t)}),this.queue=[])}}let eu=(e,t)=>{let n=typeof e;if(n!==typeof t)return!1;for(let r of["string","number","boolean","undefined"])if(r===n)return e===t;if(null==e&&null==t)return!0;if(null==e||null==t||e.length!==t.length)return!1;let r=Array.isArray(e),i=Array.isArray(t);if(r!==i)return!1;if(r&&i){for(let n=0;n<e.length;n++)if(!eu(e[n],t[n]))return!1}else{if(!eu(Object.keys(e).sort(),Object.keys(t).sort()))return!1;let n=!0;return Object.keys(e).forEach(r=>{eu(e[r],t[r])||(n=!1)}),n}return!0};Object.entries||(Object.entries=function(e){let t=Object.keys(e),n=t.length,r=Array(n);for(;n--;)r[n]=[t[n],e[t[n]]];return r});class ec{constructor(){this.identity={userProperties:{}},this.listeners=new Set}editIdentity(){let e=this,t=Object.assign({},this.identity.userProperties),n=Object.assign(Object.assign({},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(e){return n.optOut=e,this},updateUserProperties:function(e){let t=n.userProperties||{};for(let[n,r]of Object.entries(e))switch(n){case"$set":for(let[e,n]of Object.entries(r))t[e]=n;break;case"$unset":for(let e of Object.keys(r))delete t[e];break;case"$clearAll":t={}}return n.userProperties=t,this},commit:function(){return e.setIdentity(n),this}}}getIdentity(){return Object.assign({},this.identity)}setIdentity(e){let t=Object.assign({},this.identity);this.identity=Object.assign({}
1,e),eu(t,this.identity)||this.listeners.forEach(t=>{t(e)})}addIdentityListener(e){this.listeners.add(e)}removeIdentityListener(e){this.listeners.delete(e)}}let ed="undefined"!=typeof globalThis?globalThis:void 0!==n.g?n.g:self;class eh{constructor(){this.identityStore=new ec,this.eventBridge=new el,this.applicationContextProvider=new es}static getInstance(e){return ed.analyticsConnectorInstances||(ed.analyticsConnectorInstances={}),ed.analyticsConnectorInstances[e]||(ed.analyticsConnectorInstances[e]=new eh),ed.analyticsConnectorInstances[e]}}var ef="".concat("AMP","_unsent"),eg="$default_instance",ev="https://api2.amplitude.com/2/httpapi",ep="https://api.eu.amplitude.com/2/httpapi",em="https://api2.amplitude.com/batch",ey="https://api.eu.amplitude.com/batch",eb="dclid",eS="fbclid",ew="gbraid",eE="gclid",eI="ko_click_id",ek="li_fat_id",eC="msclkid",eT="rdt_cid",e_="ttclid",ex="twclid",eP="wbraid",eA={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},eO=["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"],eR=["authorization","cookie","set-cookie"],eN=function(e){return void 0===e||""===e?eg:e},eM=function(e){return eh.getInstance(eN(e))},eD=function(e,t){eM(t).identityStore.editIdentity().setUserId(e).commit()},eL=function(e,t){eM(t).identityStore.editIdentity().setDeviceId(e).commit()};!function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"}(a||(a={}));var eH="Event skipped due to empty event type",eF=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},[])},eU=function(e,t,n){return void 0===t&&(t=0),void 0===n&&(n=a.Unknown),{event:e,code:t,message:n}},ej=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:eg,logLevel:s.Warn,loggerProvider:new F,offline:!1,optOut:!1,serverUrl:ev,serverZone:"US",useBatch:!1}},eq=function(){function e(e){this._optOut=!1;var t,n,r,i,o=ej();this.apiKey=e.apiKey,this.flushIntervalMillis=null!=(t=e.flushIntervalMillis)?t:o.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||o.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||o.flushQueueSize,this.instanceName=eN(e.instanceName),this.loggerProvider=e.loggerProvider||o.loggerProvider,this.logLevel=null!=(n=e.logLevel)?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)?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)?i:o.useBatch,this.loggerProvider.enable(this.logLevel);var s=ez(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),e}(),ez=function(e,t,n){if(void 0===e&&(e=""),void 0===t&&(t=ej().serverZone),void 0===n&&(n=ej().useBatch),e)return{serverUrl:e,serverZone:void 0};var r,i=["US","EU"].includes(t)?t:ej().serverZone;return{serverZone:i,serverUrl:(r=n,"EU"===i?r?ey:ep:r?em:ev)}},eB=function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(e,t){this.sdk.metrics.histogram[e]=t},e}();function eY(e){return e>=200&&e<300}var eV=function(e){return void 0===e&&(e=0),(Error().stack||"").split("\n").slice(2+e).map(function(e){return e.trim()})},eW=function(e){return function(){var t=(0,D.Cl)({},e.config);return{logger:t.loggerProvider,logLevel:t.logLevel}}},eJ=function(e,t){var n,r;t=(t=t.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"");try{for(var i=(0,D.Ju)(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},eK=function(e,t){return function(){var n,r,i={};try{for(var o=(0,D.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;i[a]=eJ(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}},e$=function(e,t,n,r,i){return void 0===i&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var l=n(),u=l.logger,c=l.logLevel;if(c&&c<s.Debug||!c||!u)return e.apply(i,o);var d={type:"invoke public method",name:t,args:o,stacktrace:eV(1),time:{start:new Date().toISOString()},states:{}};r&&d.states&&(d.states.before=r());var h=e.apply(i,o);return h&&h.promise?h.promise.then(function(){r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=new Date().toISOString()),u.debug(JSON.stringify(d,null,2))}):(r&&d.states&&(d.states.after=r()),d.time&&(d.time.end=new Date().toISOString()),u.debug(JSON.stringify(d,null,2))),h}},eG=new Set([ev,ep,em,ey]);function eX(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch(e){}return t}var eQ=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,D.sH)(this,void 0,void 0,function(){var n,r=this;return(0,D.YH)(this,function(i){switch(i.label){case 0:return this.config=e,this.storageKey="".concat(ef,"_").concat(this.config.apiKey.substring(0,10)),[4,null==(t=this.config.storageProvider)?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=Y()),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()})}
1,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,D.sH)(this,void 0,void 0,function(){var t,n,r=this;return(0,D.YH)(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,eF(t,this.config.flushQueueSize).reduce(function(t,n){return(0,D.sH)(r,void 0,void 0,function(){return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var r,i,o,s,l;return(0,D.YH)(this,function(u){var c,d,h;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,D.Tt)(t,["extra"])}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new eB,u.label=1;case 1:return u.trys.push([1,3,,4]),c=i=ez(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,void 0===(d=this.config.enableRequestBodyCompression)&&(d=!1),o=!!eG.has(c)||d,[4,this.config.transportProvider.send(i,r,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(eX(s))):this.fulfillRequest(e,s.statusCode,s.status),[2];return this.handleResponse(s,e),[3,4];case 3:return l=(h=u.sent())instanceof Error?h.message:String(h),this.config.loggerProvider.error(l),null==(n=this.diagnosticsClient)||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(e){return e.event.event_type}),message:l,stack_trace:eV()}),this.handleResponse({status:a.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(e,t){eY(e.statusCode)||null==(n=this.diagnosticsClient)||n.recordEvent("analytics.events.unsuccessful",{events:t.map(function(e){return e.event.event_type}),code:e.statusCode,status:e.status,body:eX(e),stack_trace:eV()});var n,r=e.status;switch(r){case a.Success:this.handleSuccessResponse(e,t);break;case a.Invalid:this.handleInvalidResponse(e,t);break;case a.PayloadTooLarge:this.handlePayloadTooLargeResponse(e,t);break;case a.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"))return void this.fulfillRequest(t,e.statusCode,e.body.error);var r=new Set((0,D.fX)((0,D.fX)((0,D.fX)((0,D.fX)([],(0,D.zs)(Object.values(e.body.eventsWithInvalidFields)),!1),(0,D.zs)(Object.values(e.body.eventsWithMissingFields)),!1),(0,D.zs)(Object.values(e.body.eventsWithInvalidIdLengths)),!1),(0,D.zs)(e.body.silencedEvents),!1).flat()),i=t.filter(function(t,i){return!r.has(i)||void n.fulfillRequest([t],e.statusCode,e.body.error)});i.length>0&&this.config.loggerProvider.warn(eX(e));
1var o=this.removeEventsExceedFlushMaxRetries(i);this.scheduleEvents(o)},e.prototype.handlePayloadTooLargeResponse=function(e,t){if(1===t.length)return void this.fulfillRequest(t,e.statusCode,e.body.error);this.config.loggerProvider.warn(eX(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),l=new Set(o),u=t.filter(function(t,r){return t.event.user_id&&s.has(t.event.user_id)||t.event.device_id&&a.has(t.event.device_id)?void n.fulfillRequest([t],e.statusCode,e.body.error):(l.has(r)&&(t.timeout=n.throttleTimeout),!0)});u.length>0&&this.config.loggerProvider.warn(eX(e));var c=this.removeEventsExceedFlushMaxRetries(u);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;eY(t)?null==(o=this.diagnosticsClient)||o.increment("analytics.events.sent",e.length):(null==(r=this.diagnosticsClient)||r.increment("analytics.events.dropped",e.length),null==(i=this.diagnosticsClient)||i.recordEvent("analytics.events.dropped",{events:e.map(function(e){return e.event.event_type}),code:t,message:n,stack_trace:eV()})),this.removeEvents(e),e.forEach(function(e){return e.callback(eU(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}(),eZ=function(){function e(){this.name="identity",this.type="before",this.identityStore=eM().identityStore}return e.prototype.execute=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(this,function(n){return(t=e.user_properties)&&this.identityStore.editIdentity().updateUserProperties(t).commit(),[2,e]})})},e.prototype.setup=function(e){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(t){return e.instanceName&&(this.identityStore=eM(e.instanceName).identityStore),[2]})})},e}(),e0=function(e){if(Object.keys(e).length>1e3)return!1;for(var t in e){var n=e[t];
1if(!e1(t,n))return!1}return!0},e1=function(e,t){var n,r;if("string"!=typeof e)return!1;if(Array.isArray(t)){var i=!0;try{for(var o=(0,D.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;if(Array.isArray(a))return!1;if("object"==typeof a)i=i&&e0(a);else if(!["number","string"].includes(typeof a))return!1;if(!i)return!1}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else if(null==t)return!1;else if("object"==typeof t)return e0(t);else if(!["number","string","boolean"].includes(typeof t))return!1;return!0},e2=function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return(0,D.Cl)({},this._properties)},e.prototype.set=function(e,t){return this._safeSet(l.SET,e,t),this},e.prototype.setOnce=function(e,t){return this._safeSet(l.SET_ONCE,e,t),this},e.prototype.append=function(e,t){return this._safeSet(l.APPEND,e,t),this},e.prototype.prepend=function(e,t){return this._safeSet(l.PREPEND,e,t),this},e.prototype.postInsert=function(e,t){return this._safeSet(l.POSTINSERT,e,t),this},e.prototype.preInsert=function(e,t){return this._safeSet(l.PREINSERT,e,t),this},e.prototype.remove=function(e,t){return this._safeSet(l.REMOVE,e,t),this},e.prototype.add=function(e,t){return this._safeSet(l.ADD,e,t),this},e.prototype.unset=function(e){return this._safeSet(l.UNSET,e,"-"),this},e.prototype.clearAll=function(){return this._properties={},this._properties[l.CLEAR_ALL]="-",this},e.prototype._safeSet=function(e,t,n){if(this._validate(e,t,n)){var r=this._properties[e];return void 0===r&&(r={},this._properties[e]=r),r[t]=n,this._propertySet.add(t),!0}return!1},e.prototype._validate=function(e,t,n){return!(void 0!==this._properties[l.CLEAR_ALL]||this._propertySet.has(t))&&(e===l.ADD?"number"==typeof n:e===l.UNSET||e===l.REMOVE||e1(t,n))},e}();!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(l||(l={}));var e3=[l.CLEAR_ALL,l.UNSET,l.SET,l.SET_ONCE,l.ADD,l.APPEND,l.PREPEND,l.PREINSERT,l.POSTINSERT,l.REMOVE];!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(u||(u={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(c||(c={}));var e4=function(e,t){return(0,D.Cl)((0,D.Cl)({},t),{event_type:c.IDENTIFY,user_properties:e.getUserProperties()})},e6=function(e,t,n,r){var i;return(0,D.Cl)((0,D.Cl)({},r),{event_type:c.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:((i={})[e]=t,i)})},e5=function(e,t,n){var r,i=new e2;return i.set(e,t),(0,D.Cl)((0,D.Cl)({},n),{event_type:c.IDENTIFY,user_properties:i.getUserProperties(),groups:((r={})[e]=t,r)})},e8=function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(e){return this.productId=e,this},e.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},e.prototype.setPrice=function(e){return this.price=e,this},e.prototype.setRevenueType=function(e){return this.revenueType=e,this},e.prototype.setCurrency=function(e){return this.currency=e,this},e.prototype.setRevenue=function(e){return this.revenue=e,this},e.prototype.setReceipt=function(e){return this.receipt=e,this},e.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},e.prototype.setEventProperties=function(e){try{var t=JSON.parse(JSON.stringify(e));e0(t)&&(this.properties=t)}catch(e){}return this},e.prototype.getEventProperties=function(){var e=this.properties?(0,D.Cl)({},this.properties):{};return e[d.REVENUE_PRODUCT_ID]=this.productId,e[d.REVENUE_QUANTITY]=this.quantity,e[d.REVENUE_PRICE]=this.price,e[d.REVENUE_TYPE]=this.revenueType,e[d.REVENUE_CURRENCY]=this.currency,e[d.REVENUE]=this.revenue,e[d.RECEIPT]=this.receipt,e[d.RECEIPT_SIG]=this.receiptSig,e},e}();!function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"}(d||(d={}));var e7=function(e,t){return void 0===t&&(t=Date.now()),Date.now()-t>e},e9=function(){function e(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(e,t){var n,r;return(0,D.sH)(this,void 0,void 0,function(){var i;return(0,D.YH)(this,function(o){switch(o.label){case 0:if(void 0===e.name&&(e.name=Y(),this.loggerProvider.warn("Plugin name is undefined.\n      Generating a random UUID for plugin name: ".concat(e.name,".\n      Set a name for the plugin to prevent it from being added multiple times."))),i=e.name,this.pluginStatus.has(i))return this.loggerProvider.warn("Plugin with name ".concat(i," already exists, skipping registration")),[2];return e.type=null!=(n=e.type)?n:"enrichment",this.pluginStatus.set(i,"locked"),[4,null==(r=e.setup)?void 0:r.call(e,t,this.client)];case 1:if(o.sent(),"locked"!==this.pluginStatus.get(i))return[2];return this.plugins.push(e),this.pluginStatus.set(i,"installed"),[2]}})})},e.prototype.deregister=function(e,t){var n;return(0,D.sH)(this,void 0,void 0,function(){var r,i;return(0,D.YH)(this,function(o){switch(o.label){case 0:if(this.pluginStatus.delete(e),-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.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.call(e)}),this.plugins=[],this.pluginStatus.clear(),this.client=e},e.prototype.push=function(e){var t=this;return new Promise(function(n){t.queue.push([e,n]),t.scheduleApply(0)})},e.prototype.scheduleApply=function(e){var t=this;this.applying||(this.applying=!0,setTimeout(function(){t.apply(t.queue.shift()).then(function(){t.applying=!1,t.queue.length>0&&t.scheduleApply(0)})},e))},e.prototype.apply=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s,a,l,u,c,d,h,f,g,v;return(0,D.YH)(this,function(p){switch(p.label){case 0:if(!e)return[2];t=(0,D.zs)(e,1)[0],n=(0,D.zs)(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,D.Ju)(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,D.Cl)({},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(j(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(j(t))),p.label=4;case 4:return o=i.next(),[3,2];case 5:return[3,8];case 6:return h={error:p.sent()},[3,8];case 7:try{o&&!o.done&&(f=i.return)&&f.call(i)}finally{if(h)throw h.error}
1return[7];case 8:l=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=(u=(0,D.Ju)(l)).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,D.Cl)({},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(j(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(j(t))),p.label=12;case 12:return c=u.next(),[3,10];case 13:return[3,16];case 14:return g={error:p.sent()},[3,16];case 15:try{c&&!c.done&&(v=u.return)&&v.call(u)}finally{if(g)throw g.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(j(t))),Promise.all(d.map(function(e){var n=(0,D.Cl)({},t);return e.execute(n).catch(function(e){return eU(n,0,String(e))})})).then(function(e){var r=(0,D.zs)(e,1)[0]||eU(t,100,"Event not tracked, no destination plugins on the instance");n(r)}),[2]}})})},e.prototype.flush=function(){return(0,D.sH)(this,void 0,void 0,function(){var e,t=this;return(0,D.YH)(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)||n.call(t,e)})},e.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onSessionIdChanged)||n.call(t,e)})},e.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(t){var n;null==(n=t.onOptOutChanged)||n.call(t,e)}),this._callOptOutListeners(e)},e.prototype._callOptOutListeners=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,D.YH)(this,function(a){switch(a.label){case 0:a.trys.push([0,7,8,9]),n=(t=(0,D.Ju)(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)||t.call(e)})},e}(),te=function(){function e(e){void 0===e&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new e9(this),this.name=e}return e.prototype._init=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t=this;return(0,D.YH)(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return t.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(e,t){return(0,D.sH)(this,void 0,void 0,function(){var n,r,i,o,s,a;return(0,D.YH)(this,function(l){switch(l.label){case 0:n=this[e],this[e]=[],l.label=1;case 1:l.trys.push([1,8,9,10]),i=(r=(0,D.Ju)(n)).next(),l.label=2;case 2:if(i.done)return[3,7];if(!((o=(0,i.value)())&&"promise"in o))return[3,4];return[4,o.promise];case 3:return l.sent(),[3,6];case 4:return[4,o];case 5:l.sent(),l.label=6;case 6:return i=r.next(),[3,2];case 7:return[3,10];case 8:return s={error:l.sent()},[3,10];case 9:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}
1return[7];case 10:if(!this[e].length)return[3,12];return[4,this.runQueuedFunctions(e,t)];case 11:return l.sent(),[3,13];case 12:null==t||t(),l.label=13;case 13:return[2]}})})},e.prototype.track=function(e,t,n){var r=(0,D.Cl)((0,D.Cl)((0,D.Cl)({},"string"==typeof e?{event_type:e}:e),n),t&&{event_properties:t});return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),L(this.dispatch(r))},e.prototype.identify=function(e,t){var n=e4(e,t);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),L(this.dispatch(n))},e.prototype.groupIdentify=function(e,t,n,r){var i=e6(e,t,n,r);return L(this.dispatch(i))},e.prototype.setGroup=function(e,t,n){var r=e5(e,t,n);return this.userProperties=this.getOperationAppliedUserProperties(r.user_properties),L(this.dispatch(r))},e.prototype.revenue=function(e,t){var n=(0,D.Cl)((0,D.Cl)({},t),{event_type:c.REVENUE,event_properties:e.getEventProperties()});return L(this.dispatch(n))},e.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),L())},e.prototype._addPlugin=function(e){return L(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)),L())},e.prototype._removePlugin=function(e){return L(this.timeline.deregister(e,this.config))},e.prototype.dispatchWithCallback=function(e,t){if(!this.isReady)return t(eU(e,0,"Client not initialized"));this.process(e).then(t)},e.prototype.dispatch=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t=this;return(0,D.YH)(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)?t:{},r=(0,D.Cl)({},n);if(void 0===e)return r;var i={};return Object.keys(e).forEach(function(t){Object.values(u).includes(t)||(i[t]=e[t])}),e3.forEach(function(t){if(Object.keys(e).includes(t)){var n=e[t];switch(t){case u.CLEAR_ALL:Object.keys(r).forEach(function(e){delete r[e]});break;case u.UNSET:Object.keys(n).forEach(function(e){delete r[e]});break;case u.SET:Object.assign(r,n)}}}),Object.assign(r,i),r},e.prototype.process=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),this.config.optOut)return[2,eU(e,0,"Event skipped due to optOut config")];if("string"!=typeof(t=e.event_type)||0===t.trim().length)return this.config.loggerProvider.error(eH),[2,eU(e,0,eH)];return e.event_type===c.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(e)];case 1:return 200===(n=i.sent()).code?this.config.loggerProvider.log(n.message):100===n.code?this.config.loggerProvider.warn(n.message):this.config.loggerProvider.error(n.message),[2,n];case 2:return r=String(i.sent()),this.config.loggerProvider.error(r),[2,n=eU(e,0,r)];case 3:return[2]}})})},e.prototype.setOptOut=function(e){if(!this.isReady)return void this.q.push(this._setOptOut.bind(this,!!e));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 L(this.timeline.flush())},e.prototype.plugin=function(e){var t=this.timeline.plugins.find(function(t){return t.name===e});return void 0===t?void this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e)):t},e.prototype.plugins=function(e){return this.timeline.plugins.filter(function(t){return t instanceof e})},e}(),tt=function(e,t){var n,r,i;return"boolean"==typeof e?e:(null==e?void 0:e[t])!==!1&&("string"!=typeof(null==(r=null==(n=null==(i=(0,z.m)())?void 0:i.chrome)?void 0:n.runtime)?void 0:r.id)||!!(null==e?void 0:e[t]))},tn=function(e){return tt(e,"attribution")},tr=function(e){return tt(e,"formInteractions")},ti=function(e){return tt(e,"pageViews")},to=function(e){return tt(e,"sessions")},ts=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.networkTracking||"object"==typeof e.networkTracking)},ta=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.elementInteractions||"object"==typeof e.elementInteractions)},tl=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.webVitals;if("object"==typeof t&&null!==t)return t}},tu=function(e){return"boolean"==typeof e?e:"object"==typeof e&&(!0===e.frustrationInteractions||"object"==typeof e.frustrationInteractions)},tc=function(e){if("object"==typeof e.autocapture){var t=e.autocapture.performanceTracking;if(!0===t)return{mainThreadBlock:!0};if("object"==typeof t&&null!==t)return t}},td=function(e){if(ta(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.elementInteractions)return e.autocapture.elementInteractions},th=function(e){if(tu(e.autocapture)&&"object"==typeof e.autocapture&&"object"==typeof e.autocapture.frustrationInteractions)return e.autocapture.frustrationInteractions},tf=function(e){if(ts(e.autocapture)){var t,n,r=void 0;return"object"==typeof e.autocapture&&"object"==typeof e.autocapture.
1networkTracking?r=e.autocapture.networkTracking:e.networkTrackingOptions&&(r=e.networkTrackingOptions),(0,D.Cl)((0,D.Cl)({},r),{captureRules:(t=null==r?void 0:r.captureRules,n=e.loggerProvider,null==t?void 0:t.map(function(e){var t,r;if((null==(t=e.urls)?void 0:t.length)&&(null==(r=e.hosts)?void 0:r.length)){var i=JSON.stringify(e.hosts),o=JSON.stringify(e.urls);return null==n||n.warn("Found network capture rule with both urls='".concat(o,"' and hosts='").concat(i,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),(0,D.Cl)((0,D.Cl)({},e),{hosts:void 0})}return e}))})}},tg=function(e){var t,n=function(){return!1},r=void 0,i=e.pageCounter;return ti(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}},tv=function(e){if(tr(e.defaultTracking)&&e.defaultTracking&&"object"==typeof e.defaultTracking&&"object"==typeof e.defaultTracking.formInteractions)return e.defaultTracking.formInteractions},tp=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 l=a.apply(e,o);"function"==typeof s&&s(null==l?void 0:l.promise)}}return e},tm=function(e){return e&&void 0!==e._q},ty=function(e){var t,n;return"string"==typeof(null==(n=null==(t=e.chrome)?void 0:t.runtime)?void 0:n.id)},tb=function(e){var t=e.ServiceWorkerGlobalScope;return"function"==typeof t&&e instanceof t},tS=function(e){var t=e.WorkerGlobalScope;return"function"==typeof t&&e instanceof t},tw=function(e){var t,n;return"string"==typeof(null==(n=null==(t=e.process)?void 0:t.versions)?void 0:n.node)},tE=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[0])?t:navigator.language)?n:i)?r:""},tI="2.47.2",tk="amplitude-ts",tC=function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(tk,"/").concat(tI),"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,D.sH)(this,void 0,void 0,function(){var r,i,o;return(0,D.YH)(this,function(s){return r=new Date().getTime(),i=null!=(t=this.config.lastEventId)?t:-1,o=null!=(n=e.event_id)?n:i+1,this.config.lastEventId=o,e.time||(this.config.lastEventTime=r),[2,(0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)({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:tE()}),this.config.trackingOptions.ipAddress&&{ip:"$remote"}),{insert_id:Y(),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}(),tT=function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){return[2,!0]})})},e.prototype.get=function(e){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,this.memoryStorage.get(e)]})})},e.prototype.getRaw=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return this.memoryStorage.set(e,t),[2]})})},e.prototype.remove=function(e){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(t){return this.memoryStorage.delete(e),[2]})})},e.prototype.reset=function(){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){return this.memoryStorage.clear(),[2]})})},e}(),t_=function(){var e,t=(0,z.m)();return null==(e=null==t?void 0:t.navigator)?void 0:e.locks},tx=function(){function e(e,t){void 0===t&&(t={}),this.options=(0,D.Cl)({},e),this.config=t}return e.prototype.isEnabled=function(){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r,i=this;return(0,D.YH)(this,function(o){switch(o.label){case 0:return t="AMP_TEST",n=new e((0,D.Cl)({},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)||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)||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,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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=tO(t);if(void 0===n)return void console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(t));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,D.sH)(this,void 0,void 0,function(){var r,i,o,s,a,l,u,c;return(0,D.YH)(this,function(d){switch(d.label){case 0:r=(0,z.m)(),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)||t.recordEvent("cookies.duplicate",{cookies:o.map(function(e){return e.domain})}),null==(n=this.config.diagnosticsClient)||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(a=(s=(0,D.Ju)(o)).next();!a.done;a=s.next())if(l=a.value,tR(l.domain,this.options.domain))return[2,l.value]}catch(e){u={error:e}}finally{try{a&&!a.done&&(c=s.return)&&c.call(s)}finally{if(u)throw u.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=(0,z.m)(),o=(null!=(n=null==(t=null==i?void 0:i.document)?void 0:t.cookie.split("; "))?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)||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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return this.setSync(e,t),[2]})})},e.prototype.setSync=function(e,t){var n;try{var r=(0,z.m)();if(!r||!r.document||"function"!=typeof r.btoa||"function"!=typeof r.encodeURIComponent)return;var i=null!=(n=this.options.expirationDays)?n:0,o=null!==t?i:-1,s=void 0;if(o){var a=new Date;a.setTime(a.getTime()+24*o*36e5),s=a}var l="".concat(e,"=").concat(r.btoa(r.encodeURIComponent(JSON.stringify(t))));s&&(l+="; expires=".concat(s.toUTCString())),l+="; path=/",this.options.domain&&(l+="; domain=".concat(this.options.domain)),this.options.secure&&(l+="; Secure"),this.options.sameSite&&(l+="; SameSite=".concat(this.options.sameSite)),r.document.cookie=l}catch(t){var u=t instanceof Error?t.message:String(t);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(u))}},e.prototype.remove=function(e){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){return[2]})})},e.isDomainWritable=function(t){return(0,D.sH)(this,void 0,void 0,function(){var n,r;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var n,r,i=this;return(0,D.YH)(this,function(o){switch(o.label){case 0:if(n=t_(),r=function(){return t({get:function(){return i.getSync(e)},set:function(t){return i.setSync(e,t)}})},!n)return[2,r()];o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(e),r)];case 2:return[2,o.sent()];case 3:return o.sent(),[2,r()];case 4:return[2]}})})},e.cachedTlds={},e}(),tP=function(e){try{return decodeURIComponent(atob(e))}catch(e){return}},tA=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch(e){return}},tO=function(e){var t;return null!=(t=tP(e))?t:tA(e)},tR=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()},tN=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),["AMP",t,e.substring(0,n)].filter(Boolean).join("_")},tM=function(){function e(e){this.storage=e}return e.prototype.isEnabled=function(){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return[2,(null==(t=this.storage)?void 0:t.getItem(e))||void 0]})})},e.prototype.set=function(e,t){var n;return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(r){try{null==(n=this.storage)||n.setItem(e,JSON.stringify(t))}catch(e){}return[2]})})},e.prototype.remove=function(e){var t;return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){try{null==(t=this.storage)||t.removeItem(e)}catch(e){}return[2]})})},e.prototype.reset=function(){var e;return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(t){try{null==(e=this.storage)||e.clear()}catch(e){}return[2]})})},e}(),tD=function(e){function t(t){var n,r,i,o=this;try{i=null==(n=(0,z.m)())?void 0:n.localStorage}catch(e){null==(r=null==t?void 0:t.loggerProvider)||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,D.C6)(t,e),t.prototype.set=function(t,n){var r;return(0,D.sH)(this,void 0,void 0,function(){var i;return(0,D.YH)(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)||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}(tM),tL=function(e){function t(){var t;return e.call(this,null==(t=(0,z.m)())?void 0:t.sessionStorage)||this}return(0,D.C6)(t,e),t}(tM);function tH(){return"undefined"!=typeof CompressionStream}function tF(e){return(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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 tU=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,l,u,c,d,h,f,g,v,p,m,y,b,S,w,E,I,k=e.code||0,C=this.buildStatus(k);switch(C){case a.Success:return{status:C,statusCode:k,body:{eventsIngested:null!=(t=e.events_ingested)?t:0,payloadSizeBytes:null!=(n=e.payload_size_bytes)?n:0,serverUploadTime:null!=(r=e.server_upload_time)?r:0}};case a.Invalid:return{status:C,statusCode:k,body:{error:null!=(i=e.error)?i:"",missingField:null!=(o=e.missing_field)?o:"",eventsWithInvalidFields:null!=(s=e.events_with_invalid_fields)?s:{},eventsWithMissingFields:null!=(l=e.events_with_missing_fields)?l:{}
1,eventsWithInvalidIdLengths:null!=(u=e.events_with_invalid_id_lengths)?u:{},epsThreshold:null!=(c=e.eps_threshold)?c:0,exceededDailyQuotaDevices:null!=(d=e.exceeded_daily_quota_devices)?d:{},silencedDevices:null!=(h=e.silenced_devices)?h:[],silencedEvents:null!=(f=e.silenced_events)?f:[],throttledDevices:null!=(g=e.throttled_devices)?g:{},throttledEvents:null!=(v=e.throttled_events)?v:[]}};case a.PayloadTooLarge:return{status:C,statusCode:k,body:{error:null!=(p=e.error)?p:""}};case a.RateLimit:return{status:C,statusCode:k,body:{error:null!=(m=e.error)?m:"",epsThreshold:null!=(y=e.eps_threshold)?y:0,throttledDevices:null!=(b=e.throttled_devices)?b:{},throttledUsers:null!=(S=e.throttled_users)?S:{},exceededDailyQuotaDevices:null!=(w=e.exceeded_daily_quota_devices)?w:{},exceededDailyQuotaUsers:null!=(E=e.exceeded_daily_quota_users)?E:{},throttledEvents:null!=(I=e.throttled_events)?I:[]}};case a.Timeout:default:return{status:C,statusCode:k}}},e.prototype.buildStatus=function(e){return eY(e)?a.Success:429===e?a.RateLimit:413===e?a.PayloadTooLarge:408===e?a.Timeout:e>=400&&e<500?a.Invalid:e>=500?a.Failed:a.Unknown},e}(),tj=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,D.C6)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,D.sH)(this,void 0,void 0,function(){var r=this;return(0,D.YH)(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:"*/*"},l=JSON.stringify(t),u=n&&l.length>=2048&&tH(),c=function(e){var t,n;a=(0,D.Cl)((0,D.Cl)({},r.customHeaders),a);try{for(var i=(0,D.Ju)(Object.entries(a)),o=i.next();!o.done;o=i.next()){var l=(0,D.zs)(o.value,2),u=l[0],c=l[1];s.setRequestHeader(u,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,D.sH)(r,void 0,void 0,function(){var e;return(0,D.YH)(this,function(t){switch(t.label){case 0:if(!u)return[3,2];return[4,tF(l)];case 1:return(e=t.sent())?(a["Content-Encoding"]="gzip",c(e)):c(l),[3,3];case 2:c(l),t.label=3;case 3:return[2]}})}).catch(o)})]})})},t}(tU),tq=function(e){function t(t,n,r){void 0===t&&(t={});var i=e.call(this)||this;return i.customHeaders=t,i.enableKeepalive=!1!==n,i.referrerPolicy=r,i}return(0,D.C6)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,D.sH)(this,void 0,void 0,function(){var r,i,o,s,a,l,u,c,d;return(0,D.YH)(this,function(h){switch(h.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");if(r=JSON.stringify(t),i=n&&r.length>=2048&&tH(),o=r,s={"Content-Type":"application/json",Accept:"*/*"},!i)return[3,2];return[4,tF(r)];case 1:(a=h.sent())&&(s["Content-Encoding"]="gzip",o=a),h.label=2;case 2:return s=(0,D.Cl)((0,D.Cl)({},this.customHeaders),s),l="string"==typeof o?o.length:o.byteLength,u={headers:s,body:o,method:"POST",keepalive:this.enableKeepalive&&l<=16384},this.referrerPolicy&&(u.referrerPolicy=this.referrerPolicy),[4,fetch(e,u)];case 3:return[4,(c=h.sent()).text()];case 4:d=h.sent();try{return[2,this.buildResponse(JSON.parse(d))]}catch(e){return[2,this.buildResponse({code:c.status})]}}})})},t}(tU),tz=function(e){function t(){return e.call(this)||this}return(0,D.C6)(t,e),t.prototype.send=function(e,t,n){return void 0===n&&(n=!1),(0,D.sH)(this,void 0,void 0,function(){var n=this;return(0,D.YH)(this,function(r){return[2,new Promise(function(r,i){var o=(0,z.m)();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}(tU),tB=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},tY=function(e){if(atob&&escape&&e)try{return decodeURIComponent(escape(atob(e)))}catch(e){return}},tV="[Amplitude]",tW="".concat(tV," Form Started"),tJ="".concat(tV," Form Submitted"),tK="".concat(tV," File Downloaded"),t$="session_start",tG="session_end",tX="".concat(tV," File Extension"),tQ="".concat(tV," File Name"),tZ="".concat(tV," Link ID"),t0="".concat(tV," Link Text"),t1="".concat(tV," Link URL"),t2="".concat(tV," Form ID"),t3="".concat(tV," Form Name"),t4="".concat(tV," Form Destination"),t6="cookie",t5={always:"always",ifEmptyCampaign:"ifEmptyCampaign"},t8=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},t7=function(e,t,n,r,i,o){void 0===i&&(i=!0),e.referrer;var s=e.referring_domain,a=(0,D.Tt)(e,["referrer","referring_domain"]),l=t||{},u=(l.referrer,l.referring_domain),c=(0,D.Tt)(l,["referrer","referring_domain"]),d=n.excludeInternalReferrers;if(d){var h=nn(d,r);if(!(h instanceof TypeError)&&e.referring_domain&&ns(e.referring_domain,o)){if
1("always"===h)return nr(h,e.referring_domain,r),!1;else if("ifEmptyCampaign"===h&&Object.values((0,D.Cl)((0,D.Cl)({},e),{referring_domain:void 0,referrer:void 0})).every(function(e){return!e}))return nr(h,e.referring_domain,r),!1}}if(t9(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 f=JSON.stringify(a)!==JSON.stringify(c),g=t8(s||"")!==t8(u||""),v=!t||f||g;return v?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."),v},t9=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})},ne=function(e,t){var n=t.startsWith(".")?t:".".concat(t);return!!(e.startsWith(".")?e:".".concat(e)).endsWith(n)},nt=function(e){var t=e;return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},nn=function(e,t){if(!0===e)return t5.always;if("object"==typeof e){var n=e.condition;if("string"==typeof n&&Object.keys(t5).includes(n))return n;if(void 0===n)return t5.always}var r="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(r),TypeError(r)};function nr(e,t,n){var r="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");"always"===e?n.debug(r):"ifEmptyCampaign"===e&&n.debug("".concat(r," with empty campaign parameters"))}var ni=["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"],no=function(e){var t,n,r=e||(null==(n=null==(t=(0,z.m)())?void 0:t.location)?void 0:n.hostname);if(!r)return"";var i=r.split("."),o=i[i.length-1],s=i[i.length-2];return(ni.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},ns=function(e,t){var n=(0,z.m)();return!!n&&ne(e,(t||"").trim()||no(n.location.hostname))},na=function(e){function t(t,n,r,i,o,a,l,u,c,d,h,f,g,v,p,m,y,b,S,w,E,I,k,C,T,_,x,P,A,O,R,N,M,D,L,H,U,j,q,z,B,Y,V,W){void 0===r&&(r=new tT),void 0===i&&(i={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),void 0===u&&(u=1e3),void 0===c&&(c=5),void 0===d&&(d=30),void 0===h&&(h=t6),void 0===m&&(m=new F),void 0===y&&(y=s.Warn),void 0===S&&(S=!1),void 0===w&&(w=!1),void 0===k&&(k=""),void 0===C&&(C="US"),void 0===x&&(x=18e5),void 0===P&&(P=new tD({loggerProvider:m})),void 0===A&&(A={ipAddress:!0,language:!0,platform:!0}),void 0===O&&(O="fetch"),void 0===R&&(R=!1),void 0===N&&(N=!0),void 0===j&&(j=!0),void 0===q&&(q=0),void 0===V&&(V=!1);var J,K=this;(K=e.call(this,{apiKey:t,instanceName:g,storageProvider:P,transportProvider:nc(O)})||this).apiKey=t,K.appVersion=n,K.cookieOptions=i,K.defaultTracking=o,K.autocapture=a,K.flushIntervalMillis=u,K.flushMaxRetries=c,K.flushQueueSize=d,K.identityStorage=h,K.ingestionMetadata=f,K.loggerProvider=m,K.logLevel=y,K.minIdLength=b,K.offline=S,K.partnerId=E,K.plan=I,K.serverUrl=k,K.serverZone=C,K.sessionTimeout=x,K.storageProvider=P,K.trackingOptions=A,K.transport=O,K.useBatch=R,K.fetchRemoteConfig=N,K.networkTrackingOptions=H,K.identify=U,K.enableDiagnostics=j,K.diagnosticsSampleRate=q,K.diagnosticsClient=z,K.remoteConfig=B,K.topLevelDomain=Y,K.enableRequestBodyCompression=V,K.customEnrichment=W,K.version=tI,K._optOut=!1,K._cookieStorage=r,K.deviceId=l,K.lastEventId=v,K.lastEventTime=p,K.optOut=w,K.deferredSessionId=_,K.sessionId=T,K.pageCounter=D,K.userId=M,K.debugLogsEnabled=L,K.loggerProvider.enable(L?s.Debug:K.logLevel),K.networkTrackingOptions=H,K.identify=U,K.enableDiagnostics=j,K.diagnosticsSampleRate=q,K.diagnosticsClient=z;var $=null!=(J=null==B?void 0:B.fetchRemoteConfig)?J:N;return K.remoteConfig=K.remoteConfig||{},K.remoteConfig.fetchRemoteConfig=$,K.fetchRemoteConfig=$,K.topLevelDomain=Y||no(),K}return(0,D.C6)(t,e),Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(e){this._cookieStorage!==e&&(this._cookieStorage=e,this.updateStorage())}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(e){this._deviceId!==e&&(this._deviceId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(e){this._userId!==e&&(this._userId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(e){this._sessionId!==e&&(this._sessionId=e,void 0!==e&&void 0!==this._deferredSessionId&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(e){this._deferredSessionId!==e&&e!==this.sessionId&&(this._deferredSessionId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut!==e&&(this._optOut=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(e){this._lastEventTime!==e&&(this._lastEventTime=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(e){this._lastEventId!==e&&(this._lastEventId=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(e){this._pageCounter!==e&&(this._pageCounter=e,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(e){this._debugLogsEnabled!==e&&(this._debugLogsEnabled=e,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var e={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof tx&&(e.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(tN(this.apiKey),e)},t}(eq),nl=function(e,t,n){switch(void 0===e&&(e=t6),void 0===t&&(t={}),e){case"localStorage":return new tD;case"sessionStorage":return new tL;case"none":return new tT;default:return new tx((0,D.Cl)((0,D.Cl)({},t),{expirationDays:t.expiration}),n)}},nu=function(e){var t,n;return void 0===e&&(e={}),(null==(t=e.remoteConfig)?void 0:t.fetchRemoteConfig)===!0||(null==(n=e.remoteConfig)?void 0:n.fetchRemoteConfig)!==!1&&!1!==e.fetchRemoteConfig},nc=function(e){var t="object"==typeof e?e.type:e,n="object"==typeof e?e.headers:void 0,r="object"==typeof e?e.enableKeepalive:void 0,i="object"==typeof e?e.referrerPolicy:void 0;return"xhr"===t?new tj(n):"beacon"===t?new tz:new tq(n,r,i)},nd="data-amp-mask",nh="*****",nf=/\b(?:\d[ -]*?){13,16}\b/,ng=/(\d{3}-?\d{2}-?\d{4})/g,nv=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,np=function(e,t){if(void 0===t&&(t=[]),"string"!=typeof e)return"";var n,r,i=e;i=(i=(i=i.replace(nf,nh)).replace(ng,nh)).replace(nv,nh);try{for(var o=(0,D.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;try{i=i.replace(a,nh)}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},nm=function(e){if("undefined"==typeof document||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(nd)?nh:e?e(document.title):document.title},ny=function(e){var t={};for(var n in e){var r=e[n];r&&(t[n]=r)}return t},nb=function(){function e(){}return e.prototype.parse=function(){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){return[2,(0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)({},eA),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var e=ei();
1return{utm_campaign:e.utm_campaign,utm_content:e.utm_content,utm_id:e.utm_id,utm_medium:e.utm_medium,utm_source:e.utm_source,utm_term:e.utm_term}},e.prototype.getReferrer=function(){var e,t,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=null!=(t=null==(e=n.referrer)?void 0:e.split("/")[2])?t:void 0}catch(e){}return n},e.prototype.getClickIds=function(){var e,t=ei();return(e={})[eb]=t[eb],e[eS]=t[eS],e[ew]=t[ew],e[eE]=t[eE],e[eI]=t[eI],e[ek]=t[ek],e[eC]=t[eC],e[eT]=t[eT],e[e_]=t[e_],e[ex]=t[ex],e[eP]=t[eP],e},e}(),nS="AMP_PAGE_VIEW",nw=function(e){void 0===e&&(e={});var t,n,r,i=(0,z.m)(),o=void 0,s=!1,a=e.trackOn,l=e.trackHistoryChanges,u=e.eventType,c=void 0===u?"[Amplitude] Page Viewed":u,d=function(e){var t=e;try{t=decodeURI(e)}catch(e){null==o||o.error("Malformed URI sequence: ",e)}return t},h=function(e){return(0,D.sH)(void 0,void 0,void 0,function(){var t,n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:return t=d("undefined"!=typeof location&&location.href||""),r={event_type:c},n=[{}],[4,nE()];case 1:return[2,(r.event_properties=D.Cl.apply(void 0,[D.Cl.apply(void 0,n.concat([i.sent()])),{"[Amplitude] Page Domain":"undefined"!=typeof location&&location.hostname||"","[Amplitude] Page Location":t,"[Amplitude] Page Path":"undefined"!=typeof location&&d(location.pathname)||"","[Amplitude] Page Title":nm(np),"[Amplitude] Page URL":t.split("?")[0],"[Amplitude] Page View ID":e}]),r)]}})})},f=function(){return void 0===a||"function"==typeof a&&a()},g="undefined"!=typeof location?location.href:null,v=function(){(0,D.sH)(void 0,void 0,void 0,function(){var e,n,i,s,a;return(0,D.YH)(this,function(u){switch(u.label){case 0:if(n=nk(l,e=location.href,g||"")&&f(),g=e,!n)return[3,4];if(i=void 0,r&&(i=Y(),r.set(nS,{pageViewId:i})),null==o||o.log("Tracking page view event"),null!=t)return[3,1];return[3,3];case 1:return a=(s=t).track,[4,h(i)];case 2:a.apply(s,[u.sent()]),u.label=3;case 3:u.label=4;case 4:return[2]}})})};return{name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(e,a){return(0,D.sH)(void 0,void 0,void 0,function(){var l,u,c;return(0,D.YH)(this,function(d){switch(d.label){case 0:if(t=a,n=e,(o=e.loggerProvider).log("Installing @amplitude/plugin-page-view-tracking-browser"),s=!0,i){try{r=new tM(i.sessionStorage)}catch(e){null==o||o.debug("sessionStorage is not available in this environment.")}i.addEventListener("popstate",v),i.history.pushState=new Proxy(i.history.pushState,{apply:function(e,t,n){var r=(0,D.zs)(n,3),i=r[0],o=r[1],a=r[2];e.apply(t,[i,o,a]),s&&v()}})}if(!f())return[3,2];return o.log("Tracking page view event"),l=void 0,r&&(l=Y(),r.set(nS,{pageViewId:l})),c=(u=t).track,[4,h(l)];case 1:c.apply(u,[d.sent()]),d.label=2;case 2:return[2]}})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){var t,i,s;return(0,D.YH)(this,function(l){switch(l.label){case 0:if(!("attribution"===a&&nI(e)))return[3,4];if(null==o||o.log("Enriching campaign event to page view event with campaign parameters"),t=void 0,!r)return[3,2];return[4,r.get(nS)];case 1:t=null==(i=l.sent())?void 0:i.pageViewId,l.label=2;case 2:return[4,h(t)];case 3:e.event_type=(s=l.sent()).event_type,e.event_properties=(0,D.Cl)((0,D.Cl)({},e.event_properties),s.event_properties),l.label=4;case 4:return n&&e.event_type===c&&(n.pageCounter=n.pageCounter?n.pageCounter+1:1,e.event_properties=(0,D.Cl)((0,D.Cl)({},e.event_properties),{"[Amplitude] Page Counter":n.pageCounter})),[2,e]}})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){return i&&(i.removeEventListener("popstate",v),s=!1),[2]})})}}},nE=function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e;return(0,D.YH)(this,function(t){switch(t.label){case 0:return e=ny,[4,new nb().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},nI=function(e){if("$identify"===e.event_type&&e.user_properties){var t=e.user_properties,n=t[u.SET]||{},r=t[u.UNSET]||{},i=(0,D.fX)((0,D.fX)([],(0,D.zs)(Object.keys(n)),!1),(0,D.zs)(Object.keys(r)),!1);return Object.keys(eA).every(function(e){return i.includes(e)})}return!1},nk=function(e,t,n){if("pathOnly"!==e)return t!==n;if(""==n)return!0;
1var r=new URL(t),i=new URL(n);return r.origin+r.pathname!==i.origin+i.pathname},nC=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,D.sH)(void 0,void 0,void 0,function(){var o,s;return(0,D.YH)(this,function(a){return t=tv(n),o=function(){if(!i)return void n.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");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=n_(e);s||i.track(tW,((t={})[t2]=nT(e.id),t[t3]=nT(e.name),t[t4]=n,t)),s=!0}),r(e,"submit",function(r){var o,a,l=n_(e);if(s||i.track(tW,((o={})[t2]=nT(e.id),o[t3]=nT(e.name),o[t4]=l,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(tJ,((a={})[t2]=nT(e.id),a[t3]=nT(e.name),a[t4]=l,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){try{if("FORM"===e.nodeName&&s(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var t=e.querySelectorAll("form");null==t||t.forEach(s)}}catch(e){n.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?o():(s=(0,z.m)())?s.addEventListener("load",o):n.loggerProvider.debug("Form interaction tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return null==e||e.disconnect(),i(),[2]})})}}},nT=function(e){if("string"==typeof e)return e},n_=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(null!=t?t:""),window.location.href).href}catch(e){}return t},nx=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,D.sH)(void 0,void 0,void 0,function(){var i,o;return(0,D.YH)(this,function(s){return i=function(){if(!r)return void t.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");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(tK,((n={})[tX]=s,n[tQ]=t.pathname,n[tZ]=e.id,n[t0]=e.text,n[t1]=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)(\?.+)?$/;Array.from(document.getElementsByTagName("a")).forEach(i),"undefined"!=typeof MutationObserver&&(e=new MutationObserver(function(e){e.forEach(function(e){e.addedNodes.forEach(function(e){try{if("A"===e.nodeName&&i(e),"querySelectorAll"in e&&"function"==typeof e.querySelectorAll){var n=e.querySelectorAll("a");null==n||n.forEach(i)}}catch(e){t.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(e)))}})})})).observe(document.body,{subtree:!0,childList:!0})}},"complete"===document.readyState?i():(o=(0,z.m)())?o.addEventListener("load",i):t.loggerProvider.debug("File download tracking is not installed because global is undefined."),[2]})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return null==e||e.disconnect(),r(),[2]})})}}},nP=!1,nA=function(e){nP||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."),nP=!0)},nO=function(){var e=(0,z.m)(),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,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(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(){!1!==e.offline&&(e.loggerProvider.debug("Network connectivity changed to online."),e.offline=!1,setTimeout(function(){t.flush()},e.flushIntervalMillis))}),n("offline",function(){e.loggerProvider.debug("Network connectivity changed to offline."),e.offline=!0})),[2]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){return r(),[2]})})}}};function nR(e,t,n){var r,i,o=[];try{for(var s=(0,D.Ju)(null!=t?t:[]),a=s.next();!a.done;a=s.next()){var l=a.value;try{o.push(new RegExp(l))}catch(e){n.warn("Invalid regex pattern: ".concat(l),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 nN=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],nM="data-amp-track-",nD=["div","span","h1","h2","h3","h4","h5","h6"],nL=n(83886),nH=n.n(nL);
1function nF(e,t){return new(nH())(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 nU(e,t){return new(nH())(function(n){var r=!1,i=new Set,o=function(){var e,t;r=!0;try{for(var n=(0,D.Ju)(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 nj(e){var t=new Set,n=null;function r(){null==n||n.unsubscribe(),n=null,t.clear()}return new(nH())(function(i){return t.add(i),null===n&&(n=e.subscribe({next:function(e){try{for(var n,r,i,o=(0,D.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.next)||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,D.Ju)(t),a=s.next();!a.done;a=s.next()){var l=a.value;null==(o=l.error)||o.call(l,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,D.Ju)(t),s=o.next();!s.done;s=o.next()){var a=s.value;null==(i=a.complete)||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 nq="https://app.amplitude.com",nz={US:nq,EU:"https://app.eu.amplitude.com",STAGING:"https://apps.stag2.amplitude.com"},nB="__AMPLITUDE_MESSENGER_INSTANCE__",nY="__AMPLITUDE_MESSENGER__",nV=function(){function e(e){var t=(void 0===e?{}:e).origin;this[h]=!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?nq:t}return e.prototype.notify=function(e){var t,n,r,i;null==(n=null==(t=this.logger)?void 0:t.debug)||n.call(t,"Message sent: ",JSON.stringify(e)),null==(i=null==(r=window.opener)?void 0:r.postMessage)||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)||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.warn)||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,D.Ju)(s),l=a.next();!l.done;l=a.next()){var u=l.value;t(u)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r;return(0,D.YH)(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)||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===nq&&(this.endpoint=s),this.isSetup||(this.isSetup=!0,null==(n=null==(t=this.logger)?void 0:t.debug)||n.call(t,"Setting up messenger"),this.messageHandler=function(e){if(null==(n=null==(t=r.logger)?void 0:t.debug)||n.call(t,"Message received: ",JSON.stringify(e)),r.endpoint===e.origin){var t,n,i,o,s,a=e.data,l=null==a?void 0:a.action;if(l)if("id"in a&&a.id)null==(o=null==(i=r.logger)?void 0:i.debug)||o.call(i,"Received Response to previous request: ",JSON.stringify(e)),r.handleResponse(a
1);else{if("ping"===l)return void r.notify({action:"pong"});var u=r.actionHandlers.get(l);if(u)u(a.data);else{var c=null!=(s=r.pendingMessages.get(l))?s:[];c.push(a.data),r.pendingMessages.set(l,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,z.m)();(null==e?void 0:e[nY])===this&&delete e[nY]},e}();function nW(e){var t=(0,z.m)(),n=null==t?void 0:t[nY];if("object"==typeof n&&null!==n&&nB in n&&!0===n[nB])return n;var r=new nV(e);return t&&(t[nY]=r),r}h=nB;var nJ=["desktop","tablet","mobile"],nK=function(e){if("string"==typeof e)return nJ.includes(e)?e:void 0},n$="__AMPLITUDE_BACKGROUND_CAPTURE__";function nG(e,t){var n;if(!0!==e[n$]){e[n$]=!0;var r=null!=(n=null==t?void 0:t.scriptUrl)?n:"https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz",i=null,o=function(t,n){var r,i;"background-capture-complete"===t&&(null==(i=null==(r=e.logger)?void 0:r.debug)||i.call(r,"Background capture complete"),e.notify({action:"background-capture-complete",data:n}))};e.registerActionHandler("initialize-background-capture",function(t){null==(s=null==(n=e.logger)?void 0:n.debug)||s.call(n,"Initializing background capture (external script)");var n,s,a=new URL(r,e.endpoint).toString(),l=t&&"object"==typeof t?nK(t.deviceMode):void 0;e.loadScriptOnce(a).then(function(){var t,n,r;null==(n=null==(t=e.logger)?void 0:t.debug)||n.call(t,"Background capture script loaded (external)"),i=null==(r=null==window?void 0:window.amplitudeBackgroundCapture)?void 0:r.call(window,(0,D.Cl)({messenger:e,onBackgroundCapture:o},void 0!==l?{initialDeviceMode:l}:{})),e.notify({action:"background-capture-loaded"})}).catch(function(){var t;null==(t=e.logger)||t.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var e;null==(e=null==i?void 0:i.close)||e.call(i),i=null})}}var nX="1.29.5",nQ="[Amplitude] Element Clicked",nZ="[Amplitude] Element Tag",n0="[Amplitude] Element Text",n1="[Amplitude] Page URL",n2="[Amplitude] Viewport Height",n3="[Amplitude] Viewport Width",n4="[Amplitude] Page View ID",n6="data-amp-mask-attributes",n5="data-amp-internal-shadow",n8=function(e,t){return!t||!t.length||t.some(function(t){return"string"==typeof t?e===t:e.match(t)})},n7=function(e,t){var n=e;try{n=decodeURI(e)}catch(e){null==t||t.error("Malformed URI sequence: ",e)}return n},n9=":scope > ";function re(e){return"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot}function rt(e,t){var n,r,i,o;return(0,D.YH)(this,function(s){switch(s.label){case 0:n=e,r=0,i=0,s.label=1;case 1:if(!(null!==n&&i<1024))return[3,3];return i+=1,[4,n];case 2:if(s.sent(),n.parentElement)return n=n.parentElement,[3,1];if(r<t&&"function"==typeof n.getRootNode&&(o=function(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return re(t)?t.host:null}(n))&&o!==n)return r+=1,n=o,[3,1];return[3,3];case 3:return[2]}})}function rn(e,t){var n=[];if(t<=0)return n;for(var r=[[e,0]],i=0;r.length&&i<5e4;){i+=1;var o=(0,D.zs)(r.pop(),2),s=o[0],a=o[1],l=s.shadowRoot;if(l&&a+1<=t){n.push({root:l,depth:a+1});for(var u=l.children,c=0;c<u.length;c++)r.push([u[c],a+1])}for(var d=s.children,c=0;c<d.length;c++)r.push([d[c],a])}return n}function rr(e,t){for(var n=[],r=e,i=0;null!==r&&i<1024;){i+=1;var o=function(e){var t,n=e.getRootNode();return re(n)?n:null!=(t=e.ownerDocument)?t:document}(r);n.push({root:o,target:r});var s=r.getRootNode();if(!re(s))break;r=s.host}var a=n.length-1,l=!1,u=n;return a>t&&(u=n.slice(a-t),l=!0),{segments:u.reverse(),truncated:l}}function ri(e,t){for(var n=0,r=0;r<t.length;r++){var i=t[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}var ro=Object.freeze({enabled:!1,maxDepth:0}),rs=function(e){var t,n=null!=(t=e.maxShadowDomDepth)?t:1;return!e.shadowDomEnabled||n<=0?ro:Object.freeze({enabled:!0,maxDepth:n})},ra=function(){var e=ro,t=new Set,n=function(e){var n,r;try{for(var i=(0,D.Ju)((0,D.fX)([],(0,D.zs)(t),!1)),o=i.next();!o.done;o=i.next()){var s=o.value;try{s(e)}catch(e){}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}t.clear()};return{get:function(){return e},arm:function(t){return e.enabled||!t.enabled||(e=t,n(t)),e},onArm:function(n){if(e.enabled){var r=e;try{n(r)}catch(e){}return function(){}}return t.add(n),function(){t.delete(n)}}}},rl=["input","select","textarea"],ru=function(e,t){var n,r=null==(n=null==window?void 0:window.getComputedStyle)?void 0:n.call(window,e);return(null==r?void 0:r.getPropertyValue("cursor"))==="pointer"&&"click"===t},rc=function(e){var t=e.pageUrlAllowlist,n=e.pageUrlExcludelist;return!(n&&n.length>0&&n8(window.location.href,n))&&!!n8(window.location.href,t)},rd=function(e,t){return function(n,r){var i,o,s=e.shouldTrackEventResolver,a=null==(o=null==(i=null==r?void 0:r.tagName)?void 0:i.toLowerCase)?void 0:o.call(i);if(!a)return!1;if(s)return s(n,r);if(!rc(e))return!1;var l=String(null==r?void 0:r.getAttribute("type"))||"";if("string"==typeof l)switch(l.toLowerCase()){case"hidden":case"password":return!1}if(t&&!t.some(function(e){var t;return!!(null==(t=null==r?void 0:r.matches)?void 0:t.call(r,e))}))return!1;switch(a){case"input":case"select":case"textarea":return"change"===n||"click"===n;default:return"click"===n}}},rh=function(e){var t,n,r,i=null==(n=null==(t=null==e?void 0:e.tagName)?void 0:t.toLowerCase)?void 0:n.call(t),o=e instanceof HTMLElement&&(null==(r=e.getAttribute("contenteditable"))?void 0:r.toLowerCase())==="true";return!rl.includes(i)&&!o},rf=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},{})},rg=function(){var e;try{var t=(0,z.m)(),n=null==(e=null==t?void 0:t.sessionStorage)?void 0:e.getItem("AMP_PAGE_VIEW");if(!n)return;var r=JSON.parse(n);if("string"==typeof r.pageViewId)return r.pageViewId}catch(e){}},rv=function(e,t,n){return(void 0===n&&(n=ro),n.enabled)?rm(e,t,n.maxDepth):rp(e,t)},rp=function(e,t){return e?t.some(function(t){var n;return null==(n=null==e?void 0:e.matches)?void 0:n.call(e,t)})?e:rp(null==e?void 0:e.parentElement,t):null},rm=function(e,t,n){if(!e)return null;var r,i,o=function(e){if(t.some(function(t){var n;return null==(n=null==e?void 0:e.matches)?void 0:n.call(e,t)}))return{value:e}};try{for(var s=(0,D.Ju)(rt(e,n)),a=s.next();!a.done;a=s.next()){var l=a.value,u=o(l);if("object"==typeof u)return u.value}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return null},ry=function(e,t,n){return void 0===n&&(n=ro),n.enabled?rS(e,t,n.maxDepth):rb(e,t)},rb=function(e,t){var n=[];return t&&e.querySelectorAll(t).forEach(function(e){return n.push(e)}),n},rS=function(e,t,n){var r=rb(e,t),i=e instanceof Document?e.documentElement:e;
1return i&&rn(i,n).forEach(function(e){e.root.querySelectorAll(t).forEach(function(e){return r.push(e)})}),r},rw=function(e,t){if(void 0===t&&(t=ro),!t.enabled)return e.target;var n,r,i=null==(n=e.composedPath)?void 0:n.call(e),o=null!=(r=e.target)?r:null;if(!i||0===i.length)return o;var s=i[0];if(!(s instanceof Element))return null!=s?s:o;var a=rr(s,t.maxDepth),l=a.segments;return a.truncated&&l.length>0?l[l.length-1].target:s},rE=function(e){return null!==e.event.target&&!!e.closestTrackedAncestor};function rI(e){if(!e)return"";try{var t=new URL(e);return t.search="",n7(t.href)}catch(t){return n7(e)}}function rk(e){var t,n;return void 0===e&&(e=(0,z.m)()),rI(null!=(n=null==(t=null==e?void 0:e.location)?void 0:t.href)?n:"")}!function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"}(g||(g={}));var rC="__AMPLITUDE_VISUAL_TAGGING__",rT=(0,z.m)(),r_=null==rT?void 0:rT.console,rx={},rP={},rA=!1,rO={addListener:function(e,t){if(!r_||"function"!=typeof r_[e]||!rP[e]&&(rP[e]=r_[e],r_[e]=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];try{if(rx[e]&&!rA){rA=!0;var r=rx[e];r&&r.forEach(function(n){try{n(e,t)}catch(e){}})}}catch(e){}return rA=!1,rP[e].apply(r_,t)},0))return Error("Console override failed");rx[e]?rx[e].push(t):rx[e]=[t]},removeListener:function(e){var t,n;try{for(var r=(0,D.Ju)(Object.values(rx)),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}}}},rR=(0,z.m)(),rN=function(e){return e.get()},rM={childList:!0,attributes:!0,characterData:!0,subtree:!0},rD=function(e){return new(nH())(e?function(t){var n,r=new WeakSet,i=new WeakMap,o=function(e,t){r.has(e)||(r.add(e),re(e)&&i.set(e,t),l.observe(e,rM))},s=function(e,t,n){var r=n-t;r<=0||rn(e,r).forEach(function(e){return o(e.root,t+e.depth)})},a=function(e){var t=e.getRootNode();if(!re(t))return 0;var n=i.get(t);return null!=n?n:0},l=new MutationObserver(function(n){var r,i;t.next(n);try{var o=rN(e);if(!o.enabled)return;try{for(var l=(0,D.Ju)(n),u=l.next();!u.done;u=l.next()){var c=u.value;!function(e){var t=a(e.target);e.addedNodes.forEach(function(e){e instanceof Element&&s(e,t,o.maxDepth)})}(c)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(r)throw r.error}}}catch(e){}});if(document.body){var u=document.body;o(u,0),n=e.onArm(function(e){s(u,0,e.maxDepth)})}return function(){null==n||n(),l.disconnect()}}:function(e){var t=new MutationObserver(function(t){e.next(t)});return document.body&&t.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return t.disconnect()}})},rL=function(e){return void 0===e&&(e="click"),new(nH())(function(t){var n,r=function(e){t.next(e)};return null==(n=(0,z.m)())||n.document.addEventListener(e,r,{capture:!0}),function(){var t;null==(t=(0,z.m)())||t.document.removeEventListener(e,r,{capture:!0})}})},rH=function(e,t,n,r){var i="function"==typeof n?n:void 0,o="function"==typeof n?r:n;return new(nH())(function(n){var r=(0,z.m)();if(!(null==r?void 0:r.IntersectionObserver))return function(){};var s=new IntersectionObserver(function(e){e.forEach(function(e){n.next(e)})},{root:null,rootMargin:"0px",threshold:0}),a=t.join(","),l=function(e){e instanceof Element&&e.matches(a)&&s.observe(e),e.querySelectorAll(a).forEach(function(e){s.observe(e)})},u=function(e){if(o)try{ry(e,a,rN(o)).forEach(function(e){s.observe(e)})}catch(e){}},c=function(){var e=null==r?void 0:r.document;if(e){var t=[];try{t=o&&rN(o).enabled?ry(e,a,rN(o)):e.querySelectorAll(a)}catch(e){return}Array.from(t).forEach(function(e){s.unobserve(e),s.observe(e)})}};null==i||i(c),c();var d=null==o?void 0:o.onArm(function(){(null==r?void 0:r.document)&&u(r.document)}),h=e.subscribe(function(e){return e.event.forEach(function(e){return e.addedNodes.forEach(function(e){if(e instanceof DocumentFragment)return void l(e);if(e instanceof Element){if(!o||!rN(o).enabled)return void l(e);try{e.matches(a)&&s.observe(e)}catch(e){}u(e)}})})});return function(){null==i||i(void 0),null==d||d(),h.unsubscribe(),s.disconnect()}})},rF=function(){var e=nU(new(nH())(function(e){var t=function(t){if(t instanceof ErrorEvent){var n={kind:"error"};t.error instanceof Error||t.error instanceof DOMException?n=(0,D.Cl)((0,D.Cl)({},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 rR.addEventListener("error",t),function(){rR.removeEventListener("error",t)}}),new(nH())(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 rR.addEventListener("unhandledrejection",t),function(){rR.removeEventListener("unhandledrejection",t)}}));return nU(e,new(nH())(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 rO.addListener("error",t),function(){rO.removeListener(t)}}))},rU=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},rj=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){}},rq=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}})}
1,rz={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},rB=function(e){var t,n,r,i,o=Object.values(rz).reduce(function(e,t){return e[t]=new Set,e},{});if(!e)return o;try{for(var s=(0,D.Ju)(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{try{for(var u=(r=void 0,(0,D.Ju)(l.definition)),c=u.next();!c.done;c=u.next()){var d=rz[c.value.event_type];d&&o[d].add(l.id)}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(r)throw r.error}}}catch(e){console.warn("Skipping Labeled Event due to malformed definition",null==l?void 0:l.id,e)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return o},rY=function(e){var t,n,r,i,o=new Map;try{for(var s=(0,D.Ju)(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(r=void 0,(0,D.Ju)(l.conditions)),c=u.next();!c.done;c=u.next()){var d=c.value;if("LABELED_EVENT"===d.type){var h=d.match.eventId,f=o.get(h);f||(f=[],o.set(h,f)),f.push(l)}}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}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},rV=function(e,t){var n,r,i,o,s=new Set;try{for(var a=(0,D.Ju)(e),l=a.next();!l.done;l=a.next()){var u=l.value,c=t.get(u.id);if(c)try{for(var d=(i=void 0,(0,D.Ju)(c)),h=d.next();!h.done;h=d.next()){var f=h.value;s.add(f)}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return Array.from(s)},rW=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=rV(Array.from(this.groupedLabeledEvents[e.type]).map(function(e){return r.labeledEvents[e]}).filter(function(t){return t.definition.some(function(t){return rz[t.event_type]===e.type&&t.filters.every(function(t){return rU(e,t)})})}),this.labeledEventToTriggerMap);try{for(var o=(0,D.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;rq(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}(),rJ=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",n6,nd,n5]),rK=["type"],r$=["svg","path","g"],rG=["password","hidden"];function rX(e,t){return(void 0===t&&(t=ro),e)?t.enabled?function(e,t){var n,r,i=[];try{for(var o=(0,D.Ju)(rt(e,t)),s=o.next();!s.done;s=o.next()){var a=s.value;if("HTML"===a.tagName)break;i.push(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}(e,t.maxDepth):function(e){var t=[];t.push(e);for(var n=e.parentElement;n&&"HTML"!==n.tagName;)t.push(n),n=n.parentElement;return t}(e):[]}var rQ=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:(0,D.fX)([],(0,D.zs)([/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/]),!1),unstableClassPatterns:(0,D.fX)([],(0,D.zs)([/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/]),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:!1,maxShadowDomDepth:1});function rZ(e){var t;return(0,D.Cl)((0,D.Cl)({},e),{shadowDomEnabled:null!=(t=e.shadowDomEnabled)&&t,maxShadowDomDepth:r1(e.maxShadowDomDepth)})}function r0(e,t){if(!e)return r2();var n=r2();return"boolean"==typeof e.enabled&&(n.enabled=e.enabled),"string"==typeof e.explicitTrackingAttribute&&""!==e.explicitTrackingAttribute&&(n.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(n.autogeneratedIdPatterns=function(e,t){var n,r,i=[];try{for(var o=(0,D.Ju)(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(n.unstableClassPatterns=function(e,t){var n,r,i=[];try{for(var o=(0,D.Ju)(e),s=o.next();!s.done;s=o.next()){var a=s.value;try{i.push(new RegExp(a))}catch(e){var l=e instanceof Error?e.message:String(e);null==t||t.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(a,'" (').concat(l,")"))}}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}(e.unstableClassPatterns,t)),n.maxAncestorWalkDepth=function(e){if("number"==typeof e&&Number.isFinite(e)&&!(e<=0))return Math.floor(e)}(e.maxAncestorWalkDepth),"boolean"==typeof e.shadowDomEnabled&&(n.shadowDomEnabled=e.shadowDomEnabled),n.maxShadowDomDepth=r1(e.maxShadowDomDepth),rZ(n)}function r1(e){return"number"==typeof e&&Number.isFinite(e)?Math.min(Math.max(Math.floor(e),1),10):1}
1function r2(){return{enabled:rQ.enabled,explicitTrackingAttribute:rQ.explicitTrackingAttribute,autogeneratedIdPatterns:(0,D.fX)([],(0,D.zs)(rQ.autogeneratedIdPatterns),!1),unstableClassPatterns:(0,D.fX)([],(0,D.zs)(rQ.unstableClassPatterns),!1),maxAncestorWalkDepth:rQ.maxAncestorWalkDepth,shadowDomEnabled:rQ.shadowDomEnabled,maxShadowDomDepth:rQ.maxShadowDomDepth}}function r3(e,t){var n=e.getAttribute(t.explicitTrackingAttribute);if(null!==n&&""===n)return null;var r=e.getAttribute("id");return null===r||""===r||!function(e,t){var n,r;if(null==e||""===e)return!1;try{for(var i=(0,D.Ju)(t),o=i.next();!o.done;o=i.next())if(o.value.test(e))return!1}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return!0}(r,t.autogeneratedIdPatterns)?null:r}function r4(e){var t=globalThis.CSS;if(t&&"function"==typeof t.escape)return t.escape(e);for(var n=String(e),r=n.length,i="",o=0;o<r;o++){var s=n.charCodeAt(o);if(0===s){i+="�";continue}if(s>=1&&s<=31||127===s||0===o&&s>=48&&s<=57||1===o&&s>=48&&s<=57&&45===n.charCodeAt(0)){i+="\\".concat(s.toString(16)," ");continue}if(0===o&&1===r&&45===s){i+="\\-";continue}if(s>=128||45===s||95===s||s>=48&&s<=57||s>=65&&s<=90||s>=97&&s<=122){i+=n.charAt(o);continue}i+="\\".concat(n.charAt(o))}return i}function r6(e){var t=e.tagName.toLowerCase(),n=e.parentElement;if(null===n)return t;var r=function(e,t){for(var n=0,r=0;r<t.children.length;r++){var i=t.children[r];if(i.tagName===e.tagName&&(n+=1,i===e))return n}return 1}(e,n);return"".concat(t,":nth-of-type(").concat(r,")")}var r5=[{name:"explicitTrackingAttribute",try:function(e,t){var n=t.config.explicitTrackingAttribute,r=e.getAttribute(n);return null===r||""===r?null:"[".concat(n,"=").concat(JSON.stringify(r),"]")}},{name:"stableId",try:function(e,t){var n=r3(e,t.config);return null===n?null:"".concat(e.tagName.toLowerCase(),"#").concat(r4(n))}}];function r8(e,t,n,r,i){var o;try{o=e.querySelectorAll(t)}catch(e){var s=e instanceof Error?e.message:String(e);return null==i||i.debug('@amplitude/element-selector: strategy "'.concat(r,'" emitted a malformed selector "').concat(t,'" (').concat(s,")")),!1}return 1===o.length&&o[0]===n}var r7=function(){function e(e,t){this.value=e,this.optimized=t}return e.prototype.toString=function(){return this.value},e}(),r9=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var n=[],r=e;r;){var i=ie(r,!!t,r===e);if(!i||(n.push(i),i.optimized))break;r=r.parentElement}return n.reverse(),n.join(" > ")},ie=function(e,t,n){if(e.nodeType!==Node.ELEMENT_NODE)return null;var r,i,o=e.getAttribute("id");if(t){if(o)return new r7(ir(o),!0);var s=e.tagName.toLowerCase();if("body"===s||"head"===s||"html"===s)return new r7(s,!0)}var a=e.tagName.toLowerCase();if(o)return new r7(a+ir(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new r7(a,!0);for(var u=it(e),c=!1,d=!1,h=-1,f=-1,g=l.children,v=0;g&&(-1===h||!d)&&v<g.length;++v){var p=g[v];if(p.nodeType===Node.ELEMENT_NODE){if(f+=1,p===e){h=f;continue}if(!d&&p.tagName.toLowerCase()===a){c=!0;var m=new Set(u);if(!m.size){d=!0;continue}for(var y=it(p),b=0;b<y.length;++b){var S=y[b];if(m.has(S)&&(m.delete(S),!m.size)){d=!0;break}}}}}var w=a;if(n&&"input"===a.toLowerCase()&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(w+="[type="+r4(e.getAttribute("type")||"")+"]"),d)w+=":nth-child("+String(h+1)+")";else if(c)try{for(var E=(0,D.Ju)(u),I=E.next();!I.done;I=E.next()){var k=I.value;w+="."+r4(k.slice(1))}}catch(e){r={error:e}}finally{try{I&&!I.done&&(i=E.return)&&i.call(E)}finally{if(r)throw r.error}}return new r7(w,!1)},it=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(e){return"$"+e}):[]},ir=function(e){return"#"+r4(e)};function ii(e,t){try{return r9(e)}catch(e){var n=e instanceof Error?e.message:String(e);return null==t||t.warn("@amplitude/element-selector: legacyCssPath threw — emitting empty selector: ".concat(n)),""}}var io=function(e,t){var n,r;return!!rX(e,t).some(function(e){return e.hasAttribute(nd)})||null!=(r=null==(n=document.documentElement)?void 0:n.hasAttribute(nd))&&r},is=function(e,t){var n,r,i,o,s,a,l,u,c,d,h,g=this;
1this.replaceSensitiveString=function(e){return np(e,g.additionalMaskTextPatterns)},this.getHierarchy=function(e){var t,n,r,i,o=performance.now(),s=[];if(!e)return[];for(var a=g.getShadowMode(),l=rX(e,a),u=new Map,c=l.length-1;c>=0;c--){var d=l[c];if(d){var h,f=(h=d.getAttribute(n6))?h.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&"id"!==e&&"class"!==e}):[],v=c===l.length-1?[]:null!=(r=u.get(l[c+1]))?r:new Set,p=new Set((0,D.fX)((0,D.fX)([],(0,D.zs)(v),!1),(0,D.zs)(f),!1));u.set(d,p)}}s=l.map(function(e){var t;return function(e,t,n){if(void 0===n&&(n=ro),null===e)return null;var r,i,o,s,a,l=String(e.tagName).toLowerCase(),u={tag:l},c=Array.from(function(e,t){if(e.parentElement)return e.parentElement.children;var n=e.getRootNode();return t&&re(n)?n.children:[]}(e,n.enabled));c.length&&(u.index=c.indexOf(e),u.indexOfType=c.filter(function(t){return t.tagName===e.tagName}).indexOf(e));var d=null==(a=null==(s=e.previousElementSibling)?void 0:s.tagName)?void 0:a.toLowerCase();d&&(u.prevSib=String(d));var h=e.getAttribute("id");h&&(u.id=String(h));var f=Array.from(e.classList);f.length&&(u.classes=f);var g={},v=Array.from(e.attributes).filter(function(e){return!rJ.has(e.name)}),p=!rh(e);if(!rG.includes(String(e.getAttribute("type")))&&!r$.includes(l))try{for(var m=(0,D.Ju)(v),y=m.next();!y.done;y=m.next()){var b=y.value;if(!p||rK.includes(b.name)){if(t.has(b.name)){g[b.name]=nh;continue}g[b.name]=String(b.value).substring(0,128)}}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}return Object.keys(g).length&&(u.attrs=g),e.shadowRoot&&(u.attrs=(0,D.Cl)((0,D.Cl)({},u.attrs||{}),((o={})[n5]="true",o)),u.shadow=!0),u}(e,null!=(t=u.get(e))?t:new Set,a)});var m=function(e){(null==e?void 0:e.attrs)&&Object.entries(e.attrs).forEach(function(t){var n=(0,D.zs)(t,2),r=n[0],i=n[1];e.attrs&&(e.attrs[r]=g.replaceSensitiveString(i))})};try{for(var y=(0,D.Ju)(s),b=y.next();!b.done;b=y.next()){var S=b.value;m(S)}}catch(e){t={error:e}}finally{try{b&&!b.done&&(n=y.return)&&n.call(y)}finally{if(t)throw t.error}}var w=performance.now();return null==(i=g.diagnosticsClient)||i.recordHistogram("autocapturePlugin.getHierarchy",w-o),s},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?g.getText(t):g.getNearestLabel(n)},this.getElementPath=function(e){if(!e)return"";var t,n=performance.now(),r=g.selectorEngine.generate(e),i=performance.now();return null==(t=g.diagnosticsClient)||t.recordHistogram("autocapturePlugin.getElementPath",i-n),r},this.updateSelectorConfig=function(e,t){if(null!=e){var n,r="boolean"==typeof e.enabled,i="boolean"==typeof e.shadowDomEnabled;if(!r&&!i){null==t||t.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag — keeping current engine state.");return}var o=r0(e,t),s=g.selectorEngine.getConfig().enabled,a=g.shadowGate.get().enabled,l=g.shadowGate.arm(rs(o));g.selectorEngine.updateConfig((0,D.Cl)((0,D.Cl)((0,D.Cl)({},r?o:g.selectorEngine.getConfig()),{shadowDomEnabled:l.enabled}),l.enabled&&{maxShadowDomDepth:l.maxDepth})),r&&s!==o.enabled&&(null==t||t.debug(o.enabled?"@amplitude/element-selector: engine enabled — now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled — reverting to legacy cssPath for element paths.")),!a&&l.enabled&&(null==(n=g.diagnosticsClient)||n.setTag("plugin.autocapture.shadowDom","enabled:".concat(l.maxDepth)))}}
1,this.getShadowMode=function(){return g.shadowGate.get()},this.getEventProperties=function(e,t,n){var r,i,o,s,a=null==(o=null==(i=null==t?void 0:t.tagName)?void 0:i.toLowerCase)?void 0:o.call(i),l="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():{left:null,top:null},u=g.getHierarchy(t),c=null==(s=u[0])?void 0:s.attrs,d=g.getNearestLabel(t),h=Object.entries(null!=c?c:{}).reduce(function(e,t){var r=(0,D.zs)(t,2),i=r[0],o=r[1];if(i.startsWith(n)){var s=i.replace(n,"");s&&(e[s]=o||"")}return e},{}),f=((r={})["[Amplitude] Element Hierarchy"]=u,r[nZ]=a,r[n0]=g.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"]=h,r["[Amplitude] Element Path"]=g.getElementPath(t),r["[Amplitude] Element Parent Label"]=d,r[n1]=n7(window.location.href.split("?")[0]),r["[Amplitude] Page Title"]=nm(g.replaceSensitiveString),r[n2]=window.innerHeight,r[n3]=window.innerWidth,r),v=rg();if(v&&(f[n4]=v),f["[Amplitude] Element ID"]=t.getAttribute("id")||"",f["[Amplitude] Element Class"]=t.getAttribute("class"),f["[Amplitude] Element Aria Label"]=null==c?void 0:c["aria-label"],"a"===a&&"click"===e&&t instanceof HTMLAnchorElement){var p=t.href.substring(0,128);f["[Amplitude] Element Href"]=g.replaceSensitiveString(p)}return rf(f)},this.addTypeAndTimestamp=function(e,t){return{event:e,timestamp:Date.now(),type:t}},this.addAdditionalEventProperties=function(e,t,n,r,i){void 0===i&&(i=!1);var o=g.addTypeAndTimestamp(e,t);try{if(("click"===o.type||"change"===o.type)&&null!==o.event.target){var s=g.getShadowMode(),a=rw(o.event,s);if(i&&ru(a,o.type))return o.closestTrackedAncestor=a,o.targetElementProperties=g.getEventProperties(o.type,o.closestTrackedAncestor,r),o;var l=rv(a,n,s);l&&(o.closestTrackedAncestor=l,o.targetElementProperties=g.getEventProperties(o.type,l,r))}}catch(e){}return o},this.extractDataFromDataSource=function(e,t){if("DOM_ELEMENT"===e.sourceType){var n=rj(e,t);if(n){if("TEXT"===e.elementExtractType)return g.getText(n);if("ATTRIBUTE"===e.elementExtractType&&e.attribute)return n.getAttribute(e.attribute)}}},this.getTextWithMaskedDescendants=function(e){var t,n,r="[".concat(nd,"], [contenteditable]");if(!e.querySelector(r))return e.innerText;var i="",o=Array.from(e.childNodes);try{for(var s=(0,D.Ju)(o),a=s.next();!a.done;a=s.next()){var l=a.value;if(l.nodeType===Node.TEXT_NODE){i+=l.textContent||"";continue}if(l instanceof Element){if(l.hasAttribute(nd)||l.hasAttribute("contenteditable")){i+=nh;continue}i+=g.getTextWithMaskedDescendants(l)}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}return i},this.hasMaskedAncestor=function(e){var t=g.getShadowMode();return t.enabled?io(e,t):null!==e.closest("[".concat(nd,"]"))},this.getText=function(e){if(g.hasMaskedAncestor(e))return nh;var t="";return t=e.querySelector("[".concat(nd,"], [contenteditable]"))?g.getTextWithMaskedDescendants(e):e.innerText||"",g.replaceSensitiveString(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.toLowerCase)?void 0:r.call(n);return rf(((t={})[nZ]=i,t[n0]=g.getText(e),t[n1]=window.location.href.split("?")[0],t))},this.diagnosticsClient=null==t?void 0:t.diagnosticsClient,this.selectorEngine=(v||(n=r0(),void 0===r&&(r={}),i=rZ(n),o=new Set,s=r.logger,a=function(e){return ii(e,s)},l=function(e,t){var n;return null!=(n=function(e,t,n){void 0===n&&(n={});var r,i,o,s,a,l=rZ(t),u=null!=(o=n.strategies)?o:r5,c=null!=(a=null!=(s=n.scope)?s:e.ownerDocument)?a:document,d={scope:c,config:l},h=function(e,t){for(var n=[],r=e;null!==r&&(n.push(r),void 0===t||!(n.length>t));)r=r.parentElement;return n}(e,l.maxAncestorWalkDepth);try{for(var f=(0,D.Ju)(u),g=f.next();!g.done;g=f.next())for(var v=g.value,p=0;p<h.length;p++){var m=h[p],y=v.try(m,d);if(null!==y){if(0===p){if(r8(c,y,e,v.name,n.logger))return y;continue}var b=h.slice(0,p).reverse(),S=b.map(r6).join(" > "),w="".concat(y," > ").concat(S);if(r8(c,w,e,v.name,n.logger))return w}}}catch(e){r={error:e}}finally{try{g&&!g.done&&(i=f.return)&&i.call(f)}finally{if(r)throw r.error}}return null}(e,i,{strategies:r.strategies,scope:t,logger:s}
1))?n:function(e,t,n){void 0===n&&(n={});for(var r,i,o=rZ(t),s=null!=(i=null!=(r=n.scope)?r:e.ownerDocument)?i:document,a=re(s),l=[],u=e,c=0,d=!(o.shadowDomEnabled&&a);null!==u&&(!d||void 0===o.maxAncestorWalkDepth||!(c>o.maxAncestorWalkDepth));){var h=r3(u,o);if(null!==h){var f="".concat(u.tagName.toLowerCase(),"#").concat(r4(h)),g=(0,D.fX)([f],(0,D.zs)(l),!1).join(" > ");if(function(e,t,n){var r;try{r=e.querySelectorAll(t)}catch(e){return!1}return 1===r.length&&r[0]===n}(s,g,e))return g}l.unshift(function(e,t){var n=e.tagName.toLowerCase(),r=e.parentElement;if(null===r){var i=e.getRootNode();return t&&re(i)?"".concat(n,":nth-of-type(").concat(ri(e,i.children),")"):n}return"".concat(n,":nth-of-type(").concat(ri(e,r.children),")")}(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var v=l.join(" > ");return o.shadowDomEnabled&&a&&null===u?"".concat(n9).concat(v):v}(e,i,{scope:t})},u=function(e,t){var n,r;return n=a(e,t),r=function(e){for(var t=e;null!==t;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}(e),n&&r&&re(t)?"".concat(n9).concat(n):n},v={generate:function(e){try{if(!i.shadowDomEnabled)return(i.enabled?l:a)(e,null!=(n=null!=(t=r.scope)?t:e.ownerDocument)?n:document);return o=i.enabled?l:u,d=(c=rr(e,i.maxShadowDomDepth)).segments,c.truncated&&(null==s||s.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(i.maxShadowDomDepth,") — emitting a best-effort selector for the outermost in-budget shadow host"))),d.map(function(e){return o(e.target,e.root)}).join(" >>> ")}catch(r){var t,n,o,c,d,h=r instanceof Error?r.message:String(r);return null==s||s.warn("@amplitude/element-selector: selector generation threw — falling back to legacy cssPath: ".concat(h)),ii(e,s)}},getConfig:function(){return i},updateConfig:function(e){var t,n;i=rZ(e);try{for(var r=(0,D.Ju)(o),a=r.next();!a.done;a=r.next()){var l=a.value;try{l(i)}catch(e){var u=e instanceof Error?e.message:String(e);null==s||s.warn("@amplitude/element-selector: onConfigChange subscriber threw — ".concat(u))}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},onConfigChange:function(e){return o.add(e),function(){o.delete(e)}}}),v),this.shadowGate=(f||(f=ra()),f);var p=null!=(h=e.maskTextRegex)?h:[],m=[];try{for(var y=(0,D.Ju)(p),b=y.next();!b.done;b=y.next()){var S=b.value;if(m.length>=25)break;if(S instanceof RegExp)m.push(S);else if("pattern"in S&&"string"==typeof S.pattern)try{m.push(RegExp(S.pattern,"i"))}catch(e){}}}catch(e){c={error:e}}finally{try{b&&!b.done&&(d=y.return)&&d.call(y)}finally{if(c)throw c.error}}this.additionalMaskTextPatterns=m};function ia(e,t){var n=e.remoteConfigClient;if(e.fetchRemoteConfig&&n){var r=n.subscribe("configs.analyticsSDK.browserSDK.autocapture.elementSelector","all",function(n,r){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(r),") ").concat(JSON.stringify(n))),t.updateSelectorConfig(n,e.loggerProvider)});return function(){n.unsubscribe(r)}}}var il=function(e){var t;return e.assignedSlot||e.parentElement||(null==(t=e.parentNode)?void 0:t.host)||null},iu=function(e,t){return("fixed"===t||"absolute"===t)&&e instanceof HTMLElement?e.offsetParent:il(e)},ic=function(e){var t=(0,z.m)(),n=t.document.documentElement.clientHeight||t.innerHeight,r=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+.5*i.height,s=Math.max(i.left,0),a=Math.min(i.right,r);if(o<-1||o>n+1||s>=a||i.width<=0)return!1;for(var l=iu(e,t.getComputedStyle(e).position);l;){var u=t.getComputedStyle(l),c=u.overflowY&&"visible"!==u.overflowY,d=u.overflowX&&"visible"!==u.overflowX;if(c||d){var h=l.getBoundingClientRect();if(c&&(o<h.top-1||o>h.bottom+1)||d&&(s=Math.max(s,h.left))>=(a=Math.min(a,h.right)))return!1}l=iu(l,u.position)}return!0};!function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"}(p||(p={}));var id=function(e,t){void 0===e&&(e={}),null==t||t.diagnosticsClient.setTag("plugin.autocapture.version",nX);var n,r,i,o,s,a,l,u,c,d,h,f,g,v,m=e.dataAttributePrefix,y=void 0===m?nM:m,b=e.visualTaggingOptions,S=void 0===b?{enabled:!0}:b;e.cssSelectorAllowlist=null!=(n=e.cssSelectorAllowlist)?n:nN,e.actionClickAllowlist=null!=(r=e.actionClickAllowlist)?r:nD,e.debounceTime=null!=(i=e.debounceTime)?i:0;var w=(null==(o=e.viewportContentUpdated)?void 0:o.enabled)!==!1,E=null!=(l=null!=(a=null==(s=e.viewportContentUpdated)?void 0:s.exposureDuration)?a:e.exposureDuration)?l:150;e.viewportContentUpdated=(0,D.Cl)((0,D.Cl)({},e.viewportContentUpdated),{exposureDuration:E}),e.pageUrlExcludelist=null==(u=e.pageUrlExcludelist)?void 0:u.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 I="@amplitude/plugin-autocapture-browser",k=[],C=new is(e,t),T=new Set,_=new Set,x=new Set,P=function(){var t,n,r=nj(rL().map(function(t){return C.addAdditionalEventProperties(t,"click",e.cssSelectorAllowlist,y)})),i=nj(new(nH())(function(t){var n,r=function(n){var r=C.addAdditionalEventProperties(n,"change",e.cssSelectorAllowlist,y);t.next(r)};return null==(n=(0,z.m)())||n.document.addEventListener("change",r,{capture:!0}),function(){var e;return null==(e=(0,z.m)())?void 0:e.document.removeEventListener("change",r)}}));window.navigation&&(n=nj(new(nH())(function(t){var n=function(n){var r=C.addAdditionalEventProperties(n,"navigate",e.cssSelectorAllowlist,y);t.next(r)};return window.navigation.addEventListener("navigate",n),function(){window.navigation.removeEventListener("navigate",n)}})));var o=C.shadowGate,s=nj(rD(o).map(function(t){return C.addAdditionalEventProperties(t,"mutation",e.cssSelectorAllowlist,y)})),a=new(nH())(function(e){var t,n,r=function(t){e.next(t)};return null==(t=(0,z.m)())||t.addEventListener("scroll",r,{capture:!0,passive:!0}),null==(n=(0,z.m)())||n.addEventListener("resize",r,{passive:!0}),function(){var e,t;null==(e=(0,z.m)())||e.removeEventListener("scroll",r,{capture:!0}),null==(t=(0,z.m)())||t.removeEventListener("resize",r)}}),l=rH(s,e.cssSelectorAllowlist,function(e){v=e},o);return(t={})[p.ChangeObservable]=i,t[p.ClickObservable]=r,t[p.MutationObservable]=s,t[p.NavigateObservable]=n,t[p.ScrollObservable]=a,t[p.ExposureObservable]=l,t},A=rB(Object.values(null!=(d=null==(c=e.pageActions)?void 0:c.labeledEvents)?d:{})),O=rY(null!=(f=null==(h=e.pageActions)?void 0:h.triggers)?f:[]),R=new rW(A,O,C,e),N=function(t){var n,r;t&&(e.pageActions=(0,D.Cl)((0,D.Cl)({},e.pageActions),t),A=rB(Object.values(null!=(n=e.pageActions.labeledEvents)?n:{})),O=rY(null!=(r=e.pageActions.triggers)?r:[]),R.update(A,O,e))};return{name:I,type:"enrichment",setup:function(t,n){return(0,D.sH)(void 0,void 0,void 0,function(){var r,i,o,s,a,l,u,c,d,h,f,m,b,A,O,M,L,H,F,U,j,q,B,Y,V,W,J;return(0,D.YH)(this,function(K){var $,G,X,Q,Z,ee,et,en,er,ei,eo,es,ea,el,eu,ec,ed,eh,ef,eg,ev,ep,em,ey,eb,eS,ew,eE,eI,ek,eC,eT,e_,ex,eP,eA,eO,eR,eN,eM,eD,eL,eH,eF,eU,ej,eq,ez,eB,eY,eV,eW,eJ,eK,e$,eG,eX,eQ,eZ,e0,e1,e2,e3,e4,e6,e5;return"undefined"==typeof document?[2]:(r=!1,t.fetchRemoteConfig&&(t.remoteConfigClient?t.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(e){N(e)}):t.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),(i=ia(t,C))&&k.push({unsubscribe:i}),o=rd(e,e.cssSelectorAllowlist),s=rd(e,e.actionClickAllowlist),G=($={allObservables:a=P(),amplitude:n,shouldTrackEvent:o,evaluateTriggers:R.evaluate.bind(R)}).amplitude,X=$.allObservables,Q=$.shouldTrackEvent,Z=$.evaluateTriggers,l=X.
1clickObservable.filter(rE).filter(function(e){return Q("click",e.closestTrackedAncestor)}).map(function(e){return Z(e)}).subscribe(function(e){null==G||G.track(nQ,e.targetElementProperties)}),k.push(l),et=(ee={allObservables:a,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,(0,D.fX)((0,D.fX)([],(0,D.zs)(e),!1),[y],!1))},amplitude:n,shouldTrackEvent:o,evaluateTriggers:R.evaluate.bind(R)}).amplitude,en=ee.allObservables,er=ee.getEventProperties,ei=ee.shouldTrackEvent,eo=ee.evaluateTriggers,u=en.changeObservable.filter(rE).filter(function(e){return ei("change",e.closestTrackedAncestor)}).map(function(e){return eo(e)}).subscribe(function(e){null==et||et.track("[Amplitude] Element Changed",er("change",e.closestTrackedAncestor))}),k.push(u),ea=(es={allObservables:a,options:e,getEventProperties:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return C.getEventProperties.apply(C,(0,D.fX)((0,D.fX)([],(0,D.zs)(e),!1),[y],!1))},amplitude:n,shouldTrackEvent:o,shouldTrackActionClick:s}).amplitude,el=es.allObservables,eu=es.options,ec=es.getEventProperties,ed=es.shouldTrackEvent,eh=es.shouldTrackActionClick,ef=el.clickObservable,eg=el.mutationObservable,ev=el.navigateObservable,ep=ef.filter(function(e){return!ed("click",e.closestTrackedAncestor)}).map(function(e){var t=rv(e.event.target,eu.actionClickAllowlist);return e.closestTrackedAncestor=t,null!==e.closestTrackedAncestor&&(e.targetElementProperties=ec(e.type,e.closestTrackedAncestor)),e}).filter(rE).filter(function(e){return eh("click",e.closestTrackedAncestor)}),em=ev?nU(eg,ev):eg,ey=nU(ep,em),eb=null,eS=null,(c=nF(ey,function(e){if(eb&&(clearTimeout(eb),eb=null),"click"===e.type)eS=e,eb=setTimeout(function(){eb=null,eS=null},500);else if(eS){var t=eS;return eS=null,Promise.resolve(t)}return Promise.resolve(null)}).subscribe(function(e){e&&(null==ea||ea.track(nQ,ec("click",e.closestTrackedAncestor)))}))&&k.push(c),(ew={allObservables:a,amplitude:n}).amplitude,eE=ew.allObservables.scrollObservable,eI={maxX:0,maxY:0},ek=eE.subscribe(function(){var e,t,n,r,i=(0,z.m)(),o=Math.floor(null!=(t=null!=(e=null==i?void 0:i.scrollX)?e:null==i?void 0:i.pageXOffset)?t:0),s=Math.floor(null!=(r=null!=(n=null==i?void 0:i.scrollY)?n:null==i?void 0:i.pageYOffset)?r:0);eI.maxX=Math.max(eI.maxX,o),eI.maxY=Math.max(eI.maxY,s)}),d={unsubscribe:function(){ek.unsubscribe()},getState:function(){return eI},reset:function(){eI.maxX=0,eI.maxY=0}},k.push(d),h=(0,D.Cl)({},d.getState()),f={},m=(0,z.m)(),A=function(e){e&&(null==b||b.reset()),e&&r||(e&&(r=!0,setTimeout(function(){r=!1},100)),function(e){var t,n,r,i=e.amplitude,o=e.scrollTracker,s=e.currentElementExposed,a=e.elementExposedForPage,l=e.elementExposedInSentEvents,u=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,h=o.getState(),f=(0,z.m)(),g=null!=(n=null==f?void 0:f.innerWidth)?n:0,v=null!=(r=null==f?void 0:f.innerHe
1ight)?r:0,p=Array.from(s).filter(function(e){return!l.has(e)}),m=((t={})[n1]=rk(f),t["[Amplitude] Max Page X"]=h.maxX+g,t["[Amplitude] Max Page Y"]=h.maxY+v,t[n2]=v,t[n3]=g,t["[Amplitude] Element Exposed"]=p,t),y=rg();y&&(m[n4]=y);var b=function(){o.reset();var e=o.getState();d.maxX=e.maxX,d.maxY=e.maxY,a.clear(),l.clear(),null==u||u.reset()};if(0===p.length&&h.maxX===d.maxX&&h.maxY===d.maxY){c&&b();return}null==i||i.track("[Amplitude] Viewport Content Updated",m),d.maxX=h.maxX,d.maxY=h.maxY,p.forEach(function(e){l.add(e)}),s.clear(),c&&b()}({amplitude:n,scrollTracker:d,currentElementExposed:x,elementExposedForPage:T,elementExposedInSentEvents:_,exposureTracker:f.exposure,isPageEnd:e,lastScroll:h}))},O=rk(m),M=function(){var e=rk(m);e!==O&&(O=e,A(!0))},L=function(e,t){var n=rk(m),r=function(e,t){if(void 0===t&&(t=(0,z.m)()),null==e||""===e)return rk(t);var n,r=(null==(n=null==t?void 0:t.location)?void 0:n.href)||"http://localhost/";try{return rI(new URL(e,r).href)}catch(e){return rk(t)}}(t,m);if(n===r)return void e();O=r,A(!0),e()},H=function(e){!(T.has(e)||_.has(e))&&(T.add(e),x.add(e),JSON.stringify(Array.from(x)).length>=18e3&&A(!1))},w&&(eT=(eC={allObservables:a,onExposure:H,dataExtractor:C,exposureDuration:E}).allObservables,e_=eC.onExposure,ex=eC.dataExtractor,eA=void 0===(eP=eC.exposureDuration)?150:eP,eO=new Map,eR=new Map,eN=new Set,eM=function(e){var t=eR.get(e);t&&(clearTimeout(t),eR.set(e,null))},eD=function(e){if(!ic(e))return void eM(e);if(!(eO.get(e)||eR.get(e))){var t=setTimeout(function(){eO.set(e,!0),e_(ex.getElementPath(e)),eR.set(e,null)},eA);eR.set(e,t)}},eL=eT.exposureObservable,eH=eT.scrollObservable,eF=eL.subscribe(function(e){var t=e.target;e.isIntersecting?(eN.add(t),eD(t)):(eN.delete(t),eM(t))}),eU=eH.subscribe(function(){eN.forEach(eD)}),ej=function(){eR.forEach(function(e){e&&clearTimeout(e)}),eR.clear(),eO.clear()}
1,f.exposure={unsubscribe:function(){eF.unsubscribe(),eU.unsubscribe(),ej(),eN.clear()},reset:function(){ej(),eN.forEach(eD)}},f.exposure&&k.push(f.exposure),eJ=(eq={mutationObservable:a[p.MutationObservable],onRescan:function(){var e,n;null==(n=null==(e=t.loggerProvider)?void 0:e.debug)||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — rescanning DOM"),null==v||v()},onFlush:function(){var e,n;null==(n=null==(e=t.loggerProvider)?void 0:e.debug)||n.call(e,"@amplitude/plugin-autocapture-browser: initial exposure snapshot — flushing viewport content updated"),A(!1)},exposureDuration:E}).mutationObservable,eK=eq.onRescan,e$=eq.onFlush,eG=eq.exposureDuration,eQ=void 0===(eX=eq.quietMs)?150:eX,e0=void 0===(eZ=eq.maxWaitMs)?4e3:eZ,e1=!1,e2=function(){ez&&(clearTimeout(ez),ez=void 0),eB&&(clearTimeout(eB),eB=void 0),eY&&(clearTimeout(eY),eY=void 0)},e3=function(){eW&&(document.removeEventListener("DOMContentLoaded",eW),eW=void 0)},e4=function(){if(!e1){if("undefined"==typeof document||"loading"===document.readyState){eW||(eW=function(){eW=void 0,e6()},document.addEventListener("DOMContentLoaded",eW));return}e1=!0,e2(),e3(),eK(),eY=setTimeout(function(){eY=void 0,e$()},eG+50)}},e6=function(){e1||(ez&&clearTimeout(ez),ez=setTimeout(e4,eQ))},e5=function(){e2(),e3(),e1=!1,e6(),eB=setTimeout(e4,e0)},(b={start:function(){eV||(eV=eJ.subscribe(function(){e6()}),e5())},reset:function(){e5()},stop:function(){null==eV||eV.unsubscribe(),eV=void 0,e2(),e3()}}).start(),k.push({unsubscribe:function(){null==b||b.stop()}}),F=function(){A(!0)},null==m||m.addEventListener("beforeunload",F),g=function(){null==m||m.removeEventListener("beforeunload",F)},k.push({unsubscribe:function(){return g()}}),(U=a[p.NavigateObservable])?k.push(U.subscribe(function(e){var t,n,r=null==(n=null==(t=e.event)?void 0:t.destination)?void 0:n.url;if(r){var i=rI(r);if(i===O)return;O=i,A(!0);return}M()})):m&&(j=function(){M()},m.addEventListener("popstate",j),q=m.history.pushState,B=m.history.replaceState,m.history&&q&&(m.history.pushState=new Proxy(q,{apply:function(e,t,n){L(function(){e.apply(t,n)},n[2])}})),m.history&&B&&(m.history.replaceState=new Proxy(B,{apply:function(e,t,n){L(function(){e.apply(t,n)},n[2])}})),k.push({unsubscribe:function(){m.removeEventListener("popstate",j),m.history&&q&&(m.history.pushState=q),m.history&&B&&(m.history.replaceState=B)}}))),null==(J=null==t?void 0:t.loggerProvider)||J.log("".concat(I," has been successfully added.")),window.opener&&S.enabled&&(Y=e.cssSelectorAllowlist,V=e.actionClickAllowlist,!function(e,t){if(!0!==e[rC]){e[rC]=!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})},l=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 u;s=null==(u=null==window?void 0:window.amplitudeVisualTaggingSelector)?void 0:u.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(e){return!r||r((null==t?void 0:t.actionType)||"click",e)},onTrack:l,onSelect:a,visualHighlightClass:"amp-visual-tagging-selector-highlight",messenger:e,cssSelectorAllowlist:i,actionClickAllowlist:o,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:nX}}}),e.notify({action:"selector-loaded"})}).catch(function(){var t;null==(t=e.logger)||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)||e.call(s)})}}(W=nW(),{dataExtractor:C,isElementSelectable:rd(e,(0,D.fX)((0,D.fX)([],(0,D.zs)(Y),!1),(0,D.zs)(V),!1)),cssSelectorAllowlist:Y,actionClickAllowlist:V}),nG(W),W.setup((0,D.Cl)({logger:null==t?void 0:t.loggerProvider},(null==t?void 0:t.serverZone)&&{endpoint:nz[t.serverZone]}))),[2])})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,D.YH)(this,function(i){try{for(t=(e=(0,D.Ju)(k)).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]})})}}},ih=(0,D.fX)(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],(0,D.zs)(["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]']),!1),ig=["*"],iv=["mutation","navigate"];function ip(e,t){var n,r,i,o,s=t.event,a=s.pageX,l=s.pageY;e.yMin=Math.min(null!=(n=e.yMin)?n:l,l),e.yMax=Math.max(null!=(r=e.yMax)?r:l,l),e.xMin=Math.min(null!=(i=e.xMin)?i:a,a),e.xMax=Math.max(null!=(o=e.xMax)?o:a,a),e.isOutOfBounds=e.yMax-e.yMin>50||e.xMax-e.xMin>50}function im(e){if(0===e.length)return null;var t=e[0],n=e[e.length-1];return{rageClickEvent:(0,D.Cl)({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(n.timestamp).toISOString(),"[Amplitude] Duration":n.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(e){return{X:e.event.pageX,Y:e.event.pageY,Time:e.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties),time:t.timestamp}}!function(e){e.INCREASING="increasing",e.DECREASING="decreasing"}(m||(m={})),function(e){e.X="x",e.Y="y"}(y||(y={}));var iy=function(e){var t=e.allWindowObservables.mouseMoveObservable;return new(nH())(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===m.DECREASING&&e.next(y.X),r=m.INCREASING):o.x<n.x&&(r===m.INCREASING&&e.next(y.X),r=m.DECREASING),o.y>n.y?(i===m.DECREASING&&e.next(y.Y),i=m.INCREASING):o.y<n.y&&(i===m.INCREASING&&e.next(y.Y),i=m.DECREASING),n=o})})};function ib(e){var t=e.changes,n=e.changesThreshold,r=e.thresholdMs;return!(t.length<n)&&t[t.length-1]-t[0]<r}function iS(e){e.changes=[],e.startTime=void 0}function iw(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 iE=function(e){var t=e.mouseDirectionChangeObservable,n=e.directionChanges,r=void 0===n?20:n,i=e.thresholdMs,o=void 0===i?2e3:i;return new(nH())(function(e){var n={changes:[],changesThreshold:r,thresholdMs:o},i={changes:[],changesThreshold:r,thresholdMs:o},s=void 0,a=null;function l(){void 0!==s&&(e.next(s),s=void 0,null!==a&&clearTimeout(a),iS(n),iS(i))}return t.subscribe(function(e){null!==a&&clearTimeout(a),t=e===y.X?n:i,r=+Date.now(),t.startTime=t.startTime||r,u=t.changes,c=t.changesThreshold,u.push(r),u.length>c&&u.shift();var t,r,u,c,d=function(e,t){var n=void 0;if(ib(e)&&(n=e.startTime),ib(t)){var r=t.startTime;r&&(!n||r<n)&&(n=r)}return n}(n,i);return d?(s=s||d,a=setTimeout(function(){l(),a=null},o)):l(),iw(n),iw(i),function(){null!==a&&(clearTimeout(a),a=null)}})})},iI=function(e){var t=e.amplitude,n=e.options,r=e.allObservables,i=e.directionChanges,o=e.thresholdMs;return iE({mouseDirectionChangeObservable:iy({allWindowObservables:r}),directionChanges:void 0===i?20:i,thresholdMs:void 0===o?2e3:o}).subscribe(function(e){rc(n)&&t.track("[Amplitude] Thrashed Cursor",void 0,{time:e})})};function ik(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 iC=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 l=ik(e,"rageClicks",ig,s),u=ik(e,"deadClicks",ih,o),c=ik(e,"errorClicks",ih,i),d=null!=(t=e.dataAttributePrefix)?t:nM,h=new is(e),f=(0,D.fX)([],(0,D.zs)(new Set((0,D.fX)((0,D.fX)((0,D.fX)([],(0,D.zs)(l),
1!1),(0,D.zs)(u),!1),(0,D.zs)(c),!1))),!1),v=function(){var e,t,n=function(e){return nj(rL(e).map(function(e){return h.addAdditionalEventProperties(e,"click",f,d,!0)}))},r=n("click"),i=n("pointerdown"),o=nj(rF().map(function(e){return h.addTypeAndTimestamp(e,"error")})),s=nj(rD(h.shadowGate).map(function(e){return h.addAdditionalEventProperties(e,"mutation",f,d)}));window.navigation&&(t=nj(new(nH())(function(e){var t=function(t){e.next((0,D.Cl)((0,D.Cl)({},t),{type:"navigate"}))};return window.navigation.addEventListener("navigate",t),function(){window.navigation.removeEventListener("navigate",t)}}).map(function(e){return h.addAdditionalEventProperties(e,"navigate",f,d)})));var a=nj(new(nH())(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)}})),l=nj(new(nH())(function(e){var t=function(t){e.next(t)},n={capture:!0};return rR.document.addEventListener("mousemove",t,n),function(){rR.document.removeEventListener("mousemove",t,n)}}));return(e={})[p.ClickObservable]=r,e[p.PointerDownObservable]=i,e[p.MutationObservable]=s,e[p.NavigateObservable]=t,e[p.BrowserErrorObservable]=o,e[p.SelectionObservable]=a,e[p.MouseMoveObservable]=l,e};return{name:n,type:"enrichment",setup:function(t,f){return(0,D.sH)(void 0,void 0,void 0,function(){var p,m,y,b,S,w,E,I,k;return(0,D.YH)(this,function(C){var T,_,x,P,A,O,R,N,M,L,H,F,U,j,q,z,B,Y,V,W,J,K;return"undefined"==typeof document?[2]:(p=v(),(m=ia(t,h))&&r.push({unsubscribe:m}),s&&(y=function(e){var t=this,n=e.amplitude,r=e.allObservables,i=e.shouldTrackRageClick,o=r.pointerDownObservable,s=r.selectionObservable,a=[],l={},u=null;function c(e){a=[],l={},e&&(ip(l,e),a.push(e))}var d=nF(o.filter(function(e){return i("click",e.closestTrackedAncestor)}),function(e){return(0,D.sH)(t,void 0,void 0,function(){var t;return(0,D.YH)(this,function(n){var r,i,o,s;return(ip(l,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)||l.isOutOfBounds)?(u&&(t=im(a)),c(e)):a.push(e),(u&&(clearTimeout(u.timerId),u.resolve(t),u=null),a.length>=4)?[2,new Promise(function(e){u={resolve:e,timerId:setTimeout(function(){e(im(a))},1e3)}})]:[2,null]})})}),h=null==s?void 0:s.subscribe(function(){c()}),f=d.subscribe(function(e){null!==e&&n.track("[Amplitude] Rage Click",e.rageClickEvent,{time:e.time})});return{unsubscribe:function(){f.unsubscribe(),null==h||h.unsubscribe()}}}({allObservables:p,amplitude:f,shouldTrackRageClick:rd(e,l)}),r.push(y)),o&&(_=(T={amplitude:f,allObservables:p,getEventProperties:function(e,t){return h.getEventProperties(e,t,d)},shouldTrackDeadClick:rd(e,u)}).amplitude,x=T.allObservables,P=T.getEventProperties,A=T.shouldTrackDeadClick,O=x.clickObservable,R=x.mutationObservable,N=x.navigateObservable,M=O.filter(function(e){return rE(e)&&A("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===g.LEFT_OR_TOUCH_CONTACT}),L=N?nU(R,N):R,H=nU(M,L),F=null,b=nF(H,function(e){if(F&&iv.includes(e.type))clearTimeout(F),F=null;else if("click"===e.type)return F?Promise.resolve(null):new Promise(function(t){F=setTimeout(function(){t(e),F=null},3e3)});return Promise.resolve(null)}).subscribe(function(e){if(e){var t={"[Amplitude] X":e.event.clientX,"[Amplitude] Y":e.event.clientY};_.track("[Amplitude] Dead Click",(0,D.Cl)((0,D.Cl)({},P("click",e.closestTrackedAncestor)),t),{time:e.timestamp})}}),r.push(b)),i&&(j=(U={amplitude:f,allObservables:p,shouldTrackErrorClick:rd(e,c)}).amplitude,q=U.allObservables,z=U.shouldTrackErrorClick,B=q.pointerDownObservable,Y=q.browserErrorObservable,V=B.filter(function(e){return rE(e)&&z("click",e.closestTrackedAncestor)&&e.event.target instanceof Element&&null===e.event.target.closest('a[target="_blank"]')&&e.event.button===g.LEFT_OR_TOUCH_CONTACT}),W=null,J=null,K=function(){null!==W&&(clearTimeout(W),W=null),J=null},S=nU(V,Y).subscribe(function(e){var t;if("click"===e.type){K(),J=e,W=setTimeout(K,2e3);return}"error"===e.type&&J&&(j.track("[Amplitude] Error Click",(0,D.Cl)(((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),J.targetElementProperties)),K())}),r.push(S)),a&&(w=void 0,E=void 0,"object"==typeof e.thrashedCursor&&(w=e.thrashedCursor.directionChanges,E=e.thrashedCursor.threshold,w&&w<5&&(t.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(w," is below the minimum of ").concat(5,", setting to ").concat(5)),w=5),E&&E>4e3&&(t.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(E," is above the maximum of ").concat(4e3,", setting to ").concat(4e3)),E=4e3)),I=iI({amplitude:f,options:e,allObservables:p,directionChanges:w,thresholdMs:E}),r.push(I)),null==(k=null==t?void 0:t.loggerProvider)||k.log("".concat(n," has been successfully added.")),[2])})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,i;return(0,D.YH)(this,function(o){try{for(t=(e=(0,D.Ju)(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 iT(e,t){var n=e.startTime+e.duration;return t.filter(function(t){return t.startTime<n&&t.startTime+t.duration>e.startTime}).map(function(e){return e.name})}var i_=function(e){void 0===e&&(e={});var t="@amplitude/plugin-performance-browser",n=[],r=!0===e.mainThreadBlock||"object"==typeof e.mainThreadBlock&&null!==e.mainThreadBlock;return{name:t,type:"enrichment",setup:function(i,o){return(0,D.sH)(void 0,void 0,void 0,function(){var s,a,l;return(0,D.YH)(this,function(u){return"undefined"==typeof document||(r&&(s=100,"object"==typeof e.mainThreadBlock&&void 0!==e.mainThreadBlock.durationThreshold&&(s=e.mainThreadBlock.durationThreshold),a=function(e){var t=e.amplitude,n=e.options,r=e.durationThreshold,i=void 0===r?100:r,o=function(){if("undefined"==typeof PerformanceObserver)return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch(e){}return null}();if(!o)return{unsubscribe:function(){}};var s=[],a=new PerformanceObserver(function(e){var t,n,r=performance.now();try{for(var i=(0,D.Ju)(e.getEntries()),o=i.next();!o.done;o=i.next()){var a=o.value;s.push(a)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}for(var l=r-1e4;s.length>0&&s[0].startTime<l;)s.shift()});try{a.observe({entryTypes:["measure"]})}catch(e){}var l=new PerformanceObserver(function(e){var r,a;try{for(var l=(0,D.Ju)(e.getEntries()),u=l.next();!u.done;u=l.next()){var c=u.value;if(!rc(n))return;if(!(c.duration<i)){var d="long-animation-frame"===o?function(e,t){var n,r=iT(e,t),i=null!=(n=e.scripts)?n:[],o=i.map(function(e){return e.sourceURL}
1).filter(Boolean),s=i.map(function(e){return e.sourceFunctionName}).filter(Boolean),a=i.map(function(e){return e.sourceCharPosition}).filter(function(e){return"number"==typeof e&&e>=0}),l=i.map(function(e){return e.invokerType}).filter(Boolean),u=i.map(function(e){return e.invoker}).filter(Boolean);return(0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),s.length>0&&{"[Amplitude] Main Thread Block Script Functions":s}),a.length>0&&{"[Amplitude] Main Thread Block Script Positions":a}),l.length>0&&{"[Amplitude] Main Thread Block Invoker Types":l}),u.length>0&&{"[Amplitude] Main Thread Block Invokers":u})}(c,s):function(e,t){var n,r=iT(e,t),i=null!=(n=e.attribution)?n:[];return(0,D.Cl)((0,D.Cl)({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},r.length>0&&{"[Amplitude] Main Thread Block Measures":r}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(e){return e.name})})}(c,s);t.track("[Amplitude] Main Thread Block",d)}}}catch(e){r={error:e}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(r)throw r.error}}});try{l.observe({entryTypes:[o]})}catch(e){return a.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),a.disconnect()}}}({amplitude:o,options:e,durationThreshold:s}),n.push(a)),null==(l=null==i?void 0:i.loggerProvider)||l.log("".concat(t," performance tracking has been successfully added."))),[2]})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e,t,r,i;return(0,D.YH)(this,function(o){try{for(t=(e=(0,D.Ju)(n)).next();!t.done;t=e.next())t.value.unsubscribe()}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}}},ix=n(51602),iP=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,D.zs)(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,D.Ju)(Object.entries(r)),s=o.next();!s.done;s=o.next()){var a=(0,D.zs)(s.value,2),l=a[0],u=a[1];i[l]=u}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return iL(i,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if("number"==typeof this._bodySize)return this._bodySize;var e=(0,z.m)();if(null==e?void 0:e.TextEncoder){var t=this.request.body;return this._bodySize=iO(t,100),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return"string"==typeof this.request.body?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return 0===e.length?[2,null]:[2,iM(this.body,e,t)]})})},e}(),iA=function(){function e(e,t){this.bodyRaw=e,this.requestHeaders=t}return e.prototype.headers=function(e){return void 0===e&&(e=[]),iL(this.requestHeaders,{allow:e})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return iO(this.bodyRaw,100)}
1,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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return 0===e.length?[2,null]:[2,iM(this.body,e,t)]})})},e}();function iO(e,t){var n,r,i,o,s=(0,z.m)(),a=null==s?void 0:s.TextEncoder;if(a&&null!=e){if("string"==typeof e)o=e,i=new a().encode(o).length;else if("undefined"!=typeof Blob&&e instanceof Blob)i=(o=e).size;else if("undefined"!=typeof URLSearchParams&&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("undefined"!=typeof FormData&&e instanceof FormData){var l=0,u=0;try{for(var c=(0,D.Ju)(e.entries()),d=c.next();!d.done;d=c.next()){var h=(0,D.zs)(d.value,2),f=h[0],g=h[1];if(l+=f.length,"string"==typeof g)l+=new a().encode(g).length;else{if(!("undefined"!=typeof Blob&&g instanceof Blob))return;l+=g.size}if(++u>=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=l}else if("undefined"!=typeof ReadableStream&&e instanceof ReadableStream){o=e;return}return i}}var iR=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)||t.call(n,function(e,t){r[t]=e}),iL(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.get)?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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){switch(n.label){case 0:if(0===e.length)return[2,null];return[4,this.text()];case 1:return[2,iM(n.sent(),e,t)]}})})},e}(),iN=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,D.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,l=(0,D.zs)(a.split(": "),2),u=l[0],c=l[1];u&&c&&(r[u]=c)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}return iL(r,{allow:e})},e.prototype.json=function(e,t){return void 0===e&&(e=[]),void 0===t&&(t=[]),(0,D.sH)(this,void 0,void 0,function(){var n;return(0,D.YH)(this,function(r){return 0===e.length?[2,null]:(n=this.getJson())?((0,ix.D7)(n,e,t),[2,n]):[2,null]})})},e}();function iM(e,t,n){if(!e)return null;try{var r=JSON.parse(e);return(0,ix.D7)(r,t,n),r}catch(e){return null}}!function(e){e.REDACT="redact",e.REMOVE="remove"}(b||(b={}));var iD="[REDACTED]",iL=function(e,t){var n,r,i=t.allow,o=void 0===i?[]:i,s=t.strategy,a=void 0===s?b.REMOVE:s,l=(0,D.fX)([],(0,D.zs)(eR),!1),u={};try{for(var c=(0,D.Ju)(Object.keys(e)),d=c.next();!d.done;d=c.next()){var h=d.value;!function(t){var n=t.toLowerCase();l.find(function(e){return e.toLowerCase()===n})?a===b.REDACT&&(u[t]=iD):o.find(function(e){return e.toLowerCase()===n})?u[t]=e[t]:a===b.REDACT&&(u[t]=iD)}(h)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=c.return)&&r.call(c)}finally{if(n)throw n.error}}return u},iH=function(){function e(e,t,n,r,i,o,s,a,l,u,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=l,this.error=u,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.headers((0,D.fX)([],(0,D.zs)(eO),!1)),requestBodySize:null==(t=this.requestWrapper)?void 0:t.bodySize,responseHeaders:null==(n=this.responseWrapper)?void 0:n.headers((0,D.fX)([],(0,D.zs)(eO),!1)),responseBodySize:null==(r=this.responseWrapper)?void 0:r.bodySize}).filter(function(e){var t=(0,D.zs)(e,2);return void 0!==(t[0],t[1])}))},e}(),iF=function(e,t){void 0===t&&(t=Y()),this.callback=e,this.id=t};function iU(e){try{e()}catch(e){}}var ij=new(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var n=(0,z.m)();e.isSupported()&&(this.globalScope=n)}return e.isSupported=function(){var e=(0,z.m)();return!!e&&!!e.fetch},e.prototype.subscribe=function(e,t){var n,r,i,o,s,a,l,u,c,d;if(this.logger||(this.logger=t),this.eventCallbacks.set(e.id,e),!this.isObserving){var h=null==(i=null==(r=null==(n=this.globalScope)?void 0:n.XMLHttpRequest)?void 0:r.prototype)?void 0:i.open,f=null==(a=null==(s=null==(o=this.globalScope)?void 0:o.XMLHttpRequest)?void 0:s.prototype)?void 0:a.send,g=null==(c=null==(u=null==(l=this.globalScope)?void 0:l.XMLHttpRequest)?void 0:u.prototype)?void 0:c.setRequestHeader;h&&f&&g&&this.observeXhr(h,f,g);var v=null==(d=this.globalScope)?void 0:d.fetch;v&&this.observeFetch(v),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){iU(function(){var n;null==(n=t.logger)||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,l,u,c,d="GET";if("object"==typeof t&&null!==t&&"url"in t&&"method"in t?(l=t.url,d=t.method):l=null==(a=null==t?void 0:t.toString)?void 0:a.call(t),l)try{var h=new URL(l);l="".concat(h.protocol,"//").concat(h.host).concat(h.pathname).concat(h.search).concat(h.hash)}catch(e){}d=(null==n?void 0:n.method)||d,r&&(u=r.status),i&&(c={name:i.name||"UnknownError",message:i.message||"An unknown error occurred"},u=0);var f=Math.floor(performance.now()-s),g=Math.floor(o+f),v=new iH(e,d,o,o,l,n,u,f,r,c,g);this.triggerEventCallbacks(v)}},e.prototype.getTimestamps=function(){var e,t;return{startTime:null==(e=Date.now)?void 0:e.call(Date),durationStart:null==(t=null==performance?void 0:performance.now)?void 0:t.call(performance)}},e.prototype.observeFetch=function(e){var t=this;this.globalScope&&e&&(this.globalScope.fetch=function(n,r){return(0,D.sH)(t,void 0,void 0,function(){var t,i,o,s=this;return(0,D.YH)(this,function(a){switch(a.label){case 0:try{t=this.getTimestamps()}catch(e){iU(function(){var t;return null==(t=s.logger)?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 iP(r):void 0,i?new iR(i):void 0,o,null==t?void 0:t.startTime,null==t?void 0:t.durationStart)}catch(e){iU(function(){var t;return null==(t=s.logger)?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.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&&iU(function(){var n;return null==(n=t.logger)?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,D.zs)(n,2),s=i[0],a=i[1];try{this.$$AmplitudeAnalyticsEvent=(0,D.Cl)({method:s,url:null==(e=null==a?void 0:a.toString)?void 0:e.call(a),headers:{}},o.getTimestamps())}catch(e){iU(function(){var t;return null==(t=o.logger)?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],l=i.$$AmplitudeAnalyticsEvent;return i.$$AmplitudeAnalyticsEvent&&i.addEventListener("loadend",function(){try{var e=i.getAllResponseHeaders(),t=i.getResponseHeader("content-length"),n=new iN(i.status,e,t?parseInt(t,10):void 0,s),r=i.$$AmplitudeAnalyticsEvent.headers,u=new iA(a,r);l.status=i.status,o.handleNetworkRequestEvent("xhr",{url:l.url,method:l.method},u,n,void 0,l.startTime,l.durationStart)}catch(e){iU(function(){var t;return null==(t=o.logger)?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){iU(function(){var t;return null==(t=o.logger)?void 0:t.debug("an unexpected error occurred while calling xhr setRequestHeader",e)})}r.apply(this,[e,t])}}},e}()),iq="[Amplitude] Network Request",iz="500-599";function iB(e,t){return RegExp("^"+t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&").replace(/\*/g,".*")+"$").test(e)}function iY(e,t){var n,r,i=t.split(",");try{for(var o=(0,D.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value,l=(0,D.zs)(a.split("-").map(Number),2),u=l[0],c=l[1];if(e===u&&void 0===c||e>=u&&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 iV(e){if(e)try{var t,n,r,i,o,s,a,l,u,c=null==(t=(0,z.m)())?void 0:t.location.href,d=new URL(e,c),h=d.searchParams.toString(),f=d.hash.replace("#",""),g=d.href,v=d.host;d.hash="",d.search="";var p=d.href;return{query:h,fragment:f,href:g,hrefWithoutQueryOrHash:p,host:v}}catch(t){try{return i=(r=e.indexOf("#"))>=0?e.slice(r+1):"",a=(s=(o=r>=0?e.slice(0,r):e).indexOf("?"))>=0?o.slice(s+1):"",u=(l=s>=0?o.slice(0,s):o).match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i),{query:a,fragment:i,href:e,hrefW
1ithoutQueryOrHash:l,host:null!=(n=null==u?void 0:u[1])?n:""}}catch(e){return}}}function iW(e){return"object"!=typeof e||null===e?e?(0,D.fX)([],(0,D.zs)(eO),!1):void 0:0!==e.length?e:void 0}function iJ(e){var t,n,r;return!(null==(t=null==e?void 0:e.allowlist)?void 0:t.length)&&!(null==(n=null==e?void 0:e.blocklist)?void 0:n.length)&&!(null==(r=null==e?void 0:e.excludelist)?void 0:r.length)}(S||(S={})).NetworkObservable="networkObservable";var iK=function(e){void 0===e&&(e={});var t,n="@amplitude/plugin-network-capture-browser",r=function(){var e,n=new(nH())(function(e){var n=new iF(function(t){var n={event:t,timestamp:Date.now(),type:"network"};e.next(n)});return ij.subscribe(n,t),function(){ij.unsubscribe(n)}});return(e={})[S.NetworkObservable]=n,e};return{name:n,type:"enrichment",setup:function(i,o){return(0,D.sH)(void 0,void 0,void 0,function(){var s;return(0,D.YH)(this,function(a){var l,u,c,d,h,f,g;return"undefined"==typeof document&&(null==(l=null==(u=(0,z.m)())?void 0:u.navigator)?void 0:l.product)!=="ReactNative"?[2]:(s=r(),t=null==i?void 0:i.loggerProvider,d=(c={allObservables:s,networkTrackingOptions:e,amplitude:o,loggerProvider:t}).allObservables,h=c.networkTrackingOptions,f=c.amplitude,g=c.loggerProvider,w=d.networkObservable.filter(function(e){return function(e,t){void 0===t&&(t={});var n,r,i=iV(e.url);if(!i)return!1;var o=i.host;return!(!1!==t.ignoreAmplitudeRequests&&(iB(o,"*.amplitude.com")||iB(o,"amplitude.com"))||(null==(n=t.ignoreHosts)?void 0:n.find(function(e){return iB(o,e)})))&&(!!t.captureRules||void 0===e.status||!!iY(e.status,iz))&&(!t.captureRules||((0,D.fX)([],(0,D.zs)(t.captureRules),!1).reverse().find(function(t){if(r=function(e,t,n,r,i){if((!e.hosts||e.hosts.find(function(e){return iB(t,e)}))&&(!r||!e.urls||n8(r,e.urls))&&(!i||!e.methods||e.methods.find(function(e){return i.toLowerCase()===e.toLowerCase()||"*"===e})))return(!n&&0!==n||!!iY(n,e.statusCodeRange||iz))&&!0}(t,o,e.status,e.url,e.method)){var n=iW(t.responseHeaders);if(e.responseWrapper&&n){var i=e.responseWrapper.headers(n);i&&(e.responseHeaders=i)}var s=iW(t.requestHeaders);if(e.requestWrapper&&s){var a=e.requestWrapper.headers(s);a&&(e.requestHeaders=a)}if(e.responseWrapper&&t.responseBody&&!iJ(t.responseBody)){var l=t.responseBody.excludelist||t.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(t.responseBody.allowlist,l)}if(e.requestWrapper&&t.requestBody&&!iJ(t.requestBody)){var l=t.requestBody.excludelist||t.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(t.requestBody.allowlist,l)}}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===iq}))return!0}catch(e){}return!1}(o,e.requestWrapper))}(e.event,h)}).subscribe(function(e){var t,n,r,i=e.event,o=iV(i.url);if(o){var s=null==(n=i.responseWrapper)?void 0:n.bodySize,a=null==(r=i.requestWrapper)?void 0:r.bodySize;!function(e,t,n,r){(0,D.sH)(this,void 0,void 0,function(){var i,o,s;return(0,D.YH)(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=D.zs.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(iq,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,f,g)}}),null==t||t.log("".concat(n," has been successfully added.")),[2])})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){return w.unsubscribe(),[2]})})}}},i$="web-vitals-browser",iG="[Amplitude] Web Vitals",iX={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};let iQ=-1,iZ=e=>{addEventListener("pageshow",t=>{t.persisted&&(iQ=t.timeStamp,e(t))},!0)},i0=(e,t,n,r)=>{let i,o;return s=>{t.value>=0&&(s||r)&&((o=t.value-(i??0))||void 0===i)&&(i=t.value,t.delta=o,t.rating=((e,t)=>e>t[1]?"poor":e>t[0]?"needs-improvement":"good")(t.value,n),e(t))}},i1=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},i2=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},i3=()=>i2()?.activationStart??0,i4=-1,i6=new Set,i5=()=>"hidden"!==document.visibilityState||document.prerendering?1/0:0,i8=e=>{if("hidden"===document.visibilityState){if("visibilitychange"===e.type)for(let e of i6)e();isFinite(i4)||(i4="visibilitychange"===e.type?e.timeStamp:0,removeEventListener("prerenderingchange",i8,!0))}},i7=(e=!1)=>
1{if(e&&(i4=1/0),i4<0){let e=i3();i4=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(t=>"hidden"===t.name&&t.startTime>=e)?.startTime)??i5(),addEventListener("visibilitychange",i8,!0),addEventListener("prerenderingchange",i8,!0),iZ(()=>{setTimeout(()=>{i4=i5()})})}return{get firstHiddenTime(){return i4},onHidden(e){i6.add(e)}}},i9=(e,t=-1,n,r=0,i,o,s)=>{let a=i2(),l=a?.navigationId||0,u="navigate";return n?u=n:iQ>=0?u="back-forward-cache":a&&(document.prerendering||i3()>0?u="prerender":document.wasDiscarded?u="restore":a.type&&(u=a.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(0x82f79cd8fff*Math.random())+1e12}`,navigationType:u,navigationId:r||l,navigationInteractionId:i,navigationURL:o||a?.name,navigationStartTime:s||0}},oe=new WeakMap;function ot(e,t){let n=oe.get(t);return n||(n=new WeakMap,oe.set(t,n)),n.get(e)||n.set(e,new t),n.get(e)}class on{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 or=(e,t,n={})=>{try{let r=e.filter(e=>PerformanceObserver.supportedEntryTypes.includes(e));if(r.length>0){let e=new PerformanceObserver(e=>{queueMicrotask(()=>{let n=e.getEntries();r.length>1&&n.sort((e,t)=>e.startTime+e.duration-(t.startTime+t.duration)),t(n)})});for(let t of r)e.observe({type:t,buffered:!0,...n});return e}}catch{}},oi=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&"function"==typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint&&e&&e.reportSoftNavs,oo=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let t=e.keys().next().value;void 0!==t&&e.delete(t)}},os=e=>{let t=!1;return()=>{t||(e(),t=!0)}};class oa{l}let ol=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},ou=[1800,3e3],oc=(e,t={})=>{let n=oi(t);ol(()=>{let r=ot(t,oa),i=i7(),o,s=i9("FCP"),a=or(["paint"],e=>{for(let t of e)"first-contentful-paint"===t.name&&(a.disconnect(),t.startTime<i.firstHiddenTime&&(s.value=Math.max(t.startTime-i3(),0),s.entries.push(t),s.navigationId=t.navigationId||s.navigationId,o(!0)))});a&&(o=i0(e,s,ou,t.reportAllChanges),iZ(n=>{o=i0(e,s=i9("FCP",-1,"back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,iQ),ou,t.reportAllChanges),i1(()=>{s.value=performance.now()-n.timeStamp,o(!0)})})),n&&or(["soft-navigation"],n=>{n.forEach(n=>{r.l&&n.navigationId&&oo(r.l,n),(o=i0(e,s=i9("FCP",Math.max((n.presentationTime||n.paintTime||0)-n.startTime,0),"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime),ou,t.reportAllChanges))(!0)})},t)})},od=[.1,.25],oh=(e,t={})=>{let n=i7();oc(os(()=>{let r,i=i9("CLS",0),o=ot(t,on),s=(n,s,a,l,u)=>{i=i9("CLS",0,n,s,a,l,u),o.i=0,r=i0(e,i,od,t.reportAllChanges)},a=(e=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),r(e)},l=e=>{a(!0),s("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},u=e=>{for(let t of e)"soft-navigation"!==t.entryType?o.h(t):l(t);a()},c=["layout-shift"];oi(t)&&c.push("soft-navigation");let d=or(c,u);d&&(r=i0(e,i,od,t.reportAllChanges),n.onHidden(()=>{u(d.takeRecords()),r(!0)}),iZ(()=>{s("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,iQ),i1(r)}),setTimeout(r))}))},of=0,og=1/0,ov=0,op=e=>{for(let t of e)t.interactionId&&(og=Math.min(og,t.interactionId),of=(ov=Math.max(ov,t.interactionId))?(ov-og)/7+1:0)},om=()=>r?of:performance.interactionCount??0;class oy{u=0;v=[];m=new Map;p;T;_(){return om()-this.u}M(){this.u=om(),this.v.length=0,this.m.clear()}L(e){let t=this._(),n=Math.min(this.v.length-1,Math.floor(t/50));return t&&-1===n&&("soft-navigation"===e||"back-forward-cache"===e)?{P:8,id:-1,entries:[]}:this.v[n]}h(e){if(this.p?.(e),!e.interactionId)return;let t=this.v.at(-1),n=this.m.get(e.interactionId);if(n||this.v.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.m.set(n.id,n),this.v.push(n)),this.v.sort((e,t)=>
1t.P-e.P),this.v.length>10)for(let e of this.v.splice(10))this.m.delete(e.id);this.T?.(n)}}}let ob=e=>{let t=1e3*("requestIdleCallback"in globalThis),n=globalThis.requestIdleCallback||setTimeout,r=globalThis.cancelIdleCallback||clearTimeout;if("hidden"===document.visibilityState)e();else{let i=os(e),o=-1,s=()=>{r(o),i()};addEventListener("visibilitychange",s,{once:!0,capture:!0}),o=n(()=>{removeEventListener("visibilitychange",s,{capture:!0}),i()},{timeout:t})}},oS=[200,500],ow=(e,t={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let n=i7();ol(()=>{"interactionCount"in performance||r||(r=or(["event"],op,{durationThreshold:0}));let i,o=i9("INP"),s=ot(t,oy),a=(n,r,a,l,u)=>{s.M(),i=i0(e,o=i9("INP",-1,n,r,a,l,u),oS,t.reportAllChanges)},l=()=>{let e=s.L(o.navigationType);e&&e.P!==o.value&&(o.value=e.P,o.entries=e.entries,i())},u=e=>{l(),i(!0),a("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime)},c=(e,t=!1)=>{ob(()=>{for(let t of e)"soft-navigation"!==t.entryType?s.h(t):u(t);l(),t&&i(!0)})},d=["event","first-input"];oi(t)&&d.push("soft-navigation");let h=or(d,c,{...t,durationThreshold:t.durationThreshold??40});i=i0(e,o,oS,t.reportAllChanges),h&&(n.onHidden(()=>{c(h.takeRecords(),!0)}),iZ(()=>{a("back-forward-cache",o.navigationId,o.navigationInteractionId,o.navigationURL,iQ)}))})};class oE{p;l;h(e){this.p?.(e)}}let oI=[2500,4e3],ok=(e,t={})=>{let n=!1,r=oi(t);ol(()=>{let i,o=i7(),s=i9("LCP"),a=ot(t,oE),l=(r,a,l,u,c)=>{i=i0(e,s=i9("LCP",-1,r,a,l,u,c),oI,t.reportAllChanges),n=!1,"soft-navigation"===r&&(o=i7(!0))},u=e=>{a.l&&e.navigationId&&oo(a.l,e),n||i(!0),l("soft-navigation",e.navigationId,e.interactionId,e.name,e.startTime);let t=e.getLargestInteractionContentfulPaint?.();t&&c([t])},c=e=>{for(let n of(t.reportAllChanges||r||(e=e.slice(-1)),e)){if(!n)continue;if("soft-navigation"===n.entryType){u(n);continue}let e=0,t=[],r=n.startTime;if("largest-contentful-paint"===n.entryType)e=Math.max(n.startTime-i3(),0),a.h(n),t=[n];else if("interaction-contentful-paint"===n.entryType){if(!s.navigationId||"interactionId"in n&&n.interactionId!=s.navigationInteractionId)continue;e=Math.max((r=n.largestContentfulPaint?.renderTime||0)-n.startTime,0),n.largestContentfulPaint&&(a.h(n.largestContentfulPaint),t=[n.largestContentfulPaint])}r<o.firstHiddenTime&&(s.value=e,s.entries=t,i())}},d=["largest-contentful-paint"];r&&d.push("interaction-contentful-paint","soft-navigation");let h=or(d,c);if(h){i=i0(e,s,oI,t.reportAllChanges);let o=["keydown","click","visibilitychange"],a=e=>{if(e.isTrusted&&!n){let e=s.id;ob(()=>{if(!n){if(!r)for(let e of(h.disconnect(),o))removeEventListener(e,a,{capture:!0});e===s.id&&(n=!0,i(!0))}})}};for(let e of o)addEventListener(e,a,{capture:!0});iZ(r=>{l("back-forward-cache",s.navigationId,s.navigationInteractionId,s.navigationURL,iQ),i=i0(e,s,oI,t.reportAllChanges),i1(()=>{s.value=performance.now()-r.timeStamp,n=!0,i(!0)})})}})},oC=[800,1800],oT=e=>{document.prerendering?ol(()=>oT(e)):"complete"!==document.readyState?addEventListener("load",()=>oT(e),!0):setTimeout(e)},o_=(e,t={})=>{let n=oi(t),r=i9("TTFB"),i=i0(e,r,oC,t.reportAllChanges);oT(()=>{let o=i2();if(o){let s=o.responseStart;r.value=Math.max(s-i3(),0),r.entries=[o],i(!0),iZ(()=>{(i=i0(e,r=i9("TTFB",0,"back-forward-cache",r.navigationId,r.navigationInteractionId,r.navigationURL,iQ),oC,t.reportAllChanges))(!0)}),n&&or(["soft-navigation"],n=>{n.forEach(n=>{n.navigationId&&((r=i9("TTFB",0,"soft-navigation",n.navigationId,n.interactionId,n.name,n.startTime)).entries=[n],(i=i0(e,r,oC,t.reportAllChanges))(!0))})},t)}})};function ox(e,t){void 0===t&&(t=!1);var n,r,i={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor((r=(null==(n=e.entries[0])?void 0:n.startTime)||0,performance.timeOrigin+r)),navigationStart:t?Math.floor(performance.timeOrigin+(e.navigationStartTime||0)):Math.floor(performance.timeOrigin)};return t&&(i.navigationId=e.navigationId),i}var oP=function(){var e=null,t=(0,z.m)(),n=null==t?void 0:t.document,r=null==t?void 0:t.location;return{name:i$,type:"enrichment",setup:function(t,i){return(0,D.sH)(void 0,void 0,void 0,function(){var o,s;return(0,D.YH)(this,function(a){return void 0===n||(o=n7((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":n7((null==r?void 0:r.pathname)||"",t.loggerProvider),"[Amplitude] Page Title":"undefined"!=typeof document&&document.title||"","[Amplitude] Page URL":n7(o.split("?")[0],t.loggerProvider)},ok(function(e){s["[Amplitude] LCP"]=ox(e)}),oc(function(e){s["[Amplitude] FCP"]=ox(e)}),ow(function(e){s["[Amplitude] INP"]=ox(e)}),oh(function(e){s["[Amplitude] CLS"]=ox(e)}),o_(function(e){s["[Amplitude] TTFB"]=ox(e)}),e=function(){"hidden"===n.visibilityState&&e&&(i.track(iG,s),n.removeEventListener("visibilitychange",e),e=null)},n.addEventListener("visibilitychange",e)),[2]})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return e&&(null==n||n.removeEventListener("visibilitychange",e)),[2]})})}}},oA=Object.values(iX),oO=function(){var e,t=null,n=(0,z.m)(),r=null==n?void 0:n.document,i=null==n?void 0:n.location,o=!1,s=new Set;return{name:i$,type:"enrichment",setup:function(n,a){return(0,D.sH)(void 0,void 0,void 0,function(){var l,u,c,d,h,f,g,v;return(0,D.YH)(this,function(p){return void 0===r||(o=!0,l=new Map,u=-1,c=function(e){var t=e.navigationId,o=l.get(t);return o||(o=function(e,t,n){var r="",i="";try{var o=new URL(e);r=o.hostname,i=o.pathname}catch(e){n.debug("Web vitals plugin is unable to parse page URL: ",e)}var s=n7(e,n);return{"[Amplitude] Page Domain":r,"[Amplitude] Page Location":s,"[Amplitude] Page Path":n7(i,n),"[Amplitude] Page Title":t,"[Amplitude] Page URL":n7(s.split("?")[0],n)}}(e.navigationURL||(null==i?void 0:i.href)||"",r.title||"",n.loggerProvider),l.set(t,o)),o},d=function(e){s.add(e);var t=l.get(e);t&&(l.delete(e),oA.some(function(e){return e in t})&&a.track(iG,t))},h=function(){var e,t;try{for(var n=(0,D.Ju)(Array.from(l.keys())),r=n.next();!r.done;r=n.next()){var i=r.value;d(i)}}catch(t){e={error:t}}finally{try{r&&!r.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},f=function(t){void 0!==e&&clearTimeout(e),e=setTimeout(function(){var n,r;e=void 0;try{for(var i=(0,D.Ju)(Array.from(l.keys())),o=i.next();!o.done;o=i.next()){var s=o.value;s<t&&d(s)}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},1e3)},v={reportSoftNavs:!0},ok((g=function(e){return function(t){!(!o||s.has(t.navigationId))&&(c(t)[e]=ox(t,!0),t.navigationId>u&&(-1!==u&&f(t.navigationId),u=t.navigationId))}})(iX.LCP),v),oc(g(iX.FCP),v),ow(g(iX.INP),v),oh(g(iX.CLS),v),o_(g(iX.TTFB),v),t=function(){"hidden"===r.visibilityState&&t&&h()},r.addEventListener("visibilitychange",t)),[2]})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(n){return o=!1,void 0!==e&&(clearTimeout(e),e=void 0),t&&(null==r||r.removeEventListener("visibilitychange",t),t=null),[2]})})}}},oR=function(){var e=(0,z.m)();return e&&"PerformanceSoftNavigation"in e},oN=function(e,t,n){return void 0===t&&(t=""),void 0===n&&(n=10),["AMP",t,e.substring(0,n)].filter(
1Boolean).join("_")},oM=function(){function e(e,t){var n;this.shouldTrackNewCampaign=!1,this.options=(0,D.Cl)({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:nt((null==(n=t.cookieOptions)?void 0:n.domain)||t.topLevelDomain),optOut:t.optOut},e),this.storage=t.cookieStorage,this.storageKey=oN(t.apiKey,"MKTG"),this.webExpStorageKey=oN(t.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=eA,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,D.sH)(this,void 0,void 0,function(){var e,t;return(0,D.YH)(this,function(n){switch(n.label){case 0:if(this.options.optOut)return[2];return[4,this.fetchCampaign()];case 1:if(t=D.zs.apply(void 0,[n.sent(),2]),this.currentCampaign=t[0],this.previousCampaign=t[1],e=!this.lastEventTime||e7(this.sessionTimeout,this.lastEventTime),!t7(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,D.sH)(this,void 0,void 0,function(){var e;return(0,D.YH)(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 nb().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,e4(Object.entries((0,D.Cl)((0,D.Cl)({},eA),t)).reduce(function(e,t){var r,i=(0,D.zs)(t,2),o=i[0],s=i[1];return(e.setOnce("initial_".concat(o),null!=(r=null!=s?s:n.initialEmptyValue)?r:"EMPTY"),s)?e.set(o,s):e.unset(o)},new e2)));return e&&(r.event_id=e),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e}(),oD=new Set([c.IDENTIFY,c.GROUP_IDENTIFY]),oL=function(e){void 0===e&&(e={});var t,n,r,i,o,s,a,l=null!=(t=e.fallbackAttributionEvent)&&t,u=(0,z.m)(),c={},d=!1,h=!1,f=function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:return[4,new nb().parse()];case 1:return c=ny(e.sent()),l&&(null==r||r.log("Tracking attribution fallback event."),null==n||n.track("[Amplitude] Attribution",c)),[2]}})})},g=function(){f()},v=function(e){return new Proxy(e,{apply:function(e,t,n){Reflect.apply(e,t,n),d&&g()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(e,t){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(l){switch(l.label){case 0:return n=t,r=e.loggerProvider,d=!0,r.log("Installing event property attribution tracking."),[4,f()];case 1:if(l.sent(),!u)return[2];if(u.addEventListener("popstate",g),!h){if(i=Reflect.get(u.history,"pushState"),o=Reflect.get(u.history,"replaceState"),!i||!o)return[2];s=v(i),u.history.pushState=s,a=v(o),u.history.replaceState=a,h=!0}return[2]}})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(t){return oD.has(e.event_type)||(e.event_properties=(0,D.Cl)((0,D.Cl)({},c),e.event_properties)),[2,e]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e,t;return(0,D.YH)(this,function(n){return u&&(u.removeEventListener("popstate",g),e=Reflect.get(u.history,"pushState"),t=Reflect.get(u.history,"replaceState"),h&&e===s&&i&&(u.history.pushState=i),h&&t===a&&o&&(u.history.replaceState=o)),d=!1,h=!1,i=void 0,o=void 0,s=void 0,a=void 0,c={},[2]})})}}},oH="AMP_CURRENT_PAGE",oF="AMP_PREVIOUS_PAGE",oU="AMP_URL_INFO";!function(e){e.Direct="direct",e.Internal="internal",e.External="external"}(E||(E={}));var oj=new Set([c.IDENTIFY,c.GROUP_IDENTIFY,c.REVENUE]),oq=function(e){var t=(void 0===e?{}:e).internalDomains,n=void 0===t?[]:t,r=(0,z.m)(),i=void 0,o=!1,s=void 0,a=!1,l=!1,u=function(e){var t;try{t=new URL(e).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?u(e):void 0;if(!r)return E.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?E.Internal:E.External},d=function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,r,s;return(0,D.YH)(this,function(a){switch(a.label){case 0:if(!(i&&o))return[3,3];return[4,i.get(oU)];case 1:return e=a.sent(),t=n7("undefined"!=typeof location&&location.href||""),n=(null==e?void 0:e[oH])||"",r=void 0,r=t===n?(null==e?void 0:e[oF])||"":n||document.referrer||"",[4,i.set(oU,((s={})[oH]=t,s[oF]=r,s))];case 2:a.sent(),a.label=3;case 3:return[2]}})})},h=function(){d()};return{name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(e,t){return(0,D.sH)(void 0,void 0,void 0,function(){var t,n,c,f,g,v,p,m;return(0,D.YH)(this,function(y){switch(y.label){case 0:if((s=e.loggerProvider).log("Installing @amplitude/plugin-page-url-enrichment-browser"),l=!0,!r)return[3,7];try{i=new tM(r.sessionStorage)}catch(e){null==s||s.debug("sessionStorage is not available in this environment.")}return[4,null==i?void 0:i.isEnabled()];case 1:if(o=null!=(m=y.sent())&&m,!(i&&o))return[3,6];return n=(t="undefined"!=typeof document&&document.referrer||"")?u(t):void 0,c="undefined"!=typeof location&&location.hostname||"",f=n7("undefined"!=typeof location&&location.href||""),[4,i.get(oU)];case 2:if(v=(null==(g=y.sent())?void 0:g[oH])||"",!(n&&n!==c&&v!==f))return[3,4];return[4,i.set(oU,((p={})[oH]=f,p[oF]=t,p))];case 3:return y.sent(),[3,6];case 4:return[4,d()];case 5:y.sent(),y.label=6;case 6:r.addEventListener("popstate",h),a||(r.history.pushState=new Proxy(r.history.pushState,{apply:function(e,t,n){var r=(0,D.zs)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),l&&h()}}),r.history.replaceState=new Proxy(r.history.replaceState,{apply:function(e,t,n){var r=(0,D.zs)(n,3),i=r[0],o=r[1],s=r[2];e.apply(t,[i,o,s]),l&&h()}}),a=!0),y.label=7;case 7:return[2]}})})},execute:function(e){return(0,D.sH)(void 0,void 0,void 0,function(){var t,n,r;return(0,D.YH)(this,function(s){switch(s.label){case 0:if(t=n7("undefined"!=typeof location&&location.href||""),!(i&&o))return[3,2];return[4,i.get(oU)];case 1:if(r=(null==(n=s.sent())?void 0:n[oF])||"",oj.has(e.event_type))return[2,e];e.event_properties=(0,D.Cl)((0,D.Cl)({},e.event_properties||{}),{"[Amplitude] Page Domain":oz(e,"[Amplitude] Page Domain","undefined"!=typeof location&&location.hostname||""),"[Amplitude] Page Location":oz(e,"[Amplitude] Page Location",t),"[Amplitude] Page Path":oz(e,"[Amplitude] Page Path","undefined"!=typeof location&&n7(location.pathname)||""),"[Amplitude] Page Title":oz(e,"[Amplitude] Page Title",nm(np)),"[Amplitude] Page URL":oz(e,"[Amplitude] Page URL",t.split("?")[0]),"[Amplitude] Previous Page Location":r,"[Amplitude] Previous Page Type":c(r)}),s.label=2;case 2:return[2,e]}})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:if(r&&(r.removeEventListener("popstate",h),l=!1),!(i&&o))return[3,2];return[4,i.set(oU,{})];case 1:e.sent(),e.label=2;case 2:return[2]}})})}}};function oz(e,t,n){return(e.event_properties||(e.event_properties={}),void 0===e.event_properties[t])?n:e.event_properties[t]}var oB=function(){var e,t,n;function r(t){if(t)try{var n=Function("return "+t)();if("function"==typeof n)return n;null==e||e.error("Custom enrichment body did not evaluate to a function")}catch(t){null==e||e.error("Could not create custom enrichment function",t)}return function(e){return e}}return{name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(i,o){return(0,D.sH)(void 0,void 0,void 0,function(){var o,s;return(0,D.YH)(this,function(a){return null==(e=i.loggerProvider)||e.log("Installing @amplitude/plugin-custom-enrichment-browser"),(null==(s=i.remoteConfig)?void 0:s.fetchRemoteConfig)&&(i.remoteConfigClient?(o=i.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(e){n=e&&"object"==typeof e&&null!==e&&"body"in e&&"string"==typeof e.body?r(e.body||""):r("")}),t=function(){var e;return null==(e=i.remoteConfigClient)?void 0:e.unsubscribe(o)}):null==e||e.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(t){return(0,D.sH)(void 0,void 0,void 0,function(){var r;return(0,D.YH)(this,function(i){if(n)try{return[2,null!=(r=n(t))?r:null]}catch(t){null==e||e.error("Could not execute custom enrichment function",t)}return[2,t]})})},teardown:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){return t&&t(),[2]})})}}},oY="userProperty",oV="eventProperty",oW=function(e){return e===oY||e===oV},oJ=[oY,oV],oK=function(e){var t=(0,D.fX)([],(0,D.zs)(new Set((Array.isArray(e)?e:[e]).filter(oW))),!1);return t.length>0?t:(0,D.fX)([],(0,D.zs)(oJ),!1)},o$=function(e,t){return oK(e.trackingMethod).includes(t)},oG=function(e){return o$(e,oY)},oX=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._diagnosticsSampleRate=0,t}return(0,D.C6)(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),L(this._init((0,D.Cl)((0,D.Cl)({},i),{userId:r,apiKey:e})))},t.prototype._init=function(t){var n,r,i,o,a,l,u,c;return(0,D.sH)(this,void 0,void 0,function(){var d,h,f,g,v,p,m,y,b,S,w,E,I,k,C=this;return(0,D.YH)(this,function(T){var _,x,P,A,O,R,N,M,L,H;switch(T.label){case 0:if(this.initializing)return[2];if(this.initializing=!0,d=nu(t),h=null!=(n=t.loggerProvider)?n:new F,t.loggerProvider||h.enable(null!=(r=t.logLevel)?r:s.Warn),f=null!=(i=t.serverZone)?i:"US",v=this._diagnosticsSampleRate,p=null==(o=t.enableDiagnostics)||o,!d)return[3,2];return g=new W(t.apiKey,h,f,null==(a=t.remoteConfig)?void 0:a.serverUrl),[4,new Promise(function(e){null==g||g.subscribe("configs.diagnostics.browserSDK","all",function(t,n,r){if(h.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:t,source:n,lastFetch:r},null,2)),t){var i=t.sampleRate;"number"!=typeof i||isNaN(i)||(v=i);var o=t.enabled;"boolean"==typeof o&&(p=o)}e()})})];case 1:T.sent(),T.label=2;case 2:return(m=new er(t.apiKey,h,f,{enabled:p,sampleRate:v})).setTag("library","".concat(tk,"/").concat(tI)),m.setTag("platform","Web"),m.setTag("web_environment",function(){var e=(0,z.m)();if(!e)return"unknown";var t=ty(e);return tb(e)?t?"chrome_extension_service_worker":"service_worker":tS(e)?"web_worker":void 0!==e.document?t?"chrome_extension":"browser":tw(e)?"node":"unknown"}()),"undefined"!=typeof navigator&&m.setTag("user_agent",navigator.userAgent),[4,(_=t.apiKey,x=t,P=this,A=m,O={loggerProvider:h,serverZone:f,enableDiagnostics:p,diagnosticsSampleRate:v},void 0===x&&(x={}),(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,l,u,c,d,h,f,g,v,p,m,y,b,S,w,E,I,k,C,T,R,N,M,L,H,F,U,j,q,z,B,V,W,J,K,$,G,X,Q,Z,ee,et,en,er;return(0,D.YH)(this,function(eo){var es,ea,el,eu;switch(eo.label){case 0:if(e=x.identityStorage||t6,t="",!(e===t6&&!(null==(w=x.cookieOptions)?void 0:w.domain)&&(null==(E=x.cookieOptions)?void 0:E.domain)!==""))return[3,2];return[4,(es=void 0,ea=A,(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s;return(0,D.YH)(this,function(a){switch(a.label){case 0:return[4,new tx(void 0,{diagnosticsClient:ea}).isEnabled()];case 1:if(!a.sent()||!es&&("undefined"==typeof location||!location.hostname)||1===(t=(e=null!=es?es:location.hostname).split(".")).length)return[2,""];for(n=[],r=1,ni.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,tx.isDomainWritable(o)];case 4:if(a.sent())return[2,"."+o];return[3,6];case 5:return s=a.sent(),ea&&ea.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 ea&&ea.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(e)}),[2,""]}})}))];case 1:t=eo.sent(),eo.label=2;case 2:return n=(0,D.Cl)({domain:null!=(k=null==(I=x.cookieOptions)?void 0:I.domain)?k:t,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},x.cookieOptions),r={duplicateResolverFn:function(e){var t=tO(e);return!!t&&tR(JSON.parse(t).cookieDomain,n.domain)},diagnosticsClient:A},[4,(el=i=nl(x.identityStorage,n,r),void 0===(eu=null==(T=null==(C=x.cookieOptions)?void 0:C.upgrade)||T)&&(eu=!0),(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,r,i,o,s,a,l;return(0,D.YH)(this,function(u){switch(u.label){case 0:return e="".concat("amp","_").concat(_.substring(0,6)),[4,el.getRaw(e)];case 1:if(!(t=u.sent()))return[2,{optOut:!1}];if(!eu)return[3,3];
1return[4,el.remove(e)];case 2:u.sent(),u.label=3;case 3:return r=(n=(0,D.zs)(t.split("."),6))[0],i=n[1],o=n[2],s=n[3],a=n[4],l=n[5],[2,{deviceId:r,userId:tY(i),sessionId:tB(s),lastEventId:tB(l),lastEventTime:tB(a),optOut:!!o}]}})}))];case 3:return o=eo.sent(),[4,i.get(tN(_))];case 4:return s=eo.sent(),u=!(l=(a=ei()).ampTimestamp?Number(a.ampTimestamp):void 0)||Date.now()<l,c=null!=(H=null!=(L=null!=(M=null!=(R=x.deviceId)?R:u?null!=(N=a.ampDeviceId)?N:a.deviceId:void 0)?M:null==s?void 0:s.deviceId)?L:o.deviceId)?H:Y(),d=null!=(F=null==s?void 0:s.lastEventId)?F:o.lastEventId,h=null!=(U=null==s?void 0:s.lastEventTime)?U:o.lastEventTime,f=null!=(q=null!=(j=x.optOut)?j:null==s?void 0:s.optOut)?q:o.optOut,g=null!=(z=null==s?void 0:s.sessionId)?z:o.sessionId,v=null==s?void 0:s.deferredSessionId,p=null!=(V=null!=(B=x.userId)?B:null==s?void 0:s.userId)?V:o.userId,P.previousSessionDeviceId=null!=(W=null==s?void 0:s.deviceId)?W:o.deviceId,P.previousSessionUserId=null!=(J=null==s?void 0:s.userId)?J:o.userId,m={ipAddress:null==($=null==(K=x.trackingOptions)?void 0:K.ipAddress)||$,language:null==(X=null==(G=x.trackingOptions)?void 0:G.language)||X,platform:null==(Z=null==(Q=x.trackingOptions)?void 0:Q.platform)||Z},y=null==s?void 0:s.pageCounter,b=null==s?void 0:s.debugLogsEnabled,void 0!==x.autocapture&&(x.defaultTracking=x.autocapture),[4,(S=new na(_,x.appVersion,i,n,x.defaultTracking,x.autocapture,c,x.flushIntervalMillis,x.flushMaxRetries,x.flushQueueSize,e,x.ingestionMetadata,x.instanceName,d,h,null!=(ee=null==O?void 0:O.loggerProvider)?ee:x.loggerProvider,x.logLevel,x.minIdLength,x.offline,f,x.partnerId,x.plan,x.serverUrl,null!=(et=null==O?void 0:O.serverZone)?et:x.serverZone,g,v,x.sessionTimeout,x.storageProvider,m,x.transport,x.useBatch,x.fetchRemoteConfig,p,y,b,x.networkTrackingOptions,x.identify,null!=(en=null==O?void 0:O.enableDiagnostics)?en:x.enableDiagnostics,null!=(er=null==O?void 0:O.diagnosticsSampleRate)?er:P._diagnosticsSampleRate,A,x.remoteConfig,t,x.enableRequestBodyCompression,x.customEnrichment)).storageProvider.isEnabled()];case 5:return eo.sent()||(S.loggerProvider.warn("Storage provider ".concat(S.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),S.storageProvider=new tT),[2,S]}})}))];case 3:if(y=T.sent(),!(d&&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){var n,r;if(e){!function e(t){if("object"==typeof t&&null!==t&&!Array.isArray(t)){var n,r,i,o,s,a,l,u,c,d,h,f,g,v=Object.keys(t);try{for(var p=(0,D.Ju)(v),m=p.next();!m.done;m=p.next()){var y=m.value;try{var b=t[y];"boolean"==typeof(null==b?void 0:b.enabled)&&(b.enabled?(delete b.enabled,0===Object.keys(b).length&&(t[y]=!0)):t[y]=!1),e(b)}catch(e){}}}catch(e){n={error:e}}finally{try{m&&!m.done&&(r=p.return)&&r.call(p)}finally{if(n)throw n.error}}try{if(null==(c=null==(u=null==(l=t.autocapture)?void 0:l.networkTracking)?void 0:u.captureRules)?void 0:c.length)try{for(var S=(0,D.Ju)(t.autocapture.networkTracking.captureRules),w=S.next();!w.done;w=S.next()){var E=w.value;try{for(var I=(s=void 0,(0,D.Ju)(["responseHeaders","requestHeaders"])),k=I.next();!k.done;k=I.next()){var C=k.value,T=null!=(d=E[C])?d:{},_=T.captureSafeHeaders,x=T.allowlist;if(_||x){if(void 0!==x&&!Array.isArray(x)){delete E[C];continue}E[C]=(0,D.fX)((0,D.fX)([],(0,D.zs)(_?eO:[]),!1),(0,D.zs)(null!=x?x:[]),!1)}}}catch(e){s={error:e}}finally{try{k&&!k.done&&(a=I.return)&&a.call(I)}finally{if(s)throw s.error}}}}catch(e){i={error:e}}
1finally{try{w&&!w.done&&(o=S.return)&&o.call(S)}finally{if(i)throw i.error}}}catch(e){}(null==(h=t.autocapture)?void 0:h.pageViews)!==void 0&&(t.autocapture.screenViews=t.autocapture.pageViews);var P=null==(f=t.autocapture)?void 0:f.frustrationInteractions;P&&(P.rageClick&&(P.rageClicks=P.rageClick,delete P.rageClick),P.deadClick&&(P.deadClicks=P.deadClick,delete P.deadClick));try{var A=null==(g=t.autocapture)?void 0:g.elementInteractions;if(A&&"object"==typeof A&&(!0===A.viewportContentUpdated&&(A.viewportContentUpdated={}),!1===A.viewportContentUpdated&&(A.viewportContentUpdated={enabled:!1}),void 0!==A.exposureDuration)){var O=A.viewportContentUpdated;void 0===O?A.viewportContentUpdated={exposureDuration:A.exposureDuration}:"object"==typeof O&&void 0===O.exposureDuration&&!1!==O.enabled&&(O.exposureDuration=A.exposureDuration),delete A.exposureDuration}}catch(e){}}}(e);try{if(t.loggerProvider.debug("Update browser config with remote configuration:",j(e)),e&&"autocapture"in e){if("boolean"==typeof e.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture&&null!==e.autocapture){var i=(0,D.Cl)({},e.autocapture);if(void 0===t.autocapture&&(t.autocapture=e.autocapture),"object"==typeof e.autocapture.elementInteractions&&null!==e.autocapture.elementInteractions&&(null==(n=e.autocapture.elementInteractions.pageUrlAllowlistRegex)?void 0:n.length)){i.elementInteractions=(0,D.Cl)({},e.autocapture.elementInteractions);var o=i.elementInteractions,s=null!=(r=o.pageUrlAllowlist)?r:[],a=e.autocapture.elementInteractions.pageUrlAllowlistRegex;o.pageUrlAllowlist=nR(s,a,t.loggerProvider),delete o.pageUrlAllowlistRegex}var l=function(e,t){if("object"==typeof e&&null!==e&&(null==(i=e.captureRules)?void 0:i.length)){var n,r,i,o,s,a=(0,D.Cl)({},e),l=null!=(o=a.captureRules)?o:[];try{for(var u=(0,D.Ju)(l),c=u.next();!c.done;c=u.next()){var d=c.value;d.urls=nR(null!=(s=d.urls)?s:[],d.urlsRegex,t),delete d.urlsRegex}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return a}}(e.autocapture.networkTracking,t.loggerProvider);l&&(i.networkTracking=l),"boolean"==typeof t.autocapture&&(t.autocapture=(0,D.Cl)({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},i)),"object"==typeof t.autocapture&&(t.autocapture=(0,D.Cl)((0,D.Cl)({},t.autocapture),i))}t.defaultTracking=t.autocapture}"customEnrichment"in e&&null!==e.customEnrichment&&!1!==t.customEnrichment&&(t.customEnrichment=e.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",j(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,b=tn((R=this.config).defaultTracking)&&R.defaultTracking&&"object"==typeof R.defaultTracking&&R.defaultTracking.attribution&&"object"==typeof R.defaultTracking.attribution?(0,D.Cl)({},R.defaultTracking.attribution):{},!(tn(this.config.defaultTracking)&&oG(b)))return[3,8];return this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,D.sH)(C,void 0,void 0,function(){return(0,D.YH)(this,function(t){switch(t.label){case 0:if(e)return[3,2];return this.webAttribution=new oM(b,this.config),[4,this.webAttribution.init()];case 1:t.sent(),t.label=2;case 2:return[2]}})})}),this.webAttribution=new oM(b,this.config),[4,this.webAttribution.init()];case 7:T.sent(),T.label=8;case 8:if(E=!(!(w=(S=ei()).ampTimestamp?Number(S.ampTimestamp):void 0)||Date.now()<w)||Number.isNaN(Number(S.ampSessionId))?void 0:Number(S.ampSessionId),-1!==(I=this.config.deferredSessionId)||this.config.optOut||(I=Date.now()),this.setSessionId(null!=(c=null!=(u=null!=(l=t.sessionId)?l:E)?u:I)?c:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(e){return(0,D.sH)(C,void 0,void 0,function(){return(0,D.YH)(this,function(t){return!e&&this.config.deferredSessionId&&(-1===this.config.deferredSessionId?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),(k=eM(this.config.instanceName)).identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),null===this.config.offline)return[3,10];return[4,this.add(nO()).promise];case 9:T.sent(),T.label=10;case 10:return[4,this.add(new eQ({diagnosticsClient:m})).promise];
1case 11:return T.sent(),[4,this.add(new tC).promise];case 12:return T.sent(),[4,this.add(new eZ).promise];case 13:if(T.sent(),nA(this.config),!tt(this.config.defaultTracking,"fileDownloads"))return[3,15];return this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(nx()).promise];case 14:T.sent(),T.label=15;case 15:if(!tr(this.config.defaultTracking))return[3,17];return this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(nC()).promise];case 16:T.sent(),T.label=17;case 17:if(!ti(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(nw(tg(this.config))).promise];case 18:return T.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(e){return(0,D.sH)(C,void 0,void 0,function(){return(0,D.YH)(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(nw(tg(this.config))).promise];case 1:return t.sent(),[2]}})})}),T.label=20;case 20:if(!(tn(this.config.defaultTracking)&&o$(b,oV)))return[3,22];return this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(oL(b)).promise];case 21:T.sent(),T.label=22;case 22:if(!ta(this.config.autocapture))return[3,24];return this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(id(td(this.config),{diagnosticsClient:m})).promise];case 23:T.sent(),T.label=24;case 24:if(!tu(this.config.autocapture))return[3,26];return this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(iC(th(this.config))).promise];case 25:T.sent(),T.label=26;case 26:if(!ts(this.config.autocapture))return[3,28];return this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(iK(tf(this.config))).promise];case 27:T.sent(),T.label=28;case 28:if(!("boolean"==typeof(N=this.config.autocapture)?N:"object"==typeof N&&(!0===N.webVitals||"object"==typeof N.webVitals&&null!==N.webVitals)))return[3,30];return this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add((void 0===(M=tl(this.config))&&(M={}),!0===M.reportSoftNav&&oR())?oO():oP()).promise];case 29:T.sent(),T.label=30;case 30:if("object"!=typeof(L=this.config.autocapture)||!0!==L.performanceTracking&&"object"!=typeof L.performanceTracking)return[3,32];return this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(i_(tc(this.config))).promise];case 31:T.sent(),T.label=32;case 32:if(!tt(this.config.autocapture,"pageUrlEnrichment"))return[3,34];return this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(oq()).promise];case 33:T.sent(),T.label=34;case 34:if(!("boolean"==typeof(H=this.config.customEnrichment)?H:"object"==typeof H&&null!==H&&!1!==H.enabled))return[3,36];return this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(oB()).promise];case 35:T.sent(),T.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return T.sent(),k.eventBridge.setEventReceiver(function(e){var t=e.eventProperties||{},n=t.time,r=(0,D.Tt)(t,["time"]);C.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.userId},t.prototype.setUserId=function(e){if(!this.config)return void this.q.push(this.setUserId.bind(this,e));this.config.loggerProvider.debug("function setUserId: ",e),(e!==this.config.userId||void 0===e)&&(this.config.userId=e,this.timeline.onIdentityChanged({userId:e}),eD(e,this.config.instanceName))},t.prototype.getDeviceId=function(){var e;return null==(e=this.config)?void 0:e.deviceId},t.prototype.setDeviceId=function(e){if(!this.config)return void this.q.push(this.setDeviceId.bind(this,e));this.config.loggerProvider.debug("function setDeviceId: ",e),e!==this.config.deviceId&&(this.config.deviceId=e,this.timeline.onIdentityChanged({deviceId:e}),eL(e,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(Y()),this.setUserId(void 0),this.timeline.onReset()},t.prototype.getIdentity=function(){var e,t;return{deviceId:null==(e=this.config)?void 0:e.deviceId,userId:null==(t=this.config)?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 e2,o=null!=(r=e.userProperties)?r:{};try{for(var s=(0,D.Ju)(Object.entries(o)),a=s.next();!a.done;a=s.next()){var l=(0,D.zs)(a.value,2),u=l[0],c=l[1];i.set(u,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.optOut},t.prototype.getSessionId=function(){var e;return null==(e=this.config)?void 0:e.sessionId},t.prototype.setSessionId=function(e){var t,n=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,e)),L(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=null!=e?e:-1,L(Prom
1ise.resolve());if(void 0===e&&(e=Date.now()),e===this.config.sessionId)return L(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)?t:-1;this.config.sessionId=e,this.config.lastEventTime=void 0,this.config.pageCounter=0,to(this.config.defaultTracking)&&(r&&i&&n.push(this.track(tG,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(e4(this.config.identify)).promise),to(this.config.defaultTracking)&&n.push(this.track(t$,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,L(Promise.all(n))},t.prototype.extendSession=function(){if(!this.config)return void this.q.push(this.extendSession.bind(this));this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(e){if(!this.config)return void this.q.push(this.setTransport.bind(this,e));this.config.transportProvider=nc(e)},t.prototype.identify=function(t,n){if(tm(t)){var r=t._q;t._q=[],t=tp(new e2,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(tm(r)){var o=r._q;r._q=[],r=tp(new e2,o)}return e.prototype.groupIdentify.call(this,t,n,r,i)},t.prototype.revenue=function(t,n){if(tm(t)){var r=t._q;t._q=[],t=tp(new e8,r)}return e.prototype.revenue.call(this,t,n)},t.prototype.trackCampaignEventIfNeeded=function(e,t){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!oG(this.webAttribution.options))return!1;var n=this.webAttribution.generateCampaignEvent(e);return t?t.push(this.track(n).promise):this.track(n),this.config.loggerProvider.log("Tracking attribution."),!0},t.prototype.process=function(t){return(0,D.sH)(this,void 0,void 0,function(){var n,r,i;return(0,D.YH)(this,function(o){return n=Date.now(),r=e7(this.config.sessionTimeout,this.config.lastEventTime),i=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),t.event_type!==t$&&t.event_type!==tG&&(!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,D.Cl)((0,D.Cl)({},e),{apiKey:e.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",j(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}(te),oQ=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return n.customHeaders=t,n}return(0,D.C6)(t,e),t.prototype.send=function(e,t){return(0,D.sH)(this,void 0,void 0,function(){var n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:if("undefined"==typeof fetch)throw Error("FetchTransport is not supported");return[4,fetch(e,{headers:(0,D.Cl)({"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})]}}})})},t}(tU);!function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"}(I||(I={}));var oZ="[Amplitude]",o0="".concat(oZ," Session Replay ID"),o1=I.US,o2={enabled:!0},o3="".concat(oZ," Session Replay Debug"),o4="https://api-sr.amplitude.com/sessions/v2/track",o6="https://api-sr.eu.amplitude.com/sessions/v2/track",o5="https://api-sr.stag2.amplitude.com/sessions/v2/track",o8=/payload.*exceed/i,o7="X-Session-Replay-Event-Skipped",o9="amplitude-sr-iframe";!function(e){e.GET_SR_PROPS="get-sr-props",e.DEBUG_INFO="debug-info",e.FETCH_REQUEST="fetch-request",e.METADATA="metadata",e.TARGETING_DECISION="targeting-decision",e.REPLAY_GATE_DECISION="replay-gate-decision"}(k||(k={}));var se=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__)?t:n).bind(this.logger):function(){}},e.prototype.enable=function(e){this.logger.enable(e)},e.prototype.disable=function(){this.logger.disable()},e}(),st=new Map,sn=function(e){var t=st.get(e);if(t)return t;var n="\0TRAIL\0",r="\0MID\0",i="\0DS\0",o="\0ST\0",s="\0QU\0",a=e;a=(a=(a=(a=(a=(a=(a=(a=(a=(a=(a=a.replace(/\/\*\*$/,n)).replace(/\/\*\*\//g,r)).replace(/\*\*/g,i)).replace(/\*/g,o)).replace(/\?/g,s)).replace(/[.+^${}()|[\]\\]/g,"\\$&")).split(n).join("(/.*)?")).split(r).join("/(.*\\/)?")).split(i).join(".*")).split(o).join(".*")).split(s).join(".");var l=new RegExp("^".concat(a,"$"));return st.set(e,l),l},sr=function(){var e=(0,z.m)();return(null==e?void 0:e.location)?e.location.href:""},si=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")},so=function(e,t){var n,r;try{for(var i=(0,D.Ju)(t),o=i.next();!o.done;o=i.next()){var s=o.value,a=sn(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},ss=function(){return(0,D.sH)(void 0,void 0,void 0,function(){var e,t,n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:if(i.trys.push([0,3,,4]),!(e=(0,z.m)()))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:""}]}})})},sa=function(e){var t=(0,D.Cl)({},e),n=t.apiKey;return t.apiKey="****".concat(n.substring(n.length-4)),t},sl=function(){return{flushMaxRetries:2,logLevel:s.Warn,loggerProvider:new F,transportProvider:new oQ}},su=function(e){function t(t,n){var r,i,o,s,a,l,u,c,d,h,f,g,v,p,m=this,y=sl();return(m=e.call(this,(0,D.Cl)((0,D.Cl)({transportProvider:y.transportProvider,loggerProvider:new se(n.loggerProvider||y.loggerProvider)},n),{apiKey:t}))||this).flushMaxRetries=void 0!==n.flushMaxRetries&&n.flushMaxRetries<=y.flushMaxRetries?n.flushMaxRetries:y.flushMaxRetries,m.apiKey=t,m.sampleRate=n.sampleRate||0,m.serverZone=n.serverZone||o1,m.configServerUrl=n.configServerUrl,m.trackServerUrl=n.trackServerUrl,m.shouldInlineStylesheet=n.shouldInlineStylesheet,m.inlineImages=n.inlineImages,m.version=n.version,m.performanceConfig=n.performanceConfig||o2,m.storeType=null!=(r=n.storeType)?r:"memory",m.applyBackgroun
1dColorToBlockedElements=null!=(i=n.applyBackgroundColorToBlockedElements)&&i,m.enableUrlChangePolling=null!=(o=n.enableUrlChangePolling)&&o,m.urlChangePollingInterval=null!=(s=n.urlChangePollingInterval)?s:1e3,m.captureDocumentTitle=null!=(a=n.captureDocumentTitle)&&a,void 0!==n.fullSnapshotIntervalMs&&(m.fullSnapshotIntervalMs=n.fullSnapshotIntervalMs),void 0!==n.eagerFullSnapshotSend&&(m.eagerFullSnapshotSend=n.eagerFullSnapshotSend),m.captureFullSnapshotOnFocus=null!=(l=n.captureFullSnapshotOnFocus)&&l,void 0!==n.maxPersistedEventsSizeBytes&&(m.maxPersistedEventsSizeBytes=sf(n.maxPersistedEventsSizeBytes,sc,sd,"maxPersistedEventsSizeBytes",m.loggerProvider)),void 0!==n.maxSingleEventSizeBytes&&(m.maxSingleEventSizeBytes=sf(n.maxSingleEventSizeBytes,sc,sh,"maxSingleEventSizeBytes",m.loggerProvider)),m.privacyConfig=(0,D.Cl)((0,D.Cl)({},null!=(u=n.privacyConfig)?u:{}),{unmaskSelector:Array.from(new Set((0,D.fX)([".".concat("amp-unmask")],(0,D.zs)(null!=(d=null==(c=n.privacyConfig)?void 0:c.unmaskSelector)?d:[]),!1)))}),n.interactionConfig&&(m.interactionConfig=n.interactionConfig,m.interactionConfig.ugcFilterRules&&si(m.interactionConfig.ugcFilterRules)),n.debugMode&&(m.debugMode=n.debugMode),m.useWebWorker=null==(g=null!=(h=n.useWebWorker)?h:null==(f=n.experimental)?void 0:f.useWebWorker)||g,m.enableTransportCompression=null==(v=n.enableTransportCompression)||v,m.sendTimeoutMs=n.sendTimeoutMs,m.captureAdoptedStyleSheets=null==(p=n.captureAdoptedStyleSheets)||p,n.crossOriginIframes&&(m.crossOriginIframes=n.crossOriginIframes),n.flushIntervalConfig?m.flushIntervalConfig=function(e,t){var n,r,i={};if(void 0!==e.minIntervalMs&&(!Number.isFinite(e.minIntervalMs)||e.minIntervalMs<100?(t.warn("flushIntervalConfig.minIntervalMs ".concat(e.minIntervalMs," is below floor ").concat(100,"ms; clamping.")),i.minIntervalMs=100):i.minIntervalMs=e.minIntervalMs),void 0!==e.maxIntervalMs&&(Number.isNaN(e.maxIntervalMs)||e.maxIntervalMs<100?(t.warn("flushIntervalConfig.maxIntervalMs ".concat(e.maxIntervalMs," is below floor ").concat(100,"ms; clamping.")),i.maxIntervalMs=100):i.maxIntervalMs=e.maxIntervalMs),void 0!==i.minIntervalMs||void 0!==i.maxIntervalMs){var o=null!=(n=i.minIntervalMs)?n:500,s=null!=(r=i.maxIntervalMs)?r:1e4;s<o&&(void 0===i.maxIntervalMs?(t.warn("flushIntervalConfig.minIntervalMs (".concat(o,") exceeds the default maxIntervalMs (").concat(1e4,"); raising max to match min.")),i.maxIntervalMs=o):void 0===i.minIntervalMs?(t.warn("flushIntervalConfig.maxIntervalMs (".concat(s,") is below the default minIntervalMs (").concat(500,"); lowering min to match max.")),i.minIntervalMs=s):(t.warn("flushIntervalConfig.maxIntervalMs (".concat(i.maxIntervalMs,") is less than minIntervalMs (").concat(i.minIntervalMs,"); raising max to match min.")),i.maxIntervalMs=i.minIntervalMs))}return i}(n.flushIntervalConfig,m.loggerProvider):m.flushIntervalConfig={minIntervalMs:1e3,maxIntervalMs:1e4},m.handleSendEvents=n.handleSendEvents,m.handleFetchConfig=n.handleFetchConfig,m}return(0,D.C6)(t,e),t}(eq),sc=1e3,sd=8e6,sh=1e7;function sf(e,t,n,r,i){return Number.isFinite(e)?e<t?(i.warn("".concat(r," ").concat(e," is below floor ").concat(t,"; clamping.")),t):e>n?(i.warn("".concat(r," ").concat(e," exceeds ceiling ").concat(n,"; clamping.")),n):e:void i.warn("".concat(r," value is not a finite number (got ").concat(String(e),"); ignoring."))}var sg="medium",sv=function(e,t,n){switch(t){case"light":if("input"!==e)return!1;var r,i,o=n?(i=(r=n).type,r.hasAttribute("data-rr-is-password")?"password":i?i.toLowerCase():null):"";if(!o)return!1;if(["password","hidden","email","tel"].includes(o)||n.autocomplete.startsWith("cc-"))return!0;return!1;case"medium":return"input"===e;case"conservative":return!0;default:return sv(e,sg,n)}},sp=function(e,t){if(e&&t.urlMaskLevels)try{for(var n,r,i,o=(0,D.Ju)(t.urlMaskLevels),s=o.next();!s.done;s=o.next()){var a=s.value;if(sn(a.match).test(e))return a.maskLevel}}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return null!=(i=t.defaultMaskLevel)?i:sg},sm=function(e,t,n,r){var i,o;if(void 0===t&&(t={defaultMaskLevel:sg}),n){if(n.closest(".amp-mask, [data-amp-mask]")||(null!=(i=t.maskSelector)?i:[]).some(function(e){return n.closest(e)}))return!0;
1if(n.closest(".amp-unmask, [data-amp-unmask]")||(null!=(o=t.unmaskSelector)?o:[]).some(function(e){return n.closest(e)}))return!1}return sv(e,sp(r,t),n)},sy=function(e,t,n){return function(r,i){return sm(e,t,i,null==n?void 0:n())?r.replace(/[^\s]/g,"*"):r}},sb=function(e){var t=null==e?void 0:e.blockSelector;return(0,D.fX)((0,D.fX)([],(0,D.zs)("string"==typeof t?t?[t]:[]:null!=t?t:[]),!1),["[data-amp-block]"],!1).join(",")},sS=function(e,t){var n,r;return e&&("conservative"===sp(t,e)||"conservative"===e.defaultMaskLevel||(null==(n=e.urlMaskLevels)?void 0:n.some(function(e){return"conservative"===e.maskLevel})))?"*":(0,D.fX)((0,D.fX)([],(0,D.zs)(null!=(r=null==e?void 0:e.maskSelector)?r:[]),!1),["[data-amp-mask]"],!1).join(",")},sw=function(e,t){var n;return void 0===t&&(t=function(){return""}),{maskAllInputs:!0,maskTextClass:"amp-mask",blockClass:"amp-block",blockSelector:sb(e),maskTextSelector:sS(e,t()),maskInputFn:sy("input",e,t),maskTextFn:sy("text",e,t),maskAttributeFn:(n=t,function(t,r,i){var o;return"style"!==t&&(null!=(o=null==e?void 0:e.maskAttributes)?o:[]).includes(t)?sm(["INPUT","SELECT","TEXTAREA"].includes(i.tagName)?"input":"text",e,i,null==n?void 0:n())?r.replace(/[^\s]/g,"*"):r:r})}},sE=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(sE||{}),sI=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(sI||{}),sk=(e=>(e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e))(sk||{}),sC=(e=>(e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e))(sC||{}),sT=(e=>(e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e))(sT||{}),s_=(e=>(e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e))(s_||{}),sx=(e=>(e.Start="start",e.Pause="pause",e.Resume="resume",e.Resize="resize",e.Finish="finish",e.FullsnapshotRebuilded="fullsnapshot-rebuilded",e.LoadStylesheetStart="load-stylesheet-start",e.LoadStylesheetEnd="load-stylesheet-end",e.SkipStart="skip-start",e.SkipEnd="skip-end",e.MouseInteraction="mouse-interaction",e.EventCast="event-cast",e.CustomEvent="custom-event",e.Flush="flush",e.StateChange="state-change",e.PlayBack="play-back",e.Destroy="destroy",e.SeekStart="seek-start",e.SeekEnd="seek-end",e))(sx||{}),sP=(e=>(e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e))(sP||{}),sA=function(e,t,n){var r,i,o=(0,D.Cl)({},e);try{for(var s=(0,D.Ju)(["blockSelector","maskSelector","unmaskSelector"]),a=s.next();!a.done;a=s.next()){var l=a.value,u=e[l],c=("string"==typeof u?[u]:null!=u?u:[]).filter(function(e){try{return t(e),!0}catch(t){if(!n)throw Error("Invalid privacy selector: ".concat(e));return n(e),!1}});o[l]=c.length?c:void 0}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}return o},sO=function(e,t){var n=document.createDocumentFragment();return sA(e,function(e){n.querySelector(e)},function(e){t.warn('[session-replay-browser] omitting selector "'.concat(e,'" because it is invalid'))})},sR=function(){function e(e,t){this.localConfig=t,this.remoteConfigClient=e}return e.prototype.generateJoinedConfig=function(){var e,t,n,r,i,o,s;return(0,D.sH)(this,void 0,void 0,function(){var a,l,u,c,d,h,f,g,v,p,m,y,b,S,w,E,I,k=this;return(0,D.YH)(this,function(C){switch(C.label){case 0:(a=(0,D.Cl)({},this.localConfig)).optOut=this.localConfig.optOut,a.captureEnabled=!0,C.label=1;case 1:return C.trys.push([1,3,,4]),[4,new Promise(function(e,t){k.remoteConfigClient.subscribe("configs.sessionReplay",{timeout:1500},function(n,r){if(k.localConfig.loggerProvider.debug("Session Replay remote configuration received from ".concat(r,":"),JSON.stringify(n,null,2)),!n)return void t(Error("No remote config received"));var i,o=n.sr_sampling_config,s=n.sr_privacy_config,u=n.sr_targeting_config,c=null==(i=a.interactionConfig)?void 0:i.ugcFilterRules;a.interactionConfig=n.sr_interaction_config,a.interactionConfig&&c&&(a.interactionConfig.ugcFilterRules=c),a.loggingConfig=n.sr_logging_config,(o||s||u)&&(l={},o&&(l.sr_sampling_config=o),s&&(l.sr_privacy_config=s),u&&(l.sr_targeting_config=u)),e()})})];case 2:return C.sent(),[3,4];case 3:return u=C.sent(),this.localConfig.loggerProvider.error("Failed to generate joined config: ",u),a.captureEnabled=!1,[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:void 0}];case 4:if(!l)return[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:l}];if(c=l.sr_sampling_config,d=l.sr_privacy_config,h=l.sr_targeting_config,c&&Object.keys(c).length>0?(Object.prototype.hasOwnProperty.call(c,"capture_enabled")?a.captureEnabled=c.capture_enabled:a.captureEnabled=!1,Object.prototype.hasOwnProperty.call(c,"sample_rate")&&(a.sampleRate=c.sample_rate),Object.prototype.hasOwnProperty.call(c,"min_session_duration_ms")&&(a.minSessionDurationMs=this.sanitizeMinSessionDurationMs(c.min_session_duration_ms))):(a.captureEnabled=!0,this.localConfig.loggerProvider.debug("Remote config successfully fetched, but no values set for project, Session Replay capture enabled.")),d){f=null!=(e=a.privacyConfig)?e:{},g={defaultMaskLevel:null!=(n=null!=(t=d.defaultMaskLevel)?t:f.defaultMaskLevel)?n:"medium",blockSelector:[],maskSelector:[],unmaskSelector:[],maskAttributes:(0,D.fX)([],(0,D.zs)(new Set((0,D.fX)((0,D.fX)([],(0,D.zs)(null!=(r=f.maskAttributes)?r:[]),!1),(0,D.zs)(null!=(i=d.maskAttributes)?i:[]),!1))),!1),urlMaskLevels:(0,D.fX)((0,D.fX)([],(0,D.zs)(null!=(o=d.urlMaskLevels)?o:[]),!1),(0,D.zs)(null!=(s=f.urlMaskLevels)?s:[]),!1)},v=function(e){var t,n,r,i,o,s,a,l,u,c={};"string"==typeof e.blockSelector&&(e.blockSelector=[e.blockSelector]);try{for(var d=(0,D.Ju)(null!=(a=e.blockSelector)?a:[]),h=d.next();!h.done;h=d.next()){var f=h.value;c[f]="block"}}catch(e){t={error:e}}finally{try{h&&!h.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}try{for(var g=(0,D.Ju)(null!=(l=e.maskSelector)?l:[]),v=g.next();!v.done;v=g.next()){var f=v.value;c[f]="mask"}}catch(e){r={error:e}}finally{try{v&&!v.done&&(i=g.return)&&i.call(g)}finally{if(r)throw r.error}}try{for(var p=(0,D.Ju)(null!=(u=e.unmaskSelector)?u:[]),m=p.next();!m.done;m=p.next()){var f=m.value;c[f]="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},p=(0,D.Cl)((0,D.Cl)({},v(f)),v(d));try{for(y=(m=(0,D.Ju)(Object.entries(p))).next();!y.done;y=m.next())S=(b=(0,D.zs)(y.value,2))[0],w=b[1],"mask"===w?g.maskSelector.push(S):"block"===w?g.blockSelector.push(S):"unmask"===w&&g.unmaskSelector.push(S)}catch(e){E={error:e}}finally{try{y&&!y.done&&(I=m.return)&&I.call(m)}finally{if(E)throw E.error}}a.privacyConfig=sO(g,this.localConfig.loggerProvider)}return h&&Object.keys(h).length>0&&(a.targetingConfig=h),this.localConfig.loggerProvider.debug(JSON.stringify({name:"session replay joined config",config:sa(a)},null,2)),[2,{localConfig:this.localConfig,joinedConfig:a,remoteConfig:l}]}})})},e.prototype.sanitizeMinSessionDurationMs=function(e){return"number"==typeof e&&Number.isFinite(e)?e<0?void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is negative (".concat(e,"); ignoring.")):e>sN?(this.localConfig.loggerProvider.warn("min_session_duration_ms remote value ".concat(e," exceeds ").concat(sN,"ms ceiling; clamping.")),sN):e:void this.localConfig.loggerProvider.warn("min_session_duration_ms remote value is not a finite number (got ".concat(String(e),"); ignoring."))},e}(),sN=6e4;function sM(e,t){return t||("STAGING"===e?o5:"EU"===e?o6:o4)}function sD(e){if(e.type!==sE.IncrementalSnapshot)return!1;var t=e.data;return t.source===sI.Mutation&&!t.isAttachIframe}var sL=function(){function e(e,t,n,r,i){var o,s=this;this.taskQueue=[],this.pendingQueue=[],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){var n,r=new Blob([e]).size;if(r>(null!=(n=s.config.maxSingleEventSizeBytes)?n:9e6))return void s.config.loggerProvider.warn("Session replay event dropped: serialized size ".concat(Math.round(r/1024)," KB exceeds maximum allowed event size. If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));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.flushQueue=function(){var e;
1for(s.pendingQueue.length>0&&(e=s.taskQueue).push.apply(e,(0,D.fX)([],(0,D.zs)(s.mergeMutationTasks(s.pendingQueue.splice(0))),!1));s.taskQueue.length>0;){var t=s.taskQueue.shift();if(t){var n=t.event,r=t.sessionId,i=s.compressEvent(n);s.addCompressedEventToManager(i,r)}}s.isProcessing=!1},this.terminate=function(){var e;null==(e=s.worker)||e.terminate()};var a=(0,z.m)();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.timeout)||2e3,this.onFullSnapshotProcessed=i,r){t.loggerProvider.log("Enabling web worker for compression");try{var l=new Blob([r],{type:"application/javascript"}),u=URL.createObjectURL(l),c=new Worker(u);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===sE.FullSnapshot){if(this.config.loggerProvider.debug("Processing full snapshot immediately."),this.taskQueue.length>0||this.pendingQueue.length>0){var n,r,i,o,s=(0,D.fX)((0,D.fX)([],(0,D.zs)(this.taskQueue.splice(0)),!1),(0,D.zs)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1);try{for(var a=(0,D.Ju)(s),l=a.next();!l.done;l=a.next()){var u=l.value,c=this.compressEvent(u.event);this.addCompressedEventToManager(c,u.sessionId)}}catch(e){n={error:e}}finally{try{l&&!l.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}this.isProcessing=!1}var d=this.compressEvent(e);this.addCompressedEventToManager(d,t),null==(i=this.onFullSnapshotProcessed)||i.call(this);return}this.canUseIdleCallback&&(null==(o=this.config.performanceConfig)?void 0:o.enabled)?(this.config.loggerProvider.debug("Enqueuing event for processing during idle time."),this.pendingQueue.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){var t,n=this;for(this.pendingQueue.length>0&&(t=this.taskQueue).push.apply(t,(0,D.fX)([],(0,D.zs)(this.mergeMutationTasks(this.pendingQueue.splice(0))),!1));this.taskQueue.length>0&&(e.timeRemaining()>0||e.didTimeout);){var r=this.taskQueue.shift();if(r){var i=r.event,o=r.sessionId;this.addCompressedEvent(i,o)}}this.taskQueue.length>0||this.pendingQueue.length>0?requestIdleCallback(function(e){n.processQueue(e)},{timeout:this.timeout}):this.isProcessing=!1},e.prototype.mergeMutationTasks=function(e){if((null==(r=this.config.performanceConfig)?void 0:r.mergeMutations)===!1||e.length<=1)return e;for(var t,n,r,i=[],o=0;o<e.length;){for(var s=e[o].sessionId,a=o+1;a<e.length&&e[a].sessionId===s;)a++;var l=function(e){if(e.length<=1)return e;for(var t=[],n=0;n<e.length;){if(!sD(e[n])){t.push(e[n]),n++;continue}for(var r=n+1;r<e.length&&sD(e[r]);)r++;t.push(r>n+1?function(e){var t,n,r,i,o=e[0],s=new Map,a=new Map,l=new Map,u=new Map,c=new Map;e.forEach(function(e,t){var n,r,i,o,d=e.data;try{for(var h=(0,D.Ju)(d.adds),f=h.next();!f.done;f=h.next()){var g=f.value;s.has(g.node.id)||s.set(g.node.id,t),a.set(g.node.id,t),c.set(g.node.id,g.parentId)}}catch(e){n={error:e}}finally{try{f&&!f.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}try{for(var v=(0,D.Ju)(d.removes),p=v.next();!p.done;p=v.next()){var m=p.value;l.has(m.id)||l.set(m.id,t),u.set(m.id,t)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(o=v.return)&&o.call(v)}finally{if(i)throw i.error}}});var d=new Set,h=new Set;try{for(var f=(0,D.Ju)(s),g=f.next();!g.done;g=f.next()){var v=(0,D.zs)(g.value,2),p=v[0],m=v[1],y=l.get(p);if(void 0!==y){var b=a.get(p),S=u.get(p);!(b>=S)&&(m<y?d.add(p):y<m&&h.add(p))}}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=f.return)&&n.call(f)}finally{if(t)throw t.error}}var w=new Set;if(d.size>0||h.size>0)for(var E=!0;
1E;){E=!1;try{for(var I=(r=void 0,(0,D.Ju)(c)),k=I.next();!k.done;k=I.next()){var C=(0,D.zs)(k.value,2),T=C[0],_=C[1];if(!d.has(T)&&!h.has(T)&&!w.has(T)&&(d.has(_)||h.has(_)||w.has(_))){var x=l.get(T),P=s.get(T);void 0!==x&&void 0!==P&&x<P?h.add(T):void 0!==x&&void 0!==P&&x===P?w.add(T):d.add(T),E=!0}}}catch(e){r={error:e}}finally{try{k&&!k.done&&(i=I.return)&&i.call(I)}finally{if(r)throw r.error}}}var A=d.size>0||h.size>0||w.size>0,O=[];e.forEach(function(e,t){var n,r;try{for(var i=(0,D.Ju)(e.data.removes),o=i.next();!o.done;o=i.next()){var a=o.value;!(d.has(a.id)||h.has(a.id)&&t>=s.get(a.id))&&(w.has(a.id)&&(d.has(a.parentId)||h.has(a.parentId)||w.has(a.parentId))||O.push(a))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}});var R=e.flatMap(function(e){return e.data.adds}),N=e.flatMap(function(e){return e.data.texts}),M=e.flatMap(function(e){return e.data.attributes}),L=A?M.filter(function(e){return!d.has(e.id)&&!h.has(e.id)&&!w.has(e.id)}):M,H={source:sI.Mutation,removes:O,adds:A?R.filter(function(e){return!d.has(e.node.id)&&!h.has(e.node.id)&&!w.has(e.node.id)}):R,texts:A?N.filter(function(e){return!d.has(e.id)&&!h.has(e.id)&&!w.has(e.id)}):N,attributes:function(e){var t,n,r=new Map;if(e.forEach(function(e,t){if(e.attributes&&"style"in e.attributes){var n=r.get(e.id);n?n.push(t):r.set(e.id,[t])}}),0===r.size)return e;var i=function(t){return e[t].attributes.style},o=new Set,s=new Map;try{for(var a=(0,D.Ju)(r.values()),l=a.next();!l.done;l=a.next()){var u=l.value;!function(e){if(1!==e.length){var t=-1;e.forEach(function(e,n){var r;("object"!=typeof(r=i(e))||null===r)&&(t=n)});var n=[];if(e.forEach(function(e,r){r!==t&&(o.add(e),r>t&&n.push(e))}),n.length>0){var r=n[n.length-1],a=function(e){var t,n,r,i,o={};try{for(var s=(0,D.Ju)(e),a=s.next();!a.done;a=s.next()){var l=a.value;try{for(var u=(r=void 0,(0,D.Ju)(Object.keys(l))),c=u.next();!c.done;c=u.next()){var d=c.value;o[d]=l[d]}}catch(e){r={error:e}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}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}(n.map(function(e){return i(e)}));o.delete(r),s.set(r,a)}}}(u)}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}if(0===o.size&&0===s.size)return e;var c=[];return e.forEach(function(e,t){var n=s.get(t);if(void 0!==n)return void c.push((0,D.Cl)((0,D.Cl)({},e),{attributes:(0,D.Cl)((0,D.Cl)({},e.attributes),{style:n})}));if(!o.has(t))return void c.push(e);var r=(0,D.Cl)({},e.attributes);delete r.style,Object.keys(r).length>0&&c.push((0,D.Cl)((0,D.Cl)({},e),{attributes:r}))}),c}(L)};return(0,D.Cl)((0,D.Cl)({},o),{data:H})}(e.slice(n,r)):e[n]),n=r}return t}(e.slice(o,a).map(function(e){return e.event}));try{for(var u=(t=void 0,(0,D.Ju)(l)),c=u.next();!c.done;c=u.next()){var d=c.value;i.push({event:d,sessionId:s})}}catch(e){t={error:e}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}o=a}return i},e}(),sH="Session replay event batch rejected due to exceeded retry count",sF="Failed to store session replay events in IndexedDB",sU="Session replay event batch dropped: server signalled capture disabled or session out of valid range for this session",sj="1.51.0",sq=function(){function e(e){var t=e.trackServerUrl,n=e.loggerProvider,r=e.payloadBatcher,i=e.workerScript,o=e.enableTransportCompression,s=e.sendTimeoutMs,a=e.handleSendEvents,l=this;if(this.storageKey="",this.retryTimeout=1e3,this.scheduled=null,this.queue=[],this.sendIdCounter=0,this.pendingWorkerRequests=new Map,this.timedOutWorkerRequests=new Map,this.flushPauseUntilMs=0,this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,this.mergeLogFiredThisPause=!1,this.killedSessions=new Set,this.loggerProvider=n,this.payloadBatcher=r||function(e){return e},this.trackServerUrl=t,this.enableTransportCompression=null==o||o,this.sendTimeoutMs=null!=s?s:1e4,this.handleSendEvents=a,i)try{var u=new Blob([i],{type:"application/javascript"}),c=URL.createObjectURL(u),d=new Worker(c);d.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,")")),d.terminate(),l.worker=void 0;try{for(var i=(0,D.Ju)(l.pendingWorkerRequests),o=i.next();!o.done;o=i.next()){var s=(0,D.zs)(o.value,2)[1];s.timeout&&clearTimeout(s.timeout),n.warn("Session replay event send failed due to worker crash: ".concat(e.message)),s.resolve()}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}l.pendingWorkerRequests.clear(),l.timedOutWorkerRequests.clear()},d.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("payload_too_large"===t.type){var r=l.pendingWorkerRequests.get(t.id);if(r)r.timeout&&clearTimeout(r.timeout),l.handlePayloadTooLargeResponse(r.context,t.isWaf),r.resolve(),l.pendingWorkerRequests.delete(t.id);else{var i=l.timedOutWorkerRequests.get(t.id);i&&(l.timedOutWorkerRequests.delete(t.id),l.handlePayloadTooLargeResponse(i,t.isWaf))}}else if("complete"===t.type){var o=l.pendingWorkerRequests.get(t.id);if(o)o.timeout&&clearTimeout(o.timeout),void 0!==t.skipCode&&l.applyServerDirective(o.context.sessionId,t.skipCode),l.completeRequest({context:o.context}),o.resolve(),l.pendingWorkerRequests.delete(t.id);else{var i=l.timedOutWorkerRequests.get(t.id);i&&(l.timedOutWorkerRequests.delete(t.id),void 0!==t.skipCode&&l.applyServerDirective(i.sessionId,t.skipCode),l.completeRequest({context:i}))}}else"fetch-request"===t.type&&l.handleDelegatedFetch(d,t).catch(function(e){n.warn("Failed to handle delegated session replay fetch:",e)})},this.worker=d}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,D.Cl)((0,D.Cl)({},e),{attempts:0,timeout:0}))},e.prototype.markCoalesceNextFlush=function(){this.coalesceNextFlush=!0,this.schedule(0)},e.prototype.sendBeacon=function(e){var t,n,r=this,i=e.events,o=e.sessionId,s=e.deviceId,a=e.apiKey,l=e.serverZone,u=function(e){return new Blob([e]).size},c=i,d=JSON.stringify({version:2,events:c});if(u(d)>65536){for(var h=0,f=c.length;h<f;){var g=Math.floor((h+f+1)/2);65536>=u(JSON.stringify({version:2,events:c.slice(0,g)}))?h=g:f=g-1}d=JSON.stringify({version:2,events:c=c.slice(0,h)}),this.loggerProvider.warn("sendBeacon payload exceeded 64 KB limit, trimmed from ".concat(i.length," to ").concat(c.length," events"))}if(0!==c.length){if(this.handleSendEvents){var v=new URLSearchParams({device_id:s,session_id:String(o),type:"replay"}),p="".concat(sM(l,this.trackServerUrl),"?").concat(v.toString());this.loggerProvider.debug("Routing session replay exit batch (".concat(c.length," events) through custom transport for session id ").concat(o,"."));try{this.handleSendEvents({url:p,method:"POST",headers:{"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(a)},body:d,keepalive:!0}
1).catch(function(e){r.loggerProvider.warn("Custom transport failed to send session replay exit batch:",e)})}catch(e){this.loggerProvider.warn("Custom transport threw while sending session replay exit batch:",e)}return}var m=new URLSearchParams({device_id:s,session_id:String(o),type:"replay",api_key:a}),y="".concat(sM(l,this.trackServerUrl),"?").concat(m.toString()),b=(0,z.m)();try{var S=new Blob([d],{type:"application/json"}),w=null==(n=null==(t=null==b?void 0:b.navigator)?void 0:t.sendBeacon)?void 0:n.call(t,y,S);!1===w&&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 e.killedSessions.has(t.sessionId)?(e.completeRequest({context:t,err:sU}),!1):t.attempts<(t.flushMaxRetries||0)?(t.attempts+=1,!0):(e.completeRequest({context:t,err:sH}),!1)}).forEach(function(t){e.queue=e.queue.concat(t),e.schedule(0)})},e.prototype.schedule=function(e){var t=this;if(!this.scheduled){var n=this.flushPauseUntilMs-Date.now(),r=n>e?n:e;n>0&&(this.mergeOnNextFlush=!0),this.scheduled=setTimeout(function(){t.flush(!0).then(function(){t.queue.length>0&&t.schedule(e)})},r)}},e.prototype.flush=function(e){return void 0===e&&(e=!1),(0,D.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s;return(0,D.YH)(this,function(a){switch(a.label){case 0:t=this.queue,this.queue=[],this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),this.mergeOnNextFlush?(this.mergeOnNextFlush=!1,this.coalesceNextFlush=!1,t=this.mergeQueueAfterThrottle(t)):this.coalesceNextFlush&&(this.coalesceNextFlush=!1,t=this.mergeDrainBacklog(t)),a.label=1;case 1:a.trys.push([1,6,7,8]),r=(n=(0,D.Ju)(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.mergeQueueAfterThrottle=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&!this.mergeLogFiredThisPause&&(this.mergeLogFiredThisPause=!0,this.loggerProvider.log("Session replay throttle pause ended; merged ".concat(e.length," queued batches into ").concat(t.length," request(s)"))),t},e.prototype.mergeDrainBacklog=function(e){var t=this.coalesceByIdentity(e);return t.length<e.length&&this.loggerProvider.log("Session replay coalesced ".concat(e.length," persisted page-load backlog batches into ").concat(t.length," request(s)")),t},e.prototype.coalesceByIdentity=function(e){var t,n,r,i,o,s,a,l,u,c,d,h=this;if(e.length<=1)return e;var f=new Map;try{for(var g=(0,D.Ju)(e),v=g.next();!v.done;v=g.next()){var p=v.value,m=[p.sessionId,null!=(o=p.deviceId)?o:"",null!=(s=p.apiKey)?s:"",p.type,null!=(a=p.serverZone)?a:"",p.sampleRate,null!=(u=null==(l=p.version)?void 0:l.type)?u:"",null!=(d=null==(c=p.version)?void 0:c.version)?d:""].join("|"),y=f.get(m);y?y.push(p):f.set(m,[p])}}catch(e){t={error:e}}finally{try{v&&!v.done&&(n=g.return)&&n.call(g)}finally{if(t)throw t.error}}var b=[];try{for(var S=(0,D.Ju)(f.values()),w=S.next();!w.done;w=S.next()){var E=w.value;!function(e){if(1===e.length)return b.push(e[0]);var t,n,r=null,i=0,o=function(){r&&b.push(r),r=null,i=0};try{for(var s=(t=void 0,(0,D.Ju)(e)),a=s.next();!a.done;a=s.next()){var l=a.value;!function(e){var t=e.events.reduce(function(e,t){return e+new Blob([t]).size},0);if(null===r)return r=(0,D.Cl)((0,D.Cl)({},e),{events:(0,D.fX)([],(0,D.zs)(e.events),!1),attempts:0}),i=t;if(i+t>4e6)return o(),r=(0,D.Cl)((0,D.Cl)({},e),{events:(0,D.fX)([],(0,D.zs)(e.events),!1),attempts:0}),i=t;var n=r.onComplete,s=e.onComplete;r.events=r.events.concat(e.events),i+=t,r.onComplete=function(){return(0,D.sH)(h,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:return[4,Promise.allSettled([n(),s()])];case 1:return e.sent(),[2]}})})}}(l)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}o()}(E)}}catch(e){r={error:e}}finally{try{w&&!w.done&&(i=S.return)&&i.call(S)}finally{if(r)throw r.error}}return b},e.prototype.send=function(e,t){return void 0===t&&(t=!0),(0,D.sH)(this,void 0,void 0,function(){var n,r,i,o;return(0,D.YH)(this,function(s){return this.killedSessions.has(e.sessionId)?[2,this.completeRequest({context:e,err:sU})]:(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,D.sH)(this,void 0,void 0,function(){var i,o=this;return(0,D.YH)(this,function(s){return i="".concat(++this.sendIdCounter),[2,new Promise(function(s){var a,l=o.sendTimeoutMs>0?setTimeout(function(){var e=o.pendingWorkerRequests.get(i);
1e&&(o.pendingWorkerRequests.delete(i),o.rememberTimedOutRequest(i,e.context),o.loggerProvider.warn("Session replay worker send timed out after ".concat(o.sendTimeoutMs,"ms; leaving events for retry")),e.resolve())},o.sendTimeoutMs):void 0;o.pendingWorkerRequests.set(i,{context:t,resolve:s,timeout:l}),e.postMessage({type:"send",id:i,payload:n,useRetry:r,useCustomTransport:!!o.handleSendEvents,context:{apiKey:t.apiKey,deviceId:t.deviceId,sessionId:t.sessionId,events:t.events,eventType:t.type,flushMaxRetries:null!=(a=t.flushMaxRetries)?a:0,sampleRate:t.sampleRate,serverZone:t.serverZone,trackServerUrl:o.trackServerUrl,version:t.version,currentUrl:sr(),sdkVersion:sj,enableTransportCompression:o.enableTransportCompression,sendTimeoutMs:o.sendTimeoutMs}})})]})})},e.prototype.rememberTimedOutRequest=function(e,t){var n,r;if(this.timedOutWorkerRequests.set(e,t),this.timedOutWorkerRequests.size>256)try{for(var i=(0,D.Ju)(this.timedOutWorkerRequests.keys()),o=i.next();!o.done;o=i.next()){var s=o.value;this.timedOutWorkerRequests.delete(s);break}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}},e.prototype.handleDelegatedFetch=function(e,t){var n,r,i;return(0,D.sH)(this,void 0,void 0,function(){var o,s,a,l,u,c,d,h,f,g,v;return(0,D.YH)(this,function(p){switch(p.label){case 0:o=t.requestId,s=t.url,a=t.method,l=t.headers,u=t.body,c=t.keepalive,p.label=1;case 1:if(p.trys.push([1,10,,11]),d=void 0,!this.handleSendEvents)return[3,3];return[4,this.handleSendEvents({url:s,method:a,headers:l,body:u,keepalive:c})];case 2:return d=p.sent(),[3,5];case 3:return this.loggerProvider.warn("Delegated session replay fetch received without a custom transport configured; falling back to built-in fetch."),[4,fetch(s,{method:a,headers:l,body:u,keepalive:c})];case 4:d=p.sent(),p.label=5;case 5:if(h=d.status,f=null,g="",h>=200&&h<300&&(f=null!=(i=null==(r=null==(n=d.headers)?void 0:n.get)?void 0:r.call(n,o7))?i:null),413!==h)return[3,9];p.label=6;case 6:return p.trys.push([6,8,,9]),[4,d.text()];case 7:return g=p.sent(),[3,9];case 8:return p.sent(),[3,9];case 9:return this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") returned status ").concat(h,".")),e.postMessage({type:"fetch-response",requestId:o,status:h,skipHeader:f,body:g}),[3,11];case 10:return v=p.sent(),this.loggerProvider.debug("Delegated session replay fetch (request ".concat(o,") failed:"),v),e.postMessage({type:"fetch-response",requestId:o,status:0,skipHeader:null,body:String(v),error:!0}),[3,11];case 11:return[2]}})})},e.prototype.sendOnMainThread=function(e,t,n,r,i){var o,s,a,l,u,c,d;return(0,D.sH)(this,void 0,void 0,function(){var h,f,g,v,p,m,y,b,S,w,E,I,k,C,T,_,x,P,A,O,R,N;return(0,D.YH)(this,function(M){switch(M.label){case 0:h=sr(),f=sj,g=n.sampleRate,v=new URLSearchParams({device_id:t,session_id:"".concat(n.sessionId),type:"".concat(n.type)}),p="".concat(null!=(s=null==(o=n.version)?void 0:o.type)?s:"standalone","/").concat(null!=(l=null==(a=n.version)?void 0:a.version)?l:f),M.label=1;case 1:if(M.trys.push([1,19,,23]),m=JSON.stringify(r),y=(0,z.m)(),!(this.enableTransportCompression&&y&&"CompressionStream"in y))return[3,3];return[4,function(e,t){return(0,D.sH)(this,void 0,void 0,function(){var n,r,i,o,s,a,l,u,c,d,h,f,g=this;return(0,D.YH)(this,function(v){switch(v.label){case 0:return v.trys.push([0,4,,5]),r=(n=new t.CompressionStream("gzip")).writable.getWriter(),i=n.readable.getReader(),o=[],s=(0,D.sH)(g,void 0,void 0,function(){var e,t,n;return(0,D.YH)(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 v.sent(),[4,r.close()];case 2:return v.sent(),[4,s];case 3:v.sent(),a=new Uint8Array(o.reduce(function(e,t){return e+t.length},0)),l=0;try{for(c=(u=(0,D.Ju)(o)).next();!c.done;c=u.next())d=c.value,a.set(d,l),l+=d.length}catch(e){h={error:e}}finally{try{c&&!c.done&&(f=u.return)&&f.call(u)}finally{if(h)throw h.error}}return[2,a];case 4:return v.sent(),[2,null];case 5:return[2]}})})}(m,y)];case 2:return S=M.sent(),[3,4];case 3:S=null,M.label=4;case 4:if(w=(b=S)?b.byteLength:new Blob([m]).size,E=new AbortController,T={headers:I=(0,D.Cl)({"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(e),"X-Client-Version":f,"X-Client-Library":p,"X-Client-Url":h.substring(0,1e3),"X-Client-Sample-Rate":"".concat(g),"X-Sampling-Hash-Alg":"xxhash32"},b?{"Content-Encoding":"gzip"}:{}),body:k=null!=b?b:m,method:"POST",keepalive:C=w<=65536,signal:E.signal},_="".concat(sM(n.serverZone,this.trackServerUrl),"?").concat(v.toString()),0===r.events.length)return this.completeRequest({context:n}),[2];x=this.sendTimeoutMs>0?setTimeout(function(){E.abort()},this.sendTimeoutMs):void 0,P=void 0,M.label=5;case 5:var L,H;if(M.trys.push([5,,10,11]),!this.handleSendEvents)return[3,7];return[4,(L=this.handleSendEvents({url:_,method:"POST",headers:I,body:k,keepalive:C}),H=E.signal,new Promise(function(e,t){var n=function(){var e=Error("Custom session replay transport aborted by send timeout");e.name="AbortError",t(e)};H.addEventListener("abort",n,{once:!0}),L.then(function(t){H.removeEventListener("abort",n),e(t)},function(e){H.removeEventListener("abort",n),t(e)})}))];case 6:return A=M.sent(),[3,9];case 7:return[4,fetch(_,T)];case 8:A=M.sent(),M.label=9;case 9:return P=A,[3,11];case 10:return x&&clearTimeout(x),[7];case 11:if(null===P)return this.completeRequest({context:n,err:"Unexpected error occurred"}),[2];if(P.status>=200&&P.status<300&&(O=null!=(d=null==(c=null==(u=P.headers)?void 0:u.get)?void 0:c.call(u,o7))?d:null,this.applyServerDirective(n.sessionId,O)),i)return[3,12];R="";try{R=JSON.stringify(P.body,null,2)}catch(e){}return this.completeRequest({context:n,success:"".concat(P.status,": ").concat(R)}),[3,18];
1case 12:if(R="",413!==P.status)return[3,16];M.label=13;case 13:return M.trys.push([13,15,,16]),[4,P.text()];case 14:return R=M.sent(),[3,16];case 15:return M.sent(),[3,16];case 16:return[4,this.handleReponse(P.status,n,R)];case 17:M.sent(),M.label=18;case 18:return[3,23];case 19:if(!((N=M.sent())&&"object"==typeof N&&"AbortError"===N.name&&i))return[3,21];return[4,this.handleOtherResponse(n)];case 20:return M.sent(),[3,22];case 21:this.completeRequest({context:n,err:N}),M.label=22;case 22:return[3,23];case 23:return[2]}})})},e.prototype.handleReponse=function(e,t,n){return void 0===n&&(n=""),(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(r){switch(r.label){case 0:switch(new tU().buildStatus(e)){case a.Success:return[3,1];case a.Failed:case a.Timeout:case a.RateLimit:return[3,2];case a.PayloadTooLarge:return[3,4]}return[3,5];case 1:return this.handleSuccessResponse(t),[3,8];case 2:return[4,this.handleOtherResponse(t)];case 3:case 6:return r.sent(),[3,8];case 4:return this.handlePayloadTooLargeResponse(t,o8.test(n)),[3,8];case 5:if(499!==e)return[3,7];return[4,this.handleOtherResponse(t)];case 7:this.completeRequest({context:t,err:"Network error occurred, event batch rejected"}),r.label=8;case 8:return[2]}})})},e.prototype.handlePayloadTooLargeResponse=function(e,t){var n=t?"WAF (compressed payload too large)":"server (event too large)",r=Math.round(e.events.reduce(function(e,t){return e+t.length},0)/1024);if(!t)return void this.completeRequest({context:e,err:"Session replay event batch dropped: ".concat(n," rejected payload (").concat(e.events.length," events, ").concat(r," KB) — not retrying non-WAF 413")});if(1===e.events.length)return void this.completeRequest({context:e,err:"Session replay event dropped: single event (".concat(r," KB, 1 event) rejected by ").concat(n," — cannot split further")});this.loggerProvider.warn("Session replay event batch rejected by ".concat(n," (").concat(e.events.length," events, ").concat(r," KB total) — splitting and retrying")),e.onComplete();var i=function(){return Promise.resolve()},o=Math.floor(e.events.length/2);this.sendEventsList((0,D.Cl)((0,D.Cl)({},e),{events:e.events.slice(0,o),onComplete:i})),this.sendEventsList((0,D.Cl)((0,D.Cl)({},e),{events:e.events.slice(o),onComplete:i}))},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,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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:sH}),[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.prototype.applyServerDirective=function(e,t){if(null===t){this.flushPauseUntilMs=0,this.mergeLogFiredThisPause=!1;return}if("429"===t){var n=this.flushPauseUntilMs>Date.now();this.flushPauseUntilMs=Date.now()+6e4,n||this.loggerProvider.log("Session replay throttled by server; pausing flush schedule for ".concat(60,"s"));return}("4005"===t||"4004"===t)&&this.killSession(e,t)},e.prototype.killSession=function(e,t){if(!this.killedSessions.has(e)){if(this.killedSessions.add(e),this.killedSessions.size>256)try{for(var n,r,i,o,s=(0,D.Ju)(this.killedSessions),a=s.next();!a.done;a=s.next()){var l=a.value;this.killedSessions.delete(l);break}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}this.loggerProvider.log("Session replay capture stopped for session ".concat(e," by server directive ").concat(t,"; remaining events will be dropped"));var u=[];try{for(var c=(0,D.Ju)(this.queue),d=c.next();!d.done;d=c.next()){var h=d.value;h.sessionId===e?this.completeRequest({context:h,err:sU}):u.push(h)}}catch(e){i={error:e}}
1finally{try{d&&!d.done&&(o=c.return)&&o.call(c)}finally{if(i)throw i.error}}this.queue=u}},e}();let sz=(e,t)=>t.some(t=>e instanceof t),sB=new WeakMap,sY=new WeakMap,sV=new WeakMap,sW={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return sB.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return sJ(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function sJ(e){if(e instanceof IDBRequest){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",o)},i=()=>{t(sJ(e.result)),r()},o=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",o)});return sV.set(t,e),t}if(sY.has(e))return sY.get(e);let t=function(e){if("function"==typeof e)return(o||(o=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(sK(this),t),sJ(this.request)}:function(...t){return sJ(e.apply(sK(this),t))};return(e instanceof IDBTransaction&&function(e){if(sB.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)});sB.set(e,t)}(e),sz(e,i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])))?new Proxy(e,sW):e}(e);return t!==e&&(sY.set(e,t),sV.set(t,e)),t}let sK=e=>sV.get(e);function s$(e,t,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){let s=indexedDB.open(e,t),a=sJ(s);return r&&s.addEventListener("upgradeneeded",e=>{r(sJ(s.result),e.oldVersion,e.newVersion,sJ(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 sG=["get","getKey","getAll","getAllKeys","count"],sX=["put","add","delete","clear"],sQ=new Map;function sZ(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(sQ.get(t))return sQ.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=sX.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||sG.includes(n)))return;let o=async function(e,...t){let o=this.transaction(e,i?"readwrite":"readonly"),s=o.store;return r&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),i&&o.done]))[0]};return sQ.set(t,o),o}sW=(e=>({...e,get:(t,n,r)=>sZ(t,n)||e.get(t,n,r),has:(t,n)=>!!sZ(t,n)||e.has(t,n)}))(sW);let s0=["continue","continuePrimaryKey","advance"],s1={},s2=new WeakMap,s3=new WeakMap,s4={get(e,t){if(!s0.includes(t))return e[t];let n=s1[t];return n||(n=s1[t]=function(...e){s2.set(this,s3.get(this)[t](...e))}),n}};async function*s6(...e){let t=this;if(t instanceof IDBCursor||(t=await t.openCursor(...e)),!t)return;let n=new Proxy(t,s4);for(s3.set(n,t),sV.set(n,sK(t));t;)yield n,t=await (s2.get(n)||t.continue()),s2.delete(n)}function s5(e,t){return t===Symbol.asyncIterator&&sz(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&sz(e,[IDBIndex,IDBObjectStore])}sW=(e=>({...e,get:(t,n,r)=>s5(t,n)?s6:e.get(t,n,r),has:(t,n)=>s5(t,n)||e.has(t,n)}))(sW);var s8=function(){function e(e){var t,n,r,i=this;this.minInterval=500,this.maxInterval=1e4,this.maxPersistedEventsSize=6e6,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)?t:this.minInterval,this.maxInterval=null!=(n=e.maxInterval)?n:this.maxInterval,this.maxPersistedEventsSize=null!=(r=e.maxPersistedEventsSize)?r:this.maxPersistedEventsSize,this.interval=this.minInterval}return Object.defineProperty(e.prototype,"timeAtLastSplit",{get:function(){return this._timeAtLastSplit}
1,enumerable:!1,configurable:!0}),e.prototype.getStringSize=function(e){for(var t=0,n=0;n<e.length;n++){var r=e.charCodeAt(n);if(r<=127)t++;else if(r<=2047)t+=2;else if(r>=55296&&r<=56319){var i=n+1<e.length?e.charCodeAt(n+1):NaN;i>=56320&&i<=57343?(t+=4,n++):t+=3}else t+=3}return t},e.prototype.getEventsArraySize=function(e){var t,n,r=0;try{for(var i=(0,D.Ju)(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}(),s7=function(e,t,n){"object"==typeof n&&null!==n&&"AbortError"===n.name?e.debug(t):e.warn(t)},s9="sessionCurrentSequence",ae="sequencesToSend";function at(e,t,n){var r=setTimeout(n,t);return e.then(function(){return clearTimeout(r)},function(){return clearTimeout(r)}),function(){return clearTimeout(r)}}var an=function(e){var t,n;return e.objectStoreNames.contains(s9)||(n=e.createObjectStore(s9,{keyPath:"sessionId"})),e.objectStoreNames.contains(ae)||(t=e.createObjectStore(ae,{keyPath:"sequenceId",autoIncrement:!0})).createIndex("sessionId","sessionId"),{sequencesStore:t,currentSequenceStore:n}},ar=function(e){function t(t){var n,r=this;return(r=e.call(this,t)||this).consecutiveFailures=0,r.hasTriggeredFallback=!1,r.emptyFilteredCount=0,r.getSequencesToSend=function(){return(0,D.sH)(r,void 0,void 0,function(){var e,t,n,r,i,o,s,a,l,u,c=this;return(0,D.YH)(this,function(d){switch(d.label){case 0:e=!1,t=!1,d.label=1;case 1:return d.trys.push([1,9,,10]),n=[],(r=this.db.transaction("sequencesToSend","readwrite")).done.catch(function(n){e||t||(s7(c.loggerProvider,"".concat(sF,": ").concat(n),n),c.recordFailure())}),i=at(r.done,5e3,function(){e||t||(t=!0,s7(c.loggerProvider,"".concat(sF,": transaction timed out")),c.recordFailure())}),[4,r.store.openCursor()];case 2:o=d.sent(),d.label=3;case 3:if(!o)return[3,8];if(a=(s=o.value).sessionId,0!==(l=s.events).length)return[3,5];return this.maybeLogEmptyFiltered("getSequencesToSend"),[4,o.delete()];case 4:return d.sent(),[3,6];case 5:n.push({events:l,sequenceId:o.key,sessionId:a}),d.label=6;case 6:return[4,o.continue()];case 7:return o=d.sent(),[3,3];case 8:return this.recordSuccess(),i(),[2,n];case 9:return u=d.sent(),t||(e=!0,s7(this.loggerProvider,"".concat(sF,": ").concat(u),u),this.recordFailure()),[3,10];case 10:return[2,void 0]}})})},r.storeCurrentSequence=function(e){return(0,D.sH)(r,void 0,void 0,function(){var t,n,r,i,o,s,a,l,u=this;return(0,D.YH)(this,function(c){switch(c.label){case 0:t=!1,n=!1,c.label=1;case 1:return c.trys.push([1,5,,6]),(r=this.db.transaction([s9,ae],"readwrite")).done.catch(function(e){t||n||(s7(u.loggerProvider,"".concat(sF,": ").concat(e),e),u.recordFailure())}),i=at(r.done,5e3,function(){t||n||(n=!0,s7(u.loggerProvider,"".concat(sF,": transaction timed out")),u.recordFailure())}),[4,r.objectStore(s9).get(e)];case 2:if(!(o=c.sent())||o.tabId&&o.tabId!==this.tabId)return i(),[2,void 0];if(0===o.events.length)return this.maybeLogEmptyFiltered("storeCurrentSequence"),i(),[2,void 0];return[4,r.objectStore(ae).put({sessionId:e,events:o.events,tabId:this.tabId})];case 3:return s=c.sent(),[4,r.objectStore(s9).put({sessionId:e,events:[],tabId:this.tabId})];case 4:return c.sent(),this.recordSuccess(),i(),o.tabId,a=(0,D.Tt)(o,["tabId"]),[2,(0,D.Cl)((0,D.Cl)({},a),{sessionId:e,sequenceId:s})];case 5:return l=c.sent(),n||(t=!0,s7(this.loggerProvider,"".concat(sF,": ").concat(l),l),this.recordFailure()),[3,6];case 6:return[2,void 0]}})})},r.addEventToCurrentSequence=function(e,t){return(0,D.sH)(r,void 0,void 0,function(){var n,r,i,o,s,a,l,u,c,d=this;return(0,D.YH)(this,function(h){switch(h.label){case 0:n=!1,r=!1,h.label=1;case 1:return h.trys.push([1,15,,16]),(i=this.db.transaction([s9,ae],"readwrite")).done.catch(function(e){n||r||(s7(d.loggerProvider,"".concat(sF,": ").concat(e),e),d.recordFailure())}),o=at(i.done,5e3,function(){n||r||(r=!0,s7(d.loggerProvider,"".concat(sF,": transaction timed out")),d.recordFailure())}),[4,i.objectStore(s9).get(e)];case 2:if(!((null==(s=h.sent())?void 0:s.tabId)&&s.tabId!==this.tabId))return[3,6];if(!(s.events.length>0))return[3,4];return[4,i.objectStore(ae).put({sessionId:e,events:s.events,tabId:s.tabId})];case 3:h.sent(),h.label=4;case 4:case 12:return[4,i.objectStore(s9).put({sessionId:e,events:[t],tabId:this.tabId})];case 5:case 7:case 9:case 11:return h.sent(),this.recordSuccess(),o(),[2,void 0];case 6:if(a=s)return[3,8];return[4,i.objectStore(s9).put({sessionId:e,events:[t],tabId:this.tabId})];case 8:if(this.shouldSplitEventsList(a.events,t))return[3,10];return[4,i.objectStore(s9).put({sessionId:e,events:a.events.concat(t),tabId:this.tabId})];case 10:if(0!==(l=a.events).length)return[3,12];return this.maybeLogEmptyFiltered("addEventToCurrentSequence"),[4,i.objectStore(s9).put({sessionId:e,events:[t],tabId:this.tabId})];case 13:return h.sent(),[4,i.objectStore(ae).put({sessionId:e,events:l,tabId:this.tabId})];case 14:return u=h.sent(),this.recordSuccess(),o(),[2,{events:l,sessionId:e,sequenceId:u}];case 15:return c=h.sent(),r||(n=!0,s7(this.loggerProvider,"".concat(sF,": ").concat(c),c),this.recordFailure()),[3,16];case 16:return[2,void 0]}})})},r.storeSendingEvents=function(e,t){return(0,D.sH)(r,void 0,void 0,function(){var n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.db.put(ae,{sessionId:e,events:t,tabId:this.tabId})];case 1:return n=i.sent(),this.recordSuccess(),[2,n];case 2:return r=i.sent(),s7(this.loggerProvider,"".concat(sF,": ").concat(r),r),this.recordFailure(),[3,3];case 3:return[2,void 0]}})})},r.cleanUpSessionEventsStore=function(e,t){return(0,D.sH)(r,void 0,void 0,function(){var e;return(0,D.YH)(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(ae,t)];case 2:return n.sent(),this.recordSuccess(),[3,4];case 3:return e=n.sent(),s7(this.loggerProvider,"".concat(sF,": ").concat(e),e),this.recordFailure(),[3,4];case 4:return[2]}})})},r.db=t.db,r.tabId=t.tabId,r.onPersistentFailure=t.onPersistentFailure,r.consecutiveFailureThreshold=null!=(n=t.consecutiveFailureThreshold)?n:1,r}return(0,D.C6)(t,e),t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (idb store)"))},t.prototype.recordFailure=function(){var e;this.consecutiveFailures++,!this.hasTriggeredFallback&&this.consecutiveFailures>=this.consecutiveFailureThreshold&&(this.hasTriggeredFallback=!0,null==(e=this.onPersistentFailure)||e.call(this))},t.prototype.recordSuccess=function(){this.consecutiveFailures=0},t.new=function(e,n){var r;return(0,D.sH)(this,void 0,void 0,function(){var i,o,s,a;return(0,D.YH)(this,function(l){switch(l.label){case 0:var u;return l.trys.push([0,2,,3]),i="replay"===e?"":"_".concat(e),[4,(u="".concat(n.apiKey.substring(0,10),"_amp_session_replay_events").concat(i),(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:var t;return[4,(t=s$(u,1,{upgrade:an}),new Promise(function(e,n){var r=setTimeout(function(){return n(Error("".concat("IDB openDB timed out"," after ").concat(2e3,"ms")))},2e3);t.then(function(t){clearTimeout(r),e(t)},function(e){clearTimeout(r),n(e)})}))];case 1:return[2,e.sent()]}})}))];case 1:return o=l.sent(),s=null!=(r=n.tabId)?r:function(){try{return crypto.randomUUID()}catch(e){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}}(),[2,new t((0,D.Cl)((0,D.Cl)({},n),{db:o,tabId:s}
1))];case 2:return a=l.sent(),s7(n.loggerProvider,"".concat(sF,": ").concat(a),a),[3,3];case 3:return[2]}})})},t.prototype.getCurrentSequenceEvents=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t,n,r,i,o,s,a;return(0,D.YH)(this,function(l){switch(l.label){case 0:if(!e)return[3,2];return[4,this.db.get("sessionCurrentSequence",e)];case 1:if(!(t=l.sent())||t.tabId&&t.tabId!==this.tabId)return[2,void 0];return t.tabId,[2,[n=(0,D.Tt)(t,["tabId"])]];case 2:r=[],l.label=3;case 3:return l.trys.push([3,8,9,10]),[4,this.db.getAll("sessionCurrentSequence")];case 4:o=(i=D.Ju.apply(void 0,[l.sent()])).next(),l.label=5;case 5:if(o.done)return[3,7];if((t=o.value).tabId&&t.tabId!==this.tabId)return[3,6];t.tabId,n=(0,D.Tt)(t,["tabId"]),r.push(n),l.label=6;case 6:return o=i.next(),[3,5];case 7:return[3,10];case 8:return s={error:l.sent()},[3,10];case 9:try{o&&!o.done&&(a=i.return)&&a.call(i)}finally{if(s)throw s.error}return[7];case 10:return[2,r]}})})},t}(s8),ai=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.finalizedSequences={},t.sequences={},t.sequenceId=0,t.emptyFilteredCount=0,t}return(0,D.C6)(t,e),t.prototype.resetCurrentSequence=function(e){this.sequences[e]=[]},t.prototype.addSequence=function(e){var t=this.sequenceId++,n=(0,D.fX)([],(0,D.zs)(this.sequences[e]),!1);return this.finalizedSequences[t]={sessionId:e,events:n},this.resetCurrentSequence(e),{sequenceId:t,events:n,sessionId:e}},t.prototype.maybeLogEmptyFiltered=function(e){this.emptyFilteredCount++%100==0&&this.loggerProvider.debug("Filtered empty session replay sequence at ".concat(e," (in-memory store)"))},t.prototype.getSequencesToSend=function(){return(0,D.sH)(this,void 0,void 0,function(){var e,t,n,r,i,o,s,a,l,u;return(0,D.YH)(this,function(c){e=[];try{for(n=(t=(0,D.Ju)(Object.entries(this.finalizedSequences))).next();!n.done;n=t.next()){if(i=(r=(0,D.zs)(n.value,2))[0],s=(o=r[1]).sessionId,a=o.events,0===a.length){this.maybeLogEmptyFiltered("getSequencesToSend"),delete this.finalizedSequences[Number(i)];continue}e.push({sequenceId:Number(i),sessionId:s,events:a})}}catch(e){l={error:e}}finally{try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(l)throw l.error}}return[2,e]})})},t.prototype.storeCurrentSequence=function(e){return(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(this,function(n){return(t=this.sequences[e])?0===t.length?(this.maybeLogEmptyFiltered("storeCurrentSequence"),[2,void 0]):[2,this.addSequence(e)]:[2,void 0]})})},t.prototype.addEventToCurrentSequence=function(e,t){return(0,D.sH)(this,void 0,void 0,function(){var n;return(0,D.YH)(this,function(r){return this.sequences[e]||this.resetCurrentSequence(e),this.shouldSplitEventsList(this.sequences[e],t)&&(0===this.sequences[e].length?this.maybeLogEmptyFiltered("addEventToCurrentSequence"):n=this.addSequence(e)),this.sequences[e].push(t),[2,n]})})},t.prototype.storeSendingEvents=function(e,t){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return this.finalizedSequences[this.sequenceId]={sessionId:e,events:t},[2,this.sequenceId++]})})},t.prototype.cleanUpSessionEventsStore=function(e,t){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){return void 0!==t&&delete this.finalizedSequences[t],[2]})})},t}(s8),ao=function(e){var t=e.config,n=e.minInterval,r=e.maxInterval,i=e.maxPersistedEventsSize,o=e.type,s=e.payloadBatcher,a=e.storeType,l=e.trackDestinationWorkerScript,u=e.shouldSend;return(0,D.sH)(void 0,void 0,void 0,function(){var e,c,d,h,f,g,v,p,m,y,b,S;function w(e){return void 0===e&&(e=!1),(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(t){return[2,c.flush(e)]})})}return(0,D.YH)(this,function(E){switch(E.label){case 0:if(e=null!=(S=t.maxSingleEventSizeBytes)?S:9e6,c=new sq((0,D.Cl)((0,D.Cl)({},t),{loggerProvider:t.loggerProvider,payloadBatcher:s,workerScript:l})),d=function(){return new ai({loggerProvider:t.loggerProvider,maxInterval:r,minInterval:n,maxPersistedEventsSize:i})},f=!1,"idb"!==a)return[3,2];return[4,(0,D.sH)(void 0,void 0,void 0,function(){var e;return(0,D.YH)(this,function(s){switch(s.label){case 0:return[4,ar.new(o,{loggerProvider:t.loggerProvider,minInterval:n,maxInterval:r,maxPersistedEventsSize:i,apiKey:t.apiKey,onPersistentFailure:function(){(0,D.sH)(void 0,void 0,void 0,function(){var e,n,r;return(0,D.YH)(this,function(i){switch(i.label){case 0:if(!f)return[2];if(f=!1,t.loggerProvider.warn("IDB store is experiencing repeated failures; falling back to in-memory event store."),!h)return[3,2];return[4,g.getSequencesToSend()];case 1:return n=i.sent(),[3,3];case 2:n=void 0,i.label=3;case 3:return e=n,g=d(),e&&h&&(r=h,e.forEach(function(e){b({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:r})})),[2]}})})}})];case 1:if(!(e=s.sent()))return t.loggerProvider.log("Failed to initialize idb store, falling back to memory store."),[2,d()];return f=!0,[2,e]}})})];case 1:return v=E.sent(),[3,3];case 2:v=d(),E.label=3;case 3:return g=v,p=[],m=0,y=function(e){if(!(e<=m)){var t=Math.min(e-m,p.length);t>0&&(p.splice(0,t),m=e)}},b=function(n){var r=n.events,i=n.sessionId,s=n.deviceId,a=n.sequenceId,l=r.map(function(e){return{event:e,bytes:new Blob([e]).size}}
1),u=l.filter(function(t){return t.bytes>e});u.length>0&&t.loggerProvider.warn("Dropping ".concat(u.length," oversized event(s) from session replay sequence before send. Sizes: ").concat(u.map(function(e){return"".concat(Math.round(e.bytes/1024)," KB")}).join(", "),". If this recurs, please open a GitHub issue at https://github.com/amplitude/Amplitude-TypeScript/issues or contact Amplitude support."));var d=u.length>0?l.filter(function(t){return t.bytes<=e}).map(function(e){return e.event}):r;if(0===d.length)return void g.cleanUpSessionEventsStore(i,a).catch(function(e){t.loggerProvider.warn("Failed to clean up session replay events store:",e)});t.debugMode&&ss().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(){}),c.sendEventsList({events:d,sessionId:i,flushMaxRetries:t.flushMaxRetries,apiKey:t.apiKey,deviceId:s,sampleRate:t.sampleRate,serverZone:t.serverZone,version:t.version,type:o,onComplete:function(){return(0,D.sH)(void 0,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:return[4,g.cleanUpSessionEventsStore(i,a)];case 1:return e.sent(),[2]}})})}})},[2,{sendCurrentSequenceEvents:function(e){var n=e.sessionId,r=e.deviceId;if(h=r,!u||u()){var i=m+p.length;g.storeCurrentSequence(n).then(function(e){e&&(y(i),b({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;h=i;var o=!u||u(),s=m+p.length;p.push(n.data),g.addEventToCurrentSequence(r,n.data).then(function(e){if(e){if(!o){g.cleanUpSessionEventsStore(e.sessionId,e.sequenceId).catch(function(e){t.loggerProvider.warn("Failed to clean up dropped session replay sequence:",e)}),y(s);return}y(s),b({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 n=e.deviceId;return(0,D.sH)(void 0,void 0,void 0,function(){var e;return(0,D.YH)(this,function(r){switch(r.label){case 0:return h=n,[4,g.getSequencesToSend()];case 1:if(!(null==(e=r.sent())?void 0:e.length))return[2];return t.loggerProvider.log("Draining ".concat(e.length," stored sequence(s) from previous session.")),e.length>1&&c.markCoalesceNextFlush(),e.forEach(function(e){b({sequenceId:e.sequenceId,events:e.events,sessionId:e.sessionId,deviceId:n})}),[2]}})})},flush:w,getBeaconEvents:function(){return(0,D.fX)([],(0,D.zs)(p),!1)},dropPendingBeaconEvents:function(){y(m+p.length)},trackDestination:c}]}})})},as=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,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(this,function(n){switch(n.label){case 0:return t=[],this.managers.forEach(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))||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,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(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 aa(e,t,n){for(var r=null,i=[],o=e,s=0;o&&"break"!==function(){var e,a,l,u,c=new Date().getTime()-_.getTime();if(void 0!==C.timeoutMs&&c>C.timeoutMs)throw Error("Timeout: Can't find a unique selector after ".concat(c,"ms"));var d=av((e=o.getAttribute("id"))&&C.idName(e)?{name:"#"+CSS.escape(e),penalty:0}:null)||av.apply(void 0,(0,D.fX)([],(0,D.zs)(Array.from(o.attributes).filter(function(e){return C.attr(e.name,e.value)}).map(function(e){return{name:"[".concat(CSS.escape(e.name),'="').concat(CSS.escape(e.value),'"]'),penalty:.5}})),!1))||av.apply(void 0,(0,D.fX)([],(0,D.zs)(Array.from(o.classList).filter(C.className).map(function(e){return{name:"."+CSS.escape(e),penalty:1}})),!1))||av((a=o.tagName.toLowerCase(),C.tagName(a)?{name:a,penalty:2}:null))||[ah()],h=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)h&&(d=d.concat(d.filter(ag).map(function(e){return af(e,h)})));else if("two"==t)d=d.slice(0,1),h&&(d=d.concat(d.filter(ag).map(function(e){return af(e,h)})));else if("one"==t){var f=(0,D.zs)(d=d.slice(0,1),1)[0];h&&ag(f)&&(d=[af(f,h)])}else"none"==t&&(d=[ah()],h&&(d=[af(d[0],h)]));try{for(var g=(l=void 0,(0,D.Ju)(d)),v=g.next();!v.done;v=g.next()){var f=v.value;f.level=s}}catch(e){l={error:e}}finally{try{v&&!v.done&&(u=g.return)&&u.call(g)}finally{if(l)throw l.error}}if(i.push(d),i.length>=C.seedMinLength&&(r=al(i,n)))return"break";o=o.parentElement,s++}(););return(r||(r=al(i,n)),!r&&n)?n():r}function al(e,t){var n,r,i=am(function e(t,n){var r,i,o,s,a;return void 0===n&&(n=[]),(0,D.YH)(this,function(l){switch(l.label){case 0:if(!(t.length>0))return[3,9];l.label=1;case 1:l.trys.push([1,6,7,8]),i=(r=(0,D.Ju)(t[0])).next(),l.label=2;case 2:if(i.done)return[3,5];return o=i.value,[5,(0,D.Ju)(e(t.slice(1,t.length),n.concat(o)))];case 3:l.sent(),l.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s={error:l.sent()},[3,8];case 7:try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(s)throw s.error}
1return[7];case 8:return[3,11];case 9:return[4,n];case 10:l.sent(),l.label=11;case 11:return[2]}})}(e));if(i.length>C.threshold)return t?t():null;try{for(var o=(0,D.Ju)(i),s=o.next();!s.done;s=o.next()){var a=s.value;if(ad(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 au(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 ac(e){return e.map(function(e){return e.penalty}).reduce(function(e,t){return e+t},0)}function ad(e){var t=au(e);switch(T.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 ah(){return{name:"*",penalty:3}}function af(e,t){return{name:e.name+":nth-child(".concat(t,")"),penalty:e.penalty+1}}function ag(e){return"html"!==e.name&&!e.name.startsWith("#")}function av(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=e.filter(ap);return n.length>0?n:null}function ap(e){return null!=e}function am(e){return(0,D.fX)([],(0,D.zs)(e),!1).sort(function(e,t){return ac(e)-ac(t)})}var ay=function(e){var t=e.version,n=e.events,r=[];return n.forEach(function(e){var t=JSON.parse(e);t.count=1,"click"===t.type&&r.push(t)}),{version:t,events:r}},ab=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,D.Cl)((0,D.Cl)({},t),{timestamp:s,count:1}),e},{}))}},aS=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!==sk.Click)return;var l,u=(0,z.m)();if(u){var c=u.location,d=u.innerHeight,h=u.innerWidth;if(c){var f=e.x,g=e.y;if(void 0!==f&&void 0!==g){var v=o.getNode(e.id);if(v)try{l=function(e,t){if(_=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,i={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};n=(C=(0,D.Cl)((0,D.Cl)({},i),t)).root,r=i,T=n.nodeType===Node.DOCUMENT_NODE?n:n===r.root?n.ownerDocument:n;var o=aa(e,"all",function(){return aa(e,"two",function(){return aa(e,"one",function(){return aa(e,"none")})})});if(o){var s=am(function e(t,n,r){var i,o,s;return void 0===r&&(r={counter:0,visited:new Map}),(0,D.YH)(this,function(a){switch(a.label){case 0:if(!(t.length>2&&t.length>C.optimizedMinLength))return[3,5];i=1,a.label=1;case 1:var l,u;if(!(i<t.length-1))return[3,5];if(r.counter>C.maxNumberOfTries||(r.counter+=1,(o=(0,D.fX)([],(0,D.zs)(t),!1)).splice(i,1),s=au(o),r.visited.has(s)))return[2];if(!(ad(o)&&(l=o,u=n,T.querySelector(au(l))===u)))return[3,4];return[4,o];case 2:return a.sent(),r.visited.set(s,!0),[5,(0,D.Ju)(e(o,n,r))];case 3:a.sent(),a.label=4;case 4:return i++,[3,1];case 5:return[2]}})}(o,e));return s.length>0&&(o=s[0]),au(o)}throw Error("Selector was not found.")}(v,a)}catch(e){n.logger.debug("error resolving selector from finder")}var p=so(c.href,s),m={x:f+n.scrollWatcher.currentScrollX,y:g+n.scrollWatcher.currentScrollY,selector:l,viewportHeight:d,viewportWidth:h,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 aw(){var e=(0,z.m)();return(null==e?void 0:e.innerHeight)||document.documentElement&&document.documentElement.clientHeight||0}function aE(){var e=(0,z.m)();return(null==e?void 0:e.innerWidth)||document.documentElement&&document.documentElement.clientWidth||0}var aI=function(){function e(e,t){var n=(0,z.m)();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=sM(t.serverZone,t.trackServerUrl),this.apiKey=t.apiKey,this.context=e,this.handleSendEvents=t.handleSendEvents,this.loggerProvider=t.loggerProvider}return e.prototype.send=function(e,t){var n,r=this,i=this.context,o=i.sessionId,s=i.type;if(this.handleSendEvents){var a=new URLSearchParams({device_id:e,session_id:String(o),type:String(s)}),l="".concat(this.basePageUrl,"?").concat(a.toString()),u={"Content-Type":"application/json",Accept:"*/*",Authorization:"Bearer ".concat(this.apiKey)};try{this.handleSendEvents({url:l,method:"POST",headers:u,body:JSON.stringify(t),keepalive:!0}
1).catch(function(e){var t;null==(t=r.loggerProvider)||t.warn("Custom transport failed to send session replay interaction beacon:",e)})}catch(e){null==(n=this.loggerProvider)||n.warn("Custom transport threw while sending session replay interaction beacon:",e)}return}var c=new URLSearchParams({device_id:e,session_id:String(o),type:String(s),api_key:this.apiKey}),d="".concat(this.basePageUrl,"?").concat(c.toString());this.sendBeacon(d,t)||this.sendXhr(d,t)},e}(),ak=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(),l=(0,z.m)();if(l&&a){var u=null!=(r=l.scrollX)?r:0,c=null!=(i=l.scrollY)?i:0;(u>0||c>0)&&n.update({id:1,x:u,y:c}),n.transport.send(a,{version:1,events:[{maxScrollX:n._maxScrollX,maxScrollY:n._maxScrollY,maxScrollWidth:n._maxScrollWidth,maxScrollHeight:n._maxScrollHeight,viewportHeight:aw(),viewportWidth:aE(),pageUrl:so(l.location.href,null!=(s=null==(o=n.config.interactionConfig)?void 0:o.ugcFilterRules)?s:[]),timestamp:n.timestamp,type:"scroll"}]})}}},this._maxScrollX=0,this._maxScrollY=0,this._currentScrollX=0,this._currentScrollY=0,this._maxScrollWidth=aE(),this._maxScrollHeight=aw(),this.config=t,this.transport=e}return e.default=function(t,n){return new e(new aI(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=aE();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=aw();this._maxScrollY=e.y;var o=e.y+i;o>this._maxScrollHeight&&(this._maxScrollHeight=o),this.timestamp=t}},e}(),aC=function(e){var t=e.sessionId,n=e.deviceId;this.deviceId=n,this.sessionId=t,t&&n&&(this.sessionReplayId="".concat(n,"/").concat(t))},aT=function(e){return"".concat("AMP_SR_START_").concat(e.substring(0,10),"_")},a_=function(e,t){return"".concat(aT(e)).concat(t)},ax=function(){try{var e=(0,z.m)();return null==e?void 0:e.localStorage}catch(e){return}},aP=function(e,t,n,r){var i=ax();if(i){var o=a_(e,t);try{var s=i.getItem(o);if(null!==s){var a=Number(s);if(Number.isFinite(a)&&a>0&&a<=n&&n-a<864e5)return a}return i.setItem(o,String(n)),n}catch(e){null==r||r.debug("Failed to read/write replay start time from storage: ".concat(String(e)));return}}},aA=function(e,t,n,r){var i=ax();if(i)try{i.setItem(a_(e,t),String(n))}catch(e){null==r||r.debug("Failed to write replay start time to storage: ".concat(String(e)))}},aO=function(e,t,n){var r=ax();if(r)try{r.removeItem(a_(e,t))}catch(e){null==n||n.debug("Failed to remove replay start time from storage: ".concat(String(e)))}},aR=function(e,t,n){var r,i,o=ax();if(o){var s=aT(e);try{for(var a=[],l=0;l<o.length;l++){var u=o.key(l);if(u&&u.startsWith(s)){var c=o.getItem(u);if(null!==c){var d=Number(c);(!Number.isFinite(d)||d<=0||t-d>=864e5)&&a.push(u)}}}try{for(var h=(0,D.Ju)(a),f=h.next();!f.done;f=h.next()){var u=f.value;o.removeItem(u)}}catch(e){r={error:e}}finally{try{f&&!f.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}}catch(e){null==n||n.debug("Failed to prune stale replay start times: ".concat(String(e)))}}},aN=new function(){var e=this;this.dbs={},this.createStore=function(t){return(0,D.sH)(e,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:return[4,s$(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,D.sH)(e,void 0,void 0,function(){var e,n;return(0,D.YH)(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,D.sH)(e,void 0,void 0,function(){var e,t,o,s;return(0,D.YH)(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(),s7(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,D.sH)(e,void 0,void 0,function(){var e,t,s;return(0,D.YH)(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(),s7(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,D.sH)(e,void 0,void 0,function(){var e,t,o,s,a,l,u,c;return(0,D.YH)(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(l=s[a],u=Date.now()-l.lastUpdated,!(l.sessionId!==t&&u>1728e5))return[3,5];return[4,o.store.delete(l.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(),s7(n,"Failed to clear old targeting matches for sessions: ".concat(c),c),[3,9];case 9:return[2]}})})}},aM=function(e){var t=e.sessionId,r=e.targetingConfig,i=e.loggerProvider,o=e.apiKey,s=e.targetingParams,a=e.urlChange,l=void 0!==a&&a;return(0,D.sH)(void 0,void 0,void 0,function(){var e,a,u;return(0,D.YH)(this,function(c){switch(c.label){case 0:return[4,aN.
1clearStoreOfOldSessions({loggerProvider:i,apiKey:o,currentSessionId:t})];case 1:return c.sent(),[4,aN.getTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t})];case 2:if(!0===c.sent()&&!l)return[2,!0];e=!0,c.label=3;case 3:return c.trys.push([3,6,,7]),[4,n.e(7288).then(n.bind(n,57288))];case 4:return[4,(0,c.sent().evaluateTargeting)((0,D.Cl)((0,D.Cl)({},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),aN.storeTargetingMatchForSession({loggerProvider:i,apiKey:o,sessionId:t,targetingMatch:e}),[3,7];case 6:return u=c.sent(),i.warn(u.message),[3,7];case 7:return[2,e]}})})};function aD(e,t){return(e<<t|e>>>32-t)>>>0}function aL(e,t){return Math.imul(e=aD(e=e+Math.imul(t,0x85ebca77)>>>0,13),0x9e3779b1)>>>0}function aH(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}var aF="__amplitude_url_tracking_patched__",aU=new WeakMap;function aj(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)?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 l=aU.get(e);if(!l){var u=void 0,c=new Set,d=function(){var t;return null!=(t=e.location.href)?t:""},h=function(){var e=d();(void 0===u||e!==u)&&(u=e,c.forEach(function(t){return t(e)}))},f=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 h(),r};return t[aF]=!0,t},g=e.history;if(null==g?void 0:g.pushState){var v=Reflect.get(g,"pushState");v[aF]||(g.pushState=f(v))}if(null==g?void 0:g.replaceState){var p=Reflect.get(g,"replaceState");p[aF]||(g.replaceState=f(p))}l={callbacks:c,notify:h,onPopStateOrHashChange:function(){return h()},listenersAttached:!1},aU.set(e,l)}var m=l;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 aq(e){return void 0===e&&(e={}),{name:"amplitude/url-tracking@1",observer:function(t,n,r){var i,o,s,a=(0,D.Cl)((0,D.Cl)({},e),r),l=a.ugcFilterRules||[],u=null!=(i=a.enablePolling)&&i,c=null!=(o=a.pollingInterval)?o:1e3,d=null!=(s=a.captureDocumentTitle)&&s;if(!n)return function(){};var h=void 0,f=function(){return n.location&&n.location.href||""},g=function(){var e=n.innerHeight,t=n.innerWidth,r=n.document,i=f(),o="";return d&&(o=(null==r?void 0:r.title)||""),{href:l.length>0?so(i,l):i,title:o,viewportHeight:e,viewportWidth:t,type:"url-change-event"}},v=function(){var e=f();(void 0===h||e!==h)&&(h=e,t(g()))},p=aj(n,function(){return v()},u?{enablePolling:!0,pollingInterval:c}:{});return v(),function(){return p()}},options:e}}aq();var az=function(){function e(){this.pendingLoadListeners=new Map}return e.prototype.start=function(){var e,t=this;null==(e=this.mutationObserver)||e.disconnect(),(0,z.m)()&&(this.sendToAllIframes({type:o9,action:"start"}),this.mutationObserver=new MutationObserver(function(e){var n,r,i,o,s,a;try{for(var l=(0,D.Ju)(e),u=l.next();!u.done;u=l.next()){var c=u.value;try{for(var d=(i=void 0,(0,D.Ju)(Array.from(c.addedNodes))),h=d.next();!h.done;h=d.next()){var f=h.value;f instanceof HTMLIFrameElement?t.sendToIframeAfterLoad(f):f instanceof Element&&f.querySelectorAll("iframe").forEach(function(e){t.sendToIframeAfterLoad(e)})}}catch(e){i={error:e}}finally{try{h&&!h.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}try{for(var g=(s=void 0,(0,D.Ju)(Array.from(c.removedNodes))),v=g.next();!v.done;v=g.next()){var f=v.value;if(f instanceof HTMLIFrameElement){var p=t.pendingLoadListeners.get(f);p&&(f.removeEventListener("load",p),t.pendingLoadListeners.delete(f))}}}catch(e){s={error:e}}finally{try{v&&!v.done&&(a=g.return)&&a.call(g)}finally{if(s)throw s.error}}}}catch(e){n={error:e}}finally{try{u&&!u.done&&(r=l.return)&&r.call(l)}finally{if(n)throw n.error}}}),this.mutationObserver.observe(document.documentElement,{childList:!0,subtree:!0}))},e.prototype.stop=function(){var e;null==(e=this.mutationObserver)||e.disconnect(),this.mutationObserver=void 0,this.pendingLoadListeners.forEac
1h(function(e,t){t.removeEventListener("load",e)}),this.pendingLoadListeners.clear(),this.sendToAllIframes({type:o9,action:"stop"})},e.prototype.sendToIframeAfterLoad=function(e){var t=this,n=function(){t.pendingLoadListeners.delete(e),t.sendToIframe(e,{type:o9,action:"start"})};this.pendingLoadListeners.set(e,n),e.addEventListener("load",n,{once:!0})},e.prototype.sendToAllIframes=function(e){var t=this;document.querySelectorAll("iframe").forEach(function(n){return t.sendToIframe(n,e)})},e.prototype.sendToIframe=function(e,t){var n;try{null==(n=e.contentWindow)||n.postMessage(t,"*")}catch(e){}},e}(),aB=function(){function e(){var e=this;this.name="@amplitude/session-replay-browser",this.recordCancelCallback=null,this.eventCount=0,this.sessionTargetingMatch=!1,this.pageLeaveFns=[],this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,this.recordFunction=null,this.recordEventsInFlight=!1,this.recordingEnabled=!0,this.recordingGeneration=0,this.startChildRecordingOnSetup=!1,this.pendingEmitEvents=[],this.currentPageUrl="",this.recordEventsPendingShouldLogMetadata=null,this.urlChangeCleanup=null,this.crossOriginIframeCoordinator=null,this.crossOriginParentSignalCleanup=null,this.latestUrlChangeTargetingEvaluationId=0,this.teardownEventListeners=function(t){var n=(0,z.m)();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(){var t;if(e.recordingEnabled)if(e.recordCancelCallback&&e.recordFunction){if((null==(t=e.config)?void 0:t.captureFullSnapshotOnFocus)===!1)return;try{e.recordFunction.takeFullSnapshot(!0)}catch(t){e.loggerProvider.warn("Failed to take full snapshot on focus:",t)}}else e.recordEventsInFlight||e.recordEvents(!1)},this.pageLeaveListener=function(t){var n;null==(n=e.eventCompressor)||n.flushQueue(),e.sendEvents(),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,D.sH)(e,void 0,void 0,function(){var e,o,s,a,l,u,d,h,f,g,v,p;return(0,D.YH)(this,function(m){switch(m.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];else 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(c).includes(s.event_type)&&(s=void 0),a=null!=(v=null!=(h=null==(d=t.page)?void 0:d.url)?h:null==(g=null==(f=(0,z.m)())?void 0:f.location)?void 0:g.href)?v:"",l=null!=(p=t.page)?p:""!==a?{url:a}:void 0,[4,aM({sessionId:this.identifiers.sessionId,targetingConfig:e,loggerProvider:this.loggerProvider,apiKey:this.config.apiKey,targetingParams:{userProperties:t.userProperties,event:s,page:l},urlChange:i})];case 1:if(u=m.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||u,this.loggerProvider.debug(JSON.stringify({name:"targeted replay capture config",sessionTargetingMatch:this.sessionTargetingMatch,event:s,targetingParams:t},null,2)),m.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:m.sent(),m.label=5;case 5:return[2]}})})},this.addCustomRRWebEvent=function(t,n,r){return void 0===n&&(n={}),void 0===r&&(r=!0),(0,D.sH)(e,void 0,void 0,function(){var e,i,o,s;return(0,D.YH)(this,function(a){switch(a.label){case 0:if(a.trys.push([0,3,,4]),e=void 0,!((i=this.config)&&t!==k.METADATA)||(e={config:sa(i),version:sj},!r))return[3,2];return[4,ss()];case 1:o=a.sent(),e=(0,D.Cl)((0,D.Cl)({},o),e),a.label=2;case 2:return this.recordCancelCallback&&this.recordFunction?this.recordFunction.addCustomEvent(t,(0,D.Cl)((0,D.Cl)({},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,n,r;try{e.loggerProvider.log("Session Replay capture stopping."),e.recordCancelCallback&&e.recordCancelCallback(),e.recordCancelCallback=null,null==(t=e.networkObservers)||t.stop(),null==(n=e.crossOriginIframeC
1oordinator)||n.stop(),e.crossOriginIframeCoordinator=null,null==(r=e.crossOriginParentSignalCleanup)||r.call(e),e.crossOriginParentSignalCleanup=null}catch(t){e.loggerProvider.warn("Error occurred while stopping replay capture: ".concat(t.toString()))}},this.loggerProvider=new se(new F)}return e.prototype.init=function(e,t){return L(this._init(e,t))},e.prototype.setupUrlChangeListener=function(){var e,t,n=this;null==(e=this.urlChangeCleanup)||e.call(this);var r=(0,z.m)();if(null==r?void 0:r.location){var i=!!(null==(t=this.config)?void 0:t.targetingConfig),o=aj(r,function(e){if(n.currentPageUrl=e,i){var t=++n.latestUrlChangeTargetingEvaluationId;n.evaluateTargetingAndCapture({userProperties:{},event:void 0,page:{url:e}},!1,!1,!0),n.loggerProvider.debug("Queued URL-change targeting re-evaluation #".concat(t," for ").concat(e,"."))}});this.urlChangeCleanup=function(){o(),n.urlChangeCleanup=null}}},e.prototype.isBelowMinSessionDuration=function(){var e,t=null==(e=this.config)?void 0:e.minSessionDurationMs;return void 0!==t&&void 0!==this.sessionStartTime&&Date.now()-this.sessionStartTime<t},e.prototype.getCurrentPageForTargeting=function(){var e,t,n=null==(t=null==(e=(0,z.m)())?void 0:e.location)?void 0:t.href;return null!=n?{url:n}:void 0},e.prototype._init=function(e,t){var r,i,o,s,a,l,u,c,d,h,f,g,v,p;return(0,D.sH)(this,void 0,void 0,function(){var m,y,b,S,w,E,I,k,C,T,_,x,P,A,O,R,N,M,L,H,U,j,q,B,Y,V,J,K,$,G=this;return(0,D.YH)(this,function(X){switch(X.label){case 0:return null==(r=this.urlChangeCleanup)||r.call(this),this.recordingEnabled=!0,this.startChildRecordingOnSetup=!1,this.loggerProvider=new se(t.loggerProvider||new F),Object.prototype.hasOwnProperty.call(t,"logLevel")&&this.loggerProvider.enable(t.logLevel),this.currentPageUrl=sr(),this.identifiers=new aC({sessionId:t.sessionId,deviceId:t.deviceId}),aR(e,m=Date.now(),this.loggerProvider),this.sessionStartTime=void 0!==t.sessionId&&null!=(i=aP(e,t.sessionId,m,this.loggerProvider))?i:m,y=this,[4,(0,D.sH)(void 0,void 0,void 0,function(){var n;return(0,D.YH)(this,function(r){return n=new su(e,t),[2,new sR(new W(e,n.loggerProvider,n.serverZone,t.configServerUrl,t.handleFetchConfig),n)]})})];case 1:return y.joinedConfigGenerator=X.sent(),[4,this.joinedConfigGenerator.generateJoinedConfig()];case 2:if(S=(b=X.sent()).joinedConfig,w=b.localConfig,E=b.remoteConfig,this.config=S,this.setMetadata(t.sessionId,S,w,E,null==(o=t.version)?void 0:o.version,sj,null==(s=t.version)?void 0:s.type),this.pageLeaveFns=[],t.sessionId&&(null==(a=this.config.interactionConfig)?void 0:a.enabled)&&(I=ak.default({sessionId:t.sessionId,type:"interaction"},this.config),this.pageLeaveFns=[I.send(this.getDeviceId.bind(this)).bind(I)],this.scrollHook=I.hook.bind(I),this.clickHandler=new aS(this.loggerProvider,I)),k=[],"idb"!==(C=this.config.storeType)||(null==(l=(0,z.m)())?void 0:l.indexedDB)||(C="memory",this.loggerProvider.warn("Could not use preferred indexedDB storage, reverting to in memory option.")),this.loggerProvider.log("Using ".concat(C," for event storage.")),x=(0,z.m)(),!(this.config.useWebWorker&&x&&x.Worker))return[3,4];return[4,n.e(9961).then(n.bind(n,89961))];case 3:A=(P=X.sent()).compressionScript,O=P.trackDestinationScript,T=A,_=O,X.label=4;case 4:return X.trys.push([4,6,,7]),[4,ao({config:this.config,type:"replay",minInterval:null==(u=this.config.flushIntervalConfig)?void 0:u.minIntervalMs,maxInterval:null==(c=this.config.flushIntervalConfig)?void 0:c.maxIntervalMs,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,storeType:C,trackDestinationWorkerScript:_,shouldSend:function(){return!G.isBelowMinSessionDuration()}})];case 5:return R=X.sent(),this.rrwebEventManager=R,k.push({name:"replay",manager:R}),[3,7];case 6:return N=X.sent(),this.loggerProvider.warn("Error occurred while creating replay events manager: ".concat(N.toString())),[3,7];case 7:if(!(null==(d=this.config.interactionConfig)?void 0:d.enabled))return[3,11];M=this.config.interactionConfig.batch?ab:ay,X.label=8;case 8:return X.trys.push([8,10,,11]),[4,ao({config:this.config,type:"interaction",minInterval:null!=(h=this.config.interactionConfig.trackEveryNms)?h:3e4,maxInterval:6e4,maxPersistedEventsSize:this.config.maxPersistedEventsSizeBytes,payloadBatcher:M,storeType:C,trackDestinationWorkerScript:_})];case 9:return L=X.sent(),k.push({name:"interaction",manager:L}),[3,11];case 10:return N=X.sent(),this.loggerProvider.warn("Error occurred while creating interaction events manager: ".concat(N.toString())),[3,11];case 11:if(this.eventsManager=new(as.bind.apply(as,(0,D.fX)([void 0],(0,D.zs)(k),!1))),this.eventCompressor&&this.eventCompressor.terminate(),H=!0===this.config.eagerFullSnapshotSend?function(){return G.sendEvents()}:void 0,this.eventCompressor=new sL(this.eventsManager,this.config,this.getDeviceId(),T,H),this.pendingEmitEvents.length>0){U=this.pendingEmitEvents.splice(0);try{for(q=(j=(0,D.Ju)(U)).next();!q.done;q=j.next())Y=(B=q.value).event,V=B.sessionId,this.eventCompressor.enqueueEvent(Y,V)}catch(e){K={error:e}}finally{try{q&&!q.done&&($=j.return)&&$.call(j)}finally{if(K)throw K.error}}}return this.pageLeaveFns=(0,D.fX)((0,D.fX)([],(0,D.zs)(this.pageLeaveFns),!1),[function(){if(!G.config||!(null==(e=G.identifiers)?void 0:e.sessionId)||!R)return;var e,t=R.getBeaconEvents();if(t.length){var n=G.getDeviceId();n&&(G.isBelowMinSessionDuration()||R.trackDestination.sendBeacon({events:t,sessionId:G.identifiers.sessionId,deviceId:n,apiKey:G.config.apiKey,serverZone:G.config.serverZone}))}}],!1),[4,this.initializeNetworkObservers()];case 12:return X.sent(),(null==(f=(0,z.m)())?void 0:f.opener)&&(nG(J=nW()),J.setup((0,D.Cl)({logger:this.loggerProvider},this.config.serverZone&&{endpoint:nz[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 X.sent(),(this.config.targetingConfig||(null!=(p=null==(v=null==(g=this.config.privacyConfig)?void 0:g.urlMaskLevels)?void 0:v.length)?p:0)>0)&&this.setupUrlChangeListener(),[2]}})})},e.prototype.setSessionId=function(e,t){return L(this.asyncSetSessionId(e,t))},e.prototype.asyncSetSessionId=function(e,t,n){var r,i,o,s;return(0,D.sH)(this,void 0,void 0,function(){var a,l,u,c,d;return(0,D.YH)(this,function(h){switch(h.label){case 0:if(a=null==(r=this.identifiers)?void 0:r.sessionId,l=this.getDeviceId(),void 0!==a&&a===e&&(void 0===t||t===l)&&((null==n?void 0:n.userProperties)===void 0||0===Object.keys(n.userProperties).length))return[2];if(this.latestUrlChangeTargetingEvaluationId++,this.sessionTargetingMatch=!1,this.lastShouldRecordDecision=void 0,a&&this.sendEvents(a),(u=a!==e)&&(null==(i=this.rrwebEventManager)||i.dropPendingBeaconEvents()),c=t||this.getDeviceId(),this.identifiers=new aC({sessionId:e,deviceId:c}),u&&(this.sessionStartTime=Date.now(),this.suppressedSendCount=0,this.hasEmittedGateDecision=!1,(null==(o=this.config)?void 0:o.apiKey)&&(aA(this.config.apiKey,e,this.sessionStartTime,this.loggerProvider),void 0!==a&&aO(this.config.apiKey,a,this.loggerProvider))),!(this.joinedConfigGenerator&&a))return[3,2];return[4,this.joinedConfigGenerator.generateJoinedConfig()];case 1:d=h.sent().joinedConfig,this.config=d,h.label=2;case 2:if(!(null==(s=this.config)?void 0:s.targetingConfig))return[3,4];return[4,this.evaluateTargetingAndCapture({userProperties:null==n?void 0:n.userProperties,page:this.getCurrentPageForTargeting()},!1,!0)];case 3:return h.sent(),[3,6];case 4:return[4,this.recordEvents()];case 5:h.sent(),h.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={})[o0]=n.sessionReplayId?n.sessionReplayId:null,i=e,t.debugMode&&(i[o3]=JSON.stringify({appHash:G(t.apiKey).toString()}))),this.addCustomRRWebEvent(k.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,r=e||(null==(t=this.identifiers)?void 0:t.sessionId),i=this.getDeviceId();if(this.eventsManager&&r&&i){if(this.isBelowMinSessionDuration()){var o=this.sessionStartTime,s=this.config.minSessionDurationMs;this.loggerProvider.log("Session ".concat(r," not sent: duration ").concat(Date.now()-o,"ms is below minimum ").concat(s,"ms.")),this.suppressedSendCount++;return}if(!this.hasEmittedGateDecision&&(null==(n=this.config)?void 0:n.minSessionDurationMs)!==void 0&&this.recordCancelCallback&&this.recordFunction){this.hasEmittedGateDecision=!0;var a=void 0!==this.sessionStartTime?Date.now()-this.sessionStartTime:void 0;this.addCustomRRWebEvent(k.REPLAY_GATE_DECISION,{sessionId:r,suppressedSendCount:this.suppressedSendCount,elapsedMs:a,minSessionDurationMs:this.config.minSessionDurationMs},!1)}this.eventsManager.sendCurrentSequenceEvents({sessionId:r,deviceId:i})}},e.prototype.initialize=function(e){var t;return void 0===e&&(e=!1),(0,D.sH)(this,void 0,void 0,function(){var n;return(0,D.YH)(this,function(r){return(null==(t=this.identifiers)?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==(e=this.config)?void 0:e.instanceName){var e,t,n;n=eM(this.config.instanceName).identityStore.getIdentity().optOut}return void 0!==n?n:null==(t=this.config)?void 0:t.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.recordingEnabled)return this.loggerProvider.log("Session ".concat(this.identifiers.sessionId," not being captured because recording was stopped.")),!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+0x9e3779b1+0x85ebca77>>>0,a=t+0x85ebca77>>>0,l=t>>>0,u=t-0x9e3779b1>>>0;o<=i-16;)s=aL(s,aH(r,o)),o+=4,a=aL(a,aH(r,o)),o+=4,l=aL(l,aH(r,o)),o+=4,u=aL(u,aH(r,o)),o+=4;n=aD(s,1)+aD(a,7)+aD(l,12)+aD(u,18)>>>0}else n=t+0x165667b1>>>0;for(n=n+i>>>0;o<=i-4;)n=Math.imul(aD(n=n+Math.imul(aH(r,o),0xc2b2ae3d)>>>0,17),0x27d4eb2f)>>>0,o+=4;for(;o<i;)n=Math.imul(aD(n=n+Math.imul(r[o],0x165667b1)>>>0,11),0x9e3779b1)>>>0,o++;return n^=n>>>15,n=Math.imul(n,0x85ebca77)>>>0,n^=n>>>13,n=Math.imul(n,0xc2b2ae3d)>>>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(k.TARGETING_DECISION,{message:r,sessionId:this.identifiers.sessionId,matched:i,targetingParams:this.lastTargetingParams}),this.lastShouldRecordDecision=n),n},e.prototype.getBlockSelectors=function(){var e;return sb(null==(e=this.config)?void 0:e.privacyConfig)},e.prototype.getMaskTextSelectors=function(){var e;return sS(null==(e=this.config)?void 0:e.privacyConfig,this.currentPageUrl)},e.prototype.getRecordingPlugins=function(e){var t,r,i,o,s,a;return(0,D.sH)(this,void 0,void 0,function(){var l,u,c,d;return(0,D.YH)(this,function(h){switch(h.label){case 0:l=[];try{u=aq({ugcFilterRules:(null==(r=null==(t=this.config)?void 0:t.interactionConfig)?void 0:r.ugcFilterRules)||[],enablePolling:(null==(i=this.config)?void 0:i.enableUrlChangePolling)||!1,pollingInterval:null==(o=this.config)?void 0:o.urlChangePollingInterval,captureDocumentTitle:null==(s=this.config)?void 0:s.captureDocumentTitle}),l.push(u)}catch(e){this.loggerProvider.warn("Failed to create URL tracking plugin:",e)}if(!(null==(a=null==e?void 0:e.console)?void 0:a.enabled))return[3,4];h.label=1;case 1:return h.trys.push([1,3,,4]),[4,n.e(6851).then(n.bind(n,37434))];case 2:return c=h.sent().getRecordConsolePlugin,l.push(c({level:e.console.levels})),[3,4];case 3:return d=h.sent(),this.loggerProvider.warn("Failed to load console plugin:",d),[3,4];case 4:return[2,l.length>0?l:void 0]}})})},e.prototype.getRecordFunction=function(){return(0,D.sH)(this,void 0,void 0,function(){var e,t;return(0,D.YH)(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,n.e(8950).then(n.bind(n,48770))];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){return void 0===e&&(e=!0),(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(this,function(n){switch(n.label){case 0:if(this.recordEventsInFlight)return this.recordEventsPendingShouldLogMetadata=e,[2];this.recordEventsInFlight=!0,n.label=1;case 1:return n.trys.push([1,,6,7]),[4,this._recordEvents(e)];case 2:n.sent(),n.label=3;case 3:if(null===this.recordEventsPendingShouldLogMetadata)return[3,5];return t=this.recordEventsPendingShouldLogMetadata,this.recordEventsPendingShouldLogMetadata=null,[4,this._recordEvents(t)];case 4:return n.sent(),[3,3];case 5:return[3,7];case 6:return this.recordEventsInFlight=!1,this.recordEventsPendingShouldLogMetadata=null,[7];case 7:return[2]}})})},e.prototype.shouldAbandonRecordStart=function(e){return!this.recordingEnabled||e!==this.recordingGeneration},e.prototype._recordEvents=function(e){var t,n,r,i,o,s,a,l;return void 0===e&&(e=!0),(0,D.sH)(this,void 0,void 0,function(){var u,c,d,h,f,g,v,p,m,y,b,S,w,E,I,C,T=this;return(0,D.YH)(this,function(_){switch(_.label){case 0:if(u=this.config,c=this.getShouldRecord(),d=null==(t=this.identifiers)?void 0:t.sessionId,!c||!d||!u)return[2];return this.stopRecordingEvents(),h=this.recordingGeneration,[4,this.getRecordFunction()];case 1:if(!(f=_.sent())||this.shouldAbandonRecordStart(h))return[2];return[4,this.initializeNetworkObservers()];case 2:if(_.sent(),this.shouldAbandonRecordStart(h))return[2];g=null==(n=u.loggingConfig)?void 0:n.network,v=[o4,o6,o5,sM(u.serverZone,u.trackServerUrl)],null==(r=this.networkObservers)||r.start(function(e){v.some(function(t){return e.url.
1startsWith(t)})||T.addCustomRRWebEvent(k.FETCH_REQUEST,e)},g),p=u.interactionConfig,m=u.loggingConfig,y=(null==p?void 0:p.enabled)?{mouseInteraction:this.eventsManager&&(null==(i=this.clickHandler)?void 0:i.createHook({eventsManager:this.eventsManager,sessionId:d,deviceIdFn:this.getDeviceId.bind(this),mirror:f.mirror,ugcFilterRules:null!=(o=p.ugcFilterRules)?o:[],performanceOptions:null==(s=u.performanceConfig)?void 0:s.interaction})),scroll:this.scrollHook}:{},b=(null==p?void 0:p.enabled)&&p.ugcFilterRules?p.ugcFilterRules:[],this.loggerProvider.log("Session Replay capture beginning for ".concat(d,".")),_.label=3;case 3:if(_.trys.push([3,5,,6]),S=!!(null==(a=u.crossOriginIframes)?void 0:a.enabled),w=(null==(l=u.crossOriginIframes)?void 0:l.coordinateChildren)!==!1,(E=S&&function(){try{var e=(0,z.m)();if(!e)return!1;return e.parent!==e}catch(e){return!0}}())&&w)return this.crossOriginParentSignalCleanup=function(e){var t=(0,z.m)();if(!t)return function(){};var n=t.parent;function r(t){if(t.source===n){var r=t.data;(null==r?void 0:r.type)===o9&&("start"===r.action?e.onStart():"stop"===r.action&&e.onStop())}}return t.addEventListener("message",r),function(){return t.removeEventListener("message",r)}}({onStart:function(){T.recordingEnabled&&T._recordEventsInChildMode(f,d,u,y)},onStop:function(){try{T.recordCancelCallback&&T.recordCancelCallback(),T.recordCancelCallback=null}catch(e){T.loggerProvider.warn("Error occurred while stopping child iframe replay capture: ".concat(e.toString()))}}}),this.startChildRecordingOnSetup&&(this.startChildRecordingOnSetup=!1,this._recordEventsInChildMode(f,d,u,y)),[2];return this.startChildRecordingOnSetup=!1,[4,this.getRecordingPlugins(m)];case 4:if(I=_.sent(),this.shouldAbandonRecordStart(h))return[2];return this.recordCancelCallback=f((0,D.Cl)((0,D.Cl)({},this.buildRRWebRecordOptions(u,y,function(e){if(T.shouldOptOut()||!T.recordingEnabled){T.loggerProvider.log(T.shouldOptOut()?"Opting session ".concat(d," out of recording due to optOut config."):"Session Replay capture stopping for ".concat(d,".")),T.stopRecordingEvents(),T.sendEvents();return}e.type===sE.Meta&&(e.data.href=so(e.data.href,b)),T.eventCompressor?T.eventCompressor.enqueueEvent(e,d):T.pendingEmitEvents.push({event:e,sessionId:d})},"Error while capturing replay: ")),{plugins:I,recordCrossOriginIframes:S})),S&&!E&&w&&(this.crossOriginIframeCoordinator||(this.crossOriginIframeCoordinator=new az),this.crossOriginIframeCoordinator.start()),this.addCustomRRWebEvent(k.DEBUG_INFO),e&&this.addCustomRRWebEvent(k.METADATA,this.metadata),[3,6];case 5:return C=_.sent(),this.loggerProvider.warn("Failed to initialize session replay:",C),[3,6];case 6:return[2]}})})},e.prototype.buildRRWebRecordOptions=function(e,t,n,r){var i=this,o=e.privacyConfig;return(0,D.Cl)((0,D.Cl)((0,D.Cl)((0,D.Cl)({emit:n,inlineStylesheet:e.shouldInlineStylesheet,inlineImages:e.inlineImages,hooks:t},sw(o,function(){return i.currentPageUrl})),{applyBackgroundColorToBlockedElements:e.applyBackgroundColorToBlockedElements}),void 0!==e.fullSnapshotIntervalMs&&{checkoutEveryNms:e.fullSnapshotIntervalMs}),{recordCanvas:!1,captureAdoptedStyleSheets:e.captureAdoptedStyleSheets,slimDOMOptions:{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0},errorHandler:function(e){if(e.message.includes("insertRule")&&e.message.includes("CSSStyleSheet")||e._external_)throw e;return i.loggerProvider.warn(r,e.toString()),!0}})},e.prototype._recordEventsInChildMode=function(e,t,n,r){try{this.recordCancelCallback&&this.recordCancelCallback(),this.recordCancelCallback=null,this.recordCancelCallback=e((0,D.Cl)((0,D.Cl)({},this.buildRRWebRecordOptions(n,r,function(){},"Error while capturing replay (child iframe): ")),{recordCrossOriginIframes:!0})),this.loggerProvider.log("Session Replay child iframe capture beginning for session ".concat(t,"."))}catch(e){this.loggerProvider.warn("Failed to initialize session replay in child iframe mode:",e)}},e.prototype.getDeviceId=function(){var e;return null==(e=this.identifiers)?void 0:e.deviceId},e.prototype.getSessionId=function(){var e;return null==(e=this.identifiers)?void 0:e.sessionId},e.prototype.start=function(){return L(this._start())},e.prototype._start=function(){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:return this.recordingEnabled=!0,this.startChildRecordingOnSetup=!0,[4,this.recordEvents()];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,this.stopRecordingEvents(),this.sendEvents()},e.prototype.flush=function(e){var t;return void 0===e&&(e=!1),(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return[2,null==(t=this.eventsManager)?void 0:t.flush(e)]})})},e.prototype.shutdown=function(){var e,t;this.recordingEnabled=!1,this.startChildRecordingOnSetup=!1,this.recordingGeneration++,null==(e=this.urlChangeCleanup)||e.call(this),null==(t=this.crossOriginParentSignalCleanup)||t.call(this),this.crossOriginParentSignalCleanup=null,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())?G(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,D.sH)(this,void 0,void 0,function(){var i,o;return(0,D.YH)(this,function(s){switch(s.label){case 0:if(!((null==(r=null==(t=null==(e=this.config)?void 0:e.loggingConfig)?void 0:t.network)?void 0:r.enabled)&&!this.networkObservers))return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.e(3397).then(n.bind(n,83397))];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}(),aY=function(e){return function(){var t=e.config||sl();return{logger:t.loggerProvider,logLevel:t.logLevel}}};let aV=function(){var e=new aB;return{init:e$(e.init.bind(e),"init",aY(e)),evaluateTargetingAndCapture:e$(e.evaluateTargetingAndCapture.bind(e),"evaluateTargetingAndRecord",aY(e)),setSessionId:e$(e.setSessionId.bind(e),"setSessionId",aY(e)),getSessionId:e$(e.getSessionId.bind(e),"getSessionId",aY(e)),getSessionReplayProperties:e$(e.getSessionReplayProperties.bind(e),"getSessionReplayProperties",aY(e)),flush:e$(e.flush.bind(e),"flush",aY(e)),start:e$(e.start.bind(e),"start",aY(e)),stop:e$(e.stop.bind(e),"stop",aY(e)),shutdown:e$(e.shutdown.bind(e),"shutdown",aY(e))}}();
1var aW=aV.init,aJ=aV.setSessionId,aK=aV.getSessionId,a$=aV.getSessionReplayProperties,aG=aV.flush,aX=aV.start,aQ=aV.stop,aZ=aV.shutdown,a0=aV.evaluateTargetingAndCapture;!function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"}(x||(x={})),function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue"}(P||(P={})),function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"}(A||(A={}));var a1=[x.SET,x.SET_ONCE,x.ADD,x.APPEND,x.PREPEND,x.POSTINSERT],a2=function(e){if(e.user_properties){var t={};return Object.keys(e.user_properties).forEach(function(n){if(a1.includes(n)){var r=e.user_properties&&e.user_properties[n];t=(0,D.Cl)((0,D.Cl)({},t),r)}}),t}},a3="1.35.5",a4="".concat("[Amplitude]"," Session Replay ID"),a6=function(){function e(t){this.name=e.pluginName,this.type="enrichment",this.config=null,this.sessionReplay={flush:aG,getSessionId:aK,getSessionReplayProperties:a$,init:aW,setSessionId:aJ,start:aX,stop:aQ,shutdown:aZ,evaluateTargetingAndCapture:a0},this.options=(0,D.Cl)({forceSessionTracking:!1},t),this.srInitOptions=this.options}return e.prototype.setup=function(e,t){var n,r,i,o,s,a,l,u;return(0,D.sH)(this,void 0,void 0,function(){var t,c;return(0,D.YH)(this,function(d){switch(d.label){case 0:return d.trys.push([0,2,,3]),null==e||e.loggerProvider.log("Installing @amplitude/plugin-session-replay, version ".concat(a3,".")),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,D.Cl)((0,D.Cl)({},e.defaultTracking),{sessions:!0})),t=eM(this.config.instanceName).identityStore.getIdentity().userProperties,this.srInitOptions={instanceName:this.config.instanceName,deviceId:null!=(n=this.options.deviceId)?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.serverUrl),trackServerUrl:this.options.trackServerUrl,sampleRate:this.options.sampleRate,privacyConfig:{blockSelector:null==(i=this.options.privacyConfig)?void 0:i.blockSelector,maskSelector:null==(o=this.options.privacyConfig)?void 0:o.maskSelector,unmaskSelector:null==(s=this.options.privacyConfig)?void 0:s.unmaskSelector,defaultMaskLevel:null==(a=this.options.privacyConfig)?void 0:a.defaultMaskLevel},debugMode:this.options.debugMode,shouldInlineStylesheet:this.options.shouldInlineStylesheet,inlineImages:this.options.inlineImages,version:{type:"plugin",version:a3},performanceConfig:this.options.performanceConfig,storeType:this.options.storeType,useWebWorker:null!=(l=this.options.useWebWorker)?l:null==(u=this.options.experimental)?void 0:u.useWebWorker,userProperties:t,applyBackgroundColorToBlockedElements:this.options.applyBackgroundColorToBlockedElements,interactionConfig:this.options.interactionConfig,captureDocumentTitle:this.options.captureDocumentTitle,enableUrlChangePolling:this.options.enableUrlChangePolling,urlChangePollingInterval:this.options.urlChangePollingInterval,captureAdoptedStyleSheets:this.options.captureAdoptedStyleSheets,crossOriginIframes:this.options.crossOriginIframes,flushIntervalConfig:this.options.flushIntervalConfig,eagerFullSnapshotSend:this.options.eagerFullSnapshotSend,captureFullSnapshotOnFocus:this.options.captureFullSnapshotOnFocus,maxPersistedEventsSizeBytes:this.options.maxPersistedEventsSizeBytes,maxSingleEventSizeBytes:this.options.maxSingleEventSizeBytes,sendTimeoutMs:this.options.sendTimeoutMs,handleSendEvents:this.options.handleSendEvents,handleFetchConfig:this.options.handleFetchConfig},[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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){switch(n.label){case 0:return null==(t=this.config)||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,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){switch(n.label){case 0:if(null==(t=this.config)||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,D.sH)(this,void 0,void 0,function(){var i,o,s,a,l;return(0,D.YH)(this,function(u){switch(u.label){case 0:if(u.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:u.sent(),u.label=2;case 2:o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,D.Cl)((0,D.Cl)({},e.event_properties),o),u.label=3;case 3:return[3,8];case 4:if(!((i=null==(t=this.config)?void 0:t.sessionId)&&i!==this.sessionReplay.getSessionId()))return[3,6];return[4,this.sessionReplay.setSessionId(i).promise];case 5:u.sent(),u.label=6;case 6:if(!(i&&i===e.session_id))return[3,8];return s=void 0,e.event_type===c.IDENTIFY&&(s=a2(e)),a=(0,z.m)(),[4,this.sessionReplay.evaluateTargetingAndCapture({event:e,userProperties:s,page:(null==(n=null==a?void 0:a.location)?void 0:n.href)!=null?{url:a.location.href}:void 0})];case 7:u.sent(),o=this.sessionReplay.getSessionReplayProperties(),e.event_properties=(0,D.Cl)((0,D.Cl)({},e.event_properties),o),u.label=8;case 8:return e.event_type===c.IDENTIFY&&e.event_properties&&delete e.event_properties[a4],[2,Promise.resolve(e)];case 9:return l=u.sent(),null==(r=this.config)||r.loggerProvider.error("Session Replay: Failed to enrich event due to ".concat(l.message)),[2,Promise.resolve(e)];case 10:return[2]}})})},e.prototype.teardown=function(){var e;return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(t){try{this.sessionReplay.shutdown(),this.config=null}catch(t){null==(e=this.config)||e.loggerProvider.error("Session Replay: teardown failed due to ".concat(t.message))}return[2]})})},e.prototype.getSessionReplayProperties=function(){return this.sessionReplay.getSessionReplayProperties()},e.prototype.start=function(){return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(e){switch(e.label){case 0:return[4,this.sessionReplay.start().promise];case 1:return e.sent(),[2]}})})},e.prototype.stop=function(){this.sessionReplay.stop()},e.pluginName="@amplitude/plugin-session-replay-browser",e}(),a5=n(81029).hp;let a8={IS:"is",IS_NOT:"is not",CONTAINS:"contains",DOES_NOT_CONTAIN:"does not contain",LESS_THAN:"less",LESS_THAN_EQUALS:"less or equal",GREATER_THAN:"greater",GREATER_THAN_EQUALS:"greater or equal",VERSION_LESS_THAN:"version less",VERSION_LESS_THAN_EQUALS:"version less or equal",VERSION_GREATER_THAN:"version greater",VERSION_GREATER_THAN_EQUALS:"version greater or equal",SET_IS:"set is",SET_IS_NOT:"set is not",SET_CONTAINS:"set contains",SET_DOES_NOT_CONTAIN:"set does not contain",SET_CONTAINS_ANY:"set contains any",SET_DOES_NOT_CONTAIN_ANY:"set does not contain any",REGEX_MATCH:"regex match",REGEX_DOES_NOT_MATCH:"regex does not match"},a7=(e,t)=>{let n=e,r=t;return r^=n=Math.imul(n=a9(n=Math.imul(n,-0x3361d2af),15),0x1b873593),(r=Math.imul(r=a9(r,13),5))+-0x19ab949c|0},a9=(e,t,n=32)=>{t>n&&(t%=n);let r=(e&0xffffffff<<n-t>>>0)>>>0>>>n-t>>>0;return(e<<t|r)>>>0},le=(e,t=0)=>lt(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3]),lt=e=>(-0x1000000&e)>>>24|(0xff0000&e)>>>8|(65280&e)<<8|(255&e)<<24,ln=(e,t)=>{if(t&&0!==t.length){for(let n of t){if(!n||!e||"object"!=typeof e)return;e=e[n]}if(null!=e)return e}};class lr{constructor(e,t,n,r){this.major=e,this.minor=t,this.patch=n,this.preRelease=r}static parse(e){if(!e)return;
1let t=RegExp("^(\\d+)\\.(\\d+)(\\.(\\d+)(-(([-\\w]+\\.?)*))?)?$").exec(e);if(!t)return;let n=Number(t[1]),r=Number(t[2]);if(!(isNaN(n)||isNaN(r)))return new lr(n,r,Number(t[4])||0,t[5]||void 0)}compareTo(e){if(this.major>e.major)return 1;if(this.major<e.major)return -1;if(this.minor>e.minor)return 1;if(this.minor<e.minor)return -1;if(this.patch>e.patch)return 1;if(this.patch<e.patch||this.preRelease&&!e.preRelease)return -1;if(!this.preRelease&&e.preRelease)return 1;if(this.preRelease&&e.preRelease){if(this.preRelease>e.preRelease)return 1;if(this.preRelease<e.preRelease)return -1}return 0}}class li{evaluate(e,t){let n={},r={context:e,result:n};for(let e of t){let t=this.evaluateFlag(r,e);t&&(n[e.key]=t)}return n}evaluateWithTraces(e,t){let n={},r={},i={context:e,result:n};for(let e of t){let{variant:t,trace:o}=this.evaluateFlagWithTrace(i,e);t&&(n[e.key]=t),r[e.key]=o}return{results:n,traces:r}}evaluateFlag(e,t){let n;for(let r of t.segments)if(n=this.evaluateSegment(e,t,r)){let e=Object.assign(Object.assign(Object.assign({},t.metadata),r.metadata),n.metadata);n=Object.assign(Object.assign({},n),{metadata:e});break}return n}evaluateFlagWithTrace(e,t){var n,r;let i,o,s,a=[];for(let l of t.segments){let u;if(!l.conditions){let r=this.bucket(e,l),u=void 0!==r;a.push({segmentMetadata:l.metadata,conditionsPassed:!0,bucketed:u,bucketVariant:r,conditionResult:void 0,matched:u}),i||void 0===r||(i=t.variants[r],o=l,s=null==(n=l.metadata)?void 0:n.segmentName);continue}let c=[],d=!1;for(let t of l.conditions){let n=!0,r=[];for(let i of t){let t=ln(e,i.selector),o=this.matchCondition(e,i);if(r.push({propValue:t,condition:i,matched:o}),!o){n=!1;break}}if(c.push(r),n){d=!0;break}}let h=!1;d&&(h=void 0!==(u=this.bucket(e,l))),a.push({segmentMetadata:l.metadata,conditionsPassed:d,bucketed:h,bucketVariant:u,conditionResult:c,matched:d&&h}),d&&void 0!==u&&!i&&(i=t.variants[u],o=l,s=null==(r=l.metadata)?void 0:r.segmentName)}if(i&&o){let e=Object.assign(Object.assign(Object.assign({},t.metadata),o.metadata),i.metadata);i=Object.assign(Object.assign({},i),{metadata:e})}let l={flagKey:t.key,matched:void 0!==i,matchedSegment:s,steps:a};return{variant:i,trace:l}}evaluateSegment(e,t,n){if(!n.conditions){let r=this.bucket(e,n);return void 0!==r?t.variants[r]:void 0}if(this.evaluateConditions(e,n.conditions)){let r=this.bucket(e,n);if(void 0!==r)return t.variants[r]}}evaluateConditions(e,t){for(let n of t){let t=!0;for(let r of n)if(!(t=this.matchCondition(e,r)))break;if(t)return!0}return!1}matchCondition(e,t){let n=ln(e,t.selector);if(null==n)return this.matchNull(t.op,t.values);{let e=this.coerceStringArray(n);if(this.isSetOperator(t.op))return!!e&&this.matchSet(e,t.op,t.values);{if(e)return this.matchStringsNonSet(e,t.op,t.values);let r=this.coerceString(n);return void 0!==r&&this.matchString(r,t.op,t.values)}}}getHash(e){return((e,t=0)=>{var n;let r,i=(e=>{let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:((64512&i)==55296&&r+1<e.length&&(64512&e.charCodeAt(r+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return Uint8Array.from(t)})(e),o=i.length,s=o>>2,a=t;for(let e=0;e<s;e++)a=a7(le(i,e<<2),a);let l=s<<2,u=0;switch(o-l){case 3:u^=i[l+2]<<16,u^=i[l+1]<<8,u^=i[l],a^=u=Math.imul(u=a9(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 2:u^=i[l+1]<<8,u^=i[l],a^=u=Math.imul(u=a9(u=Math.imul(u,-0x3361d2af),15),0x1b873593);break;case 1:u^=i[l],a^=u=Math.imul(u=a9(u=Math.imul(u,-0x3361d2af),15),0x1b873593)}return r=n=a^=o,r^=r>>>16,r=Math.imul(r,-0x7a143595),r^=r>>>13,r=Math.imul(r,-0x3d4d51cb),(r^=r>>>16)>>>0})(e)}bucket(e,t){if(!t.bucket)return t.variant;let n=this.coerceString(ln(e,t.bucket.selector));if(!n||0===n.length)return t.variant;let r=`${t.bucket.salt}/${n}`,i=this.getHash(r),o=i%100,s=Math.floor(i/100);for(let e of t.bucket.allocations){let t=e.range[0],n=e.range[1];if(o>=t&&o<n)for(let t of e.distributions){let e=t.range[0],n=t.range[1];if(s>=e&&s<n)return t.variant}}return t.variant}matchNull(e,t){let n=this.containsNone(t);switch(e){case a8.IS:case a8.CONTAINS:case a8.LESS_THAN:case a8.LESS_THAN_EQUALS:case a8.GREATER_THAN:case a8.GREATER_THAN_EQUALS:case a8.VERSION_LESS_THAN:case a8.VERSION_LESS_THAN_EQUALS:case a8.VERSION_GREATER_THAN:case a8.VERSION_GREATER_THAN_EQUALS:case a8.SET_IS:case a8.SET_CONTAINS:case a8.SET_CONTAINS_ANY:return n;case a8.IS_NOT:case a8.DOES_NOT_CONTAIN:case a8.SET_DOES_NOT_CONTAIN:case a8.SET_DOES_NOT_CONTAIN_ANY:return!n;default:return!1}}
1matchSet(e,t,n){switch(t){case a8.SET_IS:return this.setEquals(e,n);case a8.SET_IS_NOT:return!this.setEquals(e,n);case a8.SET_CONTAINS:return this.matchesSetContainsAll(e,n);case a8.SET_DOES_NOT_CONTAIN:return!this.matchesSetContainsAll(e,n);case a8.SET_CONTAINS_ANY:return this.matchesSetContainsAny(e,n);case a8.SET_DOES_NOT_CONTAIN_ANY:return!this.matchesSetContainsAny(e,n);default:return!1}}matchString(e,t,n){switch(t){case a8.IS:return this.matchesIs(e,n);case a8.IS_NOT:return!this.matchesIs(e,n);case a8.CONTAINS:return this.matchesContains(e,n);case a8.DOES_NOT_CONTAIN:return!this.matchesContains(e,n);case a8.LESS_THAN:case a8.LESS_THAN_EQUALS:case a8.GREATER_THAN:case a8.GREATER_THAN_EQUALS:return this.matchesComparable(e,t,n,e=>this.parseNumber(e),(e,t,n)=>this.comparator(e,t,n));case a8.VERSION_LESS_THAN:case a8.VERSION_LESS_THAN_EQUALS:case a8.VERSION_GREATER_THAN:case a8.VERSION_GREATER_THAN_EQUALS:return this.matchesComparable(e,t,n,e=>lr.parse(e),(e,t,n)=>this.versionComparator(e,t,n));case a8.REGEX_MATCH:return this.matchesRegex(e,n);case a8.REGEX_DOES_NOT_MATCH:return!this.matchesRegex(e,n);default:return!1}}matchStringsNonSet(e,t,n){return e.some(e=>this.matchString(e,t,n))}matchesIs(e,t){if(this.containsBooleans(t)){let n=e.toLowerCase();if("true"===n||"false"===n)return t.some(e=>e.toLowerCase()===n)}return t.some(t=>e===t)}matchesContains(e,t){for(let n of t)if(e.toLowerCase().includes(n.toLowerCase()))return!0;return!1}matchesComparable(e,t,n,r,i){let o=r(e),s=n.map(e=>r(e)).filter(e=>void 0!==e);return void 0===o||0===s.length?n.some(n=>this.comparator(e,t,n)):s.some(e=>i(o,t,e))}comparator(e,t,n){switch(t){case a8.LESS_THAN:case a8.VERSION_LESS_THAN:return e<n;case a8.LESS_THAN_EQUALS:case a8.VERSION_LESS_THAN_EQUALS:return e<=n;case a8.GREATER_THAN:case a8.VERSION_GREATER_THAN:return e>n;case a8.GREATER_THAN_EQUALS:case a8.VERSION_GREATER_THAN_EQUALS:return e>=n;default:return!1}}versionComparator(e,t,n){let r=e.compareTo(n);switch(t){case a8.LESS_THAN:case a8.VERSION_LESS_THAN:return r<0;case a8.LESS_THAN_EQUALS:case a8.VERSION_LESS_THAN_EQUALS:return r<=0;case a8.GREATER_THAN:case a8.VERSION_GREATER_THAN:return r>0;case a8.GREATER_THAN_EQUALS:case a8.VERSION_GREATER_THAN_EQUALS:return r>=0;default:return!1}}matchesRegex(e,t){return t.some(t=>!!new RegExp(t).exec(e))}containsNone(e){return e.some(e=>"(none)"===e)}containsBooleans(e){return e.some(e=>{switch(e.toLowerCase()){case"true":case"false":return!0;default:return!1}})}parseNumber(e){var t;return null!=(t=Number(e))?t:void 0}coerceString(e){if(null!=e)return"object"==typeof e?JSON.stringify(e):String(e)}coerceStringArray(e){if(Array.isArray(e))return e.map(e=>this.coerceString(e)).filter(Boolean);let t=String(e);if(t.startsWith("["))try{let e=JSON.parse(t);if(Array.isArray(e))return e.map(e=>this.coerceString(e)).filter(Boolean);return}catch(e){return}}isSetOperator(e){switch(e){case a8.SET_IS:case a8.SET_IS_NOT:case a8.SET_CONTAINS:case a8.SET_DOES_NOT_CONTAIN:case a8.SET_CONTAINS_ANY:case a8.SET_DOES_NOT_CONTAIN_ANY:return!0;default:return!1}}setEquals(e,t){let n=new Set(e),r=new Set(t);return n.size===r.size&&[...r].every(e=>n.has(e))}matchesSetContainsAll(e,t){if(e.length<t.length)return!1;for(let n of t)if(!this.matchesIs(n,e))return!1;return!0}matchesSetContainsAny(e,t){for(let n of t)if(this.matchesIs(n,e))return!0;return!1}}let lo=(e,t)=>{let n=Object.assign({},e),r=[];for(let e of t||Object.keys(n)){let t=ls(e,n);t&&r.push(...t)}return r},ls=(e,t,n=[])=>{let r=t[e];if(!r)return;if(!r.dependencies||0===r.dependencies.length)return delete t[r.key],[r];n.push(r.key);let i=[];for(let e of r.dependencies){if(n.some(t=>t===e))throw Error(`Detected a cycle between flags ${n.join(", ")}`);let r=ls(e,t,n);r&&i.push(...r)}return i.push(r),n.pop(),delete t[r.key],i};function la(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let ll="function"==typeof a5,lu="function"==typeof TextDecoder?new TextDecoder:void 0,lc="function"==typeof TextEncoder?new TextEncoder:void 0,ld=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
1+/="),lh=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(ld),lf=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,lg=String.fromCharCode.bind(String),lv="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),lp=e=>e.replace(/=/g,"").replace(/[+\/]/g,e=>"+"==e?"-":"_"),lm=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),ly="function"==typeof btoa?e=>btoa(e):ll?e=>a5.from(e,"binary").toString("base64"):e=>{let t,n,r,i,o="",s=e.length%3;for(let s=0;s<e.length;){if((n=e.charCodeAt(s++))>255||(r=e.charCodeAt(s++))>255||(i=e.charCodeAt(s++))>255)throw TypeError("invalid character found");o+=ld[(t=n<<16|r<<8|i)>>18&63]+ld[t>>12&63]+ld[t>>6&63]+ld[63&t]}return s?o.slice(0,s-3)+"===".substring(s):o},lb=ll?e=>a5.from(e).toString("base64"):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(lg.apply(null,e.subarray(n,n+4096)));return ly(t.join(""))},lS=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?lg(192|t>>>6)+lg(128|63&t):lg(224|t>>>12&15)+lg(128|t>>>6&63)+lg(128|63&t)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return lg(240|t>>>18&7)+lg(128|t>>>12&63)+lg(128|t>>>6&63)+lg(128|63&t)},lw=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,lE=ll?e=>a5.from(e,"utf8").toString("base64"):lc?e=>lb(lc.encode(e)):e=>ly(e.replace(lw,lS)),lI=(e,t=!1)=>t?lp(lE(e)):lE(e),lk=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,lC=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return lg((t>>>10)+55296)+lg((1023&t)+56320);case 3:return lg((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return lg((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},lT="function"==typeof atob?e=>atob(lm(e)):ll?e=>a5.from(e,"base64").toString("binary"):e=>{let t,n,r;if(e=e.replace(/\s+/g,""),!lf.test(e))throw TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let i=[];for(let o=0;o<e.length;)t=lh[e.charAt(o++)]<<18|lh[e.charAt(o++)]<<12|(n=lh[e.charAt(o++)])<<6|(r=lh[e.charAt(o++)]),64===n?i.push(lg(t>>16&255)):64===r?i.push(lg(t>>16&255,t>>8&255)):i.push(lg(t>>16&255,t>>8&255,255&t));return i.join("")},l_=ll?e=>lv(a5.from(e,"base64")):e=>lv(lT(e).split("").map(e=>e.charCodeAt(0))),lx=ll?e=>a5.from(e,"base64").toString("utf8"):lu?e=>lu.decode(l_(e)):e=>lT(e).replace(lk,lC),lP={encodeURL:e=>lI(e,!0)};class lA extends Error{constructor(e,t){super(t),this.statusCode=e,Object.setPrototypeOf(this,lA.prototype)}}class lO extends Error{constructor(e){super(e),Object.setPrototypeOf(this,lO.prototype)}}class lR{constructor(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}getVariants(e,t){return la(this,void 0,void 0,function*(){let n=lP.encodeURL(JSON.stringify(e)),r={Authorization:`Api-Key ${this.deploymentKey}`,"X-Amp-Exp-User":n};(null==t?void 0:t.flagKeys)&&(r["X-Amp-Exp-Flag-Keys"]=lP.encodeURL(JSON.stringify(t.flagKeys))),(null==t?void 0:t.trackingOption)&&(r["X-Amp-Exp-Track"]=t.trackingOption),(null==t?void 0:t.exposureTrackingOption)&&(r["X-Amp-Exp-Exposure-Track"]=t.exposureTrackingOption);let i=new URL(`${this.serverUrl}/sdk/v2/vardata?v=0`);(null==t?void 0:t.evaluationMode)&&i.searchParams.append("eval_mode",null==t?void 0:t.evaluationMode),(null==t?void 0:t.deliveryMethod)&&i.searchParams.append("delivery_method",null==t?void 0:t.deliveryMethod);let o=yield this.httpClient.request({requestUrl:i.toString(),method:"GET",headers:r,timeoutMillis:null==t?void 0:t.timeoutMillis});if(200!=o.status)throw new lA(o.status,`Fetch error response: status=${o.status}`);return JSON.parse(o.body)})}}class lN{constructor(e,t,n){this.deploymentKey=e,this.serverUrl=t,this.httpClient=n}getFlags(e){return la(this,void 0,void 0,function*(){let t={Authorization:`Api-Key ${this.deploymentKey}`};(null==e?void 0:e.libraryName)&&(null==e?void 0:e.libraryVersion)&&(t["X-Amp-Exp-Library"]=`${e.libraryName}/${e.libraryVersion}`),(null==e?void 0:e.user)&&(t["X-Amp-Exp-User"]=lP.encodeURL(JSON.stringify(e.user)));let n=yield this.httpClient.request({requestUrl:`${this.serverUrl}/sdk/v2/flags`+((null==e?void 0:e.deliveryMethod)?`?delivery_method=${e.deliveryMethod}`:""),method:"GET",headers:t,timeoutMillis:null==e?void 0:e.timeoutMillis});if(200!=n.status)throw Error(`Flags error response: status=${n.status}`);return JSON.parse(n.body).reduce((e,t)=>
1(e[t.key]=t,e),{})})}}let lM=()=>"undefined"!=typeof globalThis&&null!==globalThis?globalThis:"undefined"!=typeof window&&null!==window?window:"undefined"!=typeof self&&null!==self?self:void 0!==n.g&&null!==n.g?n.g:void 0;lM();let lD=()=>{var e;return null==(e=lM())?void 0:e.localStorage},lL=()=>{var e;return null==(e=lM())?void 0:e.sessionStorage},lH=()=>{let e=lM();return(null==e?void 0:e.setTimeout)?e.setTimeout.bind(e):void 0},lF=()=>{let e=lM();return(null==e?void 0:e.setInterval)?e.setInterval.bind(e):void 0},lU=()=>{let e=lM();return(null==e?void 0:e.clearInterval)?e.clearInterval.bind(e):void 0};class lj{constructor(e,t){this.poller=void 0,this.action=e,this.ms=t}start(){if(this.poller)return;let e=lF();e&&(this.poller=e(()=>{this.action()},this.ms),this.action())}stop(){if(!this.poller)return;let e=lU();e&&e(this.poller),this.poller=void 0}}var lq=n(76760);function lz(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;let lB=(e,t=!1)=>{let n,r=lY(e,t),i=(()=>{var e;return null==(e=lM())?void 0:e.document})();if(i){for(let e of i.cookie.split("; ")){let[t,i]=e.split("=",2);t===r&&(n=decodeURIComponent(i))}if(n)try{let e;if(t){let e=atob(n);return JSON.parse(decodeURIComponent(e))}let r=n.split(".");return r.length>=2&&r[1]&&(e=atob(r[1])),{deviceId:r[0],userId:e}}catch(e){return}}},lY=(e,t)=>{if(t){if((null==e?void 0:e.length)<10)return;return`AMP_${e.substring(0,10)}`}if(!((null==e?void 0:e.length)<6))return`amp_${e.substring(0,6)}`};class lV{constructor(e,t,n){this.type="integration",this.apiKey=e,this.identityStore=t.identityStore,this.eventBridge=t.eventBridge,this.contextProvider=t.applicationContextProvider,this.timeoutMillis=n,this.loadPersistedState(),n<=0&&(this.setup=void 0)}setup(e,t){return lz(this,void 0,void 0,function*(){return(null==e?void 0:e.automaticFetchOnAmplitudeIdentityChange)&&this.identityStore.addIdentityListener(()=>{null==t||t.fetch()}),this.waitForConnectorIdentity(this.timeoutMillis)})}getUser(){let e=this.identityStore.getIdentity();return{user_id:e.userId,device_id:e.deviceId,user_properties:e.userProperties,version:this.contextProvider.versionName}}track(e){return!!this.eventBridge.receiver&&(this.eventBridge.logEvent({eventType:e.eventType,eventProperties:e.eventProperties}),!0)}loadPersistedState(){if(!this.apiKey||this.apiKey.startsWith("client-"))return!1;let e=lB(this.apiKey,!0);return!!(e||(e=lB(this.apiKey,!1))||(e=(e=>{let t=lY(e,!0);try{let e=lD();if(!e)return;let n=e.getItem(t);if(!n)return;let r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}})(this.apiKey))||(e=(e=>{let t=lY(e,!0);try{let e=lL();if(!e)return;let n=e.getItem(t);if(!n)return;let r=JSON.parse(n);if("object"!=typeof r)return;return r}catch(e){return}})(this.apiKey)))&&(this.commitIdentityToConnector(e),!0)}commitIdentityToConnector(e){let t=this.identityStore.editIdentity();t.setDeviceId(e.deviceId),e.userId&&t.setUserId(e.userId),t.commit()}waitForConnectorIdentity(e){return lz(this,void 0,void 0,function*(){let t=this.identityStore.getIdentity();if(!t.userId&&!t.deviceId)return Promise.race([new Promise(e=>{let t=()=>{e(),this.identityStore.removeIdentityListener(t)};this.identityStore.addIdentityListener(t)}),new Promise((t,n)=>{let r=lH();if(!r)return void n("Timed out waiting for Amplitude Analytics SDK to initialize.");r(n,e,"Timed out waiting for Amplitude Analytics SDK to initialize.")})])})}}let lW=(()=>{let e=lM();return(null==e?void 0:e.fetch)?e.fetch.bind(e):void 0})()||function(e,t){return t=t||{},new Promise(function(n,r){var i=new XMLHttpRequest,o=[],s=[],a={},l=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(JSON.parse(i.responseText))},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:l,headers:{keys:function(){return o},entries:function(){return s},get:function(e){return a[e.toLowerCase()]},has:function(e){return e.toLowerCase()in a}}}};for(var u in i.open(t.method||"get",e,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(e,t,n){o.push(t=t.toLowerCase()),s.push([t,n]),a[t]=a[t]?a[t]+","+n:n}),n(l())},i.onerror=r,i.withCredentials="include"==t.credentials,t.headers)i.setRequestHeader(u,t.headers[u]);i.send(t.body||null)})};class lJ{constructor(e){this.client=e}request(e){return lz(this,void 0,void 0,function*(){return yield this.client.request(e.requestUrl,e.method,e.headers,null,e.timeoutMillis)})}}let lK={request:(e,t,n,r,i)=>((e,t)=>null==t||t<=0?e:new Promise(function(n,r){let i=lH();i&&i(function(){r(new lO(`Request timeout after ${t} milliseconds`))},t),e.then(n,r)}))(lz(void 0,void 0,void 0,function*(){let i=yield lW(e,{method:t,headers:n,body:r});return{status:i.status,body:yield i.text()}}),i)};!function(e){e[e.Disable=0]="Disable",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose"}(O||(O={})),function(e){e.LocalStorage="localStorage",e.InitialVariants="initialVariants"}(R||(R={})),function(e){e.LocalStorage="storage",e.InitialVariants="initial",e.SecondaryLocalStorage="secondary-storage",e.SecondaryInitialVariants="secondary-initial",e.FallbackInline="fallback-inline",e.FallbackConfig="fallback-config",e.LocalEvaluation="local-evaluation"}(N||(N={}));let l$=e=>!e||e===N.FallbackInline||e===N.FallbackConfig||e===N.SecondaryInitialVariants,lG={debug:!1,logLevel:O.Error,loggerProvider:null,instanceName:"$default_instance",fallbackVariant:{},initialVariants:{},initialFlags:void 0,source:R.LocalStorage,serverUrl:"https://api.lab.amplitude.com",flagsServerUrl:"https://flag.lab.amplitude.com",serverZone:"US",fetchTimeoutMillis:1e4,retryFetchOnFailure:!0,throwOnError:!1,automaticExposureTracking:!0,pollOnStart:!0,flagConfigPollingIntervalMillis:3e5,fetchOnStart:!0,automaticFetchOnAmplitudeIdentityChange:!1,userProvider:null,analyticsProvider:null,exposureTrackingProvider:null,httpClient:lK};var lX="1.23.1";class lQ{constructor(e,t){var n;this.isReady=new Promise(e=>{this.resolve=e}),this.config=e,this.client=t;let r=null!=(n=e.instanceName)?n:lG.instanceName;this.queue=new l0(r,512,e.internalPersistenceAllowed),this.cache=new lZ(r,e.internalPersistenceAllowed)}
1ready(){return this.integration?this.isReady:Promise.resolve()}setIntegration(e){this.integration&&this.integration.teardown&&this.integration.teardown(),this.integration=e,e.setup?this.integration.setup(this.config,this.client).then(()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()},()=>{this.queue.setTracker(this.integration.track.bind(e)),this.resolve()}):(this.queue.setTracker(this.integration.track.bind(e)),this.resolve())}getUser(){return this.integration?this.integration.getUser():{}}track(e,t){if(this.cache.shouldTrack(e,t)){let t=this.getExposureEvent(e);this.queue.push(t)}}getExposureEvent(e){var t,n,r;let i={eventType:"$exposure",eventProperties:e};return(null==(t=e.metadata)?void 0:t.exposureEvent)?i={eventType:null==(n=e.metadata)?void 0:n.exposureEvent,eventProperties:e}:(null==(r=e.metadata)?void 0:r.deliveryMethod)==="web"&&(i={eventType:"$impression",eventProperties:e}),i}}class lZ{constructor(e,t){this.persistenceAllowed=t,this.clearStoredOnReopen=!1,this.hasGatedEntries=!1,this.inMemoryCache={},this.identity={},this.storageKey=`EXP_sent_v3_${e}`}isGated(){return void 0!==this.persistenceAllowed&&!this.persistenceAllowed()}usableStorage(){if(this.isGated())return;void 0===this.isSessionStorageAvailable&&(this.isSessionStorageAvailable=l1());let e=lL();if(this.isSessionStorageAvailable&&e)return this.clearStoredOnReopen&&(this.clearStoredOnReopen=!1,e.removeItem(this.storageKey)),e}shouldTrack(e,t){var n,r;if((null==(n=e.metadata)?void 0:n.deliveryMethod)==="web")return!0;let i={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,i)||this.clearCache(),this.identity=i,this.loadCache();let o=e.flag_key in this.inMemoryCache,s=this.inMemoryCache[e.flag_key],a=null!=(r=e.variant)?r:null,l=!1;return(!o||(null!=s?s:null)!==a)&&(l=!0,this.inMemoryCache[e.flag_key]=a,this.isGated()&&(this.hasGatedEntries=!0)),this.storeCache(),l}clearCache(){this.inMemoryCache={},this.hasGatedEntries=!1;let e=this.usableStorage();e?e.removeItem(this.storageKey):this.isGated()&&(this.clearStoredOnReopen=!0)}identityEquals(e,t){return e.userId&&t.userId?e.userId===t.userId:!e.userId&&!t.userId&&e.deviceId===t.deviceId}loadCache(){let e=this.usableStorage();if(e){let t=e.getItem(this.storageKey),n=t?JSON.parse(t):{};this.hasGatedEntries?(this.inMemoryCache=Object.assign(Object.assign({},n),this.inMemoryCache),this.hasGatedEntries=!1):this.inMemoryCache=n}}storeCache(){let e=this.usableStorage();if(e)try{e.setItem(this.storageKey,JSON.stringify(this.inMemoryCache))}catch(e){}}}class l0{constructor(e,t=512,n){this.persistenceAllowed=n,this.inMemoryQueue=[],this.holdsGatedEvents=!1,this.storageKey=`EXP_unsent_${e}`,this.maxQueueSize=t}push(e){this.loadQueue(),this.inMemoryQueue.push(e),this.canPersist()||(this.holdsGatedEvents=!0),this.flush(),this.storeQueue()}setTracker(e){this.tracker=e;let t=lF();t&&(this.poller=t(()=>{this.loadFlushStore()},1e3)),this.loadFlushStore()}flush(){if(!this.tracker||0===this.inMemoryQueue.length)return;let e=0;for(;e<this.inMemoryQueue.length;e++)try{if(!this.tracker(this.inMemoryQueue[e]))break}catch(e){break}if(this.inMemoryQueue=this.inMemoryQueue.slice(e),0===this.inMemoryQueue.length&&this.poller){let e=lU();e&&e(this.poller),this.poller=void 0}}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}usableStorage(){if(!this.canPersist())return;void 0===this.isLocalStorageAvailable&&(this.isLocalStorageAvailable=(()=>{let e=lM();if(e)try{let t="EXP_test";return e.localStorage.setItem(t,t),e.localStorage.removeItem(t),!0}catch(e){}return!1})());let e=lD();return this.isLocalStorageAvailable&&e?e:void 0}loadQueue(){let e=this.usableStorage();if(e){let t=e.getItem(this.storageKey),n=t?JSON.parse(t):[];this.holdsGatedEvents?(this.inMemoryQueue=[...n,...this.inMemoryQueue],this.holdsGatedEvents=!1):this.inMemoryQueue=n}}storeQueue(){let e=this.usableStorage();if(e){if(0===this.inMemoryQueue.length)return void e.removeItem(this.storageKey);this.inMemoryQueue.length>this.maxQueueSize&&(this.inMemoryQueue=this.inMemoryQueue.slice(this.inMemoryQueue.length-this.maxQueueSize)),e.setItem(this.storageKey,JSON.stringify(this.inMemoryQueue))}}loadFlushStore(){this.loadQueue(),this.flush(),this.storeQueue()}}let l1=()=>{let e=lM();if(e)try{let t="EXP_test";return e.sessionStorage.setItem(t,t),e.sessionStorage.removeItem(t),!0}catch(e){}return!1};class l2{constructor(e,t=O.Error){this.logger=e,this.logLevel=t}error(e,...t){this.logLevel>=O.Error&&this.logger.error(e,...t)}warn(e,...t){this.logLevel>=O.Warn&&this.logger.warn(e,...t)}info(e,...t){this.logLevel>=O.Info&&this.logger.info(e,...t)}debug(e,...t){this.logLevel>=O.Debug&&this.logger.debug(e,...t)}verbose(e,...t){this.logLevel>=O.Verbose&&this.logger.verbose(e,...t)}}class l3{error(e,...t){console.error(e,...t)}warn(e,...t){console.warn(e,...t)}info(e,...t){console.info(e,...t)}debug(e,...t){console.debug(e,...t)}verbose(e,...t){console.debug(e,...t)}}class l4{constructor(){this.globalScope=lM()}get(e){var t;return null==(t=this.globalScope)?void 0:t.localStorage.getItem(e)}put(e,t){var n;null==(n=this.globalScope)||n.localStorage.setItem(e,t)}delete(e){var t;null==(t=this.globalScope)||t.localStorage.removeItem(e)}}class l6{constructor(e,t){this.namespace=e,this.storage=t}get(){return this.value}put(e){this.value=e}load(){let e=this.storage.get(this.namespace);e&&(this.value=JSON.parse(e))}store(){void 0===this.value?this.storage.delete(this.namespace):this.storage.put(this.namespace,JSON.stringify(this.value))}}class l5{constructor(e,t,n){this.cache={},this.namespace=e,this.storage=t,this.transformer=n}get(e){return this.cache[e]}getAll(){return Object.assign({},this.cache)}put(e,t){this.cache[e]=t}putAll(e){for(let t of Object.keys(e))this.cache[t]=e[t]}remove(e){delete this.cache[e]}clear(){this.cache={}}load(){let e,t=this.storage.get(this.namespace);try{e=JSON.parse(t)||{}}catch(e){return}let n={};for(let t of Object.keys(e))try{let r;(r=this.transformer?this.transformer(e[t]):e[t])&&(n[t]=r)}catch(e){}this.clear(),this.putAll(n)}store(e=this.cache){this.storage.put(this.namespace,JSON.stringify(e))}}let l8=e=>{if("string"==typeof e)return{key:e,value:e};if("object"==typeof e){let t=e.key,n=e.value,r=e.payload,i=e.metadata,o=e.expKey;i&&i.experimentKey?o=i.experimentKey:o&&((i=i||{}).experimentKey=o);let s={};return t?s.key=t:n&&(s.key=n),n&&(s.value=n),i&&(s.metadata=i),r&&(s.payload=r),o&&(s.expKey=o),s}};class l7{constructor(){this.globalScope=lM()}get(e){var t;return null==(t=this.globalScope)?void 0:t.sessionStorage.getItem(e)}put(e,t){var n;null==(n=this.globalScope)||n.sessionStorage.setItem(e,t)}delete(e){var t;null==(t=this.globalScope)||t.sessionStorage.removeItem(e)}}let l9=e=>null==e,ue=e=>!!l9(e)||e&&0===Object.keys(e).length,ut=e=>{var t;return(null==(t=null==e?void 0:e.metadata)?void 0:t.evaluationMode)==="local"};class un{constructor(e,t,n,r){this.started=!1,this.done=!1,this.attempts=e,this.min=t,this.max=n,this.scalar=r}start(e){return lz(this,void 0,void 0,function*(){if(this.started)throw Error("Backoff already started");this.started=!0,yield this.backoff(e,0,this.min)})}cancel(){this.done=!0;let e=(()=>{let e=lM();return(null==e?void 0:e.clearTimeout)?e.clearTimeout.bind(e):void 0})();e&&e(this.timeoutHandle)}backoff(e,t,n){return lz(this,void 0,void 0,function*(){if(this.done)return;let r=lH();r&&(this.timeoutHandle=r(()=>{lz(this,void 0,void 0,function*(){try{yield e()}catch(i){let r=t+1;if(r<this.attempts){let t=Math.min(n*this.scalar,this.max);yield this.backoff(e,r,t)}}})}
1,n))})}}let ur=e=>{var t,n;if(!e)return{};let r={user:e},i=lM();(null==i?void 0:i.location)&&(r.page={url:i.location.href});let o={};if(!e.groups)return r;for(let r of Object.keys(e.groups)){let i=e.groups[r];if(i.length>0&&i[0]){let s=i[0],a={group_name:s},l=null==(n=null==(t=e.group_properties)?void 0:t[r])?void 0:n[s];l&&Object.keys(l).length>0&&(a.group_properties=l),o[r]=a}}return Object.keys(o).length>0&&(r.groups=o),delete r.user.groups,delete r.user.group_properties,r},ui=e=>null==e?{}:"string"==typeof e?{key:e,value:e}:e,uo=e=>{let t;if(!e)return{};e.metadata&&(t=e.metadata.experimentKey);let n={};return e.key&&(n.key=e.key),e.value&&(n.value=e.value),e.payload&&(n.payload=e.payload),t&&(n.expKey=t),e.metadata&&(n.metadata=e.metadata),n};class us{constructor(e){this.setProperties={},this.unsetProperties={},this.analyticsProvider=e}track(e){this.setProperties[e.key]!=e.variant.value&&(this.setProperties[e.key]=e.variant.value,delete this.unsetProperties[e.key],this.analyticsProvider.track(e))}setUserProperty(e){this.setProperties[e.key]!=e.variant.value&&this.analyticsProvider.setUserProperty(e)}unsetUserProperty(e){this.unsetProperties[e.key]||(this.unsetProperties[e.key]="unset",delete this.setProperties[e.key],this.analyticsProvider.unsetUserProperty(e))}}class ua{constructor(e){this.tracked={},this.identity={},this.exposureTrackingProvider=e}track(e,t){let n={userId:null==t?void 0:t.user_id,deviceId:null==t?void 0:t.device_id};this.identityEquals(this.identity,n)||(this.tracked={}),this.identity=n;let r=e.flag_key in this.tracked,i=this.tracked[e.flag_key];r&&i===e.variant||(this.tracked[e.flag_key]=e.variant,this.exposureTrackingProvider.track(e))}identityEquals(e,t){return e.userId===t.userId&&e.deviceId===t.deviceId}}class ul{constructor(e,t){var n,r,i,o,s;let a;this.engine=new li,this.isRunning=!1,this.apiKey=e,t=(e=>{if(!e||"object"!=typeof e)return{};let t={};for(let[n,r]of Object.entries(e))l9(r)||(t[n]=r);return t})(t),this.config=Object.assign(Object.assign(Object.assign({},lG),t),{serverUrl:(null==t?void 0:t.serverUrl)||((null==(n=null==t?void 0:t.serverZone)?void 0:n.toLowerCase())==="eu"?"https://api.lab.eu.amplitude.com":lG.serverUrl),flagsServerUrl:(null==t?void 0:t.flagsServerUrl)||((null==(r=null==t?void 0:t.serverZone)?void 0:r.toLowerCase())==="eu"?"https://flag.lab.eu.amplitude.com":lG.flagsServerUrl),flagConfigPollingIntervalMillis:t.flagConfigPollingIntervalMillis<6e4?6e4:null!=(i=t.flagConfigPollingIntervalMillis)?i:lG.flagConfigPollingIntervalMillis}),this.logger=new l2(this.config.loggerProvider||new l3,ul.getLogLevel(t));let l=null==(o=this.config)?void 0:o.internalInstanceNameSuffix;if(this.isWebExperiment="web"===l,this.poller=new lj(()=>lz(this,void 0,void 0,function*(){try{yield this.doFlags()}catch(e){this.logger.info(e)}}),this.config.flagConfigPollingIntervalMillis),this.config.initialVariants)for(let e in this.config.initialVariants)this.config.initialVariants[e]=l8(this.config.initialVariants[e]);this.config.userProvider&&(this.userProvider=this.config.userProvider),this.config.analyticsProvider&&(this.analyticsProvider=new us(this.config.analyticsProvider)),this.config.exposureTrackingProvider&&(this.userSessionExposureTracker=new ua(this.config.exposureTrackingProvider)),this.integrationManager=new lQ(this.config,this);let u=new lJ(this.config.httpClient||lK);this.flagApi=new lN(this.apiKey,this.config.flagsServerUrl,u),this.evaluationApi=new lR(this.apiKey,this.config.serverUrl,u);let c=l?`${this.config.instanceName}-${String(l)}`:this.config.instanceName;if(this.isWebExperiment){let e=null==(s=this.config)?void 0:s.internalCacheStorage;a=null!=e?e:new l7}else a=new l4;this.variants=((e,t,n)=>{let r=e.substring(e.length-6);return new l5(`amp-exp-${t}-${r}`,n,l8)})(this.apiKey,c,a),this.flags=((e,t,n=new l4)=>{let r=e.substring(e.length-6);return new l5(`amp-exp-${t}-${r}-flags`,n)})(this.apiKey,c,a),this.fetchVariantsOptions=((e,t,n=new l4)=>{let r=e.substring(e.length-6);return new l6(`amp-exp-${t}-${r}-variants-options`,n)})(this.apiKey,c,a);try{this.flags.load(),this.variants.load(),this.fetchVariantsOptions.load()}catch(e){}this.mergeInitialFlagsWithStorage()}start(e){return lz(this,void 0,void 0,function*(){var t;if(!this.isRunning){this.isRunning=!0,this.setUser(e);try{let n=this.doFlags();null==(t=this.config.fetchOnStart)||t?yield Promise.all([this.fetch(e),n]):yield n}catch(e){if(this.config.throwOnError)throw e}this.config.pollOnStart&&this.poller.start()}})}stop(){this.isRunning&&(this.poller.stop(),this.isRunning=!1)}fetch(){return lz(this,arguments,void 0,function*(e=this.user,t){this.setUser(e||{});try{yield this.fetchInternal(e,this.config.fetchTimeoutMillis,this.config.retryFetchOnFailure,t)}catch(e){if(this.config.throwOnError)throw e;e instanceof lO?this.logger.debug(e):this.logger.error(e)}return this})}variant(e,t){var n,r;if(!this.apiKey)return{value:void 0};let i=this.variantAndSource(e,t);return this.config.automaticExposureTracking&&this.exposureInternal(e,i),this.logger.debug(`[Experiment] variant for ${e} is ${(null==(n=i.variant)?void 0:n.key)||(null==(r=i.variant)?void 0:r.value)}`),i.variant||{}}exposure(e){let t=this.variantAndSource(e);this.exposureInternal(e,t)}all(){if(!this.apiKey)return{};let e=this.evaluate();for(let t in e)ut(this.flags.get(t))||delete e[t];return Object.assign(Object.assign(Object.assign({},this.secondaryVariants()),this.sourceVariants()),e)}clear(){this.variants.clear();try{this.variants.store()}catch(e){}}getUser(){var e;if(!this.user)return this.user;if(null==(e=this.user)||!e.user_properties)return Object.assign({},this.user);{let e=Object.assign({},this.user.user_properties);return Object.assign(Object.assign({},this.user),{user_properties:e})}}setUser(e){var t;if(!e){this.user=null;return}if(null==(t=this.user)?void 0:t.user_properties){let t=Object.assign({},e.user_properties);this.user=Object.assign(Object.assign({},e),{user_properties:t})}else this.user=Object.assign({},e)}getUserProvider(){return this.userProvider}setUserProvider(e){return this.userProvider=e,this}mergeInitialFlagsWithStorage(){this.config.initialFlags&&JSON.parse(this.config.initialFlags).forEac
1h(e=>{this.flags.get(e.key)||this.flags.put(e.key,e)})}evaluate(e){let t=this.addContext(this.user),n=lo(this.flags.getAll(),e),r=ur(t),i=this.engine.evaluate(r,n),o={};for(let e of Object.keys(i))o[e]=uo(i[e]);return o}getEvaluationTraces(e){let t=this.addContext(this.user),n=lo(this.flags.getAll(),e),r=ur(t),{traces:i}=this.engine.evaluateWithTraces(r,n);return i}variantAndSource(e,t){let n={};this.config.source===R.LocalStorage?n=this.localStorageVariantAndSource(e,t):this.config.source===R.InitialVariants&&(n=this.initialVariantsVariantAndSource(e,t));let r=this.flags.get(e);return(ut(r)||!n.variant&&r)&&(n=this.localEvaluationVariantAndSource(e,r,t)),n}localEvaluationVariantAndSource(e,t,n){var r;let i={},o=this.evaluate([t.key])[e],s=N.LocalEvaluation,a=null==(r=null==o?void 0:o.metadata)?void 0:r.default;if(!l9(o)&&!a)return{variant:ui(o),source:s,hasDefaultVariant:!1};if(a&&(i={variant:ui(o),source:s,hasDefaultVariant:!0}),!l9(n))return{variant:ui(n),source:N.FallbackInline,hasDefaultVariant:i.hasDefaultVariant};let l=this.config.initialVariants[e];if(!l9(l))return{variant:ui(l),source:N.SecondaryInitialVariants,hasDefaultVariant:i.hasDefaultVariant};let u=ui(this.config.fallbackVariant),c={variant:u,source:N.FallbackConfig,hasDefaultVariant:i.hasDefaultVariant};return ue(u)?i:c}localStorageVariantAndSource(e,t){var n;let r={},i=this.variants.get(e),o=null==(n=null==i?void 0:i.metadata)?void 0:n.default;if(!l9(i)&&!o)return{variant:ui(i),source:N.LocalStorage,hasDefaultVariant:!1};if(o&&(r={variant:ui(i),source:N.LocalStorage,hasDefaultVariant:!0}),!l9(t))return{variant:ui(t),source:N.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};let s=this.config.initialVariants[e];if(!l9(s))return{variant:ui(s),source:N.SecondaryInitialVariants,hasDefaultVariant:r.hasDefaultVariant};let a=ui(this.config.fallbackVariant),l={variant:a,source:N.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return ue(a)?r:l}initialVariantsVariantAndSource(e,t){var n;let r={},i=this.config.initialVariants[e];if(!l9(i))return{variant:ui(i),source:N.InitialVariants,hasDefaultVariant:!1};let o=this.variants.get(e),s=null==(n=null==o?void 0:o.metadata)?void 0:n.default;if(!l9(o)&&!s)return{variant:ui(o),source:N.LocalStorage,hasDefaultVariant:!1};if(s&&(r={variant:ui(o),source:N.LocalStorage,hasDefaultVariant:!0}),!l9(t))return{variant:ui(t),source:N.FallbackInline,hasDefaultVariant:r.hasDefaultVariant};let a=ui(this.config.fallbackVariant),l={variant:a,source:N.FallbackConfig,hasDefaultVariant:r.hasDefaultVariant};return ue(a)?r:l}fetchInternal(e,t,n,r){return lz(this,void 0,void 0,function*(){var i;if(!this.apiKey)throw Error("Experiment API key is empty");
1this.logger.debug(`[Experiment] Fetch all: retry=${String(n)}`),n&&this.stopRetries();try{let n=yield this.doFetch(e,t,Object.assign({trackingOption:null==(i=this.fetchVariantsOptions.get())?void 0:i.trackingOption},r));return yield this.storeVariants(n,r),n}catch(t){throw n&&this.shouldRetryFetch(t)&&this.startRetries(e,r),t}})}setTracksAssignment(e){return lz(this,void 0,void 0,function*(){this.fetchVariantsOptions.put(Object.assign(Object.assign({},this.fetchVariantsOptions.get()||{}),{trackingOption:e?"track":"no-track"})),this.fetchVariantsOptions.store()})}cleanUserPropsForFetch(e){let t=Object.assign({},e);return delete t.cookie,t}doFetch(e,t,n){return lz(this,void 0,void 0,function*(){e=yield this.addContextOrWait(e),e=this.cleanUserPropsForFetch(e),this.logger.debug("[Experiment] Fetch variants for user: ",e);let r=yield this.evaluationApi.getVariants(e,Object.assign({timeoutMillis:t},n)),i={};for(let e of Object.keys(r))i[e]=uo(r[e]);return this.logger.debug("[Experiment] Received variants: ",i),i})}doFlags(){return lz(this,void 0,void 0,function*(){try{let e;this.isWebExperiment&&(e=yield this.addContextOrWait(this.getUser()));let t=yield this.flagApi.getFlags({libraryName:"experiment-js-client",libraryVersion:lX,timeoutMillis:this.config.fetchTimeoutMillis,deliveryMethod:this.isWebExperiment?"web":void 0,user:(null==e?void 0:e.user_id)||(null==e?void 0:e.device_id)?{user_id:null==e?void 0:e.user_id,device_id:null==e?void 0:e.device_id}:void 0});this.flags.clear(),this.flags.putAll(t)}catch(e){if(e instanceof lO){if(this.logger.debug(e),this.config.throwOnError)throw e}else throw e}try{this.flags.store()}catch(e){}this.mergeInitialFlagsWithStorage()})}storeVariants(e,t){return lz(this,void 0,void 0,function*(){let n=t&&t.flagKeys?t.flagKeys:[];for(let t in 0===n.length&&this.variants.clear(),e)n=n.filter(e=>e!==t),this.variants.put(t,e[t]);for(let e of n)this.variants.remove(e);try{this.variants.store()}catch(e){}this.logger.debug("[Experiment] Stored variants: ",e)})}startRetries(e,t){return lz(this,void 0,void 0,function*(){this.logger.debug("[Experiment] Retry fetch"),this.retriesBackoff=new un(8,500,1e4,1.5),this.retriesBackoff.start(()=>lz(this,void 0,void 0,function*(){yield this.fetchInternal(e,1e4,!1,t)}))})}stopRetries(){this.retriesBackoff&&this.retriesBackoff.cancel()}addContext(e){var t;let n=null==(t=this.userProvider)?void 0:t.getUser(),r=this.integrationManager.getUser(),i=Object.assign(Object.assign(Object.assign({},null==n?void 0:n.user_properties),r.user_properties),null==e?void 0:e.user_properties);return Object.assign(Object.assign(Object.assign(Object.assign({library:`experiment-js-client/${lX}`},n),r),e),{user_properties:i})}addContextOrWait(e){return lz(this,void 0,void 0,function*(){return yield this.integrationManager.ready(),this.addContext(e)})}sourceVariants(){return this.config.source==R.LocalStorage?this.variants.getAll():this.config.source==R.InitialVariants?this.config.initialVariants:void 0}secondaryVariants(){return this.config.source==R.LocalStorage?this.config.initialVariants:this.config.source==R.InitialVariants?this.variants.getAll():void 0}exposureInternal(e,t){var n,r,i,o,s,a,l,u,c;if(!(null==(i=null==(r=null==(n=t.variant)?void 0:n.metadata)?void 0:r.trackExposure)||i))return;this.legacyExposureInternal(e,t.variant,t.source);let d={flag_key:e},h=l$(t.source);if(h&&!t.hasDefaultVariant)return;(null==(o=t.variant)?void 0:o.expKey)&&(d.experiment_key=null==(s=t.variant)?void 0:s.expKey);let f=null==(a=t.variant)?void 0:a.metadata;if(h||(null==f?void 0:f.default)||((null==(l=t.variant)?void 0:l.key)?d.variant=t.variant.key:(null==(u=t.variant)?void 0:u.value)&&(d.variant=t.variant.value)),f&&(d.metadata=f),this.isWebExperiment&&(d.time=Date.now()),this.isWebExperiment){let e=lM();if(null==e?void 0:e.location)try{let t=e.location.href;d.metadata.url=t.split("?")[0]||""}catch(e){}}let g=this.addContext(this.getUser());null==(c=this.userSessionExposureTracker)||c.track(d,g),this.integrationManager.track(d,g)}legacyExposureInternal(e,t,n){var r,i,o,s,a;if(this.analyticsProvider){let l=((e,t,n,r)=>{let i=null==n?void 0:n.value,o=`[Experiment] ${t}`;return{name:"[Experiment] Exposure",user:e,key:t,variant:n,userProperty:o,properties:{key:t,variant:i,source:r},userProperties:{[o]:i}}})(this.addContext(this.getUser()),e,t,n);!l$(n)&&(null==t?void 0:t.value)?(null==t?void 0:t.value)&&(null==(s=null==(o=this.analyticsProvider)?void 0:o.setUserProperty)||s.call(o,l),null==(a=this.analyticsProvider)||a.track(l)):null==(i=null==(r=this.analyticsProvider)?void 0:r.unsetUserProperty)||i.call(r,l)}}static getLogLevel(e){var t;return!0===e.debug?O.Debug:null!=(t=e.logLevel)?t:O.Error}shouldRetryFetch(e){return!(e instanceof lA)||e.statusCode<400||e.statusCode>=500||429===e.statusCode}
1addPlugin(e){"integration"===e.type&&this.integrationManager.setIntegration(e)}}class uu{constructor(e,t,n){var r,i,o;this.globalScope=lM(),this.userAgent=void 0!==(null==(r=this.globalScope)?void 0:r.navigator)?null==(i=this.globalScope)?void 0:i.navigator.userAgent:void 0,this.ua=new lq.UAParser(this.userAgent).getResult(),this.localStorage=new l4,this.sessionStorage=new l7,this.userProvider=e,this.apiKey=t,this.persistenceAllowed=n,this.storageKey=`EXP_${null==(o=this.apiKey)?void 0:o.slice(0,10)}_DEFAULT_USER_PROVIDER`}canPersist(){return!this.persistenceAllowed||this.persistenceAllowed()}getUser(){var e,t,n,r,i;let o=(null==(e=this.userProvider)?void 0:e.getUser())||{};return Object.assign({language:this.getLanguage(),platform:"Web",os:this.getOs(this.ua),device_model:this.getDeviceModel(this.ua),device_category:null!=(n=null==(t=this.ua.device)?void 0:t.type)?n:"desktop",referring_url:null==(i=null==(r=this.globalScope)?void 0:r.document)?void 0:i.referrer.replace(/\/$/,""),cookie:this.getCookie(),browser:this.getBrowser(this.ua),landing_url:this.getLandingUrl(),first_seen:this.getFirstSeen(),url_param:this.getUrlParam(),user_agent:this.userAgent},o)}getLanguage(){return"undefined"!=typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""}getOs(e){var t,n;return[null==(t=e.browser)?void 0:t.name,null==(n=e.browser)?void 0:n.major].filter(e=>null!=e).join(" ")}getDeviceModel(e){var t;return null==(t=e.os)?void 0:t.name}getBrowser(e){var t;let n=null==(t=e.browser)?void 0:t.name;return(null==n?void 0:n.includes("Chrom"))&&(n="Chrome"),(null==n?void 0:n.includes("Firefox"))&&(n="Firefox"),(null==n?void 0:n.includes("Safari"))&&(n="Safari"),(null==n?void 0:n.includes("Edge"))&&(n="Edge"),(null==n?void 0:n.includes("Opera"))&&(n="Opera"),n}getCookie(){var e,t,n,r,i;if(this.canPersist()&&(null==(t=null==(e=this.globalScope)?void 0:e.document)?void 0:t.cookie))return Object.fromEntries(null==(i=null==(r=null==(n=this.globalScope)?void 0:n.document)?void 0:r.cookie)?void 0:i.split("; ").map(e=>e.split("=")))}getLandingUrl(){var e;if(!this.canPersist())return null!=this.gatedLandingUrl||(this.gatedLandingUrl=this.getCurrentUrl()),this.gatedLandingUrl;try{let t=JSON.parse(this.sessionStorage.get(this.storageKey)||"{}");return t.landing_url||(t.landing_url=null!=(e=this.gatedLandingUrl)?e:this.getCurrentUrl(),this.sessionStorage.put(this.storageKey,JSON.stringify(t))),t.landing_url}catch(e){return}}getCurrentUrl(){var e,t;return null==(t=null==(e=this.globalScope)?void 0:e.location)?void 0:t.href.replace(/\/$/,"")}getFirstSeen(){if(!this.canPersist())return(Date.now()/1e3).toString();try{let e=JSON.parse(this.localStorage.get(this.storageKey)||"{}");return e.first_seen||(e.first_seen=(Date.now()/1e3).toString(),this.localStorage.put(this.storageKey,JSON.stringify(e))),e.first_seen}catch(e){return}}getUrlParam(){var e;if(!this.globalScope)return;let t={};try{for(let[n,r]of new URL(this.globalScope.location.href).searchParams)t[n]=[...null!=(e=t[n])?e:[],...r.split(",")]}catch(e){return}return Object.entries(t).reduce((e,[t,n])=>(e[t]=1==n.length?n[0]:n,e),{})}}let uc=lM();uc&&(uc.experimentInstances={});let ud=null!=(M=null==uc?void 0:uc.experimentInstances)?M:{},uh=e=>(null==e?void 0:e.instanceName)||lG.instanceName;var uf=function(){function e(t){this.name=e.pluginName,this.config=t}return e.prototype.setup=function(e,t){var n,r;return(0,D.sH)(this,void 0,void 0,function(){var t;return(0,D.YH)(this,function(i){var o;return t=(null==(n=this.config)?void 0:n.instanceName)!==void 0||void 0===e.instanceName?this.config:(0,D.Cl)((0,D.Cl)({},this.config),{instanceName:e.instanceName}),this.experiment=((e,t,n)=>{let r=((e,t)=>{let n=uh(t),r=null==t?void 0:t.internalInstanceNameSuffix;return r?`${n}.${e}.${String(r)}`:`${n}.${e}`})(e,t),i=ud[r];return i||(i=((e,t)=>new ul(e,Object.assign(Object.assign({},t),{userProvider:new uu(null==t?void 0:t.userProvider,e,null==t?void 0:t.internalPersistenceAllowed)})))(e,t),n&&i.addPlugin(n()),ud[r]=i),i})(o=(null==(r=this.config)?void 0:r.deploymentKey)||e.apiKey,t,()=>new lV(o,eh.getInstance(uh(t)),1e4)),[2]})})},e.pluginName="@amplitude/experiment-analytics-plugin",e}(),ug=function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:uv(),platform:"Web",os:void 0,deviceModel:void 0}},e}(),uv=function(){return"u">typeof navigator&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},up=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}(),um=function(){return(um=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 uy(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 ub(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}var uS=function(e,t){var n,r,i=typeof e;if(i!==typeof t)return!1;try{for(var o=uy(["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 a=Array.isArray(e),l=Array.isArray(t);if(a!==l)return!1;if(a&&l){for(var u=0;u<e.length;u++)if(!uS(e[u],t[u]))return!1}else{if(!uS(Object.keys(e).sort(),Object.keys(t).sort()))return!1;var c=!0;return Object.keys(e).forEach(function(n){uS(e[n],t[n])||(c=!1)}),c}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 uw=function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var e=this,t=um({},this.identity.userProperties),n=um(um({},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,a,l=n.userProperties||{};try{for(var u=uy(Object.entries(e)),c=u.next();!c.done;c=u.next()){var d=ub(c.value,2),h=d[0],f=d[1];switch(h){case"$set":try{for(var g=(i=void 0,uy(Object.entries(f))),v=g.next();!v.done;v=g.next()){var p=ub(v.value,2),m=p[0],y=p[1];l[m]=y}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=g.return)&&o.call(g)}finally{if(i)throw i.error}}break;case"$unset":try{for(var b=(s=void 0,uy(Object.keys(f))),S=b.next();!S.done;S=b.next()){var m=S.value;delete l[m]}}catch(e){s={error:e}}finally{try{S&&!S.done&&(a=b.return)&&a.call(b)}finally{if(s)throw s.error}}break;case"$clearAll":l={}}}}catch(e){t={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(t)throw t.error}}return n.userProperties=l,this},commit:function(){return e.setIdentity(n),this}}},e.prototype.getIdentity=function(){return um({},this.identity)},e.prototype.setIdentity=function(e){var t=um({},this.identity);this.identity=um({},e),uS(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}(),uE="u">typeof globalThis?globalThis:"u">typeof window?window:self,uI=function(){function e(){this.identityStore=new uw,this.eventBridge=new up,this.applicationContextProvider=new ug}return e.getInstance=function(t){return uE.analyticsConnectorInstances||(uE.analyticsConnectorInstances={}),uE.analyticsConnectorInstances[t]||(uE.analyticsConnectorInstances[t]=new e),uE.analyticsConnectorInstances[t]},e}(),uk=["boot"],uC=Symbol.for("amplitude-engagement-plugin-caller"),uT=(e=>(e.Local="https://local.amplitude.com:3010/",e.Staging="https://apps.stag2.amplitude.com/",e.Production="https://app.amplitude.com/",e.ProductionEU="https://app.eu.amplitude.com/",e))(uT||{}),u_=((e=>{if("u">typeof window&&window.opener)for(let t of Object.values(uT))window.opener.postMessage({message:e},t)})("ENGAGEMENT_SNIPPET"),function(e){var t,n,r,i,o,s,a,l,u,c,d;let h="u">typeof window?window.engagement:void 0,f=!1,g={_q:null!=(t=null==h?void 0:h._q)?t:[],_configuration:{apiKey:null!=(r=null==(n=null==h?void 0:h._configuration)?void 0:n.apiKey)?r:"",serverUrl:null==(i=null==h?void 0:h._configuration)?void 0:i.serverUrl,chatUrl:null==(o=null==h?void 0:h._configuration)?void 0:o.chatUrl,mediaUrl:null==(s=null==h?void 0:h._configuration)?void 0:s.mediaUrl,serverZone:null!=(l=null==(a=null==h?void 0:h._configuration)?void 0:a.serverZone)?l:"US",autoRefreshIntervalSeconds:null==(u=null==h?void 0:h._configuration)?void 0:u.autoRefreshIntervalSeconds,integrations:null==(c=null==h?void 0:h._configuration)?void 0:c.integrations,options:{...null==(d=null==h?void 0:h._configuration)?void 0:d.options}},init(t,n){var r,i,o,s;let a;if(g._configuration.apiKey)return void console.log("Engagement SDK has already been initialized. Ignoring additional init call.");if((null==n?void 0:n.skip)===!0){console.log("Engagement SDK init skipped via `skip: true`. The SDK bundle will not be loaded."),f=!0;return}if(f&&(g._q.length=0),f=!1,null!=n&&n.useEngagementDomain){let e=(null!=(r=n.serverZone)?r:g._configuration.serverZone)==="EU",t="amplitudeengagement.com";n.serverUrl||(n.serverUrl=e?`https://gs.eu.${t}`:`https://gs.${t}`),n.chatUrl||(n.chatUrl=e?`https://houston-chat.eu.${t}`:`https://houston-chat.${t}`),n.mediaUrl||(n.mediaUrl=e?`https://engagement-static.eu.${t}`:`https://engagement-static.${t}`),n.cdnUrl||(n.cdnUrl=e?`https://cdn.eu.${t}`:`https://cdn.${t}`)}if(g._configuration={...g._configuration,...n,apiKey:t,options:{splitting:!0,...g._configuration.options,...null==n?void 0:n.options}},null!=(o=null==(i=g._configuration)?void 0:i.options)&&o.logger&&g._configuration.options.logger.enable(null!=(s=g._configuration.options.logLevel)?s:2),null!=n&&n.cdnUrl)a=g._configuration.options.splitting?`${n.cdnUrl}/engagement-browser/prod/split/index.js`:n.cdnUrl+"/engagement-browser/prod/index.min.js.gz";else{let e="EU"===g._configuration.serverZone?"https://cdn.eu.amplitude.com":"https://cdn.amplitude.com";a=g._configuration.options.splitting?`${e}/engagement-browser/prod/split/index.js`:`${e}/engagement-browser/prod/index.min.js.gz`}let l=null,u=()=>{if(f=!0,l&&(clearTimeout(l),l=null),g._q&&g._q.length>0)for(console.warn(`Engagement SDK failed to load within ${c}
1ms. Resolving pending calls gracefully.`);g._q.length>0;){let e=g._q.shift();if(!e)continue;let t=e[0],n=uk.includes(t);if(console.warn(`Engagement SDK method '${t}' still in queue (isAsyncMethod=${n}); attempting to resolve as no-op.`),n&&e[1]instanceof Function&&e[2]instanceof Function){let n=e[1];console.warn(`Engagement SDK method '${t}' resolved as no-op due to script loading failure`),n(void 0)}}};e(a,g._configuration.options.splitting?"module":void 0,null==n?void 0:n.nonce,u);let c=1e4;l=setTimeout(()=>{u()},1e4)},plugin(e){let t=g.init,n=null==e?void 0:e.token,r=(null==e?void 0:e.skip)===!0,i=(e,t,r)=>{let i=r.getIdentity(),o="function"==typeof n?n():n;return{user_id:e.getUserId(),device_id:e.getDeviceId(),version:t.appVersion,user_properties:i.userProperties,getSessionId:e.getSessionId,...o?{token:o}:{}}};return{name:"@amplitude/engagement-browser",type:"enrichment",async setup(n,o){var s;if(r)return void t(n.apiKey,{skip:!0});let a=null!=(s=n.instanceName)?s:"$default_instance",l=uI.getInstance(a).identityStore;g._configuration._installedViaPlugin=!0,t(n.apiKey,{serverZone:n.serverZone,...e,options:{logLevel:n.logLevel,logger:n.loggerProvider,...null==e?void 0:e.options}});let u=[{track:e=>{o.track(e)}}];await window.engagement.boot({user:()=>i(o,n,l),integrations:u},uC),l.addIdentityListener(e=>{var t,r,s,a;if(!(null!=(t=window.engagement)&&t._.user)||!(null!=(r=window.engagement)&&r._analytics.hasBooted))return void console.warn("Engagement SDK not booted. Ignoring identity change.");(null==(a=null==(s=window.engagement)?void 0:s._.user)?void 0:a.user_id)!==e.userId?(window.engagement.shutdown(uC),window.engagement.boot({user:()=>i(o,n,l),integrations:u},uC)):window.engagement._setUserProperties(e.userProperties)})},execute:async e=>(r||window.engagement.forwardEvent(e),e)}}};return new Proxy(g,{get:function(e,t){return t in g?g[t]:"then"!==t?"gs"===t||"rc"===t||"assistant"===t?new Proxy({},{get:function(e,n){return function(){let e=Array.from(arguments),r=`${t}.${n}`;e.unshift(r),g._q.push(e)}}}):uk.includes(t)?function(){let e=Array.prototype.slice.call(arguments);return new Promise((n,r)=>{e.unshift(t,n,r),g._q.push(e),f&&n(void 0)})}:function(){let e=Array.prototype.slice.call(arguments);e.unshift(t),g._q.push(e)}:void 0}})}((e,t,n,r)=>(function(e,t,n,r){for(let i of e){let e=document.createElement("script");e.src=i,e.id="engagement-sdk-bundle",n&&e.setAttribute("nonce",n),t&&e.setAttribute("type",t),r&&(e.onerror=r);let o=document.getElementsByTagName("head")[0];o&&o.appendChild(e)}})([e||"https://cdn.amplitude.com/engagement-browser/prod/index.min.js.gz"],t,n,r))),ux=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,D.C6)(t,e),t.prototype.sessionReplay=function(){return this._sessionReplay},t.prototype.experiment=function(){if(void 0!==this.config){var e=this.plugins(uf);return 0===e.length?void this.config.loggerProvider.debug("".concat(uf.pluginName," plugin is not found.")):1===e.length?e[0].experiment:void this.config.loggerProvider.debug("Multiple instances of ".concat(uf.pluginName," are found."))}},t.prototype.initAll=function(t,n){return(0,D.sH)(this,void 0,void 0,function(){var r=this;return(0,D.YH)(this,function(i){return this._initAllPromise||(this._initAllPromise=(0,D.sH)(r,void 0,void 0,function(){var r,i;return(0,D.YH)(this,function(o){switch(o.label){case 0:return r={serverZone:null==n?void 0:n.serverZone,instanceName:null==n?void 0:n.instanceName},e.prototype.add.call(this,{type:"enrichment",name:"@amplitude/unified-library-plugin",execute:function(e){var t;return(0,D.sH)(this,void 0,void 0,function(){return(0,D.YH)(this,function(n){return e.library="".concat("amplitude-ts-unified","/").concat("1.1.38","-").concat(null!=(t=e.library)?t:""),[2,e]})})}}),[4,e.prototype.init.call(this,t,(0,D.Cl)((0,D.Cl)({},null==n?void 0:n.analytics),r)).promise];case 1:return o.sent(),[4,e.prototype.add.call(this,new a6((0,D.Cl)((0,D.Cl)({},null==n?void 0:n.sessionReplay),r))).promise];case 2:return o.sent(),[4,e.prototype.add.call(this,new uf((0,D.Cl)((0,D.Cl)({},null==n?void 0:n.experiment),r))).promise];case 3:let s;return o.sent(),void 0===(i=this.plugin(a6.pluginName))?this.config.loggerProvider.debug("".concat(a6.pluginName," plugin is not found.")):this._sessionReplay=i.sessionReplay,[4,e.prototype.add.call(this,(s=(0,D.Cl)((0,D.Cl)({},null==n?void 0:n.engagement),r),"u">typeof window&&!window.engagement&&(window.engagement=u_),u_.plugin(s))).promise];case 4:return o.sent(),[2]}})}).finally(function(){r._initAllPromise=void 0})),[2,this._initAllPromise]})})},t.prototype.init=function(t,n,r){return void 0===t&&(t=""),e.prototype.init.call(this,t,n,r)},t}(oX);let uP=function(){var e=new ux;return{_setDiagnosticsSampleRate:e$(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",eW(e),eK(e,["config"])),experiment:e$(e.experiment.bind(e),"experiment",eW(e),eK(e,["config"])),sessionReplay:e$(e.sessionReplay.bind(e),"sessionReplay",eW(e),eK(e,["config"])),initAll:e$(e.initAll.bind(e),"initAll",eW(e),eK(e,["config"])),init:e$(e.init.bind(e),"init",eW(e),eK(e,["config"])),add:e$(e.add.bind(e),"add",eW(e),eK(e,["config.apiKey","timeline.plugins"])),remove:e$(e.remove.bind(e),"remove",eW(e),eK(e,["config.apiKey","timeline.plugins"])),track:e$(e.track.bind(e),"track",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),logEvent:e$(e.logEvent.bind(e),"logEvent",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),identify:e$(e.identify.bind(e),"identify",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),groupIdentify:e$(e.groupIdentify.bind(e),"groupIdentify",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),setGroup:e$(e.setGroup.bind(e),"setGroup",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),revenue:e$(e.revenue.bind(e),"revenue",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),flush:e$(e.flush.bind(e),"flush",eW(e),eK(e,["config.apiKey","timeline.queue.length"])),getUserId:e$(e.getUserId.bind(e),"getUserId",eW(e),eK(e,["config","config.userId"])),setUserId:e$(e.setUserId.bind(e),"setUserId",eW(e),eK(e,["config","config.userId"])),getDeviceId:e$(e.getDeviceId.bind(e),"getDeviceId",eW(e),eK(e,["config","config.deviceId"])),setDeviceId:e$(e.setDeviceId.bind(e),"setDeviceId",eW(e),eK(e,["config","config.deviceId"])),reset:e$(e.reset.bind(e),"reset",eW(e),eK(e,["config","config.userId","config.deviceId"])),getSessionId:e$(e.getSessionId.bind(e),"getSessionId",eW(e),eK(e,["config"])),setSessionId:e$(e.setSessionId.bind(e),"setSessionId",eW(e),eK(e,["config"])),extendSession:e$(e.extendSession.bind(e),"extendSession",eW(e),eK(e,["config"])),setOptOut:e$(e.setOptOut.bind(e),"setOptOut",eW(e),eK(e,["config"])),getOptOut:e$(e.getOptOut.bind(e),"getOptOut",eW(e),eK(e,["config"])),setTransport:e$(e.setTransport.bind(e),"setTransport",eW(e),eK(e,["config"])),getIdentity:e$(e.getIdentity.bind(e),"getIdentity",eW(e),eK(e,["config"])),setIdentity:e$(e.setIdentity.bind(e),"setIdentity",eW(e),eK(e,["config","config.userId","config.deviceId"]))}}();uP._setDiagnosticsSampleRate;var uA=uP.initAll;uP.experiment,uP.sessionReplay,uP.add,uP.extendSession,uP.flush,uP.getDeviceId,uP.getIdentity,uP.getOptOut,uP.getSessionId,uP.getUserId,uP.groupIdentify,uP.identify,uP.logEvent,uP.remove,uP.reset,uP.revenue,uP.setDeviceId,uP.setGroup,uP.setIdentity,uP.setOptOut,uP.setSessionId,uP.setTransport,uP.setUserId,uP.track},71450:(e,t,n)=>{"use strict";n.d(t,{C6:()=>i,Cl:()=>o,Ju:()=>u,Tt:()=>s,YH:()=>l,fX:()=>d,sH:()=>a,zs:()=>c});var r=function(e,t){return(r=Object.setPrototypeOf||({__proto__:[]}
1)instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function i(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function s(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function a(e,t,n,r){return new(n||(n=Promise))(function(i,o){function s(e){try{l(r.next(e))}catch(e){o(e)}}function a(e){try{l(r.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}l((r=r.apply(e,t||[])).next())})}function l(e,t){var n,r,i,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(l){var u=[a,l];if(n)throw TypeError("Generator is already executing.");for(;s&&(s=0,u[0]&&(o=0)),o;)try{if(n=1,r&&(i=2&u[0]?r.return:u[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,u[1])).done)return i;switch(r=0,i&&(u=[2&u[0],i.value]),u[0]){case 0:case 1:i=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,r=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!i||u[1]>i[0]&&u[1]<i[3])){o.label=u[1];break}if(6===u[0]&&o.label<i[1]){o.label=i[1],i=u;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(u);break}i[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],r=0}finally{n=i=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function u(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)s.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return s}function d(e,t,n){if(n||2==arguments.length)for(var r,i=0,o=t.length;i<o;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}Object.create;Object.create,"function"==typeof SuppressedError&&SuppressedError},76760:function(e,t,n){var r;!function(i,o){"use strict";var s="function",a="undefined",l="object",u="string",c="model",d="name",h="type",f="vendor",g="version",v="architecture",p="console",m="mobile",y="tablet",b="smarttv",S="wearable",w="embedded",E="Amazon",I="Apple",k="ASUS",C="BlackBerry",T="Browser",_="Chrome",x="Firefox",P="Google",A="Huawei",O="Microsoft",R="Motorola",N="Opera",M="Samsung",D="Sharp",L="Sony",H="Xiaomi",F="Zebra",U="Facebook",j=function(e,t){var n={};for(var r in e)t[r]&&t[r].length%2==0?n[r]=t[r].concat(e[r]):n[r]=e[r];return n},q=function(e){for(var t={},n=0;n<e.length;n++)t[e[n].toUpperCase()]=e[n];return t},z=function(e,t){return typeof e===u&&-1!==B(t).indexOf(B(e))},B=function(e){return e.toLowerCase()},Y=function(e,t){if(typeof e===u)return e=e.replace(/^\s\s*/,""),typeof t===a?e:e.substring(0,350)},V=function(e,t){for(var n,r,i,a,u,c,d=0;d<t.length&&!u;){var h=t[d],f=t[d+1];for(n=r=0;n<h.length&&!u;)if(u=h[n++].exec(e))for(i=0;i<f.length;i++)c=u[++r],typeof(a=f[i])===l&&a.length>0?2===a.length?typeof a[1]==s?this[a[0]]=a[1].call(this,c):this[a[0]]=a[1]:3===a.length?typeof a[1]!==s||a[1].exec&&a[1].test?this[a[0]]=c?c.replace(a[1],a[2]):void 0:this[a[0]]=c?a[1].call(this,c,a[2]):void 0:4===a.length&&(this[a[0]]=c?a[3].call(this,c.replace(a[1],a[2])):o):this[a]=c||o;d+=2}},W=function(e,t){for(var n in t)if(typeof t[n]===l&&t[n].length>0){for(var r=0;r<t[n].length;r++)if(z(t[n][r],e))return"?"===n?o:n}else if(z(t[n],e))return"?"===n?o:n;return e},J={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},K={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,g],[/opios[\/ ]+([\w\.]+)/i],[g,[d,N+" Mini"]],[/\bopr\/([\w\.]+)/i],[g,[d,N]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[d,g],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[d,"
1UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[g,[d,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[g,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[g,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[d,"IE"]],[/yabrowser\/([\w\.]+)/i],[g,[d,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+T],g],[/\bfocus\/([\w\.]+)/i],[g,[d,x+" Focus"]],[/\bopt\/([\w\.]+)/i],[g,[d,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[g,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[g,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[g,[d,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[g,[d,"MIUI "+T]],[/fxios\/([-\w\.]+)/i],[g,[d,x]],[/\bqihu|(qi?ho?o?|360)browser/i],[[d,"360 "+T]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1 "+T],g],[/(comodo_dragon)\/([\w\.]+)/i],[[d,/_/g," "],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[d,g],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,U],g],[/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[d,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[d,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[d,_+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,_+" WebView"],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[d,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[g,W,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[d,x+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i],[d,g],[/(cobalt)\/([\w\.]+)/i],[d,[g,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[v,"amd64"]],[/(ia32(?=;))/i],[[v,B]],[/((?:i[346]|x)86)[;\)]/i],[[v,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[v,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[v,"armhf"]],[/windows (ce|mobile); ppc;/i],[[v,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[v,/ower/,"",B]],[/(sun4\w)[;\)]/i],[[v,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[v,B]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[c,[f,M],[h,y]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[c,[f,M],[h,m]],[/((ipod|iphone)\d+,\d+)/i],[c,[f,I],[h,m]],[/(ipad\d+,\d+)/i],[c,[f,I],[h,y]],[/\((ip(?:hone|od)[\w ]*);/i],[c,[f,I],[h,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[c,[f,I],[h,y]],[/(macintosh);/i],[c,[f,I]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[c,[f,A],[h,y]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[c,[f,A],[h,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[c,/_/g," "],[f,H],[h,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[c,/_/g," "],[f,H],[h,y]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[c,[f,"OPPO"],[h,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[c,[f,"Vivo"],[h,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[c,[f,"Realme"],[h,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[c,[f,R],[h,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[c,[f,R],[h,y]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[c,[f,"LG"],[h,y]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[c,[f,"LG"],[h,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[c,[f,"Lenovo"],[h,y]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[c,/_/g," "],[f,"Nokia"],[h,m]],[/(pixel c)\b/i],[c,[f,P],[h,y]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[c,[f,P],[h,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[c,[f,L],[h,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[c,"Xperia Tablet"],[f,L],[h,y]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[c,[f,"OnePlus"],[h,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[c,[f,E],[h,y]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[c,/(.+)
vendor: 7,715 bytes, line 1
1/g,"Fire Phone $1"],[f,E],[h,m]],[/(playbook);[-\w\),; ]+(rim)/i],[c,f,[h,y]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[c,[f,C],[h,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[c,[f,k],[h,y]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[c,[f,k],[h,m]],[/(nexus 9)/i],[c,[f,"HTC"],[h,y]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic|sony(?!-bra))[-_ ]?([-\w]*)/i],[f,[c,/_/g," "],[h,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[c,[f,"Acer"],[h,y]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[c,[f,"Meizu"],[h,m]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[c,[f,D],[h,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[f,c,[h,m]],[/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[f,c,[h,y]],[/(surface duo)/i],[c,[f,O],[h,y]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[c,[f,"Fairphone"],[h,m]],[/(u304aa)/i],[c,[f,"AT&T"],[h,m]],[/\bsie-(\w*)/i],[c,[f,"Siemens"],[h,m]],[/\b(rct\w+) b/i],[c,[f,"RCA"],[h,y]],[/\b(venue[\d ]{2,7}) b/i],[c,[f,"Dell"],[h,y]],[/\b(q(?:mv|ta)\w+) b/i],[c,[f,"Verizon"],[h,y]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[c,[f,"Barnes & Noble"],[h,y]],[/\b(tm\d{3}\w+) b/i],[c,[f,"NuVision"],[h,y]],[/\b(k88) b/i],[c,[f,"ZTE"],[h,y]],[/\b(nx\d{3}j) b/i],[c,[f,"ZTE"],[h,m]],[/\b(gen\d{3}) b.+49h/i],[c,[f,"Swiss"],[h,m]],[/\b(zur\d{3}) b/i],[c,[f,"Swiss"],[h,y]],[/\b((zeki)?tb.*\b) b/i],[c,[f,"Zeki"],[h,y]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[f,"Dragon Touch"],c,[h,y]],[/\b(ns-?\w{0,9}) b/i],[c,[f,"Insignia"],[h,y]],[/\b((nxa|next)-?\w{0,9}) b/i],[c,[f,"NextBook"],[h,y]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[f,"Voice"],c,[h,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[f,"LvTel"],c,[h,m]],[/\b(ph-1) /i],[c,[f,"Essential"],[h,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[c,[f,"Envizen"],[h,y]],[/\b(trio[-\w\. ]+) b/i],[c,[f,"MachSpeed"],[h,y]],[/\btu_(1491) b/i],[c,[f,"Rotor"],[h,y]],[/(shield[\w ]+) b/i],[c,[f,"Nvidia"],[h,y]],[/(sprint) (\w+)/i],[f,c,[h,m]],[/(kin\.[onetw]{3})/i],[[c,/\./g," "],[f,O],[h,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[c,[f,F],[h,y]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[c,[f,F],[h,m]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[f,c,[h,p]],[/droid.+; (shield) bui/i],[c,[f,"Nvidia"],[h,p]],[/(playstation [345portablevi]+)/i],[c,[f,L],[h,p]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[c,[f,O],[h,p]],[/smart-tv.+(samsung)/i],[f,[h,b]],[/hbbtv.+maple;(\d+)/i],[[c,/^/,"SmartTV"],[f,M],[h,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[f,"LG"],[h,b]],[/(apple) ?tv/i],[f,[c,I+" TV"],[h,b]],[/crkey/i],[[c,_+"cast"],[f,P],[h,b]],[/droid.+aft(\w)( bui|\))/i],[c,[f,E],[h,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[c,[f,D],[h,b]],[/(bravia[\w ]+)( bui|\))/i],[c,[f,L],[h,b]],[/(mitv-\w{5}) bui/i],[c,[f,H],[h,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w ]*; *(\w[^;]*);([^;]*)/i],[[f,Y],[c,Y],[h,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[h,b]],[/((pebble))app/i],[f,c,[h,S]],[/droid.+; (glass) \d/i],[c,[f,P],[h,S]],[/droid.+; (wt63?0{2,3})\)/i],[c,[f,F],[h,S]],[/(quest( 2)?)/i],[c,[f,U],[h,S]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[f,[h,w]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[c,[h,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[c,[h,y]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[h,y]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[h,m]],[/(android[-\w\. ]{0,9});.+buil/i],[c,[f,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[d,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[d,g],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,g],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[d,[g,W,J]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,"Windows"],[g,W,J]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,"Mac OS"],[g,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,g],[/\(bb(10);/i],[g,[d,C]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[g,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[d,x+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[d,"webOS"]],[/crkey\/([\d\.]+)/i],[g,[d,_+"cast"]],[/(cros) [\w]+ ([\w\.]+\w)/i],[[d,"Chromium OS"],g],[/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,g],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[d,g]]},$=function(e,t){if(typeof e===l&&(t=e,e=o),!(this instanceof $))return new $(e,t).getResult();var n=e||(typeof i!==a&&i.navigator&&i.navigator.userAgent?i.navigator.userAgent:""),r=t?j(K,t):K;return this.getBrowser=function(){var e,t={};return t[d]=o,t[g]=o,V.call(t,n,r.browser),t.major=typeof(e=t.version)===u?e.replace(/[^\d\.]/g,"").split(".")[0]:o,t},this.getCPU=function(){var e={};return e[v]=o,V.call(e,n,r.cpu),e},this.getDevice=function(){var e={};return e[f]=o,e[c]=o,e[h]=o,V.call(e,n,r.device),e},this.getEngine=function(){var e={};return e[d]=o,e[g]=o,V.call(e,n,r.engine),e},this.getOS=function(){var e={};return e[d]=o,e[g]=o,V.call(e,n,r.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===u&&e.length>350?Y(e,350):e,this},this.setUA(n),this};$.VERSION="0.7.33",$.BROWSER=q([d,g,"major"]),$.CPU=q([v]),$.DEVICE=q([c,f,h,p,m,b,y,S,w]),$.ENGINE=$.OS=q([d,g]),typeof t!==a?(e.exports&&(t=e.exports=$),t.UAParser=$):n.amdO?o===(r=(function(){return $}).call(t,n,t,e))||(e.exports=r):typeof i!==a&&(i.UAParser=$);var G=typeof i!==a&&(i.jQuery||i.Zepto);if(G&&!G.ua){var X=new $;G.ua=X.getResult(),G.ua.get=function(){return X.getUA()},G.ua.set=function(e){X.setUA(e);var t=X.getResult();for(var n in t)G.ua[n]=t[n]}}}("object"==typeof window?window:this)},83886:(e,t,n)=>
1{e.exports=n(89295).Observable},87449:(e,t,n)=>{"use strict";n.d(t,{m:()=>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}},89295:(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 l(e){let t=e.constructor;return void 0!==t&&null===(t=t[s])&&(t=void 0),void 0!==t?t:p}function u(e){u.log?u.log(e):setTimeout(()=>{throw e})}function c(e){Promise.resolve().then(()=>{try{e()}catch(e){u(e)}})}function d(e){let t=e._cleanup;if(void 0!==t&&(e._cleanup=void 0,t))try{if("function"==typeof t)t();else{let e=a(t,"unsubscribe");e&&e.call(t)}}catch(e){u(e)}}function h(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function f(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(h(e),i)i.call(r,n);else throw n;break;case"complete":h(e),i&&i.call(r)}}catch(e){u(e)}"closed"===e._state?d(e):"running"===e._state&&(e._state="ready")}function g(e,t,n){if("closed"!==e._state){if("buffering"===e._state)return void e._queue.push({type:t,value:n});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&&(f(e,t[n].type,t[n].value),"closed"!==e._state);++n);}})(e));return}f(e,t,n)}}class v{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){g(n,"next",e)},error(e){g(n,"error",e)},complete(){g(n,"complete")}};try{this._cleanup=t.call(void 0,r)}catch(e){r.error(e)}"initializing"===this._state&&(this._state="ready")}get closed(){return"closed"===this._state}unsubscribe(){"closed"!==this._state&&(h(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 v(e,this._subscriber)}forEach(e){return new Promise((t,n)=>{if("function"!=typeof e)return void n(TypeError(e+" is not a function"));function r(){i.unsubscribe(),t()}let i=this.subscribe({next(t){try{e(t,r)}catch(e){n(e),i.unsubscribe()}},error:n,complete:t})})}map(e){if("function"!=typeof e)throw TypeError(e+" is not a function");return new(l(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(l(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=l(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=l(this);return new t(n=>{let r,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=l(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()=>
1{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:u},configurable:!0})}}]);

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.