PageSourceSearch

https://app.chatwik.com/vite/assets/index-BtPaM80c.js

js chatwik.com collected 2026-10-02 00:48:25 UTC 175,558 bytes, 13 lines download raw bytes

1var ri=Object.defineProperty;var ni=(t,e,r)=>e in t?ri(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var fe=(t,e,r)=>ni(t,typeof e!="symbol"?e+"":e,r);import{s as D,t as w,v as M,w as O,_ as S,x as T,y as rt,z as Se,e as ii}from"./globalConfig-CWNSqjc3.js";var ve;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(ve||(ve={}));var te;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(te||(te={}));var ar="-",ut="AMP",oi="".concat(ut,"_unsent"),sn="$default_instance",un="https://api2.amplitude.com/2/httpapi",ai="https://api.eu.amplitude.com/2/httpapi",si="https://api2.amplitude.com/batch",ui="https://api.eu.amplitude.com/batch",li="utm_campaign",ci="utm_content",di="utm_id",fi="utm_medium",vi="utm_source",hi="utm_term",sr="dclid",ur="fbclid",lr="gbraid",cr="gclid",dr="ko_click_id",fr="li_fat_id",vr="msclkid",hr="rdt_cid",gr="ttclid",pr="twclid",mr="wbraid",lt={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},nt=["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"],gi=["authorization","cookie","set-cookie"],pi=1e3,Pt=function(t){if(Object.keys(t).length>pi)return!1;for(var e in t){var r=t[e];if(!ln(e,r))return!1}return!0},ln=function(t,e){var r,n;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=D(e),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if(typeof s=="object")i=i&&Pt(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else{if(e==null)return!1;if(typeof e=="object")return Pt(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0},Te=(function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return w({},this._properties)},t.prototype.set=function(e,r){return this._safeSet(V.SET,e,r),this},t.prototype.setOnce=function(e,r){return this._safeSet(V.SET_ONCE,e,r),this},t.prototype.append=function(e,r){return this._safeSet(V.APPEND,e,r),this},t.prototype.prepend=function(e,r){return this._safeSet(V.PREPEND,e,r),this},t.prototype.postInsert=function(e,r){return this._safeSet(V.POSTINSERT,e,r),this},t.prototype.preInsert=function(e,r){return this._safeSet(V.PREINSERT,e,r),this},t.prototype.remove=function(e,r){return this._safeSet(V.REMOVE,e,r),this},t.prototype.add=function(e,r){return this._safeSet(V.ADD,e,r),this},t.prototype.unset=function(e){return this._safeSet(V.UNSET,e,ar),this},t.prototype.clearAll=function(){return this._properties={},this._properties[V.CLEAR_ALL]=ar,this},t.prototype._safeSet=function(e,r,n){if(this._validate(e,r,n)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[r]=n,this._propertySet.add(r),!0}return!1},t.prototype._validate=function(e,r,n){return this._properties[V.CLEAR_ALL]!==void 0||this._propertySet.has(r)?!1:e===V.ADD?typeof n=="number":e!==V.UNSET&&e!==V.REMOVE?ln(r,n):!0},t})(),V;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(V||(V={}));var mi=[V.CLEAR_ALL,V.UNSET,V.SET,V.SET_ONCE,V.ADD,V.APPEND,V.PREPEND,V.PREINSERT,V.POSTINSERT,V.REMOVE],yi="Event tracked successfully",bi="Unexpected error occurred",Ei="Event rejected due to exceeded retry count",Ti="Event skipped due to optOut config",Si="Event rejected due to missing API key",_i="Invalid API key",wi="Client not initialized",K;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(K||(K={}));var Ae=function(t,e,r){return e===void 0&&(e=0),r===void 0&&(r=K.Unknown),{event:t,code:e,message:r}},F=function(){var t="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[t]<"u")return globalThis[t];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global},Ii=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,ye)},yr=M([],O(Array(256).keys()),!1).map(function(t){return t.toString(16).padStart(2,"0")}),ye=function(t){var e,r=F();if(!(!((e=r==null?void 0:r.crypto)===null||e===void 0)&&e.getRandomValues))return Ii(t);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,M([],O(n.entries()),!1).map(function(i){var o=O(i,2),a=o[0],s=o[1];return[4,6,8,10].includes(a)?"-".concat(yr[s]):yr[s]}).join("")},Ai=(function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,r){var n,i;return S(this,void 0,void 0,function(){return T(this,function(o){switch(o.label){case 0:return this.plugins.some(function(a){return a.name===e.name})?(this.loggerProvider.warn("Plugin with name ".concat(e.name," already exists, skipping registration")),[2]):(e.name===void 0&&(e.name=ye(),this.loggerProvider.warn(`Plugin name is undefined. 
2      Generating a random UUID for plugin name: `.concat(e.name,`. 
3      Set a name for the plugin to prevent it from being added multiple times.`))),e.type=(n=e.type)!==null&&n!==void 0?n:"enrichment",[4,(i=e.setup)===null||i===void 0?void 0:i.call(e,r,this.client)]);case 1:return o.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e,r){var n;return S(this,void 0,void 0,function(){var i,o;return T(this,function(a){switch(a.label){case 0:return i=this.plugins.findIndex(function(s){return s.name===e}),i===-1?(r.loggerProvider.warn("Plugin with name ".concat(e," does not exist, skipping deregistration")),[2]):(o=this.plugins[i],this.plugins.splice(i,1),[4,(n=o.teardown)===null||n===void 0?void 0:n.call(o)]);case 1:return a.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var r=this.plugins;r.map(function(n){var i;return(i=n.teardown)===null||i===void 0?void 0:i.call(n)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var r=this;return new Promise(function(n){r.queue.push([e,n]),r.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var r=this;this.applying||(this.applying=!0,setTimeout(function(){r.apply(r.queue.shift()).then(function(){r.applying=!1,r.queue.length>0&&r.scheduleApply(0)})},e))},t.prototype.apply=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s,u,v,g,l,c,f,d,v,g,m,y,p,h,b,E,_;return T(this,function(I){switch(I.label){case 0:if(!e)return[2];r=O(e,1),n=r[0],i=O(e,2),o=i[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(A){return A.type==="before"}),I.label=1;case 1:I.trys.push([1,6,7,8]),s=D(a),u=s.next(),I.label=2;case 2:return u.done?[3,5]:(v=u.value,v.execute?[4,v.execute(w({},n))]:[3,4]);case 3:if(g=I.sent(),g===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=g,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),I.label=4;case 4:return u=s.next(),[3,2];case 5:return[3,8];case 6:return l=I.sent(),h={error:l},[3,8];case 7:try{u&&!u.done&&(b=s.return)&&b.call(s)}finally{if(h)throw h.error}
3return[7];case 8:c=this.plugins.filter(function(A){return A.type==="enrichment"||A.type===void 0}),I.label=9;case 9:I.trys.push([9,14,15,16]),f=D(c),d=f.next(),I.label=10;case 10:return d.done?[3,13]:(v=d.value,v.execute?[4,v.execute(w({},n))]:[3,12]);case 11:if(g=I.sent(),g===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),o({event:n,code:0,message:""}),[2];n=g,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(JSON.stringify(n))),I.label=12;case 12:return d=f.next(),[3,10];case 13:return[3,16];case 14:return m=I.sent(),E={error:m},[3,16];case 15:try{d&&!d.done&&(_=f.return)&&_.call(f)}finally{if(E)throw E.error}return[7];case 16:return y=this.plugins.filter(function(A){return A.type==="destination"}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(JSON.stringify(n))),p=y.map(function(A){var C=w({},n);return A.execute(C).catch(function(L){return Ae(C,0,String(L))})}),Promise.all(p).then(function(A){var C=O(A,1),L=C[0],P=L||Ae(n,100,"Event not tracked, no destination plugins on the instance");o(P)}),[2]}})})},t.prototype.flush=function(){return S(this,void 0,void 0,function(){var e,r,n,i=this;return T(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(a){return i.apply(a)}))];case 1:return o.sent(),r=this.plugins.filter(function(a){return a.type==="destination"}),n=r.map(function(a){return a.flush&&a.flush()}),[4,Promise.all(n)];case 2:return o.sent(),[2]}})})},t.prototype.onIdentityChanged=function(e){this.plugins.forEach(function(r){var n;(n=r.onIdentityChanged)===null||n===void 0||n.call(r,e)})},t.prototype.onSessionIdChanged=function(e){this.plugins.forEach(function(r){var n;(n=r.onSessionIdChanged)===null||n===void 0||n.call(r,e)})},t.prototype.onOptOutChanged=function(e){this.plugins.forEach(function(r){var n;(n=r.onOptOutChanged)===null||n===void 0||n.call(r,e)})},t.prototype.onReset=function(){this.plugins.forEach(function(e){var r;(r=e.onReset)===null||r===void 0||r.call(e)})},t})(),Pi=function(t,e,r){var n=typeof t=="string"?{event_type:t}:t;return w(w(w({},n),r),e&&{event_properties:e})},Vt=function(t,e){var r=w(w({},e),{event_type:te.IDENTIFY,user_properties:t.getUserProperties()});return r},ki=function(t,e,r,n){var i,o=w(w({},n),{event_type:te.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[t]=e,i)});return o},Ri=function(t,e,r){var n,i=new Te;i.set(t,e);var o=w(w({},r),{event_type:te.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[t]=e,n)});return o},Oi=function(t,e){return w(w({},e),{event_type:te.REVENUE,event_properties:t.getEventProperties()})},Z=function(t){return{promise:t||Promise.resolve()}},Ci=(function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Ai(this),this.name=e}return t.prototype._init=function(e){return S(this,void 0,void 0,function(){return T(this,function(r){switch(r.label){case 0:return this.config=e,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q")];case 1:return r.sent(),this.isReady=!0,[2]}})})},t.prototype.runQueuedFunctions=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a,s,u,l;return T(this,function(c){switch(c.label){case 0:r=this[e],this[e]=[],c.label=1;case 1:c.trys.push([1,8,9,10]),n=D(r),i=n.next(),c.label=2;case 2:return i.done?[3,7]:(o=i.value,a=o(),a&&"promise"in a?[4,a.promise]:[3,4]);case 3:return c.sent(),[3,6];case 4:return[4,a];case 5:c.sent(),c.label=6;case 6:return i=n.next(),[3,2];case 7:return[3,10];case 8:return s=c.sent(),u={error:s},[3,10];case 9:try{i&&!i.done&&(l=n.return)&&l.call(n)}finally{if(u)throw u.error}return[7];case 10:return this[e].length?[4,this.runQueuedFunctions(e)]:[3,12];case 11:c.sent(),c.label=12;case 12:return[2]}})})},t.prototype.track=function(e,r,n){var i=Pi(e,r,n);return Z(this.dispatch(i))},t.prototype.identify=function(e,r){var n=Vt(e,r);return Z(this.dispatch(n))},t.prototype.groupIdentify=function(e,r,n,i){var o=ki(e,r,n,i);return Z(this.dispatch(o))},t.prototype.setGroup=function(e,r,n){var i=Ri(e,r,n);return Z(this.dispatch(i))},t.prototype.revenue=function(e,r){var n=Oi(e,r);return Z(this.dispatch(n))},t.prototype.add=function(e){return this.isReady?this._addPlugin(e):(this.q.push(this._addPlugin.bind(this,e)),Z())},t.prototype._addPlugin=function(e){return Z(this.timeline.register(e,this.config))},t.prototype.remove=function(e){return this.isReady?this._removePlugin(e):(this.q.push(this._removePlugin.bind(this,e)),Z())},t.prototype._removePlugin=function(e){return Z(this.timeline.deregister(e,this.config))},t.prototype.dispatchWithCallback=function(e,r){if(!this.isReady)return r(Ae(e,0,wi));this.process(e).then(r)},t.prototype.dispatch=function(e){return S(this,void 0,void 0,function(){var r=this;return T(this,function(n){return this.isReady?[2,this.process(e)]:[2,new Promise(function(i){r.dispatchQ.push(r.dispatchWithCallback.bind(r,e,i))})]})})},t.prototype.getOperationAppliedUserProperties=function(e){var r={};if(e===void 0)return r;var n={};return Object.keys(e).forEach(function(i){Object.values(ve).includes(i)||(n[i]=e[i])}
3),mi.forEach(function(i){if(Object.keys(e).includes(i)){var o=e[i];switch(i){case ve.CLEAR_ALL:Object.keys(r).forEach(function(a){delete r[a]});break;case ve.UNSET:Object.keys(o).forEach(function(a){delete r[a]});break;case ve.SET:Object.assign(r,o);break}}}),Object.assign(r,n),r},t.prototype.process=function(e){return S(this,void 0,void 0,function(){var r,o,n,i,o;return T(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,Ae(e,0,Ti)]:(e.event_type===te.IDENTIFY&&(r=this.getOperationAppliedUserProperties(e.user_properties),this.timeline.onIdentityChanged({userProperties:r})),[4,this.timeline.push(e)]);case 1:return o=a.sent(),o.code===200?this.config.loggerProvider.log(o.message):o.code===100?this.config.loggerProvider.warn(o.message):this.config.loggerProvider.error(o.message),[2,o];case 2:return n=a.sent(),i=String(n),this.config.loggerProvider.error(i),o=Ae(e,0,i),[2,o];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!e));return}this._setOptOut(e)},t.prototype._setOptOut=function(e){this.config.optOut!==e&&(this.timeline.onOptOutChanged(e),this.config.optOut=!!e)},t.prototype.flush=function(){return Z(this.timeline.flush())},t.prototype.plugin=function(e){var r=this.timeline.plugins.find(function(n){return n.name===e});if(r===void 0){this.config.loggerProvider.debug("Cannot find plugin with name ".concat(e));return}return r},t.prototype.plugins=function(e){return this.timeline.plugins.filter(function(r){return r instanceof e})},t})(),cn=(function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setCurrency=function(e){return this.currency=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setReceipt=function(e){return this.receipt=e,this},t.prototype.setReceiptSig=function(e){return this.receiptSig=e,this},t.prototype.setEventProperties=function(e){return Pt(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?w({},this.properties):{};return e[ie.REVENUE_PRODUCT_ID]=this.productId,e[ie.REVENUE_QUANTITY]=this.quantity,e[ie.REVENUE_PRICE]=this.price,e[ie.REVENUE_TYPE]=this.revenueType,e[ie.REVENUE_CURRENCY]=this.currency,e[ie.REVENUE]=this.revenue,e[ie.RECEIPT]=this.receipt,e[ie.RECEIPT_SIG]=this.receiptSig,e},t})(),ie;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE_CURRENCY="$currency",t.REVENUE="$revenue",t.RECEIPT="$receipt",t.RECEIPT_SIG="$receiptSig"})(ie||(ie={}));var Li=function(t,e){var r=Math.max(e,1);return t.reduce(function(n,i,o){var a=Math.floor(o/r);return n[a]||(n[a]=[]),n[a].push(i),n},[])},ee;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(ee||(ee={}));var Be="Amplitude Logger ",dn=(function(){function t(){this.logLevel=ee.None}return t.prototype.disable=function(){this.logLevel=ee.None},t.prototype.enable=function(e){e===void 0&&(e=ee.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ee.Verbose||console.log("".concat(Be,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ee.Warn||console.warn("".concat(Be,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ee.Error||console.error("".concat(Be,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this.logLevel<ee.Debug||console.log("".concat(Be,"[Debug]: ").concat(e.join(" ")))},t})(),ze=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:sn,logLevel:ee.Warn,loggerProvider:new dn,offline:!1,optOut:!1,serverUrl:un,serverZone:"US",useBatch:!1}},Di=(function(){function t(e){var r,n,i,o;this._optOut=!1;var a=ze();this.apiKey=e.apiKey,this.flushIntervalMillis=(r=e.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||a.flushQueueSize,this.instanceName=e.instanceName||a.instanceName,this.loggerProvider=e.loggerProvider||a.loggerProvider,this.logLevel=(n=e.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:a.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:a.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||a.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:a.useBatch,this.loggerProvider.enable(this.logLevel);var s=fn(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e}
3,enumerable:!1,configurable:!0}),t})(),Ni=function(t,e){return t==="EU"?e?ui:ai:e?si:un},fn=function(t,e,r){if(t===void 0&&(t=""),e===void 0&&(e=ze().serverZone),r===void 0&&(r=ze().useBatch),t)return{serverUrl:t,serverZone:void 0};var n=["US","EU"].includes(e)?e:ze().serverZone;return{serverZone:n,serverUrl:Ni(n,r)}},xi=(function(){function t(){this.sdk={metrics:{histogram:{}}}}return t.prototype.recordHistogram=function(e,r){this.sdk.metrics.histogram[e]=r},t})();function kt(t){return t>=200&&t<300}var Xe=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(`
4`).slice(2+t).map(function(r){return r.trim()})},j=function(t){return function(){var e=w({},t.config),r=e.loggerProvider,n=e.logLevel;return{logger:r,logLevel:n}}},Ui=function(t,e){var r,n;e=e.replace(/\[(\w+)\]/g,".$1"),e=e.replace(/^\./,"");try{for(var i=D(e.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(a in t)t=t[a];else return}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return t},B=function(t,e){return function(){var r,n,i={};try{for(var o=D(e),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=Ui(t,s)}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},H=function(t,e,r,n,i){return i===void 0&&(i=null),function(){for(var o=[],a=0;a<arguments.length;a++)o[a]=arguments[a];var s=r(),u=s.logger,l=s.logLevel;if(l&&l<ee.Debug||!l||!u)return t.apply(i,o);var c={type:"invoke public method",name:e,args:o,stacktrace:Xe(1),time:{start:new Date().toISOString()},states:{}};n&&c.states&&(c.states.before=n());var f=t.apply(i,o);return f&&f.promise?f.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),u.debug(JSON.stringify(c,null,2))),f}};function Mi(t){return t instanceof Error?t.message:String(t)}function Oe(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var Fi=(function(){function t(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=e==null?void 0:e.diagnosticsClient}return t.prototype.setup=function(e){var r;return S(this,void 0,void 0,function(){var n,i=this;return T(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(oi,"_").concat(this.config.apiKey.substring(0,10)),[4,(r=this.config.storageProvider)===null||r===void 0?void 0:r.get(this.storageKey)];case 1:return n=o.sent(),n&&n.length>0&&Promise.all(n.map(function(a){return i.execute(a)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var r=this;return e.insert_id||(e.insert_id=ye()),new Promise(function(n){var i={event:e,attempts:0,callback:function(o){return n(o)},timeout:0};r.queue.push(i),r.schedule(r.config.flushIntervalMillis),r.saveEvents()})},t.prototype.removeEventsExceedFlushMaxRetries=function(e){var r=this;return e.filter(function(n){return n.attempts+=1,n.attempts<r.config.flushMaxRetries?!0:(r.fulfillRequest([n],500,Ei),!1)})},t.prototype.scheduleEvents=function(e){var r=this;e.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})},t.prototype.schedule=function(e){var r=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&e>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=e,this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){return n.timeout=0,n}),r.flush(!0)},e);return}},t.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},t.prototype.flush=function(e){return e===void 0&&(e=!1),S(this,void 0,void 0,function(){var r,n,i,o=this;return T(this,function(a){switch(a.label){case 0:return this.config.offline?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush while offline."),[2]):this.flushId?(this.resetSchedule(),this.config.loggerProvider.debug("Skipping flush because previous flush has not resolved."),[2]):(this.flushId=this.scheduleId,this.resetSchedule(),r=[],n=[],this.queue.forEach(function(s){return s.timeout===0?r.push(s):n.push(s)}),i=Li(r,this.config.flushQueueSize),[4,i.reduce(function(s,u){return S(o,void 0,void 0,function(){return T(this,function(l){switch(l.label){case 0:return[4,s];case 1:return l.sent(),[4,this.send(u,e)];case 2:return[2,l.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},t.prototype.send=function(e,r){var n;return r===void 0&&(r=!0),S(this,void 0,void 0,function(){var i,o,a,s,u;return T(this,function(l){switch(l.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,Si)];i={api_key:this.config.apiKey,events:e.map(function(c){var f=c.event;f.extra;var d=rt(f,["extra"]);return d}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new xi,l.label=1;case 1:return l.trys.push([1,3,,4]),o=fn(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(o,i)];case 2:return a=l.sent(),a===null?(this.fulfillRequest(e,0,bi),[2]):r?(this.handleResponse(a,e),[3,4]):("body"in a?this.fulfillRequest(e,a.statusCode,"".concat(a.status,": ").concat(Oe(a))):this.fulfillRequest(e,a.statusCode,a.status),[2]);case 3:return s=l.sent(),u=Mi(s),this.config.loggerProvider.error(u),(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:e.map(function(c){return c.event.event_type}),message:u,stack_trace:Xe()}),this.handleResponse({status:K.Failed,statusCode:0},e),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,r){var n;kt(e.statusCode)||(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful",{events:r.map(function(o){return o.event.event_type}),code:e.statusCode,status:e.status,body:Oe(e),stack_trace:Xe()});var i=e.status;switch(i){case K.Success:{this.handleSuccessResponse(e,r);break}case K.Invalid:{this.handleInvalidResponse(e,r);break}case K.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,r);break}case K.RateLimit:{this.handleRateLimitResponse(e,r);break}default:{this.config.loggerProvider.warn(`{code: 0, error: "Status '`.concat(i,"' provided for ").concat(r.length,' events"}')),this.handleOtherResponse(r);break}}},t.prototype.handleSuccessResponse=function(e,r){this.fulfillRequest(r,e.statusCode,yi)},t.prototype.handleInvalidResponse=function(e,r){var n=this;if(e.body.missingField||e.body.error.startsWith(_i)){this.fulfillRequest(r,e.statusCode,e.body.error);return}var i=M(M(M(M([],O(Object.values(e.body.eventsWithInvalidFields)),!1),O(Object.values(e.body.eventsWithMissingFields)),!1),O(Object.values(e.body.eventsWithInvalidIdLengths)),!1),O(e.body.silencedEvents),!1).flat(),o=new Set(i),a=r.filter(function(u,l){if(o.has(l)){n.fulfillRequest([u],e.statusCode,e.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(Oe(e));
4var s=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(s)},t.prototype.handlePayloadTooLargeResponse=function(e,r){if(r.length===1){this.fulfillRequest(r,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Oe(e)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},t.prototype.handleRateLimitResponse=function(e,r){var n=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),a=e.body.throttledEvents,s=new Set(i),u=new Set(o),l=new Set(a),c=r.filter(function(d,v){if(d.event.user_id&&s.has(d.event.user_id)||d.event.device_id&&u.has(d.event.device_id)){n.fulfillRequest([d],e.statusCode,e.body.error);return}return l.has(v)&&(d.timeout=n.throttleTimeout),!0});c.length>0&&this.config.loggerProvider.warn(Oe(e));var f=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(f)},t.prototype.handleOtherResponse=function(e){var r=this,n=e.map(function(o){return o.timeout=o.attempts*r.retryTimeout,o}),i=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(i)},t.prototype.fulfillRequest=function(e,r,n){var i,o,a;kt(r)?(a=this.diagnosticsClient)===null||a===void 0||a.increment("analytics.events.sent",e.length):((i=this.diagnosticsClient)===null||i===void 0||i.increment("analytics.events.dropped",e.length),(o=this.diagnosticsClient)===null||o===void 0||o.recordEvent("analytics.events.dropped",{events:e.map(function(s){return s.event.event_type}),code:r,message:n,stack_trace:Xe()})),this.removeEvents(e),e.forEach(function(s){return s.callback(Ae(s.event,r,n))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=this.queue.map(function(r){return r.event});this.config.storageProvider.set(this.storageKey,e)}},t.prototype.removeEvents=function(e){this.queue=this.queue.filter(function(r){return!e.some(function(n){return n.event.insert_id===r.event.insert_id})}),this.saveEvents()},t})(),qi=(function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Vi(),platform:"Web",os:void 0,deviceModel:void 0}},t})(),Vi=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},ji=(function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(r){e(r)}),this.queue=[])},t})(),ge=function(){return ge=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},ge.apply(this,arguments)};function Ye(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function br(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),i,o=[],a;try{for(;(e===void 0||e-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(s){a={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(a)throw a.error}}return o}var Je=function(t,e){var r,n,i=["string","number","boolean","undefined"],o=typeof t,a=typeof e;if(o!==a)return!1;try{for(var s=Ye(i),u=s.next();!u.done;u=s.next()){var l=u.value;if(l===o)return t===e}}catch(y){r={error:y}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),f=Array.isArray(e);if(c!==f)return!1;if(c&&f){for(var d=0;d<t.length;d++)if(!Je(t[d],e[d]))return!1}else{var v=Object.keys(t).sort(),g=Object.keys(e).sort();if(!Je(v,g))return!1;var m=!0;return Object.keys(t).forEach(function(y){Je(t[y],e[y])||(m=!1)}),m}return!0},Bi="$set",Hi="$unset",Gi="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),r=e.length,n=new Array(r);r--;)n[r]=[e[r],t[e[r]]];return n});var Wi=(function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,r=ge({},this.identity.userProperties),n=ge(ge({},this.identity),{userProperties:r});return{setUserId:function(i){return n.userId=i,this},setDeviceId:function(i){return n.deviceId=i,this},setUserProperties:function(i){return n.userProperties=i,this},setOptOut:function(i){return n.optOut=i,this},updateUserProperties:function(i){var o,a,s,u,l,c,f=n.userProperties||{};try{for(var d=Ye(Object.entries(i)),v=d.next();!v.done;v=d.next()){var g=br(v.value,2),m=g[0],y=g[1];switch(m){case Bi:try{for(var p=(s=void 0,Ye(Object.entries(y))),h=p.next();!h.done;h=p.next()){var b=br(h.value,2),E=b[0],_=b[1];f[E]=_}}catch(C){s={error:C}}finally{try{h&&!h.done&&(u=p.return)&&u.call(p)}finally{if(s)throw s.error}}break;case Hi:try{for(var I=(l=void 0,Ye(Object.keys(y))),A=I.next();!A.done;A=I.next()){var E=A.value;delete f[E]}}catch(C){l={error:C}}finally{try{A&&!A.done&&(c=I.return)&&c.call(I)}finally{if(l)throw l.error}}break;case Gi:f={};break}}}catch(C){o={error:C}}
4finally{try{v&&!v.done&&(a=d.return)&&a.call(d)}finally{if(o)throw o.error}}return n.userProperties=f,this},commit:function(){return e.setIdentity(n),this}}},t.prototype.getIdentity=function(){return ge({},this.identity)},t.prototype.setIdentity=function(e){var r=ge({},this.identity);this.identity=ge({},e),Je(r,this.identity)||this.listeners.forEach(function(n){n(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t})(),Ce=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Ki=(function(){function t(){this.identityStore=new Wi,this.eventBridge=new ji,this.applicationContextProvider=new qi}return t.getInstance=function(e){return Ce.analyticsConnectorInstances||(Ce.analyticsConnectorInstances={}),Ce.analyticsConnectorInstances[e]||(Ce.analyticsConnectorInstances[e]=new t),Ce.analyticsConnectorInstances[e]},t})(),qe=function(t){return t===void 0&&(t=sn),Ki.getInstance(t)},$i=function(t,e){qe(e).identityStore.editIdentity().setUserId(t).commit()},zi=function(t,e){qe(e).identityStore.editIdentity().setDeviceId(t).commit()},Xi=(function(){function t(){this.name="identity",this.type="before",this.identityStore=qe().identityStore}return t.prototype.execute=function(e){return S(this,void 0,void 0,function(){var r;return T(this,function(n){return r=e.user_properties,r&&this.identityStore.editIdentity().updateUserProperties(r).commit(),[2,e]})})},t.prototype.setup=function(e){return S(this,void 0,void 0,function(){return T(this,function(r){return e.instanceName&&(this.identityStore=qe(e.instanceName).identityStore),[2]})})},t})(),vn=function(t,e){e===void 0&&(e=Date.now());var r=Date.now(),n=r-e;return n>t},hn=function(t,e,r){return e===void 0&&(e=""),r===void 0&&(r=10),[ut,e,t.substring(0,r)].filter(Boolean).join("_")},Yi=function(t){return"".concat(ut.toLowerCase(),"_").concat(t.substring(0,6))},Ji=function(){var t,e,r,n;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(n=(r=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&r!==void 0?r:i)!==null&&n!==void 0?n:""},it=function(){var t,e=F();if(!(!((t=e==null?void 0:e.location)===null||t===void 0)&&t.search))return{};var r=e.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(i,o){var a=o.split("=",2),s=Er(a[0]),u=Er(a[1]);return u&&(i[s]=u),i},{});return n},Er=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}},Rt=function(t,e){return!e||!e.length?!0:e.some(function(r){return typeof r=="string"?t===r:t.match(r)})},pe=function(t,e){var r=t;try{r=decodeURI(t)}catch(n){e==null||e.error("Malformed URI sequence: ",n)}return r},Qi=function(t){var e=0;if(t.length===0)return e;for(var r=0;r<t.length;r++){var n=t.charCodeAt(r);e=(e<<5)-e+n,e|=0}return e},Tr=function(t,e){var r=Qi(t.toString()),n=Math.abs(r),i=n*31,o=i%1e5;return o/1e5<e},jt=(function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return S(this,void 0,void 0,function(){return T(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return S(this,void 0,void 0,function(){return T(this,function(r){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return S(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return[4,this.get(e)];case 1:return r=n.sent(),[2,r?JSON.stringify(r):void 0]}})})},t.prototype.set=function(e,r){return S(this,void 0,void 0,function(){return T(this,function(n){return this.memoryStorage.set(e,r),[2]})})},t.prototype.remove=function(e){return S(this,void 0,void 0,function(){return T(this,function(r){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return S(this,void 0,void 0,function(){return T(this,function(e){return this.memoryStorage.clear(),[2]})})},t})(),Ot=(function(){function t(e){this.options=w({},e)}return t.prototype.isEnabled=function(){return S(this,void 0,void 0,function(){var e,r,n;return T(this,function(i){switch(i.label){case 0:if(!F())return[2,!1];t.testValue=String(Date.now()),e=new t(this.options),r="AMP_TEST",i.label=1;case 1:return i.trys.push([1,4,5,7]),[4,e.set(r,t.testValue)];case 2:return i.sent(),[4,e.get(r)];case 3:return n=i.sent(),[2,n===t.testValue];case 4:return i.sent(),[2,!1];case 5:return[4,e.remove(r)];case 6:return i.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){var r;return S(this,void 0,void 0,function(){var n,i;return T(this,function(o){switch(o.label){case 0:return[4,this.getRaw(e)];case 1:if(n=o.sent(),!n)return[2,void 0];try{return i=(r=Zi(n))!==null&&r!==void 0?r:eo(n),i===void 0?(console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]):[2,JSON.parse(i)]}catch{return console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(e,", value: ").concat(n)),[2,void 0]}return[2]}})})},t.prototype.getRaw=function(e){var r,n;return S(this,void 0,void 0,function(){var i,o,a;return T(this,function(s){return i=F(),o=(n=(r=i==null?void 0:i.document)===null||r===void 0?void 0:r.cookie.split("; "))!==null&&n!==void 0?n:[],a=o.find(function(u){return u.indexOf(e+"=")===0}),a?[2,a.substring(e.length+1)]:[2,void 0]})})},t.prototype.set=function(e,r){var n;return S(this,void 0,void 0,function(){var i,o,a,s,u,l,c;return T(this,function(f){try{i=(n=this.options.expirationDays)!==null&&n!==void 0?n:0,o=r!==null?i:-1,a=void 0,o&&(s=new Date,s.setTime(s.getTime()+o*24*60*60*1e3),a=s),u="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(r)))),a&&(u+="; expires=".concat(a.toUTCString())),u+="; path=/",this.options.domain&&(u+="; domain=".concat(this.options.domain)),this.options.secure&&(u+="; Secure"),this.options.sameSite&&(u+="; SameSite=".concat(this.options.sameSite)),l=F(),l&&(l.document.cookie=u)}catch(d){c=d instanceof Error?d.message:String(d),console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(e,". Error: ").concat(c))}return[2]})})},t.prototype.remove=function(e){return S(this,void 0,void 0,function(){return T(this,function(r){switch(r.label){case 0:return[4,this.set(e,null)];case 1:return r.sent(),[2]}})})},t.prototype.reset=function(){return S(this,void 0,void 0,function(){return T(this,function(e){return[2]})})},t})(),Zi=function(t){try{return decodeURIComponent(atob(t))}catch{return}},eo=function(t){try{return decodeURIComponent(atob(decodeURIComponent(t)))}catch{return}},Sr=function(t,e,r){return e===void 0&&(e=""),r===void 0&&(r=10),[ut,e,t.substring(0,r)].filter(
4Boolean).join("_")},Bt=(function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return S(this,void 0,void 0,function(){var e,r,n,i;return T(this,function(o){switch(o.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),r=new t(this.storage),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,r.set(n,e)];case 2:return o.sent(),[4,r.get(n)];case 3:return i=o.sent(),[2,i===e];case 4:return o.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return S(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return r=n.sent(),r?[2,JSON.parse(r)]:[2,void 0];case 2:return n.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var r;return S(this,void 0,void 0,function(){return T(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(e))||void 0]})})},t.prototype.set=function(e,r){var n;return S(this,void 0,void 0,function(){return T(this,function(i){try{(n=this.storage)===null||n===void 0||n.setItem(e,JSON.stringify(r))}catch{}return[2]})})},t.prototype.remove=function(e){var r;return S(this,void 0,void 0,function(){return T(this,function(n){try{(r=this.storage)===null||r===void 0||r.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return S(this,void 0,void 0,function(){return T(this,function(r){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t})(),to=10,ro=1,x={TAGS:"tags",COUNTERS:"counters",HISTOGRAMS:"histograms",EVENTS:"events",INTERNAL:"internal"},_r={LAST_FLUSH_TIMESTAMP:"last_flush_timestamp"},wr=(function(){function t(e,r){this.dbPromise=null,this.logger=r,this.dbName="AMP_diagnostics_".concat(e.substring(0,10))}return t.isSupported=function(){var e;return((e=F())===null||e===void 0?void 0:e.indexedDB)!==void 0},t.prototype.getDB=function(){return S(this,void 0,void 0,function(){return T(this,function(e){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},t.prototype.openDB=function(){var e=this;return new Promise(function(r,n){var i=indexedDB.open(e.dbName,ro);i.onerror=function(){e.dbPromise=null,n(new Error("Failed to open IndexedDB"))},i.onsuccess=function(){var o=i.result;o.onclose=function(){e.dbPromise=null,e.logger.debug("DiagnosticsStorage: DB connection closed.")},o.onerror=function(a){e.logger.debug("DiagnosticsStorage: A global database error occurred.",a),o.close()},r(o)},i.onupgradeneeded=function(o){var a=o.target.result;e.createTables(a)}})},t.prototype.createTables=function(e){if(e.objectStoreNames.contains(x.TAGS)||e.createObjectStore(x.TAGS,{keyPath:"key"}),e.objectStoreNames.contains(x.COUNTERS)||e.createObjectStore(x.COUNTERS,{keyPath:"key"}),e.objectStoreNames.contains(x.HISTOGRAMS)||e.createObjectStore(x.HISTOGRAMS,{keyPath:"key"}),!e.objectStoreNames.contains(x.EVENTS)){var r=e.createObjectStore(x.EVENTS,{keyPath:"id",autoIncrement:!0});r.createIndex("time_idx","time",{unique:!1})}e.objectStoreNames.contains(x.INTERNAL)||e.createObjectStore(x.INTERNAL,{keyPath:"key"})},t.prototype.setTags=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([x.TAGS],"readwrite"),i=n.objectStore(x.TAGS),[2,new Promise(function(u){var l=Object.entries(e);n.oncomplete=function(){u()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set tags",c),u()},l.forEach(function(c){var f=O(c,2),d=f[0],v=f[1],g=i.put({key:d,value:v});g.onerror=function(m){a.logger.debug("DiagnosticsStorage: Failed to set tag",d,v,m)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",o),[3,3];case 3:return[2]}})})},t.prototype.incrementCounters=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([x.COUNTERS],"readwrite"),i=n.objectStore(x.COUNTERS),[2,new Promise(function(u){var l=Object.entries(e);n.oncomplete=function(){u()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to increment counters",c),u()},l.forEach(function(c){var f=O(c,2),d=f[0],v=f[1],g=i.get(d);g.onsuccess=function(){var m=g.result,y=m?m.value:0,p=i.put({key:d,value:y+v});p.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to update counter",d,h)}},g.onerror=function(m){a.logger.debug("DiagnosticsStorage: Failed to read existing counter",d,m)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",o),[3,3];case 3:return[2]}})})},t.prototype.setHistogramStats=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(e).length===0?[2]:[4,this.getDB()];
4case 1:return r=s.sent(),n=r.transaction([x.HISTOGRAMS],"readwrite"),i=n.objectStore(x.HISTOGRAMS),[2,new Promise(function(u){var l=Object.entries(e);n.oncomplete=function(){u()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",c),u()},l.forEach(function(c){var f=O(c,2),d=f[0],v=f[1],g=i.get(d);g.onsuccess=function(){var m=g.result,y;m?y={key:d,count:m.count+v.count,min:Math.min(m.min,v.min),max:Math.max(m.max,v.max),sum:m.sum+v.sum}:y={key:d,count:v.count,min:v.min,max:v.max,sum:v.sum};var p=i.put(y);p.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",d,h)}},g.onerror=function(m){a.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",d,m)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",o),[3,3];case 3:return[2]}})})},t.prototype.addEventRecords=function(e){return S(this,void 0,void 0,function(){var r,n,i,o,a=this;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),e.length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([x.EVENTS],"readwrite"),i=n.objectStore(x.EVENTS),[2,new Promise(function(u){n.oncomplete=function(){u()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to add event records",c),u(
4)};var l=i.count();l.onsuccess=function(){var c=l.result,f=Math.max(0,to-c);f<e.length&&a.logger.debug("DiagnosticsStorage: Only added ".concat(f," of ").concat(e.length," events due to storage limit")),e.slice(0,f).forEach(function(d){var v=i.add(d);v.onerror=function(g){a.logger.debug("DiagnosticsStorage: Failed to add event record",g)}})},l.onerror=function(c){a.logger.debug("DiagnosticsStorage: Failed to count existing events",c)}})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to add event records",o),[3,3];case 3:return[2]}})})},t.prototype.setInternal=function(e,r){return S(this,void 0,void 0,function(){var n,i,o,a;return T(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this.getDB()];case 1:return n=s.sent(),i=n.transaction([x.INTERNAL],"readwrite"),o=i.objectStore(x.INTERNAL),[2,new Promise(function(u,l){i.onabort=function(){return l(new Error("Failed to set internal value"))};var c=o.put({key:e,value:r});c.onsuccess=function(){return u()},c.onerror=function(){return l(new Error("Failed to set internal value"))}})];case 2:return a=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set internal value",a),[3,3];case 3:return[2]}})})},t.prototype.getInternal=function(e){return S(this,void 0,void 0,function(){var r,n,i,o;return T(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this.getDB()];case 1:return r=a.sent(),n=r.transaction([x.INTERNAL],"readonly"),i=n.objectStore(x.INTERNAL),[2,new Promise(function(s,u){n.onabort=function(){return u(new Error("Failed to get internal value"))};var l=i.get(e);l.onsuccess=function(){return s(l.result)},l.onerror=function(){return u(new Error("Failed to get internal value"))}})];case 2:return o=a.sent(),this.logger.debug("DiagnosticsStorage: Failed to get internal value",o),[2,void 0];case 3:return[2]}})})},t.prototype.getLastFlushTimestamp=function(){return S(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(_r.LAST_FLUSH_TIMESTAMP)];case 1:return e=n.sent(),[2,e?parseInt(e.value,10):void 0];case 2:return r=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to get last flush timestamp",r),[2,void 0];case 3:return[2]}})})},t.prototype.setLastFlushTimestamp=function(e){return S(this,void 0,void 0,function(){var r;return T(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(_r.LAST_FLUSH_TIMESTAMP,e.toString())];case 1:return n.sent(),[3,3];case 2:return r=n.sent(),this.logger.debug("DiagnosticsStorage: Failed to set last flush timestamp",r),[3,3];case 3:return[2]}})})},t.prototype.clearTable=function(e,r){return new Promise(function(n,i){var o=e.objectStore(r),a=o.clear();a.onsuccess=function(){return n()},a.onerror=function(){return i(new Error("Failed to clear table ".concat(r)))}})},t.prototype.getAllAndClear=function(){return S(this,void 0,void 0,function(){var e,r,n,i,o,a,s,u;return T(this,function(l){switch(l.label){case 0:return l.trys.push([0,4,,5]),[4,this.getDB()];case 1:return e=l.sent(),r=e.transaction([x.TAGS,x.COUNTERS,x.HISTOGRAMS,x.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(r,x.TAGS),this.getAllFromStore(r,x.COUNTERS),this.getAllFromStore(r,x.HISTOGRAMS),this.getAllFromStore(r,x.EVENTS)])];case 2:return n=O.apply(void 0,[l.sent(),4]),i=n[0],o=n[1],a=n[2],s=n[3],[4,Promise.all([this.clearTable(r,x.COUNTERS),this.clearTable(r,x.HISTOGRAMS),this.clearTable(r,x.EVENTS)])];case 3:return l.sent(),[2,{tags:i,counters:o,histogramStats:a,events:s}];case 4:return u=l.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",u),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},t.prototype.getAllFromStore=function(e,r){return new Promise(function(n,i){var o=e.objectStore(r),a=o.getAll();a.onsuccess=function(){return n(a.result)},a.onerror=function(){return i(new Error("Failed to get all from ".concat(r)))}})},t})(),no="__AMPLITUDE_SCRIPT_URL__",io="sdk.error.uncaught",oo=function(){var t=F();return t==null?void 0:t[no]},ao=function(t){var e=F();if(!(!e||typeof e.addEventListener!="function")){var r=function(o){var a=o.error instanceof Error?o.error:void 0,s=a==null?void 0:a.stack,u=Ir({filename:o.filename,stack:s});u&&i({type:"error",message:o.message,stack:s,filename:o.filename,errorName:a==null?void 0:a.name,metadata:{colno:o.colno,lineno:o.lineno,isTrusted:o.isTrusted,matchReason:u}})},n=function(o){var a,s=o.reason instanceof Error?o.reason:void 0,u=s==null?void 0:s.stack,l=so(u),c=Ir({filename:l,stack:u});c&&i({type:"unhandledrejection",message:(a=s==null?void 0:s.message)!==null&&a!==void 0?a:uo(o.reason),stack:u,filename:l,errorName:s==null?void 0:s.name,metadata:{isTrusted:o.isTrusted,matchReason:c}})},i=function(o){t.recordEvent(io,w({type:o.type,message:o.message,filename:o.filename,error_name:o.errorName,stack:o.stack},o.metadata))};e.addEventListener("error",r,!0),e.addEventListener("unhandledrejection",n,!0)}},Ir=function(t){var e=oo();if(e){if(t.filename&&t.filename.includes(e))return"filename";if(t.stack&&t.stack.includes(e))return"stack"}},so=function(t){if(t){var e=t.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return e?e[1]:void 0}},uo=function(t){if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return"[object Object]"}},lo=1e3,He=300*1e3,co="https://diagnostics.prod.us-west-2.amplitude.com/v1/capture",fo="https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",yt=1e4,vo=10,ho=(function(){function t(e,r,n,i){n===void 0&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=e,this.logger=r,this.serverUrl=n==="US"?co:fo,this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(i,null,2)),this.config=w({enabled:!0,sampleRate:0},i),this.startTimestamp=Date.now(),this.shouldTrack=Tr(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,wr.isSupported()?this.storage=new wr(e,r):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),ao(this))}return t.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},t.prototype.setTag=function(e,r){if(this.isStorageAndTrackEnabled()){if
4(Object.keys(this.inMemoryTags).length>=yt){this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");return}this.inMemoryTags[e]=r,this.startTimersIfNeeded()}},t.prototype.increment=function(e,r){if(r===void 0&&(r=1),!!this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=yt){this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");return}this.inMemoryCounters[e]=(this.inMemoryCounters[e]||0)+r,this.startTimersIfNeeded()}},t.prototype.recordHistogram=function(e,r){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=yt){this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");return}var n=this.inMemoryHistograms[e];n?(n.count+=1,n.min=Math.min(n.min,r),n.max=Math.max(n.max,r),n.sum+=r):this.inMemoryHistograms[e]={count:1,min:r,max:r,sum:r},this.startTimersIfNeeded()}},t.prototype.recordEvent=function(e,r){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=vo){this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");return}this.inMemoryEvents.push({event_name:e,time:Date.now(),event_properties:r}),this.startTimersIfNeeded()}},t.prototype.startTimersIfNeeded=function(){var e=this;this.saveTimer||(this.saveTimer=setTimeout(function(){e.saveAllDataToStorage().catch(function(r){e.logger.debug("DiagnosticsClient: Failed to save all data to storage",r)}).finally(function(){e.saveTimer=null})},lo)),this.flushTimer||(this.flushTimer=setTimeout(function(){e._flush().catch(function(r){e.logger.debug("DiagnosticsClient: Failed to flush",r)}).finally(function(){e.flushTimer=null})},He))},t.prototype.saveAllDataToStorage=function(){return S(this,void 0,void 0,function(){var e,r,n,i;return T(this,function(o){switch(o.label){case 0:return this.storage?(e=w({},this.inMemoryTags),r=w({},this.inMemoryCounters),n=w({},this.inMemoryHistograms),i=M([],O(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(e),this.storage.incrementCounters(r),this.storage.setHistogramStats(n),this.storage.addEventRecords(i)])]):[2];case 1:return o.sent(),[2]}})})},t.prototype._flush=function(){return S(this,void 0,void 0,function(){var e,r,n,i,o,a,s,u,l,c;return T(this,function(f){switch(f.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return f.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return e=f.sent(),r=e.tags,n=e.counters,i=e.histogramStats,o=e.events,this.storage.setLastFlushTimestamp(Date.now()),a={},r.forEach(function(d){a[d.key]=d.value}),s={},n.forEach(function(d){s[d.key]=d.value}),u={},i.forEach(function(d){u[d.key]={count:d.count,min:d.min,max:d.max,avg:Math.round(d.sum/d.count*100)/100}}),l=o.map(function(d){return{event_name:d.event_name,time:d.time,event_properties:d.event_properties}}),Object.keys(s).length===0&&Object.keys(u).length===0&&l.length===0?[2]:(c={tags:a,histogram:u,counters:s,events:l},this.fetch(c),[2])}})})},t.prototype.fetch=function(e){return S(this,void 0,void 0,function(){var r,n;return T(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),!F())throw new Error("DiagnosticsClient: Fetch is not supported");return[4,fetch(this.serverUrl,{method:"POST",headers:{"X-ApiKey":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return r=i.sent(),r.ok?(this.logger.debug("DiagnosticsClient: Successfully sent diagnostics data"),[3,3]):(this.logger.debug("DiagnosticsClient: Failed to send diagnostics data."),[2]);case 2:return n=i.sent(),this.logger.debug("DiagnosticsClient: Failed to send diagnostics data. ",n),[3,3];case 3:return[2]}})})},t.prototype.initializeFlushInterval=function(){return S(this,void 0,void 0,function(){var e,r,n;return T(this,function(i){switch(i.label){case 0:return this.storage?(e=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return r=i.sent()||-1,r===-1?(this.storage.setLastFlushTimestamp(e),this._setFlushTimer(He),[2]):(n=e-r,n>=He?(this._flush(),[2]):(this._setFlushTimer(He-n),[2]))}})})},t.prototype._setFlushTimer=function(e){var r=this;this.flushTimer=setTimeout(function(){r._flush().catch(function(n){r.logger.debug("DiagnosticsClient: Failed to flush",n)}).finally(function(){r.flushTimer=null})},e)},t.prototype._setSampleRate=function(e){this.logger.debug("DiagnosticsClient: Setting sample rate to",e),this.config.sampleRate=e,this.shouldTrack=Tr(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},t})(),Ht=(function(){function t(){}return t.prototype.send=function(e,r){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var r,n,i,o,a,s,u,l,c,f,d,v,g,m,y,p,h,b,E,_,I,A;if(typeof e!="object")return null;var C=e.code||0,L=this.buildStatus(C);switch(L){case K.Success:return{status:L,statusCode:C,body:{eventsIngested:(r=e.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=e.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case K.Invalid:return{status:L,statusCode:C,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(a=e.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(s=e.events_with_invali
vendor: 5,548 bytes, line 4
4d_fields)!==null&&s!==void 0?s:{},eventsWithMissingFields:(u=e.events_with_missing_fields)!==null&&u!==void 0?u:{},eventsWithInvalidIdLengths:(l=e.events_with_invalid_id_lengths)!==null&&l!==void 0?l:{},epsThreshold:(c=e.eps_threshold)!==null&&c!==void 0?c:0,exceededDailyQuotaDevices:(f=e.exceeded_daily_quota_devices)!==null&&f!==void 0?f:{},silencedDevices:(d=e.silenced_devices)!==null&&d!==void 0?d:[],silencedEvents:(v=e.silenced_events)!==null&&v!==void 0?v:[],throttledDevices:(g=e.throttled_devices)!==null&&g!==void 0?g:{},throttledEvents:(m=e.throttled_events)!==null&&m!==void 0?m:[]}};case K.PayloadTooLarge:return{status:L,statusCode:C,body:{error:(y=e.error)!==null&&y!==void 0?y:""}};case K.RateLimit:return{status:L,statusCode:C,body:{error:(p=e.error)!==null&&p!==void 0?p:"",epsThreshold:(h=e.eps_threshold)!==null&&h!==void 0?h:0,throttledDevices:(b=e.throttled_devices)!==null&&b!==void 0?b:{},throttledUsers:(E=e.throttled_users)!==null&&E!==void 0?E:{},exceededDailyQuotaDevices:(_=e.exceeded_daily_quota_devices)!==null&&_!==void 0?_:{},exceededDailyQuotaUsers:(I=e.exceeded_daily_quota_users)!==null&&I!==void 0?I:{},throttledEvents:(A=e.throttled_events)!==null&&A!==void 0?A:[]}};case K.Timeout:default:return{status:L,statusCode:C}}},t.prototype.buildStatus=function(e){return kt(e)?K.Success:e===429?K.RateLimit:e===413?K.PayloadTooLarge:e===408?K.Timeout:e>=400&&e<500?K.Invalid:e>=500?K.Failed:K.Unknown},t})(),go=(function(t){Se(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.customHeaders=r,n}return e.prototype.send=function(r,n){return S(this,void 0,void 0,function(){var i,o,a;return T(this,function(s){switch(s.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:w({"Content-Type":"application/json",Accept:"*/*"},this.customHeaders),body:JSON.stringify(n),method:"POST"},[4,fetch(r,i)];case 1:return o=s.sent(),[4,o.text()];case 2:a=s.sent();try{return[2,this.buildResponse(JSON.parse(a))]}catch{return[2,this.buildResponse({code:o.status})]}return[2]}})})},e})(Ht),po=(function(){function t(e,r){this.key="AMP_remote_config_".concat(e.substring(0,10)),this.logger=r}return t.prototype.fetchConfig=function(){var e=null,r={remoteConfig:null,lastFetch:new Date};try{e=localStorage.getItem(this.key)}catch(i){return this.logger.debug("Remote config localstorage failed to access: ",i),Promise.resolve(r)}if(e===null)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(r);try{var n=JSON.parse(e);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(JSON.stringify(n))),Promise.resolve({remoteConfig:n.remoteConfig,lastFetch:new Date(n.lastFetch)})}catch(i){return this.logger.debug("Remote config localstorage failed to parse: ",i),localStorage.removeItem(this.key),Promise.resolve(r)}},t.prototype.setConfig=function(e){try{return localStorage.setItem(this.key,JSON.stringify(e)),this.logger.debug("Remote config localstorage set successfully."),Promise.resolve(!0)}catch(r){this.logger.debug("Remote config localstorage failed to set: ",r)}return Promise.resolve(!1)},t})(),mo="https://sr-client-cfg.amplitude.com/config",yo="https://sr-client-cfg.eu.amplitude.com/config",bo=3,Eo=1e3,To=300*1e3,So=(function(){function t(e,r,n,i){n===void 0&&(n="US"),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.apiKey=e,this.serverUrl=i||(n==="US"?mo:yo),this.logger=r,this.storage=new po(e,r)}return t.prototype.subscribe=function(e,r,n){var i=ye(),o={id:i,key:e,deliveryMode:r,callback:n};return this.callbackInfos.push(o),r==="all"?this.subscribeAll(o):this.subscribeWaitForRemote(o,r.timeout),i},t.prototype.unsubscribe=function(e){var r=this.callbackInfos.findIndex(function(n){return n.id===e});return r===-1?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(e," doesn't exist.")),!1):(this.callbackInfos.splice(r,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(e,".")),!0)},t.prototype.updateConfigs=function(){return S(this,void 0,void 0,function(){var e,r,n=this;return T(this,function(i){switch(i.label){case 0:return this.lastSuccessfulFetch&&(e=Date.now()-this.lastSuccessfulFetch,e<To)?(this.logger.debug("Remote config client skipping updateConfigs: Too recent"),[2]):[4,this.getOrCreateFetchPromise()];case 1:return r=i.sent(),this.storage.setConfig(r),this.callbackInfos.forEach(function(o){n.sendCallback(o,r,"remote")}),[2]}})})},t.prototype.getOrCreateFetchPromise=function(){var e=this;return this.fetchPromise?this.fetchPromise:(this.fetchPromise=this.fetch().then(function(r){return r.remoteConfig!==null&&(e.lastSuccessfulFetch=Date.now()),r}).finally(function(){e.fetchPromise=null}),this.fetchPromise)},t.prototype.subscribeAll=function(e){return S(this,void 0,void 0,function(){var r,n,i,o=this;return T(this,function(a){switch(a.label){case 0:return r=this.getOrCreateFetchPromise().then(function(s){o.logger.debug("Remote config client subscription all mode fetched from remote: ".concat(JSON.stringify(s))),o.sendCallback(e,s,"remote"),o.storage.setConfig(s)}),n=this.storage.fetchConfig().then(function(s){return s}),[4,Promise.race([r,n])];case 1:return i=a.sent(),i!==void 0&&(this.logger.debug("Remote config client subscription all mode fetched from cache: ".concat(JSON.stringify(i))),i.remoteConfig!==null?this.sendCallback(e,i,"cache"):this.logger.debug("Remote config client skips sending c
4allback because cache is empty (first time user).")),[4,r];case 2:return a.sent(),[2]}})})},t.prototype.subscribeWaitForRemote=function(e,r){return S(this,void 0,void 0,function(){var n,i,i;return T(this,function(o){switch(o.label){case 0:n=new Promise(function(a,s){setTimeout(function(){s("Timeout exceeded")},r)}),o.label=1;case 1:return o.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return i=o.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(e,i,"remote"),this.storage.setConfig(i),[3,5];case 3:return o.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 i=o.sent(),i.remoteConfig!==null?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(e,i,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(e,i,"remote")),[3,5];case 5:return[2]}})})},t.prototype.sendCallback=function(e,r,n){e.lastCallback=new Date;var i;e.key?i=e.key.split(".").reduce(function(o,a){return o===null?o:a in o?o[a]:null},r.remoteConfig):i=r.remoteConfig,e.callback(i,n,r.lastFetch)},t.prototype.fetch=function(e,r){return e===void 0&&(e=bo),r===void 0&&(r=Eo),S(this,void 0,void 0,function(){var n,i,o,a,s,u,l=this;return T(this,function(c){switch(c.label){case 0:n=r/e,i={remoteConfig:null,lastFetch:new Date},o=function(f){var d,v,g,m,y,p;return T(this,function(h){switch(h.label){case 0:d=new AbortController,v=setTimeout(function(){return d.abort()},r),h.label=1;case 1:return h.trys.push([1,7,8,9]),[4,fetch(a.getUrlParams(),{method:"GET",headers:{Accept:"*/*"},signal:d.signal})];case 2:return g=h.sent(),g.ok?[3,4]:[4,g.text()];case 3:return m=h.sent(),a.logger.debug("Remote config client fetch with retry time ".concat(e," failed with ").concat(g.status,": ").concat(m)),[3,6];case 4:return[4,g.json()];case 5:return y=h.sent(),[2,{value:{remoteConfig:y,lastFetch:new Date}}];case 6:return[3,9];case 7:return p=h.sent(),p instanceof Error&&p.name==="AbortError"?a.logger.debug("Remote config client fetch with retry time ".concat(e," timed out after ").concat(r,"ms")):a.logger.debug("Remote config client fetch with retry time ".concat(e," is rejected because: "),p),[3,9];case 8:return clearTimeout(v),[7];case 9:return f<e-1?[4,new Promise(function(b){return setTimeout(b,l.getJitterDelay(n))})]:[3,11];case 10:h.sent(),h.label=11;case 11:return[2]}})},a=this,s=0,c.label=1;case 1:return s<e?[5,o(s)]:[3,4];case 2:if(u=c.sent(),typeof u=="object")return[2,u.value];c.label=3;case 3:return s++,[3,1];case 4:return[2,i]}})})},t.prototype.getJitterDelay=function(e){return Math.floor(Math.random()*e)},t.prototype.getUrlParams=function(){var e=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",t.CONFIG_GROUP),"".concat(this.serverUrl,"/").concat(e,"?").concat(r.toString())},t.CONFIG_GROUP="browser",t})(),Ct;(function(t){t.US="US",t.EU="EU",t.STAGING="STAGING"})(Ct||(Ct={}));var gn=null,pn=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],Gt="data-amp-track-",mn=["div","span","h1","h2","h3","h4","h5","h6"],_o=["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]'],wo=M(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],O(_o),!1),Io=["*"],Ao=1e3,Po=4,ko=50;function Ro(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null||t===void 0}function yn(t,e,r){if(t){var n=e.map(Ar),i=r.map(Ar);bn({json:t,allowlist:n,excludelist:i,ancestors:[]})}}function bn(t){var e,r,n=t.json,i=t.targetObject,o=t.allowlist,a=t.excludelist,s=t.ancestors,u=t.parentObject,l=t.targetKey;
4i||(i=n);var c=Object.keys(i);try{for(var f=D(c),d=f.next();!d.done;d=f.next()){var v=d.value,g=M(M([],O(s),!1),[v],!1);Ro(i[v])?(!Pr(g,o)||Pr(g,a))&&delete i[v]:bn({json:n,targetObject:i[v],allowlist:o,excludelist:a,ancestors:g,parentObject:i,targetKey:v})}}catch(m){e={error:m}}finally{try{d&&!d.done&&(r=f.return)&&r.call(f)}finally{if(e)throw e.error}}Object.keys(i).length===0&&u&&l&&delete u[l]}function Ar(t){return t.startsWith("/")&&(t=t.slice(1)),t.split("/").map(function(e){return e.replace(/~0/g,"~").replace(/~1/g,"/")})}function Lt(t,e,r,n){if(r===void 0&&(r=0),n===void 0&&(n=0),n===e.length)return r===t.length;if(r===t.length){for(;n<e.length&&e[n]==="**";)n++;return n===e.length}var i=e[n];if(i==="**"){if(n+1===e.length)return!0;for(var o=r;o<=t.length;o++)if(Lt(t,e,o,n+1))return!0;return!1}else return i==="*"||i===t[r]?Lt(t,e,r+1,n+1):!1}function Pr(t,e){return e.some(function(r){return Lt(t,r)})}var Oo=500,En=100,Co=(function(){function t(e){this.request=e}return t.prototype.headers=function(e){var r,n;e===void 0&&(e=[]);var i=this.request.headers,o={};if(Array.isArray(i))i.forEach(function(f){var d=O(f,2),v=d[0],g=d[1];o[v]=g});else if(i instanceof Headers)i.forEach(function(f,d){o[d]=f});else if(typeof i=="object"&&i!==null)try{for(var a=D(Object.entries(i)),s=a.next();!s.done;s=a.next()){var u=O(s.value,2),l=u[0],c=u[1];o[l]=c}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return ct(o,{allow:e})},Object.defineProperty(t.prototype,"bodySize",{get:function(){if(typeof this._bodySize=="number")return this._bodySize;var e=F();if(e!=null&&e.TextEncoder){var r=this.request.body;return this._bodySize=Tn(r,En),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return typeof this.request.body=="string"?this.request.body:null},enumerable:!1,configurable:!0}),t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),S(this,void 0,void 0,function(){var n;return T(this,function(i){return e.length===0?[2,null]:(n=this.body,[2,Wt(n,e,r)])})})},t})(),Lo=(function(){function t(e,r){this.bodyRaw=e,this.requestHeaders=r}return t.prototype.headers=function(e){return e===void 0&&(e=[]),ct(this.requestHeaders,{allow:e})},Object.defineProperty(t.prototype,"bodySize",{get:function(){return Tn(this.bodyRaw,En)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"body",{get:function(){return typeof this.bodyRaw=="string"?this.bodyRaw:null},enumerable:!1,configurable:!0}),t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),S(this,void 0,void 0,function(){var n;return T(this,function(i){return e.length===0?[2,null]:(n=this.body,[2,Wt(n,e,r)])})})},t})();function Tn(t,e){var r,n,i,o=F(),a=o==null?void 0:o.TextEncoder;if(a){var s;if(typeof t=="string")s=t,i=new a().encode(s).length;else if(t instanceof Blob)s=t,i=s.size;else if(t instanceof URLSearchParams)s=t,i=new a().encode(s.toString()).length;else if(ArrayBuffer.isView(t))s=t,i=s.byteLength;else if(t instanceof ArrayBuffer)s=t,i=s.byteLength;else if(t instanceof FormData){var u=t,l=0,c=0;try{for(var f=D(u.entries()),d=f.next();!d.done;d=f.next()){var v=O(d.value,2),g=v[0],m=v[1];if(l+=g.length,typeof m=="string")l+=new a().encode(m).length;else if(m instanceof Blob)l+=m.size;else return;if(++c>=e)return}}catch(y){r={error:y}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}i=l}else if(t instanceof ReadableStream){s=t;return}return i}}var Do=(function(){function t(e){this.response=e}return t.prototype.headers=function(e){var r;if(e===void 0&&(e=[]),this.response.headers instanceof Headers){var n=this.response.headers,i={};return(r=n==null?void 0:n.forEach)===null||r===void 0||r.call(n,function(o,a){i[a]=o}),ct(i,{allow:e})}},Object.defineProperty(t.prototype,"bodySize",{get:function(){var e,r;if(this._bodySize!==void 0)return this._bodySize;var n=(r=(e=this.response.headers)===null||e===void 0?void 0:e.get)===null||r===void 0?void 0:r.call(e,"content-length"),i=n?parseInt(n,10):void 0;return this._bodySize=i,i}
4,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),t.prototype.text=function(){return S(this,void 0,void 0,function(){var e,r,n;return T(this,function(i){switch(i.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),i.label=1;case 1:return i.trys.push([1,3,,4]),e=this.clonedResponse.text(),r=new Promise(function(o){return setTimeout(function(){return o(null)},Oo)}),[4,Promise.race([e,r])];case 2:return n=i.sent(),[2,n];case 3:return i.sent(),[2,null];case 4:return[2]}})})},t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),S(this,void 0,void 0,function(){var n;return T(this,function(i){switch(i.label){case 0:return e.length===0?[2,null]:[4,this.text()];case 1:return n=i.sent(),[2,Wt(n,e,r)]}})})},t})(),No=(function(){function t(e,r,n,i){this.statusCode=e,this.headersString=r,this.size=n,this.getJson=i}return Object.defineProperty(t.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),t.prototype.headers=function(e){var r,n;if(e===void 0&&(e=[]),!this.headersString)return{};var i={},o=this.headersString.split(`\r
5`);try{for(var a=D(o),s=a.next();!s.done;s=a.next()){var u=s.value,l=O(u.split(": "),2),c=l[0],f=l[1];c&&f&&(i[c]=f)}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return ct(i,{allow:e})},t.prototype.json=function(e,r){return e===void 0&&(e=[]),r===void 0&&(r=[]),S(this,void 0,void 0,function(){var n;return T(this,function(i){return e.length===0?[2,null]:(n=this.getJson(),n?(yn(n,e,r),[2,n]):[2,null])})})},t})();function Wt(t,e,r){if(!t)return null;try{var n=JSON.parse(t);return yn(n,e,r),n}catch{return null}}var xe;(function(t){t.REDACT="redact",t.REMOVE="remove"})(xe||(xe={}));var kr="[REDACTED]",ct=function(t,e){var r,n,i=e.allow,o=i===void 0?[]:i,a=e.strategy,s=a===void 0?xe.REMOVE:a,u=M([],O(gi),!1),l={},c=function(g){var m=g.toLowerCase();u.find(function(y){return y.toLowerCase()===m})?s===xe.REDACT&&(l[g]=kr):o.find(function(y){return y.toLowerCase()===m})?l[g]=t[g]:s===xe.REDACT&&(l[g]=kr)};try{for(var f=D(Object.keys(t)),d=f.next();!d.done;d=f.next()){var v=d.value;c(v)}}catch(g){r={error:g}}finally{try{d&&!d.done&&(n=f.return)&&n.call(f)}finally{if(r)throw r.error}}return l},xo=(function(){function t(e,r,n,i,o,a,s,u,l,c,f){s===void 0&&(s=0),this.type=e,this.method=r,this.timestamp=n,this.startTime=i,this.url=o,this.requestWrapper=a,this.status=s,this.duration=u,this.responseWrapper=l,this.error=c,this.endTime=f}return t.prototype.toSerializable=function(){var e,r,n,i,o={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:(e=this.requestWrapper)===null||e===void 0?void 0:e.headers(M([],O(nt),!1)),requestBodySize:(r=this.requestWrapper)===null||r===void 0?void 0:r.bodySize,responseHeaders:(n=this.responseWrapper)===null||n===void 0?void 0:n.headers(M([],O(nt),!1)),responseBodySize:(i=this.responseWrapper)===null||i===void 0?void 0:i.bodySize};return Object.fromEntries(Object.entries(o).filter(function(a){var s=O(a,2);s[0];var u=s[1];return u!==void 0}))},t})();function Uo(t){return typeof t=="object"&&t!==null&&"url"in t&&"method"in t}var Mo=(function(){function t(e,r){r===void 0&&(r=ye()),this.callback=e,this.id=r}return t})(),Fo=(function(){function t(e){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=e;var r=F();t.isSupported()&&(this.globalScope=r)}return t.isSupported=function(){var e=F();return!!e&&!!e.fetch},t.prototype.subscribe=function(e,r){var n,i,o,a,s,u,l,c,f,d;if(this.logger||(this.logger=r),this.eventCallbacks.set(e.id,e),!this.isObserving){var v=(o=(i=(n=this.globalScope)===null||n===void 0?void 0:n.XMLHttpRequest)===null||i===void 0?void 0:i.prototype)===null||o===void 0?void 0:o.open,g=(u=(s=(a=this.globalScope)===null||a===void 0?void 0:a.XMLHttpRequest)===null||s===void 0?void 0:s.prototype)===null||u===void 0?void 0:u.send,m=(f=(c=(l=this.globalScope)===null||l===void 0?void 0:l.XMLHttpRequest)===null||c===void 0?void 0:c.prototype)===null||f===void 0?void 0:f.setRequestHeader;v&&g&&m&&this.observeXhr(v,g,m);var y=(d=this.globalScope)===null||d===void 0?void 0:d.fetch;
5y&&this.observeFetch(y),this.isObserving=!0}},t.prototype.unsubscribe=function(e){this.eventCallbacks.delete(e.id)},t.prototype.triggerEventCallbacks=function(e){var r=this;this.eventCallbacks.forEach(function(n){var i;try{n.callback(e)}catch(o){(i=r.logger)===null||i===void 0||i.debug("an unexpected error occurred while triggering event callbacks",o)}})},t.prototype.handleNetworkRequestEvent=function(e,r,n,i,o,a,s){var u;if(!(a===void 0||s===void 0)){var l,c="GET";if(Uo(r)?(l=r.url,c=r.method):l=(u=r==null?void 0:r.toString)===null||u===void 0?void 0:u.call(r),l)try{var f=new URL(l);l="".concat(f.protocol,"//").concat(f.host).concat(f.pathname).concat(f.search).concat(f.hash)}catch{}c=(n==null?void 0:n.method)||c;var d,v;i&&(d=i.status),o&&(v={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},d=0);var g=Math.floor(performance.now()-s),m=Math.floor(a+g),y=new xo(e,c,a,a,l,n,d,g,i,v,m);this.triggerEventCallbacks(y)}},t.prototype.getTimestamps=function(){var e,r;return{startTime:(e=Date.now)===null||e===void 0?void 0:e.call(Date),durationStart:(r=performance==null?void 0:performance.now)===null||r===void 0?void 0:r.call(performance)}},t.prototype.observeFetch=function(e){var r=this;!this.globalScope||!e||(this.globalScope.fetch=function(n,i){return S(r,void 0,void 0,function(){var o,a,s,u,l,c;return T(this,function(f){switch(f.label){case 0:try{o=this.getTimestamps()}catch(d){(l=this.logger)===null||l===void 0||l.debug("an unexpected error occurred while retrieving timestamps",d)}f.label=1;case 1:return f.trys.push([1,3,,4]),[4,e(n,i)];case 2:return a=f.sent(),[3,4];case 3:return u=f.sent(),s=u,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,i?new Co(i):void 0,a?new Do(a):void 0,s,o==null?void 0:o.startTime,o==null?void 0:o.durationStart)}catch(d){(c=this.logger)===null||c===void 0||c.debug("an unexpected error occurred while handling fetch",d)}if(a)return[2,a];throw s}})})})},t.createXhrJsonParser=function(e,r){return function(){var n,i;try{if(e.responseType==="json"){if(!((n=r.globalScope)===null||n===void 0)&&n.structuredClone)return r.globalScope.structuredClone(e.response)}else if(["text",""].includes(e.responseType))return JSON.parse(e.responseText)}catch(o){return o instanceof Error&&o.name==="InvalidStateError"&&((i=r.logger)===null||i===void 0||i.error("unexpected error when retrieving responseText. responseType='".concat(e.responseType,"'"))),null}return null}},t.prototype.observeXhr=function(e,r,n){if(!(!this.globalScope||!e||!r)){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var a,s,u=[],l=0;l<arguments.length;l++)u[l]=arguments[l];var c=this,f=O(u,2),d=f[0],v=f[1];try{c.$$AmplitudeAnalyticsEvent=w({method:d,url:(a=v==null?void 0:v.toString)===null||a===void 0?void 0:a.call(v),headers:{}},o.getTimestamps())}catch(g){(s=o.logger)===null||s===void 0||s.error("an unexpected error occurred while calling xhr open",g)}return e.apply(c,u)},i.send=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var u=this,l=u,c=t.createXhrJsonParser(u,o),f=a[0],d=l.$$AmplitudeAnalyticsEvent;return l.addEventListener("loadend",function(){var v;try{var g=l.getAllResponseHeaders(),m=l.getResponseHeader("content-length"),y=new No(l.status,g,m?parseInt(m,10):void 0,c),p=l.$$AmplitudeAnalyticsEvent.headers,h=new Lo(f,p);d.status=l.status,o.handleNetworkRequestEvent("xhr",{url:d.url,method:d.method},h,y,void 0,d.startTime,d.durationStart)}catch(b){(v=o.logger)===null||v===void 0||v.error("an unexpected error occurred while handling xhr send",b)}}),r.apply(l,a)},i.setRequestHeader=function(a,s){var u,l=this;try{l.$$AmplitudeAnalyticsEvent.headers[a]=s}catch(c){(u=o.logger)===null||u===void 0||u.error("an unexpected error occurred while calling xhr setRequestHeader",c)}n.apply(l,[a,s])}}},t})(),Rr=new Fo,Sn=(function(){function t(){}return t.prototype.parse=function(){return S(this,void 0,void 0,function(){return T(this,function(e){return[2,w(w(w(w({},lt),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=it(),r=e[li],n=e[ci],i=e[di],o=e[fi],a=e[vi],s=e[hi
5];return{utm_campaign:r,utm_content:n,utm_id:i,utm_medium:o,utm_source:a,utm_term:s}},t.prototype.getReferrer=function(){var e,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(e=n.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},t.prototype.getClickIds=function(){var e,r=it();return e={},e[sr]=r[sr],e[ur]=r[ur],e[lr]=r[lr],e[cr]=r[cr],e[dr]=r[dr],e[fr]=r[fr],e[vr]=r[vr],e[hr]=r[hr],e[gr]=r[gr],e[pr]=r[pr],e[mr]=r[mr],e},t})(),Ue="data-amp-mask",me="*****",qo=/\b(?:\d[ -]*?){13,16}\b/,Vo=/(\d{3}-?\d{2}-?\d{4})/g,jo=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,Kt=function(t,e){var r,n;if(e===void 0&&(e=[]),typeof t!="string")return"";var i=t;i=i.replace(qo,me),i=i.replace(Vo,me),i=i.replace(jo,me);try{for(var o=D(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,me)}catch{}}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},$t=function(t){if(typeof document>"u"||!document.title)return"";var e=document.querySelector("title");return e&&e.hasAttribute(Ue)?me:t?t(document.title):document.title};function Bo(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=Ho(t))||e){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
6In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Ho(t,e){if(t){if(typeof t=="string")return Or(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Or(t,e)}}function Or(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Cr(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function zt(t,e,r){return e&&Cr(t.prototype,e),r&&Cr(t,r),t}var Xt=function(){return typeof Symbol=="function"},Yt=function(t){return Xt()&&!!Symbol[t]},Jt=function(t){return Yt(t)?Symbol[t]:"@@"+t};Xt()&&!Yt("observable")&&(Symbol.observable=Symbol("observable"));var Go=Jt("iterator"),Dt=Jt("observable"),_n=Jt("species");function ot(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Le(t){var e=t.constructor;return e!==void 0&&(e=e[_n],e===null&&(e=void 0)),e!==void 0?e:re}function Wo(t){return t instanceof re}function Pe(t){Pe.log?Pe.log(t):setTimeout(function(){throw t})}function Qe(t){Promise.resolve().then(function(){try{t()}catch(e){Pe(e)}})}function wn(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=ot(e,"unsubscribe");r&&r.call(e)}}catch(n){Pe(n)}}function Nt(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function Ko(t){var e=t._queue;if(e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(In(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function In(t,e,r){t._state="running";var n=t._observer;try{var i=ot(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(Nt(t),i)i.call(n,r);else throw r;break;case"complete":Nt(t),i&&i.call(n);break}}catch(o){Pe(o)}t._state==="closed"?wn(t):t._state==="running"&&(t._state="ready")}function bt(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],Qe(function(){return Ko(t)});return}In(t,e,r)}}var $o=(function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new zo(this);try{this._cleanup=n.call(void 0,i)}catch(o){i.error(o)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Nt(this),wn(this))},zt(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t})(),zo=(function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){bt(this._subscription,"next",n)},e.error=function(n){bt(this._subscription,"error",n)},e.complete=function(){bt(this._subscription,"complete")},zt(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t})(),re=(function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new $o(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(o,a){if(typeof n!="function"){a(new TypeError(n+" is not a function"));return}function s(){u.unsubscribe(),o()}var u=i.subscribe({next:function(l){try{n(l,s)}catch(c){a(c),u.unsubscribe()}},error:a,complete:o})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var o=Le(this);return new o(function(a){return i.subscribe({next:function(s){try{s=n(s)}catch(u){return a.error(u)}a.next(s)},error:function(s){a.error(s)},complete:function(){a.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var o=Le(this);return new o(function(a){return i.subscribe({next:function(s){try{if(!n(s))return}catch(u){return a.error(u)}a.next(s)},error:function(s){a.error(s)},complete:function(){a.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var o=Le(this),a=arguments.length>1,s=!1,u=arguments[1],l=u;return new o(function(c){return i.subscribe({next:function(f){var d=!s;
6if(s=!0,!d||a)try{l=n(l,f)}catch(v){return c.error(v)}else l=f},error:function(f){c.error(f)},complete:function(){if(!s&&!a)return c.error(new TypeError("Cannot reduce an empty sequence"));c.next(l),c.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];var s=Le(this);return new s(function(u){var l,c=0;function f(d){l=d.subscribe({next:function(v){u.next(v)},error:function(v){u.error(v)},complete:function(){c===o.length?(l=void 0,u.complete()):f(s.from(o[c++]))}})}return f(n),function(){l&&(l.unsubscribe(),l=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var o=Le(this);return new o(function(a){var s=[],u=i.subscribe({next:function(c){if(n)try{c=n(c)}catch(d){return a.error(d)}var f=o.from(c).subscribe({next:function(d){a.next(d)},error:function(d){a.error(d)},complete:function(){var d=s.indexOf(f);d>=0&&s.splice(d,1),l()}});s.push(f)},error:function(c){a.error(c)},complete:function(){l()}});function l(){u.closed&&s.length===0&&a.complete()}return function(){s.forEach(function(c){return c.unsubscribe()}),u.unsubscribe()}})},e[Dt]=function(){return this},t.from=function(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var o=ot(n,Dt);if(o){var a=o.call(n);if(Object(a)!==a)throw new TypeError(a+" is not an object");return Wo(a)&&a.constructor===i?a:new i(function(s){return a.subscribe(s)})}if(Yt("iterator")&&(o=ot(n,Go),o))return new i(function(s){Qe(function(){if(!s.closed){for(var u=Bo(o.call(n)),l;!(l=u()).done;){var c=l.value;if(s.next(c),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){Qe(function(){if(!s.closed){for(var u=0;u<n.length;++u)if(s.next(n[u]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},t.of=function(){for(var n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];var a=typeof this=="function"?this:t;return new a(function(s){Qe(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})})},zt(t,null,[{key:_n,get:function(){return this}}]),t})();Xt()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:Dt,hostReportError:Pe},configurable:!0});function Qt(t,e){return new re(function(r){t.subscribe({next:function(n){e(n).then(function(i){return r.next(i)}).catch(function(i){return r.error(i)})},error:function(n){r.error(n)},complete:function(){r.complete()}})})}function at(t,e){return new re(function(r){var n=!1,i=new Set,o=function(){var s,u;n=!0;try{for(var l=D(i),c=l.next();!c.done;c=l.next()){var f=c.value;try{f.unsubscribe()}catch{}}}catch(d){s={error:d}}finally{try{c&&!c.done&&(u=l.return)&&u.call(l)}finally{if(s)throw s.error}}i.clear()},a=function(s){var u=s.subscribe({next:function(l){n||r.next(l)},error:function(l){n||(n=!0,r.error(l),o())},complete:function(){i.delete(u),!n&&i.size===0&&(r.complete(),o(),n=!0)}});i.add(u)};return a(t),a(e),o})}function Ee(t){var e=new Set,r=null;function n(){r==null||r.unsubscribe(),r=null,e.clear()}return new re(function(i){return e.add(i),r===null&&(r=t.subscribe({next:function(o){var a,s,u;try{for(var l=D(e),c=l.next();!c.done;c=l.next()){var f=c.value;(u=f.next)===null||u===void 0||u.call(f,o)}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}},error:function(o){var a,s,u;try{for(var l=D(e),c=l.next();!c.done;c=l.next()){var f=c.value;(u=f.error)===null||u===void 0||u.call(f,o)}}catch(d){a={error:d}}finally{try{c&&!c.done&&(s=l.return)&&s.call(l)}finally{if(a)throw a.error}}n()},complete:function(){var o,a,s;try{for(var u=D(e),l=u.next();!l.done;l=u.next()){var c=l.value;(s=c.complete)===null||s===void 0||s.call(c)}}catch(f){o={error:f}}finally{try{l&&!l.done&&(a=u.return)&&a.call(u)}finally{if(o)throw o.error}}n()}})),function(){e.delete(i),e.size===0&&r&&(r.unsubscribe(),r=null)}})}var ke=function(t,e){return typeof t=="boolean"?t:(t==null?void 0:t[e])!==!1},An=function(t){return ke(t,"attribution")},Xo=function(t){return ke(t,"fileDownloads")},Yo=function(t){return ke(t,"formInteractions")},Pn=function(t){return ke(t,"pageViews")},Lr=function(t){return ke(t,"sessions")},Jo=function(t){return ke(t,"pageUrlEnrichment")},kn=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.networkTracking===!0||typeof t.networkTracking=="object")},Rn=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.elementInteractions===!0||typeof t.elementInteractions=="object")},Qo=function(t){return typeof t=="boolean"?t:typeof t=="object"&&t.webVitals===!0},On=function(t){return typeof t=="boolean"?t:typeof t=="object"&&(t.frustrationInteractions===!0||typeof t.frustrationInteractions=="object")},Zo=function(t){if(Rn(t.autocapture)&&typeof t.autocapture=="object"&&typeof t.autocapture.elementInteractions=="object")return t.autocapture.elementInteractions},ea=function(t){if(On(t.autocapture)&&typeof t.autocapture=="object"&&typeof t.autocapture.frustrationInteractions=="object")return t.autocapture.frustrationInteractions},ta=function(t){var e;if(kn(t.autocapture)){var r=void 0;
6return typeof t.autocapture=="object"&&typeof t.autocapture.networkTracking=="object"?r=t.autocapture.networkTracking:t.networkTrackingOptions&&(r=t.networkTrackingOptions),w(w({},r),{captureRules:(e=r==null?void 0:r.captureRules)===null||e===void 0?void 0:e.map(function(n){var i,o,a;if(!((i=n.urls)===null||i===void 0)&&i.length&&(!((o=n.hosts)===null||o===void 0)&&o.length)){var s=JSON.stringify(n.hosts),u=JSON.stringify(n.urls);return(a=t.loggerProvider)===null||a===void 0||a.warn("Found network capture rule with both urls='".concat(u,"' and hosts='").concat(s,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),w(w({},n),{hosts:void 0})}return n})})}},ra=function(t){var e=function(){return!1},r=void 0,n,i=t.pageCounter,o=Pn(t.defaultTracking);return o&&(e=void 0,n=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(r=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(n=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:r,eventType:n,pageCounter:i}},na=function(t){return An(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?w({},t.defaultTracking.attribution):{}},ia=function(t,e){Ze(t,e)},Ze=function(t,e){for(var r=0;r<e.length;r++){var n=e[r],i=n.name,o=n.args,a=n.resolve,s=t&&t[i];if(typeof s=="function"){var u=s.apply(t,o);typeof a=="function"&&a(u==null?void 0:u.promise)}}return t},Et=function(t){var e=t;return e&&e._q!==void 0},Zt="2.33.1",Cn="amplitude-ts",oa="Web",aa="$remote",sa=(function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(Cn,"/").concat(Zt),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var r,n;return S(this,void 0,void 0,function(){var i,o,a,s;return T(this,function(u){return i=new Date().getTime(),o=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1,a=(n=e.event_id)!==null&&n!==void 0?n:o+1,this.config.lastEventId=a,e.time||(this.config.lastEventTime=i),s=w(w(w(w(w(w(w(w({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:oa}),this.config.trackingOptions.language&&{language:Ji()}),this.config.trackingOptions.ipAddress&&{ip:aa}),{insert_id:ye(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:a,library:this.library,user_agent:this.userAgent}),[2,s]})})},t})(),Ge=1e3,Ln=(function(t){Se(e,t);function e(r){var n=this,i,o,a;try{a=(i=F())===null||i===void 0?void 0:i.localStorage}catch(s){(o=r==null?void 0:r.loggerProvider)===null||o===void 0||o.debug("Failed to access localStorage. error=".concat(JSON.stringify(s))),a=void 0}return n=t.call(this,a)||this,n.loggerProvider=r==null?void 0:r.loggerProvider,n}return e.prototype.set=function(r,n){var i;return S(this,void 0,void 0,function(){var o;return T(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>Ge?(o=n.length-Ge,[4,t.prototype.set.call(this,r,n.slice(0,Ge))]):[3,2];case 1:return a.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(Ge,".")),[3,4];case 2:return[4,t.prototype.set.call(this,r,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},e})(Bt),ua=(function(t){Se(e,t);function e(){var r;return t.call(this,(r=F())===null||r===void 0?void 0:r.sessionStorage)||this}return e})(Bt),la=(function(t){Se(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.state={done:4},n.customHeaders=r,n}return e.prototype.send=function(r,n){return S(this,void 0,void 0,function(){var i=this;return T(this,function(o){return[2,new Promise(function(a,s){var u,l;typeof XMLHttpRequest>"u"&&s(new Error("XHRTransport is not supported."));var c=new XMLHttpRequest;c.open("POST",r,!0),c.onreadystatechange=function(){if(c.readyState===i.state.done){var p=c.responseText;try{a(i.buildResponse(JSON.parse(p)))}catch{a(i.buildResponse({code:c.status}))}}};var f=w({"Content-Type":"application/json",Accept:"*/*"},i.customHeaders);try{for(var d=D(Object.entries(f)),v=d.next();!v.done;v=d.next()){var g=O(v.value,2),m=g[0],y=g[1];c.setRequestHeader(m,y)}}catch(p){u={error:p}}finally{try{v&&!v.done&&(l=d.return)&&l.call(d)}finally{if(u)throw u.error}}c.send(JSON.stringify(n))})]})})},e})(Ht),ca=(function(t){Se(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(r,n){return S(this,void 0,void 0,function(){var i=this;return T(this,function(o){return[2,new Promise(function(a,s){var u=F();if(!(u!=null&&u.navigator.sendBeacon))throw new Error("SendBeaconTransport is not supported");try{var l=JSON.stringify(n),c=u.navigator.sendBeacon(r,JSON.stringify(n));return a(c?i.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:l.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(f){s(f)}})]})})},e})(Ht),da=function(t,e,r){return r===void 0&&(r=!0),S(void 0,void 0,void 0,function(){var n,i,o,a,s,u,l,c,f;return T(this,function(d){switch(d.label){case 0:return n=Yi(t),[4,e.getRaw(n)];case 1:return i=d.sent(),i?r?[4,e.remove(n)]:[3,3]:[2,{optOut:!1}];case 2:d.sent(),d.label=3;
6case 3:return o=O(i.split("."),6),a=o[0],s=o[1],u=o[2],l=o[3],c=o[4],f=o[5],[2,{deviceId:a,userId:fa(s),sessionId:Tt(l),lastEventId:Tt(f),lastEventTime:Tt(c),optOut:!!u}]}})})},Tt=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},fa=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}},oe="[Amplitude]",Dr="".concat(oe," Form Started"),va="".concat(oe," Form Submitted"),ha="".concat(oe," File Downloaded"),Nr="session_start",xr="session_end",ga="".concat(oe," File Extension"),pa="".concat(oe," File Name"),ma="".concat(oe," Link ID"),ya="".concat(oe," Link Text"),ba="".concat(oe," Link URL"),St="".concat(oe," Form ID"),_t="".concat(oe," Form Name"),wt="".concat(oe," Form Destination"),st="cookie",Ea="US",Ta=(function(t){Se(e,t);function e(r,n,i,o,a,s,u,l,c,f,d,v,g,m,y,p,h,b,E,_,I,A,C,L,P,R,N,$,W,U,q,X,z,Q,ae,se,ce,Y,J,ne){i===void 0&&(i=new jt),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),l===void 0&&(l=1e3),c===void 0&&(c=5),f===void 0&&(f=30),d===void 0&&(d=st),p===void 0&&(p=new dn),h===void 0&&(h=ee.Warn),E===void 0&&(E=!1),_===void 0&&(_=!1),C===void 0&&(C=""),L===void 0&&(L=Ea),R===void 0&&(R=1800*1e3),N===void 0&&(N=new Ln({loggerProvider:p})),$===void 0&&($={ipAddress:!0,language:!0,platform:!0}),W===void 0&&(W="fetch"),U===void 0&&(U=!1),q===void 0&&(q=!0),ce===void 0&&(ce=!0),Y===void 0&&(Y=0);var k=t.call(this,{apiKey:r,storageProvider:N,transportProvider:Dn(W)})||this;k.apiKey=r,k.appVersion=n,k.cookieOptions=o,k.defaultTracking=a,k.autocapture=s,k.flushIntervalMillis=l,k.flushMaxRetries=c,k.flushQueueSize=f,k.identityStorage=d,k.ingestionMetadata=v,k.instanceName=g,k.loggerProvider=p,k.logLevel=h,k.minIdLength=b,k.offline=E,k.partnerId=I,k.plan=A,k.serverUrl=C,k.serverZone=L,k.sessionTimeout=R,k.storageProvider=N,k.trackingOptions=$,k.transport=W,k.useBatch=U,k.fetchRemoteConfig=q,k.networkTrackingOptions=ae,k.identify=se,k.enableDiagnostics=ce,k.diagnosticsSampleRate=Y,k.diagnosticsClient=J,k.remoteConfig=ne,k.version=Zt,k._optOut=!1,k._cookieStorage=i,k.deviceId=u,k.lastEventId=m,k.lastEventTime=y,k.optOut=_,k.sessionId=P,k.pageCounter=z,k.userId=X,k.debugLogsEnabled=Q,k.loggerProvider.enable(Q?ee.Debug:k.logLevel),k.networkTrackingOptions=ae,k.identify=se,k.enableDiagnostics=ce,k.diagnosticsSampleRate=Y,k.diagnosticsClient=J;var de;return(ne==null?void 0:ne.fetchRemoteConfig)===!0?de=!0:(ne==null?void 0:ne.fetchRemoteConfig)===!1||q===!1?de=!1:de=!0,k.remoteConfig=k.remoteConfig||{},k.remoteConfig.fetchRemoteConfig=de,k.fetchRemoteConfig=de,k}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){this._cookieStorage!==r&&(this._cookieStorage=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){this._deviceId!==r&&(this._deviceId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(r){this._userId!==r&&(this._userId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){this._sessionId!==r&&(this._sessionId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(r){this._optOut!==r&&(this._optOut=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){this._lastEventTime!==r&&(this._lastEventTime=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){this._lastEventId!==r&&(this._lastEventId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){this._pageCounter!==r&&(this._pageCounter=r,this.updateStorage())}
6,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"debugLogsEnabled",{set:function(r){this._debugLogsEnabled!==r&&(this._debugLogsEnabled=r,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var r={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled};this.cookieStorage.set(hn(this.apiKey),r)},e})(Di),Sa=function(t,e,r){return e===void 0&&(e={}),S(void 0,void 0,void 0,function(){var n,i,o,a,s,u,l,c,f,d,v,g,m,y,p,h,b,E,_,I,A,C,L,P,R,N,$,W,U,q,X,z,Q,ae,se,ce,Y,J,ne,k,de,ht,gt,pt,mt;return T(this,function(be){switch(be.label){case 0:return n=e.identityStorage||st,A={},n===st?[3,1]:(o="",[3,5]);case 1:return(L=(C=e.cookieOptions)===null||C===void 0?void 0:C.domain)!==null&&L!==void 0?(a=L,[3,4]):[3,2];case 2:return[4,wa()];case 3:a=be.sent(),be.label=4;case 4:o=a,be.label=5;case 5:return i=w.apply(void 0,[(A.domain=o,A.expiration=365,A.sameSite="Lax",A.secure=!1,A.upgrade=!0,A),e.cookieOptions]),s=_a(e.identityStorage,i),[4,da(t,s,(R=(P=e.cookieOptions)===null||P===void 0?void 0:P.upgrade)!==null&&R!==void 0?R:!0)];case 6:return u=be.sent(),[4,s.get(hn(t))];case 7:return l=be.sent(),c=it(),f=c.ampTimestamp?Number(c.ampTimestamp):void 0,d=f?Date.now()<f:!0,v=(q=(U=(W=(N=e.deviceId)!==null&&N!==void 0?N:d?($=c.ampDeviceId)!==null&&$!==void 0?$:c.deviceId:void 0)!==null&&W!==void 0?W:l==null?void 0:l.deviceId)!==null&&U!==void 0?U:u.deviceId)!==null&&q!==void 0?q:ye(),g=(X=l==null?void 0:l.lastEventId)!==null&&X!==void 0?X:u.lastEventId,m=(z=l==null?void 0:l.lastEventTime)!==null&&z!==void 0?z:u.lastEventTime,y=(ae=(Q=e.optOut)!==null&&Q!==void 0?Q:l==null?void 0:l.optOut)!==null&&ae!==void 0?ae:u.optOut,p=(se=l==null?void 0:l.sessionId)!==null&&se!==void 0?se:u.sessionId,h=(Y=(ce=e.userId)!==null&&ce!==void 0?ce:l==null?void 0:l.userId)!==null&&Y!==void 0?Y:u.userId,r.previousSessionDeviceId=(J=l==null?void 0:l.deviceId)!==null&&J!==void 0?J:u.deviceId,r.previousSessionUserId=(ne=l==null?void 0:l.userId)!==null&&ne!==void 0?ne:u.userId,b={ipAddress:(de=(k=e.trackingOptions)===null||k===void 0?void 0:k.ipAddress)!==null&&de!==void 0?de:!0,language:(gt=(ht=e.trackingOptions)===null||ht===void 0?void 0:ht.language)!==null&&gt!==void 0?gt:!0,platform:(mt=(pt=e.trackingOptions)===null||pt===void 0?void 0:pt.platform)!==null&&mt!==void 0?mt:!0},E=l==null?void 0:l.pageCounter,_=l==null?void 0:l.debugLogsEnabled,e.autocapture!==void 0&&(e.defaultTracking=e.autocapture),I=new Ta(t,e.appVersion,s,i,e.defaultTracking,e.autocapture,v,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,n,e.ingestionMetadata,e.instanceName,g,m,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,y,e.partnerId,e.plan,e.serverUrl,e.serverZone,p,e.sessionTimeout,e.storageProvider,b,e.transport,e.useBatch,e.fetchRemoteConfig,h,E,_,e.networkTrackingOptions,e.identify,e.enableDiagnostics,r._diagnosticsSampleRate,void 0,e.remoteConfig),[4,I.storageProvider.isEnabled()];case 8:return be.sent()||(I.loggerProvider.warn("Storage provider ".concat(I.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),I.storageProvider=new jt),[2,I]}})})},_a=function(t,e){switch(t===void 0&&(t=st),e===void 0&&(e={}),t){case"localStorage":return new Ln;case"sessionStorage":return new ua;case"none":return new jt;case"cookie":default:return new Ot(w(w({},e),{expirationDays:e.expiration}))}},Dn=function(t){var e=typeof t=="object"?t.type:t,r=typeof t=="object"?t.headers:void 0;return e==="xhr"?new la(r):e==="beacon"?new ca:new go(r)},wa=function(t){return S(void 0,void 0,void 0,function(){var e,r,n,i,o,o,a,s,u,l;return T(this,function(c){switch(c.label){case 0:return[4,new Ot().isEnabled()];case 1:if(!c.sent()||typeof location>"u"||!location.hostname)return[2,""];for(e=location.hostname,r=e.split("."),n=[],i="AMP_TLDTEST",o=r.length-2;o>=0;--o)n.push(r.slice(o).join("."));o=0,c.label=2;case 2:return o<n.length?(a=n[o],s={domain:"."+a},u=new Ot(s),[4,u.set(i,1)]):[3,7];case 3:return c.sent(),[4,u.get(i)];case 4:return l=c.sent(),l?[4,u.remove(i)]:[3,6];case 5:return c.sent(),[2,"."+a];case 6:return o++,[3,2];case 7:return[2,""]}})})},Ia=function(t){var e={};for(var r in t){var n=t[r];
6n&&(e[r]=n)}return e},Aa="[Amplitude] Page Viewed",Pa=function(t){t===void 0&&(t={});var e,r=F(),n=void 0,i=!1,o,a=t.trackOn,s=t.trackHistoryChanges,u=t.eventType,l=u===void 0?Aa:u,c=function(p){var h=p;try{h=decodeURI(p)}catch(b){n==null||n.error("Malformed URI sequence: ",b)}return h},f=function(){return S(void 0,void 0,void 0,function(){var p,h,b;return T(this,function(E){switch(E.label){case 0:return p=c(typeof location<"u"&&location.href||""),b={event_type:l},h=[{}],[4,ka()];case 1:return[2,(b.event_properties=w.apply(void 0,[w.apply(void 0,h.concat([E.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":p,"[Amplitude] Page Path":typeof location<"u"&&c(location.pathname)||"","[Amplitude] Page Title":$t(Kt),"[Amplitude] Page URL":p.split("?")[0]}]),b)]}})})},d=function(){return typeof a>"u"||typeof a=="function"&&a()},v=typeof location<"u"?location.href:null,g=function(){return S(void 0,void 0,void 0,function(){var p,h,b,E;return T(this,function(_){switch(_.label){case 0:return p=location.href,h=Oa(s,p,v||"")&&d(),v=p,h?(n==null||n.log("Tracking page view event"),e!=null?[3,1]:[3,3]):[3,4];case 1:return E=(b=e).track,[4,f()];case 2:E.apply(b,[_.sent()]),_.label=3;case 3:_.label=4;case 4:return[2]}})})},m=function(){g()},y={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(p,h){return S(void 0,void 0,void 0,function(){var b,E;return T(this,function(_){switch(_.label){case 0:return e=h,o=p,n=p.loggerProvider,n.log("Installing @amplitude/plugin-page-view-tracking-browser"),i=!0,r&&(r.addEventListener("popstate",m),r.history.pushState=new Proxy(r.history.pushState,{apply:function(I,A,C){var L=O(C,3),P=L[0],R=L[1],N=L[2];I.apply(A,[P,R,N]),i&&g()}})),d()?(n.log("Tracking page view event"),E=(b=e).track,[4,f()]):[3,2];case 1:E.apply(b,[_.sent()]),_.label=2;case 2:return[2]}})})},execute:function(p){return S(void 0,void 0,void 0,function(){var h;return T(this,function(b){switch(b.label){case 0:return a==="attribution"&&Ra(p)?(n==null||n.log("Enriching campaign event to page view event with campaign parameters"),[4,f()]):[3,2];case 1:h=b.sent(),p.event_type=h.event_type,p.event_properties=w(w({},p.event_properties),h.event_properties),b.label=2;case 2:return o&&p.event_type===l&&(o.pageCounter=o.pageCounter?o.pageCounter+1:1,p.event_properties=w(w({},p.event_properties),{"[Amplitude] Page Counter":o.pageCounter})),[2,p]}})})},teardown:function(){return S(void 0,void 0,void 0,function(){return T(this,function(p){return r&&(r.removeEventListener("popstate",m),i=!1),[2]})})}};return y},ka=function(){return S(void 0,void 0,void 0,function(){var t;return T(this,function(e){switch(e.label){case 0:return t=Ia,[4,new Sn().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},Ra=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,r=e[ve.SET]||{},n=e[ve.UNSET]||{},i=M(M([],O(Object.keys(r)),!1),O(Object.keys(n)),!1);return Object.keys(lt).every(function(o){return i.includes(o)})}return!1},Oa=function(t,e,r){switch(t){case"pathOnly":{if(r=="")return!0;var n=new URL(e),i=new URL(r),o=n.origin+n.pathname,a=i.origin+i.pathname;return o!==a}default:return e!==r}},Ca=function(){var t,e=[],r=function(l,c,f){l.addEventListener(c,f),e.push({element:l,type:c,handler:f})},n=function(){e.forEach(function(l){var c=l.element,f=l.type,d=l.handler;c==null||c.removeEventListener(f,d)}),e=[]},i="@amplitude/plugin-form-interaction-tracking-browser",o="enrichment",a=function(l,c){return S(void 0,void 0,void 0,function(){var f,d;return T(this,function(v){return f=function(){if(!c){l.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked.");return}if(!(typeof document>"u")){var g=function(y){var p=!1;r(y,"change",function(){var h,b=Ur(y);p||c.track(Dr,(h={},h[St]=_e(y.id),h[_t]=_e(y.name),h[wt]=b,h)),p=!0}),r(y,"submit",function(){var h,b,E=Ur(y);p||c.track(Dr,(h={},h[St]=_e(y.id),h[_t]=_e(y.name),h[wt]=E,h)),c.track(va,(b={},b[St]=_e(y.id),b[_t]=_e(y.name),b[wt]=E,b)),p=!1}
6)},m=Array.from(document.getElementsByTagName("form"));m.forEach(g),typeof MutationObserver<"u"&&(t=new MutationObserver(function(y){y.forEach(function(p){p.addedNodes.forEach(function(h){h.nodeName==="FORM"&&g(h),"querySelectorAll"in h&&typeof h.querySelectorAll=="function"&&Array.from(h.querySelectorAll("form")).map(g)})})}),t.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?f():(d=F(),d?d.addEventListener("load",f):l.loggerProvider.debug("Form interaction tracking is not installed because global is undefined.")),[2]})})},s=function(l){return S(void 0,void 0,void 0,function(){return T(this,function(c){return[2,l]})})},u=function(){return S(void 0,void 0,void 0,function(){return T(this,function(l){return t==null||t.disconnect(),n(),[2]})})};return{name:i,type:o,setup:a,execute:s,teardown:u}},_e=function(t){if(typeof t=="string")return t},Ur=function(t){var e=t.getAttribute("action");try{e=new URL(encodeURI(e??""),window.location.href).href}catch{}return e},La=function(){var t,e=[],r=function(l,c,f){l.addEventListener(c,f),e.push({element:l,type:c,handler:f})},n=function(){e.forEach(function(l){var c=l.element,f=l.type,d=l.handler;c==null||c.removeEventListener(f,d)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",a=function(l,c){return S(void 0,void 0,void 0,function(){var f,d;return T(this,function(v){return f=function(){if(!c){l.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked.");return}if(!(typeof document>"u")){var g=function(p){var h;try{h=new URL(p.href,window.location.href)}catch{return}var b=m.exec(h.href),E=b==null?void 0:b[1];E&&r(p,"click",function(){var _;E&&c.track(ha,(_={},_[ga]=E,_[pa]=h.pathname,_[ma]=p.id,_[ya]=p.text,_[ba]=p.href,_))})},m=/\.(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)(\?.+)?$/,y=Array.from(document.getElementsByTagName("a"));y.forEach(g),typeof MutationObserver<"u"&&(t=new MutationObserver(function(p){p.forEach(function(h){h.addedNodes.forEach(function(b){b.nodeName==="A"&&g(b),"querySelectorAll"in b&&typeof b.querySelectorAll=="function"&&Array.from(b.querySelectorAll("a")).map(g)})})}),t.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?f():(d=F(),d?d.addEventListener("load",f):l.loggerProvider.debug("File download tracking is not installed because global is undefined.")),[2]})})},s=function(l){return S(void 0,void 0,void 0,function(){return T(this,function(c){return[2,l]})})},u=function(){return S(void 0,void 0,void 0,function(){return T(this,function(l){return t==null||t.disconnect(),n(),[2]})})};return{name:i,type:o,setup:a,execute:s,teardown:u}},Mr=!1,Da=function(t){if(!(Mr||t.defaultTracking!==void 0)){var e=`\`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:
7
8amplitude.init(<YOUR_API_KEY>, {
9  defaultTracking: true,
10});
11
12Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;t.loggerProvider.warn(e),Mr=!0}},Na=function(){var t="@amplitude/plugin-network-checker-browser",e="before",r=F(),n=[],i=function(u,l){r!=null&&r.addEventListener&&(r==null||r.addEventListener(u,l),n.push({type:u,handler:l}))},o=function(){n.forEach(function(u){var l=u.type,c=u.handler;r==null||r.removeEventListener(l,c)}),n=[]},a=function(u,l){return S(void 0,void 0,void 0,function(){return T(this,function(c){return typeof navigator>"u"?(u.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),u.offline=!1,[2]):(u.offline=!navigator.onLine,i("online",function(){u.loggerProvider.debug("Network connectivity changed to online."),u.offline=!1,setTimeout(function(){l.flush()},u.flushIntervalMillis)}),i("offline",function(){u.loggerProvider.debug("Network connectivity changed to offline."),u.offline=!0}),[2])})})},s=function(){return S(void 0,void 0,void 0,function(){return T(this,function(u){return o(),[2]})})};return{name:t,type:e,setup:a,teardown:s}};function Nn(t){var e,r,n,i,o,a,s,u,l,c,f;if(!(typeof t!="object"||t===null)&&!Array.isArray(t)){var d=Object.keys(t);try{for(var v=D(d),g=v.next();!g.done;g=v.next()){var m=g.value;try{var y=t[m];typeof(y==null?void 0:y.enabled)=="boolean"&&(y.enabled?(delete y.enabled,Object.keys(y).length===0&&(t[m]=!0)):t[m]=!1),Nn(y)}catch{}}}catch(R){e={error:R}}finally{try{g&&!g.done&&(r=v.return)&&r.call(v)}finally{if(e)throw e.error}}
12try{if(!((l=(u=(s=t.autocapture)===null||s===void 0?void 0:s.networkTracking)===null||u===void 0?void 0:u.captureRules)===null||l===void 0)&&l.length)try{for(var p=D(t.autocapture.networkTracking.captureRules),h=p.next();!h.done;h=p.next()){var b=h.value;try{for(var E=(o=void 0,D(["responseHeaders","requestHeaders"])),_=E.next();!_.done;_=E.next()){var I=_.value,A=(c=b[I])!==null&&c!==void 0?c:{},C=A.captureSafeHeaders,L=A.allowlist;if(!(!C&&!L)){if(L!==void 0&&!Array.isArray(L)){delete b[I];continue}b[I]=M(M([],O(C?nt:[]),!1),O(L??[]),!1)}}}catch(R){o={error:R}}finally{try{_&&!_.done&&(a=E.return)&&a.call(E)}finally{if(o)throw o.error}}}}catch(R){n={error:R}}finally{try{h&&!h.done&&(i=p.return)&&i.call(p)}finally{if(n)throw n.error}}}catch{}var P=(f=t.autocapture)===null||f===void 0?void 0:f.frustrationInteractions;P&&(P.rageClick&&(P.rageClicks=P.rageClick,delete P.rageClick),P.deadClick&&(P.deadClicks=P.deadClick,delete P.deadClick))}}function Fr(t,e,r){var n,i,o=[];try{for(var a=D(e??[]),s=a.next();!s.done;s=a.next()){var u=s.value;try{o.push(new RegExp(u))}catch(l){r.loggerProvider.warn("Invalid regex pattern: ".concat(u),l)}}}catch(l){n={error:l}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return t.concat(o)}function xa(t,e){var r,n,i,o,a,s,u;if(t){Nn(t);try{e.loggerProvider.debug("Update browser config with remote configuration:",JSON.stringify(t));var l=t;if(l&&"autocapture"in l){if(typeof l.autocapture=="boolean"&&(e.autocapture=l.autocapture),typeof l.autocapture=="object"&&l.autocapture!==null){var c=w({},l.autocapture);if(e.autocapture===void 0&&(e.autocapture=l.autocapture),typeof l.autocapture.elementInteractions=="object"&&l.autocapture.elementInteractions!==null&&(!((i=l.autocapture.elementInteractions.pageUrlAllowlistRegex)===null||i===void 0)&&i.length)){c.elementInteractions=w({},l.autocapture.elementInteractions);var f=c.elementInteractions,d=(o=f.pageUrlAllowlist)!==null&&o!==void 0?o:[],v=l.autocapture.elementInteractions.pageUrlAllowlistRegex;f.pageUrlAllowlist=Fr(d,v,e),delete f.pageUrlAllowlistRegex}if(typeof l.autocapture.networkTracking=="object"&&l.autocapture.networkTracking!==null&&(!((a=l.autocapture.networkTracking.captureRules)===null||a===void 0)&&a.length)){c.networkTracking=w({},l.autocapture.networkTracking);var g=c.networkTracking,m=(s=g.captureRules)!==null&&s!==void 0?s:[];try{for(var y=D(m),p=y.next();!p.done;p=y.next()){var h=p.value;h.urls=Fr((u=h.urls)!==null&&u!==void 0?u:[],h.urlsRegex,e),delete h.urlsRegex}}catch(b){r={error:b}}finally{try{p&&!p.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}}typeof e.autocapture=="boolean"&&(e.autocapture=w({attribution:e.autocapture,fileDownloads:e.autocapture,formInteractions:e.autocapture,pageViews:e.autocapture,sessions:e.autocapture,elementInteractions:e.autocapture,webVitals:e.autocapture,frustrationInteractions:e.autocapture},c)),typeof e.autocapture=="object"&&(e.autocapture=w(w({},e.autocapture),c))}e.defaultTracking=e.autocapture}e.loggerProvider.debug("Browser config after remote config update:",JSON.stringify(e))}catch(b){e.loggerProvider.error("Failed to apply remote configuration because of error: ",b)}}}var xn="1.18.3",Ua="@amplitude/plugin-autocapture-browser",Ma="@amplitude/plugin-frustration-browser",Un="[Amplitude] Element Clicked",Fa="[Amplitude] Dead Click",qa="[Amplitude] Rage Click",Va="[Amplitude] Element Changed",ja="[Amplitude] Element ID",Ba="[Amplitude] Element Class",qr="[Amplitude] Element Tag",Vr="[Amplitude] Element Text",Ha="[Amplitude] Element Hierarchy",Ga="[Amplitude] Element Href",Wa="[Amplitude] Element Position Left",Ka="[Amplitude] Element Position Top",$a="[Amplitude] Element Aria Label",za="[Amplitude] Element Attributes",Xa="[Amplitude] Element Parent Label",jr="[Amplitude] Page URL",Ya="[Amplitude] Page Title",Ja="[Amplitude] Viewport Height",Qa="[Amplitude] Viewport Width",et="https://app.amplitude.com",Za="https://app.eu.amplitude.com",es="https://apps.stag2.amplitude.com",ts={US:et,EU:Za,STAGING:es},rs="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",ns="amp-visual-tagging-selector-highlight",Mn="data-amp-mask-attributes",is=25,Fn=128,os=["input","select","textarea"],qn=function(t,e){var r,n=(r=window==null?void 0:window.getComputedStyle)===null||r===void 0?void 0:r.call(window,t);return(n==null?void 0:n.getPropertyValue("cursor"))==="pointer"&&e==="click"},Me=function(t,e,r){return r===void 0&&(r=!1),function(n,i){var o,a,s=t.pageUrlAllowlist,u=t.pageUrlExcludelist,l=t.shouldTrackEventResolver,c=(a=(o=i==null?void 0:i.tagName)===null||o===void 0?void 0:o.toLowerCase)===null||a===void 0?void 0:a.call(o);if(!c)return!1;if(l)return l(n,i);if(!Rt(window.location.href,s)||u&&u.length>0&&Rt(window.location.href,u))return!1;var f=String(i==null?void 0:i.getAttribute("type"))||"";if(typeof f=="string")switch(f.toLowerCase()){case"hidden":return!1;case"password":return!1}var d=qn(i,n);if(r&&d)return!0;
12if(e){var v=e.some(function(g){var m;return!!(!((m=i==null?void 0:i.matches)===null||m===void 0)&&m.call(i,g))});if(!v)return!1}switch(c){case"input":case"select":case"textarea":return n==="change"||n==="click";default:return d?!0:n==="click"}}},as=function(t){var e,r,n,i=(r=(e=t==null?void 0:t.tagName)===null||e===void 0?void 0:e.toLowerCase)===null||r===void 0?void 0:r.call(e),o=t instanceof HTMLElement?((n=t.getAttribute("contenteditable"))===null||n===void 0?void 0:n.toLowerCase())==="true":!1;return!os.includes(i)&&!o},ss=function(t){return t?t.split(",").map(function(e){return e.trim()}).filter(function(e){return e.length>0&&e!=="id"&&e!=="class"}):[]},us=function(t,e){return Object.entries(t).reduce(function(r,n){var i=O(n,2),o=i[0],a=i[1];if(o.startsWith(e)){var s=o.replace(e,"");s&&(r[s]=a||"")}return r},{})},ls=function(t){return t==null||typeof t=="object"&&Object.keys(t).length===0||typeof t=="string"&&t.trim().length===0},Br=function(t){return Object.keys(t).reduce(function(e,r){var n=t[r];return ls(n)||(e[r]=n),e},{})},er=function(t,e){return t?e.some(function(r){var n;return(n=t==null?void 0:t.matches)===null||n===void 0?void 0:n.call(t,r)})?t:er(t==null?void 0:t.parentElement,e):null},cs=function(t){return new Promise(function(e,r){var n;try{var i=document.createElement("script");i.type="text/javascript",i.async=!0,i.src=t,i.addEventListener("load",function(){e({status:!0})},{once:!0}),i.addEventListener("error",function(){r({status:!1,message:"Failed to load the script ".concat(t)})}),(n=document.head)===null||n===void 0||n.appendChild(i)}catch(o){r(o)}})};function ds(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var dt=function(t){return!(t.event.target===null||!t.closestTrackedAncestor)};function fs(t){return t.type==="click"||t.type==="change"}var vs=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",Mn,Ue]),hs=["type"],gs=["svg","path","g"],ps=["password","hidden"];function ms(t,e){var r,n,i,o,a,s;if(t===null)return null;var u=String(t.tagName).toLowerCase(),l={tag:u},c=Array.from((o=(i=t.parentElement)===null||i===void 0?void 0:i.children)!==null&&o!==void 0?o:[]);c.length&&(l.index=c.indexOf(t),l.indexOfType=c.filter(function(_){return _.tagName===t.tagName}).indexOf(t));var f=(s=(a=t.previousElementSibling)===null||a===void 0?void 0:a.tagName)===null||s===void 0?void 0:s.toLowerCase();f&&(l.prevSib=String(f));var d=t.getAttribute("id");d&&(l.id=String(d));var v=Array.from(t.classList);v.length&&(l.classes=v);var g={},m=Array.from(t.attributes),y=m.filter(function(_){return!vs.has(_.name)}),p=!as(t);if(!ps.includes(String(t.getAttribute("type")))&&!gs.includes(u))try{for(var h=D(y),b=h.next();!b.done;b=h.next()){var E=b.value;
12if(!(p&&!hs.includes(E.name))){if(e.has(E.name)){g[E.name]=me;continue}g[E.name]=String(E.value).substring(0,Fn)}}}catch(_){r={error:_}}finally{try{b&&!b.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return Object.keys(g).length&&(l.attrs=g),l}function ys(t){var e=[];if(!t)return e;e.push(t);for(var r=t.parentElement;r&&r.tagName!=="HTML";)e.push(r),r=r.parentElement;return e}var bs=function(t,e){try{if(t.sourceType==="DOM_ELEMENT"){var r=document.documentElement;return t.scope&&e&&(r=e.closest(t.scope)),r&&t.selector?r.querySelector(t.selector):r}}catch{return}},Es=function(t,e,r){t.forEach(function(n){if(typeof n!="string"&&n.actionType==="ATTACH_EVENT_PROPERTY"){var i=r.extractDataFromDataSource(n.dataSource,e.closestTrackedAncestor);e.targetElementProperties[n.destinationKey]=i}})},tr=(function(){function t(e,r){var n,i,o=this,a;this.replaceSensitiveString=function(d){return Kt(d,o.additionalMaskTextPatterns)},this.getHierarchy=function(d){var v,g,m,y,p=performance.now(),h=[];if(!d)return[];for(var b=ys(d),E=new Map,_=b.length-1;_>=0;_--){var I=b[_];if(I){var A=ss(I.getAttribute(Mn)),C=_===b.length-1?[]:(m=E.get(b[_+1]))!==null&&m!==void 0?m:new Set,L=new Set(M(M([],O(C),!1),O(A),!1));E.set(I,L)}}h=b.map(function(U){var q;
12return ms(U,(q=E.get(U))!==null&&q!==void 0?q:new Set)});var P=function(U){U!=null&&U.attrs&&Object.entries(U.attrs).forEach(function(q){var X=O(q,2),z=X[0],Q=X[1];U.attrs&&(U.attrs[z]=o.replaceSensitiveString(Q))})};try{for(var R=D(h),N=R.next();!N.done;N=R.next()){var $=N.value;P($)}}catch(U){v={error:U}}finally{try{N&&!N.done&&(g=R.return)&&g.call(R)}finally{if(v)throw v.error}}var W=performance.now();return(y=o.diagnosticsClient)===null||y===void 0||y.recordHistogram("autocapturePlugin.getHierarchy",W-p),h},this.getNearestLabel=function(d){var v=d.parentElement;if(!v)return"";var g;try{g=v.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch{g=null}return g?o.getText(g):o.getNearestLabel(v)},this.getEventProperties=function(d,v,g){var m,y,p,h,b=(p=(y=v==null?void 0:v.tagName)===null||y===void 0?void 0:y.toLowerCase)===null||p===void 0?void 0:p.call(y),E=typeof v.getBoundingClientRect=="function"?v.getBoundingClientRect():{left:null,top:null},_=o.getHierarchy(v),I=(h=_[0])===null||h===void 0?void 0:h.attrs,A=o.getNearestLabel(v),C=us(I??{},g),L=(m={},m[Ha]=_,m[qr]=b,m[Vr]=o.getText(v),m[Wa]=E.left==null?null:Math.round(E.left),m[Ka]=E.top==null?null:Math.round(E.top),m[za]=C,m[Xa]=A,m[jr]=pe(window.location.href.split("?")[0]),m[Ya]=$t(o.replaceSensitiveString),m[Ja]=window.innerHeight,m[Qa]=window.innerWidth,m);if(L[ja]=v.getAttribute("id")||"",L[Ba]=v.getAttribute("class"),L[$a]=I==null?void 0:I["aria-label"],b==="a"&&d==="click"&&v instanceof HTMLAnchorElement){var P=v.href.substring(0,Fn);L[Ga]=o.replaceSensitiveString(P)}return Br(L)},this.addAdditionalEventProperties=function(d,v,g,m,y){y===void 0&&(y=!1);var p={event:d,timestamp:Date.now(),type:v};if(fs(p)&&p.event.target!==null){if(y){var h=qn(p.event.target,p.type);if(h)return p.closestTrackedAncestor=p.event.target,p.targetElementProperties=o.getEventProperties(p.type,p.closestTrackedAncestor,m),p}var b=er(p.event.target,g);return b&&(p.closestTrackedAncestor=b,p.targetElementProperties=o.getEventProperties(p.type,b,m)),p}return p},this.extractDataFromDataSource=function(d,v){if(d.sourceType==="DOM_ELEMENT"){var g=bs(d,v);return g?d.elementExtractType==="TEXT"?o.getText(g):d.elementExtractType==="ATTRIBUTE"&&d.attribute?g.getAttribute(d.attribute):void 0:void 0}},this.getText=function(d){var v=d.closest("[".concat(Ue,"]"))!==null;if(v)return me;var g="";if(!d.querySelector("[".concat(Ue,"], [contenteditable]")))g=d.innerText||"";else{var m=d.cloneNode(!0);m.querySelectorAll("[".concat(Ue,"], [contenteditable]")).forEach(function(y){y.innerText=me}),g=m.innerText||""}return o.replaceSensitiveString(g.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(d){var v,g,m;if(!d)return{};var y=(m=(g=d==null?void 0:d.tagName)===null||g===void 0?void 0:g.toLowerCase)===null||m===void 0?void 0:m.call(g),p=(v={},v[qr]=y,v[Vr]=o.getText(d),v[jr]=window.location.href.split("?")[0],v);return Br(p)},this.diagnosticsClient=r==null?void 0:r.diagnosticsClient;var s=(a=e.maskTextRegex)!==null&&a!==void 0?a:[],u=[];try{for(var l=D(s),c=l.next();!c.done;c=l.next()){var f=c.value;if(u.length>=is)break;if(f instanceof RegExp)u.push(f);else if("pattern"in f&&typeof f.pattern=="string")try{u.push(new RegExp(f.pattern,"i"))}catch{}}}catch(d){n={error:d}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=u}return t})(),Ts=(function(){function t(e){var r=e===void 0?{}:e,n=r.origin,i=n===void 0?et:n,o=this;this.endpoint=et,this.requestCallbacks={},this.onSelect=function(a){o.notify({action:"element-selected",data:a})},this.onTrack=function(a,s){a==="selector-mode-changed"?o.notify({action:"track-selector-mode-changed",data:s}):a==="selector-moved"&&o.notify({action:"track-selector-moved",data:s})},this.endpoint=i}return t.prototype.notify=function(e){var r,n,i,o;(n=(r=this.logger)===null||r===void 0?void 0:r.debug)===null||n===void 0||n.call(r,"Message sent: ",JSON.stringify(e)),(o=(i=window.opener)===null||i===void 0?void 0:i.postMessage)===null||o===void 0||o.call(i,e,this.endpoint)},t.prototype.sendRequest=function(e,r,n){var i=this;n===void 0&&(n={timeout:15e3});var o=ds(),a={id:o,action:e,args:r},s=new Promise(function(u,l){i.requestCallbacks[o]={resolve:u,reject:l},i.notify(a),(n==null?void 0:n.timeout)>0&&setTimeout(function(){l(new Error("".concat(e," timed out (id: ").concat(o,")"))),delete i.requestCallbacks[o]},n.timeout)});return s},t.prototype.handleResponse=function(e){var r;if(!this.requestCallbacks[e.id]){(r=this.logger)===null||r===void 0||r.warn("No callback found for request id: ".concat(e.id));return}this.requestCallbacks[e.id].resolve(e.responseData),delete this.requestCallbacks[e.id]},t.prototype.setup=function(e){var r=this,n=e===void 0?{dataExtractor:new tr({})}:e,i=n.logger,o=n.endpoint,a=n.isElementSelectable,s=n.cssSelectorAllowlist,u=n.actionClickAllowlist,l=n.dataExtractor;
12this.logger=i,o&&this.endpoint===et&&(this.endpoint=o);var c=null;window.addEventListener("message",function(f){var d,v,g,m,y;if((v=(d=r.logger)===null||d===void 0?void 0:d.debug)===null||v===void 0||v.call(d,"Message received: ",JSON.stringify(f)),r.endpoint===f.origin){var p=f==null?void 0:f.data,h=p==null?void 0:p.action;if(h)if("id"in p)(m=(g=r.logger)===null||g===void 0?void 0:g.debug)===null||m===void 0||m.call(g,"Received Response to previous request: ",JSON.stringify(f)),r.handleResponse(p);else if(h==="ping")r.notify({action:"pong"});else if(h==="initialize-visual-tagging-selector"){var b=p==null?void 0:p.data;cs(rs).then(function(){var E;c=(E=window==null?void 0:window.amplitudeVisualTaggingSelector)===null||E===void 0?void 0:E.call(window,{getEventTagProps:l.getEventTagProps,isElementSelectable:function(_){return a?a((b==null?void 0:b.actionType)||"click",_):!0},onTrack:r.onTrack,onSelect:r.onSelect,visualHighlightClass:ns,messenger:r,cssSelectorAllowlist:s,actionClickAllowlist:u,extractDataFromDataSource:l.extractDataFromDataSource,dataExtractor:l,diagnostics:{autocapture:{version:xn}}}),r.notify({action:"selector-loaded"})}).catch(function(){var E;(E=r.logger)===null||E===void 0||E.warn("Failed to initialize visual tagging selector")})}else h==="close-visual-tagging-selector"&&((y=c==null?void 0:c.close)===null||y===void 0||y.call(c))}}),this.notify({action:"page-loaded"})},t})();function Ss(t){var e=t.amplitude,r=t.allObservables,n=t.shouldTrackEvent,i=t.evaluateTriggers,o=r.clickObservable,a=o.filter(dt).filter(function(u){return n("click",u.closestTrackedAncestor)}).map(function(u){return i(u)}),s=a;return s.subscribe(function(u){e==null||e.track(Un,u.targetElementProperties)})}function _s(t){var e=t.amplitude,r=t.allObservables,n=t.getEventProperties,i=t.shouldTrackEvent,o=t.evaluateTriggers,a=r.changeObservable,s=a.filter(dt).filter(function(u){return i("change",u.closestTrackedAncestor)}).map(function(u){return o(u)});return s.subscribe(function(u){e==null||e.track(Va,n("change",u.closestTrackedAncestor))})}function ws(t){var e=t.amplitude,r=t.allObservables,n=t.options,i=t.getEventProperties,o=t.shouldTrackEvent,a=t.shouldTrackActionClick,s=r.clickObservable,u=r.mutationObservable,l=r.navigateObservable,c=s.filter(function(y){return!o("click",y.closestTrackedAncestor)}).map(function(y){var p=er(y.event.target,n.actionClickAllowlist);return y.closestTrackedAncestor=p,y.closestTrackedAncestor!==null&&(y.targetElementProperties=i(y.type,y.closestTrackedAncestor)),y}).filter(dt).filter(function(y){return a("click",y.closestTrackedAncestor)}),f=l?at(u,l):u,d=at(c,f),v=null,g=null,m=Qt(d,function(y){if(v&&(clearTimeout(v),v=null),y.type==="click")return g=y,v=setTimeout(function(){v=null,g=null},500),Promise.resolve(null);if(g){var p=g;return g=null,Promise.resolve(p)}return Promise.resolve(null)});return m.subscribe(function(y){y&&(e==null||e.track(Un,i("click",y.closestTrackedAncestor)))})}var Vn=function(){return new re(function(t){var e=new MutationObserver(function(r){t.next(r)});return document.body&&e.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return e.disconnect()}})},jn=function(t){return t===void 0&&(t="click"),new re(function(e){var r,n=function(i){e.next(i)};return(r=F())===null||r===void 0||r.document.addEventListener(t,n,{capture:!0}),function(){var i;(i=F())===null||i===void 0||i.document.removeEventListener(t,n,{capture:!0})}})},Is=function(t,e){try{if(e.subprop_key==="[Amplitude] Element Text")return e.subprop_op==="is"&&e.subprop_value.includes(t.targetElementProperties["[Amplitude] Element Text"]);if(e.subprop_key==="[Amplitude] Element Hierarchy")return e.subprop_op==="autotrack css match"&&!!t.closestTrackedAncestor.closest(e.subprop_value.toString())}catch(r){return console.error("Error matching event to filter",r),!1}return!1},xt={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Hr=function(t){var e,r,n,i,o=Object.values(xt).reduce(function(v,g){return v[g]=new Set,v},{});if(!t)return o;try{for(var a=D(t),s=a.next();!s.done;s=a.next()){var u=s.value;try{try{for(var l=(n=void 0,D(u.definition)),c=l.next();!c.done;c=l.next()){var f=c.value,d=xt[f.event_type];d&&o[d].add(u.id)}}catch(v){n={error:v}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}catch(v){console.warn("Skipping Labeled Event due to malformed definition",u==null?void 0:u.id,v)}}}catch(v){e={error:v}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return o},Gr=function(t){var e,r,n,i,o=new Map;try{for(var a=D(t),s=a.next();!s.done;s=a.next()){var u=s.value;try{for(var l=(n=void 0,D(u.conditions)),c=l.next();!c.done;c=l.next()){var f=c.value;if(f.type==="LABELED_EVENT"){var d=f.match.eventId,v=o.get(d);v||(v=[],o.set(d,v)),v.push(u)}}}catch(g){n={error:g}}finally{try{c&&!c.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}}catch(g){e={error:g}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(e)throw e.error}}return o},As=function(t,e){return e.filter(function(r){return r.definition.some(function(n){return xt[n.event_type]===t.type&&n.filters.every(function(i){return Is(t,i)})})})},Ps=function(t,e){var r,n,i,o,a=new Set;try{for(var s=D(t),u=s.next();!u.done;u=s.next()){var l=u.value,c=e.get(l.id);if(c)try{for(var f=(i=void 0,D(c)),d=f.next();!d.done;d=f.next()){var v=d.value;a.add(v)}}catch(g){i={error:g}}
12finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}}}catch(g){r={error:g}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return Array.from(a)},ks=(function(){function t(e,r,n,i){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=r,this.dataExtractor=n,this.options=i}return t.prototype.evaluate=function(e){var r,n,i=this.options.pageActions;if(!i)return e;var o=As(e,Array.from(this.groupedLabeledEvents[e.type]).map(function(c){return i.labeledEvents[c]})),a=Ps(o,this.labeledEventToTriggerMap);try{for(var s=D(a),u=s.next();!u.done;u=s.next()){var l=u.value;Es(l.actions,e,this.dataExtractor)}}catch(c){r={error:c}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return e},t.prototype.update=function(e,r,n){this.groupedLabeledEvents=e,this.labeledEventToTriggerMap=r,this.options=n},t})(),Rs=function(t,e,r,n){return new ks(t,e,r,n)},he;(function(t){t.ClickObservable="clickObservable",t.ChangeObservable="changeObservable",t.NavigateObservable="navigateObservable",t.MutationObservable="mutationObservable"})(he||(he={}));var Os=function(t,e){var r,n,i,o,a,s,u,l;t===void 0&&(t={}),e==null||e.diagnosticsClient.setTag("plugin.autocapture.version",xn);var c=t.dataAttributePrefix,f=c===void 0?Gt:c,d=t.visualTaggingOptions,v=d===void 0?{enabled:!0,messenger:new Ts}:d;t.cssSelectorAllowlist=(r=t.cssSelectorAllowlist)!==null&&r!==void 0?r:pn,t.actionClickAllowlist=(n=t.actionClickAllowlist)!==null&&n!==void 0?n:mn,t.debounceTime=(i=t.debounceTime)!==null&&i!==void 0?i:0,t.pageUrlExcludelist=(o=t.pageUrlExcludelist)===null||o===void 0?void 0:o.reduce(function(P,R){if(typeof R=="string"&&P.push(R),R instanceof RegExp&&P.push(R),typeof R=="object"&&R!==null&&"pattern"in R)try{P.push(new RegExp(R.pattern))}catch(N){return console.warn("Invalid regex pattern: ".concat(R.pattern),N),P}return P},[]);
12var g=Ua,m="enrichment",y=[],p=new tr(t,e),h=function(){var P,R=Ee(jn().map(function(U){return p.addAdditionalEventProperties(U,"click",t.cssSelectorAllowlist,f)})),N=Ee(new re(function(U){var q,X=function(z){var Q=p.addAdditionalEventProperties(z,"change",t.cssSelectorAllowlist,f);U.next(Q)};return(q=F())===null||q===void 0||q.document.addEventListener("change",X,{capture:!0}),function(){var z;return(z=F())===null||z===void 0?void 0:z.document.removeEventListener("change",X)}})),$;window.navigation&&($=Ee(new re(function(U){var q=function(X){var z=p.addAdditionalEventProperties(X,"navigate",t.cssSelectorAllowlist,f);U.next(z)};return window.navigation.addEventListener("navigate",q),function(){window.navigation.removeEventListener("navigate",q)}})));var W=Ee(Vn().map(function(U){return p.addAdditionalEventProperties(U,"mutation",t.cssSelectorAllowlist,f)}));return P={},P[he.ChangeObservable]=N,P[he.ClickObservable]=R,P[he.MutationObservable]=W,P[he.NavigateObservable]=$,P},b=Hr(Object.values((s=(a=t.pageActions)===null||a===void 0?void 0:a.labeledEvents)!==null&&s!==void 0?s:{})),E=Gr((l=(u=t.pageActions)===null||u===void 0?void 0:u.triggers)!==null&&l!==void 0?l:[]),_=Rs(b,E,p,t),I=function(P){var R,N;P&&(t.pageActions=w(w({},t.pageActions),P),b=Hr(Object.values((R=t.pageActions.labeledEvents)!==null&&R!==void 0?R:{})),E=Gr((N=t.pageActions.triggers)!==null&&N!==void 0?N:[]),_.update(b,E,t))},A=function(P,R){return S(void 0,void 0,void 0,function(){var N,$,W,U,q,X,z,Q,ae,se;return T(this,function(ce){return typeof document>"u"?[2]:(P.fetchRemoteConfig&&(P.remoteConfigClient?P.remoteConfigClient.subscribe("analyticsSDK.pageActions","all",function(Y){I(Y)}):P.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),N=Me(t,t.cssSelectorAllowlist),$=Me(t,t.actionClickAllowlist),W=h(),U=Ss({allObservables:W,amplitude:R,shouldTrackEvent:N,evaluateTriggers:_.evaluate.bind(_)}),y.push(U),q=_s({allObservables:W,getEventProperties:function(){for(var Y=[],J=0;J<arguments.length;J++)Y[J]=arguments[J];return p.getEventProperties.apply(p,M(M([],O(Y),!1),[f],!1))},amplitude:R,shouldTrackEvent:N,evaluateTriggers:_.evaluate.bind(_)}),y.push(q),X=ws({allObservables:W,options:t,getEventProperties:function(){for(var Y=[],J=0;J<arguments.length;J++)Y[J]=arguments[J];return p.getEventProperties.apply(p,M(M([],O(Y),!1),[f],!1))},amplitude:R,shouldTrackEvent:N,shouldTrackActionClick:$}),X&&y.push(X),(ae=P==null?void 0:P.loggerProvider)===null||ae===void 0||ae.log("".concat(g," has been successfully added.")),window.opener&&v.enabled&&(z=t.cssSelectorAllowlist,Q=t.actionClickAllowlist,(se=v.messenger)===null||se===void 0||se.setup(w(w({dataExtractor:p,logger:P==null?void 0:P.loggerProvider},(P==null?void 0:P.serverZone)&&{endpoint:ts[P.serverZone]}),{isElementSelectable:Me(t,M(M([],O(z),!1),O(Q),!1)),cssSelectorAllowlist:z,actionClickAllowlist:Q}))),[2])})})},C=function(P){return S(void 0,void 0,void 0,function(){return T(this,function(R){return[2,P]})})},L=function(){return S(void 0,void 0,void 0,function(){var P,R,N,$,W;return T(this,function(U){try{for(P=D(y),R=P.next();!R.done;R=P.next())N=R.value,N.unsubscribe()}catch(q){$={error:q}}finally{try{R&&!R.done&&(W=P.return)&&W.call(P)}finally{if($)throw $.error}}return[2]})})};return{name:g,type:m,setup:A,execute:C,teardown:L}},Cs=3e3,Ls=["mutation","navigate"];function Ds(t){var e=t.amplitude,r=t.allObservables,n=t.getEventProperties,i=t.shouldTrackDeadClick,o=r.clickObservable,a=r.mutationObservable,s=r.navigateObservable,u=o.filter(function(v){return dt(v)&&i("click",v.closestTrackedAncestor)&&v.event.target instanceof Element&&v.event.target.closest('a[target="_blank"]')===null}),l=s?at(a,s):a,c=at(u,l),f=null,d=Qt(c,function(v){return f&&Ls.includes(v.type)?(clearTimeout(f),f=null,Promise.resolve(null)):v.type==="click"?f?Promise.resolve(null):new Promise(function(g){f=setTimeout(function(){g(v),f=null},Cs)}):Promise.resolve(null)});return d.subscribe(function(v){if(v){var g={"[Amplitude] X":v.event.clientX,"[Amplitude] Y":v.event.clientY};e.track(Fa,w(w({},n("click",v.closestTrackedAncestor)),g),{time:v.timestamp})}})}var Bn=Po,Hn=Ao,Wr=ko;function Kr(t,e){var r,n,i,o,a=e.event,s=a.clientX,u=a.clientY;t.yMin=Math.min((r=t.yMin)!==null&&r!==void 0?r:u,u),t.yMax=Math.max((n=t.yMax)!==null&&n!==void 0?n:u,u),t.xMin=Math.min((i=t.xMin)!==null&&i!==void 0?i:s,s),t.xMax=Math.max((o=t.xMax)!==null&&o!==void 0?o:s,s),t.isOutOfBounds=t.yMax-t.yMin>Wr||t.xMax-t.xMin>Wr}function $r(t){if(t.length===0)return null;var e=t[0],r=t[t.length-1],n=w({"[Amplitude] Begin Time":new Date(e.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-e.timestamp,"[Amplitude] Clicks":t.map(function(i){return{X:i.event.clientX,Y:i.event.clientY,Time:i.timestamp}}),"[Amplitude] Click Count":t.length},e.targetElementProperties);return{rageClickEvent:n,time:e.timestamp}}function Ns(t,e){var r=Math.max(0,t.length-Bn+1),n=t[r];return e.timestamp-n.timestamp>=Hn}function xs(t,e){return t.length>0&&t[t.length-1].closestTrackedAncestor!==e.closestTrackedAncestor}function Us(t){var e=this,r=t.amplitude,n=t.allObservables,i=t.shouldTrackRageClick,o=n.clickObservable,a=[],s={},u=null;function l(f){a=[],s={},f&&(Kr(s,f),a.push(f))}var c=Qt(o.filter(function(f){return i("click",f.closestTrackedAncestor)}),function(f){return S(e,void 0,void 0,function(){var d;return T(this,function(v){return Kr(s,f),d=null,a.length===0||xs(a,f)||Ns(a,f)||s.isOutOfBounds?(u&&(d=$r(a
12)),l(f)):a.push(f),u&&(clearTimeout(u.timerId),u.resolve(d),u=null),a.length>=Bn?[2,new Promise(function(g){u={resolve:g,timerId:setTimeout(function(){g($r(a))},Hn)}})]:[2,null]})})});return c.subscribe(function(f){f!==null&&r.track(qa,f.rageClickEvent,{time:f.time})})}var Ms=function(t){var e,r,n,i,o;t===void 0&&(t={});var a=Ma,s="enrichment",u=[],l=(r=(e=t.rageClicks)===null||e===void 0?void 0:e.cssSelectorAllowlist)!==null&&r!==void 0?r:Io,c=(i=(n=t.deadClicks)===null||n===void 0?void 0:n.cssSelectorAllowlist)!==null&&i!==void 0?i:wo,f=(o=t.dataAttributePrefix)!==null&&o!==void 0?o:Gt,d=new tr(t),v=M([],O(new Set(M(M([],O(l),!1),O(c),!1))),!1),g=function(){var h,b=Ee(jn("pointerdown").map(function(A){return d.addAdditionalEventProperties(A,"click",v,f,!0)})),E=Ee(Vn().map(function(A){return d.addAdditionalEventProperties(A,"mutation",v,f)})),_;if(window.navigation){var I=new re(function(A){var C=function(L){A.next(w(w({},L),{type:"navigate"}))};return window.navigation.addEventListener("navigate",C),function(){window.navigation.removeEventListener("navigate",C)}});_=Ee(I.map(function(A){return d.addAdditionalEventProperties(A,"navigate",v,f)}))}return h={},h[he.ClickObservable]=b,h[he.MutationObservable]=E,h[he.NavigateObservable]=_,h},m=function(h,b){return S(void 0,void 0,void 0,function(){var E,_,I,A,C,L;return T(this,function(P){return typeof document>"u"?[2]:(E=Me(t,l),_=Me(t,c),I=g(),A=Us({allObservables:I,amplitude:b,shouldTrackRageClick:E}),u.push(A),C=Ds({amplitude:b,allObservables:I,getEventProperties:function(R,N){return d.getEventProperties(R,N,f)},shouldTrackDeadClick:_}),u.push(C),(L=h==null?void 0:h.loggerProvider)===null||L===void 0||L.log("".concat(a," has been successfully added.")),[2])})})},y=function(h){return S(void 0,void 0,void 0,function(){return T(this,function(b){return[2,h]})})},p=function(){return S(void 0,void 0,void 0,function(){var h,b,E,_,I;return T(this,function(A){try{for(h=D(u),b=h.next();!b.done;b=h.next())E=b.value,E.unsubscribe()}catch(C){_={error:C}}finally{try{b&&!b.done&&(I=h.return)&&I.call(h)}finally{if(_)throw _.error}}return[2]})})};return{name:a,type:s,setup:m,execute:y,teardown:p}},Fs="@amplitude/plugin-network-capture-browser",Gn="[Amplitude] Network Request",Wn="500-599";function tt(t,e){var r=e.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&"),n="^"+r.replace(/\*/g,".*")+"$",i=new RegExp(n);return i.test(t)}function Kn(t,e){var r,n,i=e.split(",");try{for(var o=D(i),a=o.next();!a.done;a=o.next()){var s=a.value,u=O(s.split("-").map(Number),2),l=u[0],c=u[1];if(t===l&&c===void 0||t>=l&&t<=c)return!0}}catch(f){r={error:f}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function qs(t,e,r,n,i){if(!(t.hosts&&!t.hosts.find(function(a){return tt(e,a)}))&&!(n&&t.urls&&!Rt(n,t.urls))&&!(i&&t.methods&&!t.methods.find(function(a){return i.toLowerCase()===a.toLowerCase()||a==="*"}))){if(r||r===0){var o=t.statusCodeRange||Wn;if(!Kn(r,o))return!1}return!0}}function $n(t){var e;if(t)try{var r=(e=F())===null||e===void 0?void 0:e.location.href,n=new URL(t,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),a=n.href,s=n.host;n.hash="",n.search="";var u=n.href;return{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:u,host:s}}catch{return}}function Vs(t,e){if(t.includes("amplitude.com"))try{var r=e.body;if(typeof r!="string")return!1;var n=JSON.parse(r),i=n.events;if(i.find(function(o){return o.event_type===Gn}))return!0}catch{}return!1}function zr(t){if(typeof t!="object"||t===null){if(t)return M([],O(nt),!1);if(t===void 0){var e=void 0;return e}return}if(t.length!==0)return t}function Xr(t){var e,r;return!(!((e=t==null?void 0:t.allowlist)===null||e===void 0)&&e.length)&&!(!((r=t==null?void 0:t.blocklist)===null||r===void 0)&&r.length)}function js(t,e){var r;e===void 0&&(e={});var n=$n(t.url);if(!n)return!1;var i=n.host;if(e.ignoreAmplitudeRequests!==!1&&(tt(i,"*.amplitude.com")||tt(i,"amplitude.com"))||!((r=e.ignoreHosts)===null||r===void 0)&&r.find(function(a){return tt(i,a)})||!e.captureRules&&t.status!==void 0&&!Kn(t.status,Wn))return!1;if(e.captureRules){var o;
12if(M([],O(e.captureRules),!1).reverse().find(function(a){if(o=qs(a,i,t.status,t.url,t.method),o){var s=zr(a.responseHeaders);if(t.responseWrapper&&s){var u=t.responseWrapper.headers(s);u&&(t.responseHeaders=u)}var l=zr(a.requestHeaders);if(t.requestWrapper&&l){var c=t.requestWrapper.headers(l);c&&(t.requestHeaders=c)}t.responseWrapper&&a.responseBody&&!Xr(a.responseBody)&&(t.responseBodyJson=t.responseWrapper.json(a.responseBody.allowlist,a.responseBody.blocklist)),t.requestWrapper&&a.requestBody&&!Xr(a.requestBody)&&(t.requestBodyJson=t.requestWrapper.json(a.requestBody.allowlist,a.requestBody.blocklist))}return o!==void 0}),!o)return!1}return!(t.requestWrapper&&Vs(i,t.requestWrapper))}function Bs(t,e,r,n){return S(this,void 0,void 0,function(){var i,o,a;return T(this,function(s){switch(s.label){case 0:return e.requestBodyJson||e.responseBodyJson?[4,Promise.all([e.requestBodyJson,e.responseBodyJson])]:[3,2];case 1:if(i=O.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{t["[Amplitude] Request Body"]=JSON.stringify(o)}catch(u){n==null||n.debug("Failed to stringify request body",u)}if(a)try{t["[Amplitude] Response Body"]=JSON.stringify(a)}catch{n==null||n.debug("Failed to stringify response body")}s.label=2;case 2:return r==null||r.track(Gn,t),[2]}})})}function Hs(t){var e=t.allObservables,r=t.networkTrackingOptions,n=t.amplitude,i=t.loggerProvider,o=e.networkObservable,a=o.filter(function(s){return js(s.event,r)});return a.subscribe(function(s){var u,l,c,f=s.event,d=$n(f.url);if(d){var v=(l=f.responseWrapper)===null||l===void 0?void 0:l.bodySize,g=(c=f.requestWrapper)===null||c===void 0?void 0:c.bodySize,m=(u={},u["[Amplitude] URL"]=d.hrefWithoutQueryOrHash,u["[Amplitude] URL Query"]=d.query,u["[Amplitude] URL Fragment"]=d.fragment,u["[Amplitude] Request Method"]=f.method,u["[Amplitude] Status Code"]=f.status,u["[Amplitude] Start Time"]=f.startTime,u["[Amplitude] Completion Time"]=f.endTime,u["[Amplitude] Duration"]=f.duration,u["[Amplitude] Request Body Size"]=g,u["[Amplitude] Response Body Size"]=v,u["[Amplitude] Request Type"]=f.type,u["[Amplitude] Request Headers"]=f.requestHeaders,u["[Amplitude] Response Headers"]=f.responseHeaders,u);Bs(m,f,n,i)}})}var Ut;(function(t){t.NetworkObservable="networkObservable"})(Ut||(Ut={}));var Yr,Gs=function(t){t===void 0&&(t={});var e=Fs,r="enrichment",n,i=function(l,c){var f={event:l,timestamp:Date.now(),type:c};return f},o=function(){var l,c=new re(function(f){var d=new Mo(function(v){var g=i(v,"network");f.next(g)});return Rr.subscribe(d,n),function(){Rr.unsubscribe(d)}});return l={},l[Ut.NetworkObservable]=c,l},a=function(l,c){return S(void 0,void 0,void 0,function(){var f;return T(this,function(d){return typeof document>"u"?[2]:(f=o(),n=l==null?void 0:l.loggerProvider,Yr=Hs({allObservables:f,networkTrackingOptions:t,amplitude:c,loggerProvider:n}),n==null||n.log("".concat(e," has been successfully added.")),[2])})})},s=function(l){return S(void 0,void 0,void 0,function(){return T(this,function(c){return[2,l]})})},u=function(){return S(void 0,void 0,void 0,function(){return T(this,function(l){return Yr.unsubscribe(),[2]})})};return{name:e,type:r,setup:a,execute:s,teardown:u}},Ws="web-vitals-browser",Ks="[Amplitude] Web Vitals";let zn=-1;const Re=t=>{addEventListener("pageshow",(e=>{e.persisted&&(zn=e.timeStamp,t(e))}),!0)},ue=(t,e,r,n)=>{let i,o;return a=>{e.value>=0&&(a||n)&&(o=e.value-(i??0),(o||i===void 0)&&(i=e.value,e.delta=o,e.rating=((s,u)=>s>u[1]?"poor":s>u[0]?"needs-improvement":"good")(e.value,r),t(e)))}},rr=t=>{requestAnimationFrame((()=>requestAnimationFrame((()=>t()))))},nr=()=>{const t=performance.getEntriesByType("navigation")[0];if(t&&t.responseStart>0&&t.responseStart<performance.now())return t},Ve=()=>{const t=nr();return(t==null?void 0:t.activationStart)??0},le=(t,e=-1)=>{const r=nr();let n="navigate";return zn>=0?n="back-forward-cache":r&&(document.prerendering||Ve()>0?n="prerender":document.wasDiscarded?n="restore":r.type&&(n=r.type.replace(/_/g,"-"))),{name:t,value:e,rating:"good",delta:0,entries:[],id:`v5-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:n}},It=new WeakMap;function ir(t,e){return It.get(t)||It.set(t,new e),It.get(t)}class $s{constructor(){fe(this,"t");fe(this,"i",0);fe(this,"o",[])}h(e){var i;if(e.hadRecentInput)return;const r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&e.startTime-n.startTime<1e3&&e.startTime-r.startTime<5e3?(this.i+=e.value,this.o.push(e)):(this.i=e.value,this.o=[e]),(i=this.t)==null||i.call(this,e)}}const je=(t,e,r={})=>{try{if(PerformanceObserver.supportedEntryTypes.includes(t)){const n=new PerformanceObserver((i=>{Promise.resolve().then((()=>{e(i.getEntries())}))}));return n.observe({type:t,buffered:!0,...r}),n}}catch{}},or=t=>{let e=!1;return()=>{e||(t(),e=!0)}};let Ie=-1;const Xn=new Set,Jr=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Mt=t=>{if(document.visibilityState==="hidden"){if(t.type==="visibilitychange")for(const e of Xn)e();isFinite(Ie)||(Ie=t.type==="visibilitychange"?t.timeStamp:0,removeEventListener("prerenderingchange",Mt,!0))}},ft=()=>{var t;if(Ie<0){const e=Ve();Ie=(document.prerendering||(t=globalThis.performance.getEntriesByType("visibility-state").filter((n=>n.name==="hidden"&&n.startTime>e))[0])==null?void 0:t.startTime)??Jr(),addEventListener("visibilitychange",Mt,!0),addEventListener("prerenderingchange",Mt,!0),Re((()=>{setTimeout((()=>{Ie=Jr()}))}))}return{get firstHiddenTime(){return Ie},onHidden(e){Xn.add(e)}}},vt=t=>{document.prerendering?addEventListener("prerenderingchange",(()=>t()),!0):t()},Qr=[1800,3e3],Yn=(t,e={})=>{vt((()=>{const r=ft();let n,i=le("FCP");const o=je("paint",(a=>{for(const s of a)s.name==="first-contentful-paint"&&(o.disconnect(),s.startTime<r.firstHiddenTime&&(i.value=Math.max(s.startTime-Ve(),0),i.entries.push(s),n(!0)))}));o&&(n=ue(t,i,Qr,e.reportAllChanges),Re((a=>{i=le("FCP"),n=ue(t,i,Qr,e.reportAllChanges),rr((()=>{i.value=performance.now()-a.timeStamp,n(!0)}))})))}))},Zr=[.1,.25],zs=(t,e={})=>{const r=ft();Yn(or((()=>{let n,i=le("CLS",0);const o=ir(e,$s),a=u=>{for(const l of u)o.h(l);o.i>i.value&&(i.value=o.i,i.entries=o.o,n())},s=je("layout-shift",a);s&&(n=ue(t,i,Zr,e.reportAllChanges),r.onHidden((()=>{a(s.takeRecords()),n(!0)})),Re((()=>{o.i=0,i=le("CLS",0),n=ue(t,i,Zr,e.reportAllChanges),rr((()=>n()))})),setTimeout(n))})))};let Jn=0,At=1/0,We=0;const Xs=t=>{for(const e of t)e.interactionId&&(At=Math.min(At,e.interactionId),We=Math.max(We,e.interactionId),Jn=We?(We-At)/7+1:0)};let Ft;const en=()=>Ft?Jn:performance.interactionCount??0,Ys=()=>{"interactionCount"in performance||Ft||(Ft=je("event",Xs,{type:"event",buffered:!0,durationThreshold:0}))};let tn=0;class Js{constructor(){fe(this,"u",[]);fe(this,"l",new Map);fe(this,"m");fe(this,"p")}v(){tn=en(),this.u.length=0,this.l.clear()}L(){const e=Math.min(this.u.length-1,Math.floor((en()-tn)/50));return this.u[e]}h(e){var i,o;if((i=this.m)==null||i.call(this,e),!e.interactionId&&e.entryType!=="first-input")return;const r=this.u.at(-1);let n=this.l.get(e.interactionId);if(n||this.u.length<10||e.duration>r.P){if(n?e.duration>n.P?(n.entries=[e],n.P=e.duration):e.duration===n.P&&e.startTime===n.entries[0].startTime&&n.entries.push(e):(n={id:e.interactionId,entries:[e],P:e.duration},this.l.set(n.id,n),this.u.push(n)),this.u.sort(((a,s)=>s.P-a.P)),this.u.length>10){const a=this.u.splice(10);for(const s of a)this.l.delete(s.id)}(o=this.p)==null||o.call(this,n)}}}const Qn=t=>{const e=globalThis.requestIdleCallback||setTimeout;document.visibilityState==="hidden"?t():(t=or(t),addEventListener("visibilitychange",t,{once:!0,capture:!0}),e((()=>{t(),removeEventListener("visibilitychange",t,{capture:!0})}
12)))},rn=[200,500],Qs=(t,e={})=>{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;const r=ft();vt((()=>{Ys();let n,i=le("INP");const o=ir(e,Js),a=u=>{Qn((()=>{for(const c of u)o.h(c);const l=o.L();l&&l.P!==i.value&&(i.value=l.P,i.entries=l.entries,n())}))},s=je("event",a,{durationThreshold:e.durationThreshold??40});n=ue(t,i,rn,e.reportAllChanges),s&&(s.observe({type:"first-input",buffered:!0}),r.onHidden((()=>{a(s.takeRecords()),n(!0)})),Re((()=>{o.v(),i=le("INP"),n=ue(t,i,rn,e.reportAllChanges)})))}))};class Zs{constructor(){fe(this,"m")}h(e){var r;(r=this.m)==null||r.call(this,e)}}const nn=[2500,4e3],eu=(t,e={})=>{vt((()=>{const r=ft();let n,i=le("LCP");const o=ir(e,Zs),a=u=>{e.reportAllChanges||(u=u.slice(-1));for(const l of u)o.h(l),l.startTime<r.firstHiddenTime&&(i.value=Math.max(l.startTime-Ve(),0),i.entries=[l],n())},s=je("largest-contentful-paint",a);if(s){n=ue(t,i,nn,e.reportAllChanges);const u=or((()=>{a(s.takeRecords()),s.disconnect(),n(!0)})),l=c=>{c.isTrusted&&(Qn(u),removeEventListener(c.type,l,{capture:!0}))};for(const c of["keydown","click","visibilitychange"])addEventListener(c,l,{capture:!0});Re((c=>{i=le("LCP"),n=ue(t,i,nn,e.reportAllChanges),rr((()=>{i.value=performance.now()-c.timeStamp,n(!0)}))}))}}))},on=[800,1800],qt=t=>{document.prerendering?vt((()=>qt(t))):document.readyState!=="complete"?addEventListener("load",(()=>qt(t)),!0):setTimeout(t)},tu=(t,e={})=>{let r=le("TTFB"),n=ue(t,r,on,e.reportAllChanges);qt((()=>{const i=nr();i&&(r.value=Math.max(i.responseStart-Ve(),0),r.entries=[i],n(!0),Re((()=>{r=le("TTFB",0),n=ue(t,r,on,e.reportAllChanges),n(!0)})))}))};function ru(t){var e,r=((e=t.entries[0])===null||e===void 0?void 0:e.startTime)||0;return performance.timeOrigin+r}function De(t){return{value:t.value,rating:t.rating,delta:t.delta,navigationType:t.navigationType,id:t.id,timestamp:Math.floor(ru(t)),navigationStart:Math.floor(performance.timeOrigin)}}var nu=function(){var t=null,e=F(),r=e==null?void 0:e.document,n=e==null?void 0:e.location,i=function(s,u){return S(void 0,void 0,void 0,function(){var l,c;return T(this,function(f){return r===void 0?[2]:(l=pe((n==null?void 0:n.href)||"",s.loggerProvider),c={"[Amplitude] Page Domain":(n==null?void 0:n.hostname)||"","[Amplitude] Page Location":l,"[Amplitude] Page Path":pe((n==null?void 0:n.pathname)||"",s.loggerProvider),"[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":pe(l.split("?")[0],s.loggerProvider)},eu(function(d){c["[Amplitude] LCP"]=De(d)}),Yn(function(d){c["[Amplitude] FCP"]=De(d)}),Qs(function(d){c["[Amplitude] INP"]=De(d)}),zs(function(d){c["[Amplitude] CLS"]=De(d)}),tu(function(d){c["[Amplitude] TTFB"]=De(d)}),t=function(){r.visibilityState==="hidden"&&t&&(u.track(Ks,c),r.removeEventListener("visibilitychange",t),t=null)},r.addEventListener("visibilitychange",t),[2])})})},o=function(s){return S(void 0,void 0,void 0,function(){return T(this,function(u){return[2,s]})})},a=function(){return S(void 0,void 0,void 0,function(){return T(this,function(s){return t&&(r==null||r.removeEventListener("visibilitychange",t)),[2]})})};return{name:Ws,type:"enrichment",setup:i,execute:o,teardown:a}},an=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},iu=function(t){return Object.values(t).every(function(e){return!e})},ou=function(t,e,r,n,i){i===void 0&&(i=!0),t.referrer;var o=t.referring_domain,a=rt(t,["referrer","referring_domain"]),s=e||{};s.referrer;var u=s.referring_domain,l=rt(s,["referrer","referring_domain"]);if(au(r.excludeReferrers,t.referring_domain))return n.debug("This is not a new campaign because ".concat(t.referring_domain," is in the exclude referrer list.")),!1;if(!i&&iu(t)&&e)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var c=JSON.stringify(a)!==JSON.stringify(l),f=an(o||"")!==an(u||""),d=!e||c||f;return d?n.debug("This is a new campaign. An $identify event will be sent."):n.debug("This is not a new campaign because it's the same as the previous one."),d},au=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(r){return r instanceof RegExp?r.test(e):r===e})},su=function(t,e){var r=w(w({},lt),t),n=Object.entries(r).reduce(function(i,o){var a,s=O(o,2),u=s[0],l=s[1];return i.setOnce("initial_".concat(u),(a=l??e.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY"),l?i.set(u,l):i.unset(u)},new Te);return Vt(n)},uu=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\."),"$"))]):[]},lu=(function(){function t(e,r){var n;this.shouldTrackNewCampaign=!1,this.options=w({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:uu((n=r.cookieOptions)===null||n===void 0?void 0:n.domain)}
12,e),this.storage=r.cookieStorage,this.storageKey=Sr(r.apiKey,"MKTG"),this.webExpStorageKey=Sr(r.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=lt,this.sessionTimeout=r.sessionTimeout,this.lastEventTime=r.lastEventTime,this.logger=r.loggerProvider,r.loggerProvider.log("Installing web attribution tracking.")}return t.prototype.init=function(){return S(this,void 0,void 0,function(){var e,r;return T(this,function(n){switch(n.label){case 0:return[4,this.fetchCampaign()];case 1:return r=O.apply(void 0,[n.sent(),2]),this.currentCampaign=r[0],this.previousCampaign=r[1],e=this.lastEventTime?vn(this.sessionTimeout,this.lastEventTime):!0,ou(this.currentCampaign,this.previousCampaign,this.options,this.logger,e)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},t.prototype.fetchCampaign=function(){return S(this,void 0,void 0,function(){var e;return T(this,function(r){switch(r.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return e=r.sent(),e?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[4,Promise.all([e||new Sn().parse(),this.storage.get(this.storageKey)])];case 4:return[2,r.sent()]}})})},t.prototype.generateCampaignEvent=function(e){this.shouldTrackNewCampaign=!1;var r=su(this.currentCampaign,this.options);return e&&(r.event_id=e),r},t.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},t})(),Ke="AMP_CURRENT_PAGE",$e="AMP_PREVIOUS_PAGE",we="AMP_URL_INFO",Fe;(function(t){t.Direct="direct",t.Internal="internal",t.External="external"})(Fe||(Fe={}));var cu=new Set([te.IDENTIFY,te.GROUP_IDENTIFY,te.REVENUE]),du=function(t){var e={},r=e.internalDomains,n=r===void 0?[]:r,i=F(),o=void 0,a=!1,s=void 0,u=!1,l=!1,c=function(m){var y;try{var p=pe(m,s);y=new URL(p).hostname}catch(h){s==null||s.error("Could not parse URL: ",h)}return y},f=function(m){var y=typeof location<"u"&&location.hostname||"",p=m?c(m):void 0;if(!p)return Fe.Direct;var h=n.some(function(E){return y.indexOf(E)!==-1}),b=n.some(function(E){return p.indexOf(E)!==-1});return y===p||b&&h?Fe.Internal:Fe.External},d=function(){return S(void 0,void 0,void 0,function(){var m,y,p,h,b;return T(this,function(E){switch(E.label){case 0:return o&&a?[4,o.get(we)]:[3,3];case 1:return m=E.sent(),y=pe(typeof location<"u"&&location.href||""),p=(m==null?void 0:m[Ke])||"",h=void 0,y===p?h=(m==null?void 0:m[$e])||"":p?h=p:h=document.referrer||"",[4,o.set(we,(b={},b[Ke]=y,b[$e]=h,b))];case 2:E.sent(),E.label=3;case 3:return[2]}})})},v=function(){d()},g={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(m,y){return S(void 0,void 0,void 0,function(){return T(this,function(p){switch(p.label){case 0:return s=m.loggerProvider,s.log("Installing @amplitude/plugin-page-url-enrichment-browser"),l=!0,i?(o=new Bt(i.sessionStorage),[4,o.isEnabled()]):[3,2];case 1:a=p.sent(),i.addEventListener("popstate",v),u||(i.history.pushState=new Proxy(i.history.pushState,{apply:function(h,b,E){var _=O(E,3),I=_[0],A=_[1],C=_[2];h.apply(b,[I,A,C]),l&&v()}}),i.history.replaceState=new Proxy(i.history.replaceState,{apply:function(h,b,E){var _=O(E,3),I=_[0],A=_[1],C=_[2];h.apply(b,[I,A,C]),l&&v()}}),u=!0),p.label=2;case 2:return[2]}})})},execute:function(m){return S(void 0,void 0,void 0,function(){var y,p,h,b,E;return T(this,function(_){switch(_.label){case 0:return y=pe(typeof location<"u"&&location.href||""),o&&a?[4,o.get(we)]:[3,5];case 1:return p=_.sent(),p!=null&&p[Ke]?[3,3]:[4,o.set(we,(E={},E[Ke]=y,E[$e]=document.referrer||"",E))];case 2:_.sent(),_.label=3;case 3:return[4,o.get(we)];case 4:if(h=_.sent(),b="",h&&(b=h[$e]||""),cu.has(m.event_type))return[2,m];m.event_properties=w(w({},m.event_properties||{}),{"[Amplitude] Page Domain":Ne(m,"[Amplitude] Page Domain",typeof location<"u"&&location.hostname||""),"[Amplitude] Page Location":Ne(m,"[Amplitude] Page Location",y),"[Amplitude] Page Path":Ne(m,"[Amplitude] Page Path",typeof location<"u"&&pe(location.pathname)||""),"[Amplitude] Page Title":Ne(m,"[Amplitude] Page Title",$t(Kt)),"[Amplitude] Page URL":Ne(m,"[Amplitude] Page URL",y.split("?")[0]),"[Amplitude] Previous Page Location":b,"[Amplitude] Previous Page Type":f(b)}),_.label=5;case 5:return[2,m]}})})},teardown:function(){return S(void 0,void 0,void 0,function(){return T(this,function(m){switch(m.label){case 0:return i&&(i.removeEventListener("popstate",v),l=!1),o&&a?[4,o.set(we,{})]:[3,2];case 1:m.sent(),m.label=2;case 2:return[2]}})})}};return g};function Ne(t,e,r){return t.event_properties||(t.event_properties={}),t.event_properties[e]===void 0?r:t.event_properties[e]}var Zn=(function(t){Se(e,t);function e(){var r=t!==null&&t.apply(this,arguments)||this;return r._diagnosticsSampleRate=0,r}return e.prototype.init=function(r,n,i){r===void 0&&(r="");var o,a;return arguments.length>2?(o=n,a=i):typeof n=="string"?(o=n,a=void 0):(o=n==null?void 0:n.userId,a=n),Z(this._init(w(w({},a),{userId:o,apiKey:r})))},e.prototype._init=function(r){var n,i,o,a;return S(this,void 0,void 0,function(){var s,u,l,c,f,d,v,g,m,y,p=this;return T(this,function(h){switch(h.label){case 0:return this.initializing?[2]:(this.initializing=!0,[4,Sa(r.apiKey,r,this)]);case 1:return s=h.sent(),l=s.remoteConfig&&s.remoteConfig.fetchRemoteConfig,l?(u=new So(s.apiKey,s.loggerProvider,s.serverZone,(n=s.remoteConfig)===null||n===void 0?void 0:n.serverUrl),[4,new Promise(function(b){u==null||u.subscribe("configs.analyticsSDK.browserSDK","all",function(E,_,I){s.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:E,source:_,lastFetch:I},null,2)),E&&xa(E,s),b()})})]):[3,4];case 2:return h.sent(),[4,new Promise(function(b){u==null||u.subscribe("configs.diagnostics.browserSDK","all",function(E,_,I){if(s.loggerProvider.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:E,source:_,lastFetch:I},null,2)),E){var A=E.sampleRate;typeof A=="number"&&!isNaN(A)&&(s.diagnosticsSampleRate=A);var C=E.enabled;typeof C=="boolean"&&(s.enableDiagnostics=C)}b()})})];case 3:h.sent(),h.label=4;case 4:return c=new ho(s.apiKey,s.loggerProvider,s.serverZone,{enabled:s.enableDiagnostics,sampleRate:s.diagnosticsSampleRate}),c.setTag("library","".concat(Cn,"/").concat(Zt)),c.setTag("user_agent",navigator.userAgent),[4,t.prototype._init.call(this,s)];case 5:return h.sent(),this.logBrowserOptions(s),this.config.diagnosticsClient=c,this.config.remoteConfigClient=u,An(this.config.defaultTracking)?(f=na(this.config),this.webAttribution=new lu(f,this.config),[4,this.webAttribution.init()]):[3,7];case 6:h.sent(),h.label=7;case 7:return d=it(),v=d.ampTimestamp?Number(d.ampTimestamp):void 0,g=v?Date.now()<v:!0,m=g&&!Number.isNaN(Number(d.ampSessionId))?Number(d.ampSessionId):void 0,this.setSessionId((a=(o=(i=r.sessionId)!==null&&i!==void 0?i:m)!==null&&o!==void 0?o:this.config.sessionId)!==null&&a!==void 0?a:Date.now()),y=qe(r.instanceName),y.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===gn?[3,9]:[4,this.add(Na()).promise];case 8:h.sent(),h.label=9;case 9:return[4,this.add(new Fi({diagnosticsClient:c})).promise];case 10:return h.sent(),[4,this.add(new sa).promise];case 11:return h.sent(),[4,this.add(new Xi).promise];case 12:return h.sent(),Da(this.config),Xo(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(La()).promise]):[3,14];case 13:h.sent(),h.label=14;case 14:return Yo(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Ca()).promise]):[3,16];case 15:h.sent(),h.label=16;case 16:return Pn(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(Pa(ra(this.config))).promise]):[3,18];case 17:h.sent(),h.label=18;case 18:return Rn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Os(Zo(this.config),{diagnosticsClient:c})).promise]):[3,20];case 19:h.sent(),h.label=20;case 20:return On(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(Ms(ea(this.config))).promise]):[3,22];case 21:h.sent(),h.label=22;case 22:return kn(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(Gs(ta(this.config))).promise]):[3,24];case 23:h.sent(),h.label=24;case 24:return Qo(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(nu()).promise]):[3,26];
12case 25:h.sent(),h.label=26;case 26:return Jo(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(du()).promise]):[3,28];case 27:h.sent(),h.label=28;case 28:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 29:return h.sent(),y.eventBridge.setEventReceiver(function(b){var E=b.eventProperties||{},_=E.time,I=rt(E,["time"]),A=typeof _=="number"?{time:_}:void 0;p.track(b.eventType,I,A)}),[2]}})})},e.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId},e.prototype.setUserId=function(r){if(!this.config){this.q.push(this.setUserId.bind(this,r));return}this.config.loggerProvider.debug("function setUserId: ",r),(r!==this.config.userId||r===void 0)&&(this.config.userId=r,this.timeline.onIdentityChanged({userId:r}),$i(r,this.config.instanceName))},e.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId},e.prototype.setDeviceId=function(r){if(!this.config){this.q.push(this.setDeviceId.bind(this,r));return}this.config.loggerProvider.debug("function setDeviceId: ",r),r!==this.config.deviceId&&(this.config.deviceId=r,this.timeline.onIdentityChanged({deviceId:r}),zi(r,this.config.instanceName))},e.prototype.reset=function(){this.setDeviceId(ye()),this.setUserId(void 0),this.timeline.onReset()},e.prototype.getIdentity=function(){var r,n;return{deviceId:(r=this.config)===null||r===void 0?void 0:r.deviceId,userId:(n=this.config)===null||n===void 0?void 0:n.userId,userProperties:this.userProperties}},e.prototype.getOptOut=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.optOut},e.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId},e.prototype.setSessionId=function(r){var n,i=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,r)),Z(Promise.resolve());if(r===this.config.sessionId)return Z(Promise.resolve());this.config.loggerProvider.debug("function setSessionId: ",r);var o=this.getSessionId();o!==r&&this.timeline.onSessionIdChanged(r);var a=this.config.lastEventTime,s=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1;this.config.sessionId=r,this.config.lastEventTime=void 0,this.config.pageCounter=0,Lr(this.config.defaultTracking)&&(o&&a&&i.push(this.track(xr,void 0,{device_id:this.previousSessionDeviceId,event_id:++s,session_id:o,time:a+1,user_id:this.previousSessionUserId}).promise),this.config.lastEventTime=this.config.sessionId);var u=this.trackCampaignEventIfNeeded(++s,i);return this.config.identify&&i.push(this.track(Vt(this.config.identify)).promise),Lr(this.config.defaultTracking)&&i.push(this.track(Nr,void 0,{event_id:u?++s:s,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,Z(Promise.all(i))},e.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}this.config.lastEventTime=Date.now()},e.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=Dn(r)},e.prototype.identify=function(r,n){if(Et(r)){var i=r._q;r._q=[],r=Ze(new Te,i)}return n!=null&&n.user_id&&this.setUserId(n.user_id),n!=null&&n.device_id&&this.setDeviceId(n.device_id),t.prototype.identify.call(this,r,n)},e.prototype.groupIdentify=function(r,n,i,o){if(Et(i)){var a=i._q;i._q=[],i=Ze(new Te,a)}return t.prototype.groupIdentify.call(this,r,n,i,o)},e.prototype.revenue=function(r,n){if(Et(r)){var i=r._q;r._q=[],r=Ze(new cn,i)}return t.prototype.revenue.call(this,r,n)},e.prototype.trackCampaignEventIfNeeded=function(r,n){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign)return!1;var i=this.webAttribution.generateCampaignEvent(r);return n?n.push(this.track(i).promise):this.track(i),this.config.loggerProvider.log("Tracking attribution."),!0},e.prototype.process=function(r){return S(this,void 0,void 0,function(){var n,i,o;return T(this,function(a){return n=Date.now(),i=vn(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),r.event_type!==Nr&&r.event_type!==xr&&(!r.session_id||r.session_id===this.getSessionId())&&(i||o?(this.setSessionId(n),o&&this.config.loggerProvider.log("Created a new session for new campaign.")):i||this.trackCampaignEventIfNeeded()),r.event_type===te.IDENTIFY&&r.user_properties&&(this.userProperties=this.getOperationAppliedUserProperties(r.user_properties)),[2,t.prototype.process.call(this,r)]})})},e.prototype.logBrowserOptions=function(r){try{var n=w(w({},r),{apiKey:r.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",JSON.stringify(n))}catch(i){this.config.loggerProvider.error("Error logging browser config",i)}},e.prototype._setDiagnosticsSampleRate=function(r){if(!(r>1||r<0)&&!this.config){this._diagnosticsSampleRate=r;return}},e})(Ci),ei=function(){var t=new Zn;return{init:H(t.init.bind(t),"init",j(t),B(t,["config"])),add:H(t.add.bind(t),"add",j(t),B(t,["config.apiKey","timeline.plugins"])),remove:H(t.remove.bind(t),"remove",j(t),B(t,["config.apiKey","timeline.plugins"])),track:H(t.track.bind(t),"track",j(t),B(t,["config.apiKey","timeline.queue.length"])),logEvent:H(t.logEvent.bind(t),"logEvent",j(t),B(t,["config.apiKey","timeline.queue.length"])),identify:H(t.identify.bind(t),"identify",j(t),B(t,["config.apiKey","timeline.queue.length"])),groupIdentify:H(t.groupIdentify.bind(t),"groupIdentify",j(t),B(t,["config.apiKey","timeline.queue.length"])),setGroup:H(t.setGroup.bind(t),"setGroup",j(t),B(t,["config.apiKey","timeline.queue.length"])),revenue:H(t.revenue.bind(t),"revenue",j(t),B(t,["config.apiKey","timeline.queue.length"])),flush:H(t.flush.bind(t),"flush",j(t),B(t,["config.apiKey","timeline.queue.length"])),getUserId:H(t.getUserId.bind(t),"getUserId",j(t),B(t,["config","config.userId"])),setUserId:H(t.setUserId.bind(t),"setUserId",j(t),B(t,["config","config.userId"])),getDeviceId:H(t.getDeviceId.bind(t),"getDeviceId",j(t),B(t,["config","config.deviceId"])),setDeviceId:H(t.setDeviceId.bind(t),"setDeviceId",j(t),B(t,["config","config.deviceId"])),reset:H(t.reset.bind(t),"reset",j(t),B(t,["config","config.userId","config.deviceId"])),getSessionId:H(t.getSessionId.bind(t),"getSessionId",j(t),B(t,["config"])),setSessionId:H(t.setSessionId.bind(t),"setSessionId",j(t),B(t,["config"])),extendSession:H(t.extendSession.bind(t),"extendSession",j(t),B(t,["config"])),setOptOut:H(t.setOptOut.bind(t),"setOptOut",j(t),B(t,["config"])),setTransport:H(t.setTransport.bind(t),"setTransport",j(t),B(t,["config"])),getIdentity:H(t.getIdentity.bind(t),"getIdentity",j(t),B(t,["config"])),getOptOut:H(t.getOptOut.bind(t),"getOptOut",j(t),B(t,["config"])),_setDiagnosticsSampleRate:H(t._setDiagnosticsSampleRate.bind(t),"_setDiagnosticsSampleRate",j(t),B(t,["config"]))}};const G=ei(),fu=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_ACTION_CLICK_ALLOWLIST:mn,DEFAULT_CSS_SELECTOR_ALLOWLIST:pn,DEFAULT_DATA_ATTRIBUTE_PREFIX:Gt,get IdentifyOperation(){return ve},get LogLevel(){return ee},OfflineDisabled:gn,get RevenueProperty(){return ie},get ServerZone(){return Ct},get SpecialEventType(){return te}},Symbol.toStringTag,{value:"Module"}));var vu=G.add,hu=G.extendSession,gu=G.flush,pu=G.getDeviceId,mu=G.getIdentity,yu=G.getOptOut,bu=G.getSessionId,Eu=G.getUserId,Tu=G.groupIdentify,Su=G.identify,ti=G.init,_u=G.logEvent,wu=G.remove,Iu=G.reset,Au=G.revenue,Pu=G.setDeviceId,ku=G.setGroup,Ru=G.setOptOut,Ou=G.setSessionId,Cu=G.setTransport,Lu=G.setUserId,Du=G.track,Nu=G._setDiagnosticsSampleRate;const xu=Object.freeze(Object.defineProperty({__proto__:null,AmplitudeBrowser:Zn,Identify:Te,Revenue:cn,Types:fu,_setDiagnosticsSampleRate:Nu,add:vu,createInstance:ei,extendSession:hu,flush:gu,getDeviceId:pu,getIdentity:mu,getOptOut:yu,getSessionId:bu,getUserId:Eu,groupIdentify:Tu,identify:Su,init:ti,logEvent:_u,remove:wu,reset:Iu,revenue:Au,runQueuedFunctions:ia,setDeviceId:Pu,setGroup:ku,setOptOut:Ru,setSessionId:Ou,setTransport:Cu,setUserId:Lu,track:Du},Symbol.toStringTag,{value:"Module"}));class Uu{constructor({token:e}={}){this.analyticsToken=e,this.analytics=null,this.user={}}
12async init(){this.analyticsToken&&(ti(this.analyticsToken,{defaultTracking:!1}),this.analytics=xu)}identify(e){if(!this.analytics||!e)return;this.user=e,this.analytics.setUserId(`user-${this.user.id.toString()}`);const r=new Te;r.set("email",this.user.email),r.set("name",this.user.name),r.set("avatar",this.user.avatar_url),this.analytics.identify(r);const{accounts:n,account_id:i}=this.user,[o]=n.filter(a=>a.id===i);if(o){const a=`account-${o.id.toString()}`;this.analytics.setGroup("company",a);const s=new Te;s.set("name",o.name),this.analytics.groupIdentify("company",a,s)}}track(e,r={}){this.analytics&&this.analytics.track(e,r)}page(e,r={}){this.analytics&&this.analytics.track("$pageview",{pageName:e,...r})}}const Mu=new Uu(window.analyticsConfig),Vu=(...t)=>{try{return Mu.track(...t)}catch{}return null},ju=(t,e=null)=>{ii.emit("newToastMessage",{message:t,action:e})};export{Mu as A,Vu as a,ju as u};
13//# sourceMappingURL=index-BtPaM80c.js.map

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.