PageSourceSearch

https://static.amplitude.com/vendor/[email protected]

js amplitude.com collected 2026-10-09 22:53:48 UTC 249,436 bytes, 12 lines download raw bytes

1import{a as ge,b,c as nt,d as T,e as y,f as P,g as w,h as N}from"./chunks/chunk-CDWVHYJK.js";import{b as Kn,c as Sc,e as ua,g as xe}from"./chunks/chunk-6KL6YNEA.js";var wa=Kn((wv,si)=>{var xc=Object.prototype.hasOwnProperty;function Ia(e){return"[Throws: "+(e?e.message:"?")+"]"}function wc(e,t){if(xc.call(e,t))try{return e[t]}catch(r){return Ia(r)}return e[t]}function xa(e){var t=[];function r(n){if(n===null||typeof n!="object")return n;if(t.indexOf(n)!==-1)return"[Circular]";if(t.push(n),typeof n.toJSON=="function")try{var i=r(n.toJSON());return t.pop(),i}catch(s){return Ia(s)}if(Array.isArray(n)){var o=n.map(r);return t.pop(),o}var a=Object.keys(n).reduce(function(s,l){return s[l]=r(wc(n,l)),s},{});return t.pop(),a}return r(e)}si.exports=function(e,t,r){return JSON.stringify(xa(e),t,r)};si.exports.ensureProperties=xa});var as=Kn(zr=>{"use strict";Object.defineProperty(zr,"__esModule",{value:!0});zr.Observable=void 0;var rs=e=>!!Symbol[e],Bi=e=>rs(e)?Symbol[e]:"@@"+e,gd=Bi("iterator"),Vi=Bi("observable"),ns=Bi("species");function jr(e,t){let r=e[t];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function or(e){let t=e.constructor;return t!==void 0&&(t=t[ns],t===null&&(t=void 0)),t!==void 0?t:xt}function md(e){return e instanceof xt}function It(e){It.log?It.log(e):setTimeout(()=>{throw e})}function Xr(e){Promise.resolve().then(()=>{try{e()}catch(t){It(t)}})}function is(e){let t=e._cleanup;if(t!==void 0&&(e._cleanup=void 0,!!t))try{if(typeof t=="function")t();else{let r=jr(t,"unsubscribe");r&&r.call(t)}}catch(r){It(r)}}function Gi(e){e._observer=void 0,e._queue=void 0,e._state="closed"}function Ed(e){let t=e._queue;if(t){e._queue=void 0,e._state="ready";for(let r=0;r<t.length&&(os(e,t[r].type,t[r].value),e._state!=="closed");++r);}}function os(e,t,r){e._state="running";let n=e._observer;try{let i=jr(n,t);switch(t){case"next":i&&i.call(n,r);break;case"error":if(Gi(e),i)i.call(n,r);else throw r;break;case"complete":Gi(e),i&&i.call(n);break}}catch(i){It(i)}e._state==="closed"?is(e):e._state==="running"&&(e._state="ready")}function Fi(e,t,r){if(e._state!=="closed"){if(e._state==="buffering"){e._queue.push({type:t,value:r});return}if(e._state!=="ready"){e._state="buffering",e._queue=[{type:t,value:r}],Xr(()=>Ed(e));return}os(e,t,r)}}var Hi=class{constructor(t,r){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";let n=this,i={get closed(){return n._state==="closed"},next(o){Fi(n,"next",o)},error(o){Fi(n,"error",o)},complete(){Fi(n,"complete")}};try{this._cleanup=r.call(void 0,i)}catch(o){i.error(o)}this._state==="initializing"&&(this._state="ready")}get closed(){return this._state==="closed"}unsubscribe(){this._state!=="closed"&&(Gi(this),is(this))}},xt=class e{constructor(t){if(!(this instanceof e))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}subscribe(t){return(typeof t!="object"||t===null)&&(t={next:t,error:arguments[1],complete:arguments[2]}),new Hi(t,this._subscriber)}forEach(t){return new Promise((r,n)=>{if(typeof t!="function"){n(new TypeError(t+" is not a function"));return}function i(){o.unsubscribe(),r()}let o=this.subscribe({next(a){try{t(a,i)}catch(s){n(s),o.unsubscribe()}},error:n,complete:r})})}map(t){if(typeof t!="function")throw new TypeError(t+" is not a function");let r=or(this);return new r(n=>this.subscribe({next(i){try{i=t(i)}catch(o){return n.error(o)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}filter(t){if(typeof t!="function")throw new TypeError(t+" is not a function");let r=or(this);return new r(n=>this.subscribe({next(i){try{if(!t(i))return}catch(o){return n.error(o)}n.next(i)},error(i){n.error(i)},complete(){n.complete()}}))}reduce(t){if(typeof t!="function")throw new TypeError(t+" is not a function");let r=or(this),n=arguments.length>1,i=!1,a=arguments[1];return new r(s=>this.subscribe({next(l){let u=!i;if(i=!0,!u||n)try{a=t(a,l)}catch(c){return s.error(c)}else a=l},error(l){s.error(l)},complete(){if(!i&&!n)return s.error(new TypeError("Cannot reduce an empty sequence"));s.next(a),s.complete()}}))}async all(){let t=[];return await this.forEach(r=>t.push(r)),t}concat(...t){let r=or(this);return new r(n=>{let i,o=0;function a(s){i=s.subscribe({next(l){n.next(l)},error(l){n.error(l)},complete(){o===t.length?(i=void 0,n.complete()):a(r.from(t[o++]))}})}return a(this),()=>{i&&(i.unsubscribe(),i=void 0)}})}flatMap(t){if(typeof t!="function")throw new TypeError(t+" is not a function");let r=or(this);return new r(n=>{let i=[],o=this.subscribe({next(s){if(t)try{s=t(s)}catch(u){return n.error(u)}let l=r.from(s).subscribe({next(u){n.next(u)},error(u){n.error(u)},complete(){let u=i.indexOf(l);u>=0&&i.splice(u,1),a()}});i.push(l)},error(s){n.error(s)},complete(){a()}});function a(){o.closed&&i.length===0&&n.complete()}return()=>
1{i.forEach(s=>s.unsubscribe()),o.unsubscribe()}})}[Vi](){return this}static from(t){let r=typeof this=="function"?this:e;if(t==null)throw new TypeError(t+" is not an object");let n=jr(t,Vi);if(n){let i=n.call(t);if(Object(i)!==i)throw new TypeError(i+" is not an object");return md(i)&&i.constructor===r?i:new r(o=>i.subscribe(o))}if(rs("iterator")&&(n=jr(t,gd),n))return new r(i=>{Xr(()=>{if(!i.closed){for(let o of n.call(t))if(i.next(o),i.closed)return;i.complete()}})});if(Array.isArray(t))return new r(i=>{Xr(()=>{if(!i.closed){for(let o=0;o<t.length;++o)if(i.next(t[o]),i.closed)return;i.complete()}})});throw new TypeError(t+" is not observable")}static of(...t){let r=typeof this=="function"?this:e;return new r(n=>{Xr(()=>{if(!n.closed){for(let i=0;i<t.length;++i)if(n.next(t[i]),n.closed)return;n.complete()}})})}static get[ns](){return this}};zr.Observable=xt;Object.defineProperty(xt,Symbol("extensions"),{value:{symbol:Vi,hostReportError:It},configurable:!0})});var us=Kn((Xh,ss)=>{ss.exports=as().Observable});var Ee;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(Ee||(Ee={}));var se;(function(e){e.IDENTIFY="$identify",e.GROUP_IDENTIFY="$groupidentify",e.REVENUE="revenue_amount"})(se||(se={}));var Xn="-",yt="AMP",la="".concat(yt,"_unsent"),wr="$default_instance",Ht="https://api2.amplitude.com/2/httpapi",Pr="https://api.eu.amplitude.com/2/httpapi",Cr="https://api2.amplitude.com/batch",Rr="https://api.eu.amplitude.com/batch",ca="utm_campaign",da="utm_content",fa="utm_id",va="utm_medium",pa="utm_source",ha="utm_term",jn="dclid",zn="fbclid",Yn="gbraid",$n="gclid",Jn="ko_click_id",Qn="li_fat_id",Zn="msclkid",ei="rdt_cid",ti="ttclid",ri="twclid",ni="wbraid";var Be={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};var We=["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"],ii=["authorization","cookie","set-cookie"];var Ac=1e3,Lr=function(e){if(Object.keys(e).length>Ac)return!1;for(var t in e){var r=e[t];if(!oi(t,r))return!1}return!0},oi=function(e,t){var r,n;if(typeof e!="string")return!1;if(Array.isArray(t)){var i=!0;try{for(var o=P(t),a=o.next();!a.done;a=o.next()){var s=a.value;if(Array.isArray(s))return!1;if(typeof s=="object")i=i&&Lr(s);else if(!["number","string"].includes(typeof s))return!1;if(!i)return!1}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}else{if(t==null)return!1;if(typeof t=="object")return Lr(t);if(!["number","string","boolean"].includes(typeof t))return!1}return!0};var Ue=(function(){function e(){this._propertySet=new Set,this._properties={}}return e.prototype.getUserProperties=function(){return b({},this._properties)},e.prototype.set=function(t,r){return this._safeSet(z.SET,t,r),this},e.prototype.setOnce=function(t,r){return this._safeSet(z.SET_ONCE,t,r),this},e.prototype.append=function(t,r){return this._safeSet(z.APPEND,t,r),this},e.prototype.prepend=function(t,r){return this._safeSet(z.PREPEND,t,r),this},e.prototype.postInsert=function(t,r){return this._safeSet(z.POSTINSERT,t,r),this},e.prototype.preInsert=function(t,r){return this._safeSet(z.PREINSERT,t,r),this},e.prototype.remove=function(t,r){return this._safeSet(z.REMOVE,t,r),this},e.prototype.add=function(t,r){return this._safeSet(z.ADD,t,r),this},e.prototype.unset=function(t){return this._safeSet(z.UNSET,t,Xn),this},e.prototype.clearAll=function(){return this._properties={},this._properties[z.CLEAR_ALL]=Xn,this}
1,e.prototype._safeSet=function(t,r,n){if(this._validate(t,r,n)){var i=this._properties[t];return i===void 0&&(i={},this._properties[t]=i),i[r]=n,this._propertySet.add(r),!0}return!1},e.prototype._validate=function(t,r,n){return this._properties[z.CLEAR_ALL]!==void 0||this._propertySet.has(r)?!1:t===z.ADD?typeof n=="number":t!==z.UNSET&&t!==z.REMOVE?oi(r,n):!0},e})();var z;(function(e){e.SET="$set",e.SET_ONCE="$setOnce",e.ADD="$add",e.APPEND="$append",e.PREPEND="$prepend",e.REMOVE="$remove",e.PREINSERT="$preInsert",e.POSTINSERT="$postInsert",e.UNSET="$unset",e.CLEAR_ALL="$clearAll"})(z||(z={}));var ga=[z.CLEAR_ALL,z.UNSET,z.SET,z.SET_ONCE,z.ADD,z.APPEND,z.PREPEND,z.PREINSERT,z.POSTINSERT,z.REMOVE];var ma="Event tracked successfully",Ea="Unexpected error occurred",ba="Event rejected due to exceeded retry count",_a="Event skipped due to optOut config",ai="Event skipped due to empty event type",ya="Event rejected due to missing API key",Ta="Invalid API key",Sa="Client not initialized";var te;(function(e){e.Unknown="unknown",e.Skipped="skipped",e.Success="success",e.RateLimit="rate_limit",e.PayloadTooLarge="payload_too_large",e.Invalid="invalid",e.Failed="failed",e.Timeout="Timeout",e.SystemError="SystemError"})(te||(te={}));var Fe=function(e,t,r){return t===void 0&&(t=0),r===void 0&&(r=te.Unknown),{event:e,code:t,message:r}};var C=function(){var e="ampIntegrationContext";if(typeof globalThis<"u"&&typeof globalThis[e]<"u")return globalThis[e];if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var Ic=function(e){return e?(e^Math.random()*16>>e/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,ne)},Aa=N([],w(Array(256).keys()),!1).map(function(e){return e.toString(16).padStart(2,"0")}),ne=function(e){var t,r=C();if(!(!((t=r?.crypto)===null||t===void 0)&&t.getRandomValues))return Ic(e);var n=r.crypto.getRandomValues(new Uint8Array(16));return n[6]=n[6]&15|64,n[8]=n[8]&63|128,N([],w(n.entries()),!1).map(function(i){var o=w(i,2),a=o[0],s=o[1];return[4,6,8,10].includes(a)?"-".concat(Aa[s]):Aa[s]}).join("")};var ui=ua(wa()),me=ui.default||ui;var Pa=(function(){function e(t){this.client=t,this.queue=[],this.applying=!1,this.plugins=[],this.pluginStatus=new Map,this._optOutListeners=[]}return e.prototype.register=function(t,r){var n,i;return T(this,void 0,void 0,function(){var o;return y(this,function(a){switch(a.label){case 0:return t.name===void 0&&(t.name=ne(),this.loggerProvider.warn(`Plugin name is undefined.
2      Generating a random UUID for plugin name: `.concat(t.name,`.
3      Set a name for the plugin to prevent it from being added multiple times.`))),o=t.name,this.pluginStatus.has(o)?(this.loggerProvider.warn("Plugin with name ".concat(o," already exists, skipping registration")),[2]):(t.type=(n=t.type)!==null&&n!==void 0?n:"enrichment",this.pluginStatus.set(o,"locked"),[4,(i=t.setup)===null||i===void 0?void 0:i.call(t,r,this.client)]);case 1:return a.sent(),this.pluginStatus.get(o)!=="locked"?[2]:(this.plugins.push(t),this.pluginStatus.set(o,"installed"),[2])}})})},e.prototype.deregister=function(t,r){var n;return T(this,void 0,void 0,function(){var i,o;return y(this,function(a){switch(a.label){case 0:return this.pluginStatus.delete(t),i=this.plugins.findIndex(function(s){return s.name===t}),i===-1?(r.loggerProvider.warn("Plugin with name ".concat(t," 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]}})})},e.prototype.reset=function(t){this._clearOptOutListeners(),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.pluginStatus.clear(),this.client=t},e.prototype.push=function(t){var r=this;return new Promise(function(n){r.queue.push([t,n]),r.scheduleApply(0)})},e.prototype.scheduleApply=function(t){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)})},t))},e.prototype.apply=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a,s,l,v,p,u,c,d,f,v,p,h,g,m,E,_,S,I;return y(this,function(A){switch(A.label){case 0:if(!t)return[2];r=w(t,1),n=r[0],i=w(t,2),o=i[1],this.loggerProvider.log("Timeline.apply: Initial event",n),a=this.plugins.filter(function(x){return x.type==="before"}),A.label=1;case 1:A.trys.push([1,6,7,8]),s=P(a),l=s.next(),A.label=2;case 2:return l.done?[3,5]:(v=l.value,v.execute?[4,v.execute(b({},n))]:[3,4]);case 3:if(p=A.sent(),p===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by before plugin '".concat(String(v.name),"', event: ").concat(me(n))),o({event:n,code:0,message:""}),[2];n=p,this.loggerProvider.log("Timeline.apply: Event after before plugin '".concat(String(v.name),"', event: ").concat(me(n))),A.label=4;case 4:return l=s.next(),[3,2];case 5:return[3,8];case 6:return u=A.sent(),E={error:u},[3,8];case 7:try{l&&!l.done&&(_=s.return)&&_.call(s)}finally{if(E)throw E.error}
3return[7];case 8:c=this.plugins.filter(function(x){return x.type==="enrichment"||x.type===void 0}),A.label=9;case 9:A.trys.push([9,14,15,16]),d=P(c),f=d.next(),A.label=10;case 10:return f.done?[3,13]:(v=f.value,v.execute?[4,v.execute(b({},n))]:[3,12]);case 11:if(p=A.sent(),p===null)return this.loggerProvider.log("Timeline.apply: Event filtered out by enrichment plugin '".concat(String(v.name),"', event: ").concat(me(n))),o({event:n,code:0,message:""}),[2];n=p,this.loggerProvider.log("Timeline.apply: Event after enrichment plugin '".concat(String(v.name),"', event: ").concat(me(n))),A.label=12;case 12:return f=d.next(),[3,10];case 13:return[3,16];case 14:return h=A.sent(),S={error:h},[3,16];case 15:try{f&&!f.done&&(I=d.return)&&I.call(d)}finally{if(S)throw S.error}return[7];case 16:return g=this.plugins.filter(function(x){return x.type==="destination"}),this.loggerProvider.log("Timeline.apply: Final event before destinations, event: ".concat(me(n))),m=g.map(function(x){var R=b({},n);return x.execute(R).catch(function(D){return Fe(R,0,String(D))})}),Promise.all(m).then(function(x){var R=w(x,1),D=R[0],G=D||Fe(n,100,"Event not tracked, no destination plugins on the instance");o(G)}),[2]}})})},e.prototype.flush=function(){return T(this,void 0,void 0,function(){var t,r,n,i=this;return y(this,function(o){switch(o.label){case 0:return t=this.queue,this.queue=[],[4,Promise.all(t.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]}})})},e.prototype.addOptOutListener=function(t){this._optOutListeners.push(t)},e.prototype._clearOptOutListeners=function(){this._optOutListeners=[]},e.prototype.onIdentityChanged=function(t){this.plugins.forEach(function(r){var n;(n=r.onIdentityChanged)===null||n===void 0||n.call(r,t)})},e.prototype.onSessionIdChanged=function(t){this.plugins.forEach(function(r){var n;(n=r.onSessionIdChanged)===null||n===void 0||n.call(r,t)})},e.prototype.onOptOutChanged=function(t){this.plugins.forEach(function(r){var n;(n=r.onOptOutChanged)===null||n===void 0||n.call(r,t)}),this._callOptOutListeners(t)},e.prototype._callOptOutListeners=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a,s,l;return y(this,function(u){switch(u.label){case 0:u.trys.push([0,7,8,9]),r=P(this._optOutListeners),n=r.next(),u.label=1;case 1:if(n.done)return[3,6];i=n.value,u.label=2;case 2:return u.trys.push([2,4,,5]),[4,i(t)];case 3:return u.sent(),[3,5];case 4:return o=u.sent(),this.loggerProvider.error("Error calling optOut listener",o),[3,5];case 5:return n=r.next(),[3,1];case 6:return[3,9];case 7:return a=u.sent(),s={error:a},[3,9];case 8:try{n&&!n.done&&(l=r.return)&&l.call(r)}finally{if(s)throw s.error}return[7];case 9:return[2]}})})},e.prototype.onReset=function(){this.plugins.forEach(function(t){var r;(r=t.onReset)===null||r===void 0||r.call(t)})},e})();var Ca=function(e,t,r){var n=typeof e=="string"?{event_type:e}:e;return b(b(b({},n),r),t&&{event_properties:t})},it=function(e,t){var r=b(b({},t),{event_type:se.IDENTIFY,user_properties:e.getUserProperties()});return r},Ra=function(e,t,r,n){var i,o=b(b({},n),{event_type:se.GROUP_IDENTIFY,group_properties:r.getUserProperties(),groups:(i={},i[e]=t,i)});return o},La=function(e,t,r){var n,i=new Ue;i.set(e,t);var o=b(b({},r),{event_type:se.IDENTIFY,user_properties:i.getUserProperties(),groups:(n={},n[e]=t,n)});return o},Oa=function(e,t){return b(b({},t),{event_type:se.REVENUE,event_properties:e.getEventProperties()})};var le=function(e){return{promise:e||Promise.resolve()}};var li=(function(){function e(t){t===void 0&&(t="$default"),this.initializing=!1,this.isReady=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Pa(this),this.name=t}return e.prototype._init=function(t){return T(this,void 0,void 0,function(){var r=this;return y(this,function(n){switch(n.label){case 0:return this.config=t,this.timeline.reset(this),this.timeline.loggerProvider=this.config.loggerProvider,[4,this.runQueuedFunctions("q",function(){return r.isReady=!0})];case 1:return n.sent(),[2]}})})},e.prototype.runQueuedFunctions=function(t,r){return T(this,void 0,void 0,function(){var n,i,o,a,s,l,u,c;return y(this,function(d){switch(d.label){case 0:n=this[t],this[t]=[],d.label=1;case 1:d.trys.push([1,8,9,10]),i=P(n),o=i.next(),d.label=2;case 2:return o.done?[3,7]:(a=o.value,s=a(),s&&"promise"in s?[4,s.promise]:[3,4]);case 3:return d.sent(),[3,6];case 4:return[4,s];case 5:d.sent(),d.label=6;case 6:return o=i.next(),[3,2];case 7:return[3,10];case 8:return l=d.sent(),u={error:l},[3,10];case 9:try{o&&!o.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}
3return[7];case 10:return this[t].length?[4,this.runQueuedFunctions(t,r)]:[3,12];case 11:return d.sent(),[3,13];case 12:r?.(),d.label=13;case 13:return[2]}})})},e.prototype.track=function(t,r,n){var i=Ca(t,r,n);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),le(this.dispatch(i))},e.prototype.identify=function(t,r){var n=it(t,r);return this.userProperties=this.getOperationAppliedUserProperties(n.user_properties),le(this.dispatch(n))},e.prototype.groupIdentify=function(t,r,n,i){var o=Ra(t,r,n,i);return le(this.dispatch(o))},e.prototype.setGroup=function(t,r,n){var i=La(t,r,n);return this.userProperties=this.getOperationAppliedUserProperties(i.user_properties),le(this.dispatch(i))},e.prototype.revenue=function(t,r){var n=Oa(t,r);return le(this.dispatch(n))},e.prototype.add=function(t){return this.isReady?this._addPlugin(t):(this.q.push(this._addPlugin.bind(this,t)),le())},e.prototype._addPlugin=function(t){return le(this.timeline.register(t,this.config))},e.prototype.remove=function(t){return this.isReady?this._removePlugin(t):(this.q.push(this._removePlugin.bind(this,t)),le())},e.prototype._removePlugin=function(t){return le(this.timeline.deregister(t,this.config))},e.prototype.dispatchWithCallback=function(t,r){if(!this.isReady)return r(Fe(t,0,Sa));this.process(t).then(r)},e.prototype.dispatch=function(t){return T(this,void 0,void 0,function(){var r=this;return y(this,function(n){return this.isReady?[2,this.process(t)]:[2,new Promise(function(i){r.dispatchQ.push(r.dispatchWithCallback.bind(r,t,i))})]})})},e.prototype.getOperationAppliedUserProperties=function(t){var r,n=(r=this.userProperties)!==null&&r!==void 0?r:{},i=b({},n);if(t===void 0)return i;var o={};return Object.keys(t).forEach(function(a){Object.values(Ee).includes(a)||(o[a]=t[a])}),ga.forEach(function(a){if(Object.keys(t).includes(a)){var s=t[a];
3switch(a){case Ee.CLEAR_ALL:Object.keys(i).forEach(function(l){delete i[l]});break;case Ee.UNSET:Object.keys(s).forEach(function(l){delete i[l]});break;case Ee.SET:Object.assign(i,s);break}}}),Object.assign(i,o),i},e.prototype.process=function(t){return T(this,void 0,void 0,function(){var r,o,n,i,o;return y(this,function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),this.config.optOut?[2,Fe(t,0,_a)]:(r=t.event_type,typeof r!="string"||r.trim().length===0?(this.config.loggerProvider.error(ai),[2,Fe(t,0,ai)]):(t.event_type===se.IDENTIFY&&this.timeline.onIdentityChanged({userProperties:this.userProperties}),[4,this.timeline.push(t)]));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=Fe(t,0,i),[2,o];case 3:return[2]}})})},e.prototype.setOptOut=function(t){if(!this.isReady){this.q.push(this._setOptOut.bind(this,!!t));return}this._setOptOut(t)},e.prototype._setOptOut=function(t){this.config.optOut!==t&&(this.config.optOut=!!t,this.timeline.onOptOutChanged(t))},e.prototype.flush=function(){return le(this.timeline.flush())},e.prototype.plugin=function(t){var r=this.timeline.plugins.find(function(n){return n.name===t});if(r===void 0){this.config.loggerProvider.debug("Cannot find plugin with name ".concat(t));return}return r},e.prototype.plugins=function(t){return this.timeline.plugins.filter(function(r){return r instanceof t})},e})();var Or=(function(){function e(){this.productId="",this.quantity=1,this.price=0}return e.prototype.setProductId=function(t){return this.productId=t,this},e.prototype.setQuantity=function(t){return t>0&&(this.quantity=t),this},e.prototype.setPrice=function(t){return this.price=t,this},e.prototype.setRevenueType=function(t){return this.revenueType=t,this},e.prototype.setCurrency=function(t){return this.currency=t,this},e.prototype.setRevenue=function(t){return this.revenue=t,this},e.prototype.setReceipt=function(t){return this.receipt=t,this},e.prototype.setReceiptSig=function(t){return this.receiptSig=t,this},e.prototype.setEventProperties=function(t){try{var r=JSON.parse(JSON.stringify(t));Lr(r)&&(this.properties=r)}catch{}return this},e.prototype.getEventProperties=function(){var t=this.properties?b({},this.properties):{};return t[be.REVENUE_PRODUCT_ID]=this.productId,t[be.REVENUE_QUANTITY]=this.quantity,t[be.REVENUE_PRICE]=this.price,t[be.REVENUE_TYPE]=this.revenueType,t[be.REVENUE_CURRENCY]=this.currency,t[be.REVENUE]=this.revenue,t[be.RECEIPT]=this.receipt,t[be.RECEIPT_SIG]=this.receiptSig,t},e})();var be;(function(e){e.REVENUE_PRODUCT_ID="$productId",e.REVENUE_QUANTITY="$quantity",e.REVENUE_PRICE="$price",e.REVENUE_TYPE="$revenueType",e.REVENUE_CURRENCY="$currency",e.REVENUE="$revenue",e.RECEIPT="$receipt",e.RECEIPT_SIG="$receiptSig"})(be||(be={}));var ka=function(e,t){var r=Math.max(t,1);return e.reduce(function(n,i,o){var a=Math.floor(o/r);return n[a]||(n[a]=[]),n[a].push(i),n},[])};var re;(function(e){e[e.None=0]="None",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Verbose=3]="Verbose",e[e.Debug=4]="Debug"})(re||(re={}));var kr="Amplitude Logger ",ot=(function(){function e(){this.logLevel=re.None}return e.prototype.disable=function(){this.logLevel=re.None},e.prototype.enable=function(t){t===void 0&&(t=re.Warn),this.logLevel=t},e.prototype.log=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<re.Verbose||console.log("".concat(kr,"[Log]: ").concat(t.join(" ")))},e.prototype.warn=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<re.Warn||console.warn("".concat(kr,"[Warn]: ").concat(t.join(" ")))},e.prototype.error=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<re.Error||console.error("".concat(kr,"[Error]: ").concat(t.join(" ")))},e.prototype.debug=function(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];this.logLevel<re.Debug||console.log("".concat(kr,"[Debug]: ").concat(t.join(" ")))},e})();var Dr=function(e){return e===void 0||e===""?wr:e};var Nr=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:wr,logLevel:re.Warn,loggerProvider:new ot,offline:!1,optOut:!1,serverUrl:Ht,serverZone:"US",useBatch:!1}},ci=(function(){function e(t){var r,n,i,o;this._optOut=!1;
3var a=Nr();this.apiKey=t.apiKey,this.flushIntervalMillis=(r=t.flushIntervalMillis)!==null&&r!==void 0?r:a.flushIntervalMillis,this.flushMaxRetries=t.flushMaxRetries||a.flushMaxRetries,this.flushQueueSize=t.flushQueueSize||a.flushQueueSize,this.instanceName=Dr(t.instanceName),this.loggerProvider=t.loggerProvider||a.loggerProvider,this.logLevel=(n=t.logLevel)!==null&&n!==void 0?n:a.logLevel,this.minIdLength=t.minIdLength,this.plan=t.plan,this.ingestionMetadata=t.ingestionMetadata,this.offline=t.offline!==void 0?t.offline:a.offline,this.optOut=(i=t.optOut)!==null&&i!==void 0?i:a.optOut,this.serverUrl=t.serverUrl,this.serverZone=t.serverZone||a.serverZone,this.storageProvider=t.storageProvider,this.transportProvider=t.transportProvider,this.useBatch=(o=t.useBatch)!==null&&o!==void 0?o:a.useBatch,this.loggerProvider.enable(this.logLevel);var s=di(t.serverUrl,t.serverZone,t.useBatch);this.serverZone=s.serverZone,this.serverUrl=s.serverUrl}return Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(t){this._optOut=t},enumerable:!1,configurable:!0}),e})();var Pc=function(e,t){return e==="EU"?t?Rr:Pr:t?Cr:Ht},di=function(e,t,r){if(e===void 0&&(e=""),t===void 0&&(t=Nr().serverZone),r===void 0&&(r=Nr().useBatch),e)return{serverUrl:e,serverZone:void 0};var n=["US","EU"].includes(t)?t:Nr().serverZone;return{serverZone:n,serverUrl:Pc(n,r)}},fi=(function(){function e(){this.sdk={metrics:{histogram:{}}}}return e.prototype.recordHistogram=function(t,r){this.sdk.metrics.histogram[t]=r},e})();function Bt(e){return e>=200&&e<300}var Wt=function(e){e===void 0&&(e=0);var t=new Error().stack||"";return t.split(`
4`).slice(2+e).map(function(r){return r.trim()})},Y=function(e){return function(){var t=b({},e.config),r=t.loggerProvider,n=t.logLevel;return{logger:r,logLevel:n}}},Cc=function(e,t){var r,n;t=t.replace(/\[(\w+)\]/g,".$1"),t=t.replace(/^\./,"");try{for(var i=P(t.split(".")),o=i.next();!o.done;o=i.next()){var a=o.value;if(a in e)e=e[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 e},$=function(e,t){return function(){var r,n,i={};try{for(var o=P(t),a=o.next();!a.done;a=o.next()){var s=a.value;i[s]=Cc(e,s)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}},J=function(e,t,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(),l=s.logger,u=s.logLevel;if(u&&u<re.Debug||!u||!l)return e.apply(i,o);var c={type:"invoke public method",name:t,args:o,stacktrace:Wt(1),time:{start:new Date().toISOString()},states:{}};n&&c.states&&(c.states.before=n());var d=e.apply(i,o);return d&&d.promise?d.promise.then(function(){n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))}):(n&&c.states&&(c.states.after=n()),c.time&&(c.time.end=new Date().toISOString()),l.debug(JSON.stringify(c,null,2))),d}};var Rc=new Set([Ht,Pr,Cr,Rr]),Lc=function(e,t){return t===void 0&&(t=!1),Rc.has(e)?!0:t};function Oc(e){return e instanceof Error?e.message:String(e)}function qt(e){var t="";try{"body"in e&&(t=JSON.stringify(e.body,null,2))}catch{}return t}var vi=(function(){function e(t){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=t?.diagnosticsClient}return e.prototype.setup=function(t){var r;return T(this,void 0,void 0,function(){var n,i=this;return y(this,function(o){switch(o.label){case 0:return this.config=t,this.storageKey="".concat(la,"_").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)]}})})},e.prototype.execute=function(t){var r=this;return t.insert_id||(t.insert_id=ne()),new Promise(function(n){var i={event:t,attempts:0,callback:function(o){return n(o)},timeout:0};r.queue.push(i),r.schedule(r.config.flushIntervalMillis),r.saveEvents()})}
4,e.prototype.removeEventsExceedFlushMaxRetries=function(t){var r=this;return t.filter(function(n){return n.attempts+=1,n.attempts<r.config.flushMaxRetries?!0:(r.fulfillRequest([n],500,ba),!1)})},e.prototype.scheduleEvents=function(t){var r=this;t.forEach(function(n){r.schedule(n.timeout===0?r.config.flushIntervalMillis:n.timeout)})},e.prototype.schedule=function(t){var r=this;if(!this.config.offline&&(this.scheduleId===null||this.scheduleId&&t>this.scheduledTimeout)){this.scheduleId&&clearTimeout(this.scheduleId),this.scheduledTimeout=t,this.scheduleId=setTimeout(function(){r.queue=r.queue.map(function(n){return n.timeout=0,n}),r.flush(!0)},t);return}},e.prototype.resetSchedule=function(){this.scheduleId=null,this.scheduledTimeout=0},e.prototype.flush=function(t){return t===void 0&&(t=!1),T(this,void 0,void 0,function(){var r,n,i,o=this;return y(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=ka(r,this.config.flushQueueSize),[4,i.reduce(function(s,l){return T(o,void 0,void 0,function(){return y(this,function(u){switch(u.label){case 0:return[4,s];case 1:return u.sent(),[4,this.send(l,t)];case 2:return[2,u.sent()]}})})},Promise.resolve())]);case 1:return a.sent(),this.flushId=null,this.scheduleEvents(this.queue),[2]}})})},e.prototype.send=function(t,r){var n;return r===void 0&&(r=!0),T(this,void 0,void 0,function(){var i,o,a,s,l,u;return y(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(t,400,ya)];i={api_key:this.config.apiKey,events:t.map(function(d){var f=d.event,v=f.extra,p=nt(f,["extra"]);return p}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString(),request_metadata:this.config.requestMetadata},this.config.requestMetadata=new fi,c.label=1;case 1:return c.trys.push([1,3,,4]),o=di(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,a=Lc(o,this.config.enableRequestBodyCompression),[4,this.config.transportProvider.send(o,i,a)];case 2:return s=c.sent(),s===null?(this.fulfillRequest(t,0,Ea),[2]):r?(this.handleResponse(s,t),[3,4]):("body"in s?this.fulfillRequest(t,s.statusCode,"".concat(s.status,": ").concat(qt(s))):this.fulfillRequest(t,s.statusCode,s.status),[2]);case 3:return l=c.sent(),u=Oc(l),this.config.loggerProvider.error(u),(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful.from.catch.error",{events:t.map(function(d){return d.event.event_type}),message:u,stack_trace:Wt()}),this.handleResponse({status:te.Failed,statusCode:0},t),[3,4];case 4:return[2]}})})},e.prototype.handleResponse=function(t,r){var n;Bt(t.statusCode)||(n=this.diagnosticsClient)===null||n===void 0||n.recordEvent("analytics.events.unsuccessful",{events:r.map(function(o){return o.event.event_type}),code:t.statusCode,status:t.status,body:qt(t),stack_trace:Wt()});var i=t.status;switch(i){case te.Success:{this.handleSuccessResponse(t,r);break}case te.Invalid:{this.handleInvalidResponse(t,r);break}case te.PayloadTooLarge:{this.handlePayloadTooLargeResponse(t,r);break}case te.RateLimit:{this.handleRateLimitResponse(t,r);break}default:{this.config.loggerProvider.warn(`{code: 0, error: "Status '`.concat(i,"' provided for ").concat(r.length,' events"}')),this.handleOtherResponse(r);break}}},e.prototype.handleSuccessResponse=function(t,r){this.fulfillRequest(r,t.statusCode,ma)},e.prototype.handleInvalidResponse=function(t,r){var n=this;if(t.body.missingField||t.body.error.startsWith(Ta)){this.fulfillRequest(r,t.statusCode,t.body.error);return}var i=N(N(N(N([],w(Object.values(t.body.eventsWithInvalidFields)),!1),w(Object.values(t.body.eventsWithMissingFields)),!1),w(Object.values(t.body.eventsWithInvalidIdLengths)),!1),w(t.body.silencedEvents),!1).flat(),o=new Set(i),a=r.filter(function(l,u){if(o.has(u)){n.fulfillRequest([l],t.statusCode,t.body.error);return}return!0});a.length>0&&this.config.loggerProvider.warn(qt(t));
4var s=this.removeEventsExceedFlushMaxRetries(a);this.scheduleEvents(s)},e.prototype.handlePayloadTooLargeResponse=function(t,r){if(r.length===1){this.fulfillRequest(r,t.statusCode,t.body.error);return}this.config.loggerProvider.warn(qt(t)),this.config.flushQueueSize/=2;var n=this.removeEventsExceedFlushMaxRetries(r);this.scheduleEvents(n)},e.prototype.handleRateLimitResponse=function(t,r){var n=this,i=Object.keys(t.body.exceededDailyQuotaUsers),o=Object.keys(t.body.exceededDailyQuotaDevices),a=t.body.throttledEvents,s=new Set(i),l=new Set(o),u=new Set(a),c=r.filter(function(f,v){if(f.event.user_id&&s.has(f.event.user_id)||f.event.device_id&&l.has(f.event.device_id)){n.fulfillRequest([f],t.statusCode,t.body.error);return}return u.has(v)&&(f.timeout=n.throttleTimeout),!0});c.length>0&&this.config.loggerProvider.warn(qt(t));var d=this.removeEventsExceedFlushMaxRetries(c);this.scheduleEvents(d)},e.prototype.handleOtherResponse=function(t){var r=this,n=t.map(function(o){return o.timeout=o.attempts*r.retryTimeout,o}),i=this.removeEventsExceedFlushMaxRetries(n);this.scheduleEvents(i)},e.prototype.fulfillRequest=function(t,r,n){var i,o,a;Bt(r)?(a=this.diagnosticsClient)===null||a===void 0||a.increment("analytics.events.sent",t.length):((i=this.diagnosticsClient)===null||i===void 0||i.increment("analytics.events.dropped",t.length),(o=this.diagnosticsClient)===null||o===void 0||o.recordEvent("analytics.events.dropped",{events:t.map(function(s){return s.event.event_type}),code:r,message:n,stack_trace:Wt()})),this.removeEvents(t),t.forEach(function(s){return s.callback(Fe(s.event,r,n))})},e.prototype.saveEvents=function(){if(this.config.storageProvider){var t=this.queue.map(function(r){return r.event});this.config.storageProvider.set(this.storageKey,t)}},e.prototype.removeEvents=function(t){this.queue=this.queue.filter(function(r){return!t.some(function(n){return n.event.insert_id===r.event.insert_id})}),this.saveEvents()},e})();var kc=(function(){function e(){}return e.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:Dc(),platform:"Web",os:void 0,deviceModel:void 0}},e})(),Dc=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Nc=(function(){function e(){this.queue=[]}return e.prototype.logEvent=function(t){this.receiver?this.receiver(t):this.queue.length<512&&this.queue.push(t)},e.prototype.setEventReceiver=function(t){this.receiver=t,this.queue.length>0&&(this.queue.forEach(function(r){t(r)}),this.queue=[])},e})(),je=function(){return je=Object.assign||function(t){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)&&(t[o]=r[o])}return t},je.apply(this,arguments)};function Mr(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Da(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],a;try{for(;(t===void 0||t-- >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 Ur=function(e,t){var r,n,i=["string","number","boolean","undefined"],o=typeof e,a=typeof t;if(o!==a)return!1;try{for(var s=Mr(i),l=s.next();!l.done;l=s.next()){var u=l.value;if(u===o)return e===t}}catch(g){r={error:g}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}if(e==null&&t==null)return!0;if(e==null||t==null||e.length!==t.length)return!1;var c=Array.isArray(e),d=Array.isArray(t);if(c!==d)return!1;if(c&&d){for(var f=0;f<e.length;f++)if(!Ur(e[f],t[f]))return!1}else{var v=Object.keys(e).sort(),p=Object.keys(t).sort();if(!Ur(v,p))return!1;var h=!0;return Object.keys(e).forEach(function(g){Ur(e[g],t[g])||(h=!1)}),h}return!0},Mc="$set",Uc="$unset",Fc="$clearAll";Object.entries||(Object.entries=function(e){for(var t=Object.keys(e),r=t.length,n=new Array(r);r--;)n[r]=[t[r],e[t[r]]];return n});var Vc=(function(){function e(){this.identity={userProperties:{}},this.listeners=new Set}return e.prototype.editIdentity=function(){var t=this,r=je({},this.identity.userProperties),n=je(je({},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,l,u,c,d=n.userProperties||{};try{for(var f=Mr(Object.entries(i)),v=f.next();!v.done;v=f.next()){var p=Da(v.value,2),h=p[0],g=p[1];switch(h){case Mc:try{for(var m=(s=void 0,Mr(Object.entries(g))),E=m.next();!E.done;E=m.next()){var _=Da(E.value,2),S=_[0],I=_[1];d[S]=I}}catch(R){s={error:R}}finally{try{E&&!E.done&&(l=m.return)&&l.call(m)}finally{if(s)throw s.error}}break;case Uc:try{for(var A=(u=void 0,Mr(Object.keys(g))),x=A.next();!x.done;x=A.next()){var S=x.value;delete d[S]}}catch(R){u={error:R}}finally{try{x&&!x.done&&(c=A.return)&&c.call(A)}finally{if(u)throw u.error}}break;case Fc:d={};break}}}catch(R){o={error:R}}finally{try{v&&!v.done&&(a=f.return)&&a.call(f)}finally{if(o)throw o.error}}return n.userProperties=d,this},commit:function(){return t.setIdentity(n),this}}},e.prototype.getIdentity=function(){return je({},this.identity)},e.prototype.setIdentity=function(t){var r=je({},this.identity);this.identity=je({}
4,t),Ur(r,this.identity)||this.listeners.forEach(function(n){n(t)})},e.prototype.addIdentityListener=function(t){this.listeners.add(t)},e.prototype.removeIdentityListener=function(t){this.listeners.delete(t)},e})(),Kt=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Na=(function(){function e(){this.identityStore=new Vc,this.eventBridge=new Nc,this.applicationContextProvider=new kc}return e.getInstance=function(t){return Kt.analyticsConnectorInstances||(Kt.analyticsConnectorInstances={}),Kt.analyticsConnectorInstances[t]||(Kt.analyticsConnectorInstances[t]=new e),Kt.analyticsConnectorInstances[t]},e})();var ze=function(e){return Na.getInstance(Dr(e))},pi=function(e,t){ze(t).identityStore.editIdentity().setUserId(e).commit()},hi=function(e,t){ze(t).identityStore.editIdentity().setDeviceId(e).commit()};var gi=(function(){function e(){this.name="identity",this.type="before",this.identityStore=ze().identityStore}return e.prototype.execute=function(t){return T(this,void 0,void 0,function(){var r;return y(this,function(n){return r=t.user_properties,r&&this.identityStore.editIdentity().updateUserProperties(r).commit(),[2,t]})})},e.prototype.setup=function(t){return T(this,void 0,void 0,function(){return y(this,function(r){return t.instanceName&&(this.identityStore=ze(t.instanceName).identityStore),[2]})})},e})();var Xt=function(e,t){t===void 0&&(t=Date.now());var r=Date.now(),n=r-t;return n>e};var Fr=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[yt,t,e.substring(0,r)].filter(Boolean).join("_")},mi=function(e){return"".concat(yt.toLowerCase(),"_").concat(e.substring(0,6))};var Ei=function(){var e,t,r,n;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(n=(r=(t=(e=navigator.languages)===null||e===void 0?void 0:e[0])!==null&&t!==void 0?t:navigator.language)!==null&&r!==void 0?r:i)!==null&&n!==void 0?n:""};var Ye=function(){var e,t=C();if(!(!((e=t?.location)===null||e===void 0)&&e.search))return{};var r=t.location.search.substring(1).split("&").filter(Boolean),n=r.reduce(function(i,o){var a=o.split("=",2),s=Ma(a[0]),l=Ma(a[1]);return l&&(i[s]=l),i},{});return n},Ma=function(e){e===void 0&&(e="");try{return decodeURIComponent(e)}catch{return""}};var Tt=function(e,t){return!t||!t.length?!0:t.some(function(r){return typeof r=="string"?e===r:e.match(r)})},ie=function(e,t){var r=e;try{r=decodeURI(e)}catch(n){t?.error("Malformed URI sequence: ",n)}return r};var Gc=function(e){var t=0;if(e.length===0)return t;for(var r=0;r<e.length;r++){var n=e.charCodeAt(r);t=(t<<5)-t+n,t|=0}return t};var bi=function(e,t){var r=Gc(e.toString()),n=Math.abs(r),i=n*31,o=i%1e5;return o/1e5<t};var jt=function(e){var t={};for(var r in e){var n=e[r];n&&(t[r]=n)}return t};var zt=(function(){function e(){this.memoryStorage=new Map}return e.prototype.isEnabled=function(){return T(this,void 0,void 0,function(){return y(this,function(t){return[2,!0]})})},e.prototype.get=function(t){return T(this,void 0,void 0,function(){return y(this,function(r){return[2,this.memoryStorage.get(t)]})})},e.prototype.getRaw=function(t){return T(this,void 0,void 0,function(){var r;return y(this,function(n){switch(n.label){case 0:return[4,this.get(t)];case 1:return r=n.sent(),[2,r?JSON.stringify(r):void 0]}})})},e.prototype.set=function(t,r){return T(this,void 0,void 0,function(){return y(this,function(n){return this.memoryStorage.set(t,r),[2]})})},e.prototype.remove=function(t){return T(this,void 0,void 0,function(){return y(this,function(r){return this.memoryStorage.delete(t),[2]})})},e.prototype.reset=function(){return T(this,void 0,void 0,function(){return y(this,function(t){return this.memoryStorage.clear(),[2]})})},e})();var Hc=function(){var e,t=C();return(e=t?.navigator)===null||e===void 0?void 0:e.locks},St=(function(){function e(t,r){r===void 0&&(r={}),this.options=b({},t),this.config=r}return e.prototype.isEnabled=function(){return T(this,void 0,void 0,function(){var t,r,n,i,o=this;return y(this,function(a){switch(a.label){case 0:return t="AMP_TEST",r=b({},this.options),n=new e(r),i=String(Date.now()),[4,n.transaction(t,function(s){var l,u;try{s.set(i);var c=s.get(),d=c===i;return!d&&o.config.diagnosticsClient&&((l=o.config.diagnosticsClient)===null||l===void 0||l.recordEvent("cookies.isEnabled.failure",{reason:"Test Value mismatch",testKey:t,testValue:i,sync:!0})),d}catch(v){if(o.config.diagnosticsClient){var f=v instanceof Error?v.message:String(v);(u=o.config.diagnosticsClient)===null||u===void 0||u.recordEvent("cookies.isEnabled.failure",{reason:"Cookie getter/setter failed",testKey:t,testValue:i,error:f,sync:!0})}return!1}finally{s.set(null)}})];case 1:return[2,a.sent()]}})})},e.prototype.get=function(t){return T(this,void 0,void 0,function(){var r;return y(this,function(n){switch(n.label){case 0:return[4,this.getRaw(t)];case 1:return r=n.sent(),[2,this.decodeCookieValue(t,r)]}})})},e.prototype.decodeCookieValue=function(t,r){if(r)try{var n=Vr(r);if(n===void 0){console.error("Amplitude Logger [Error]: Failed to decode cookie value for key: ".concat(t,", value: ").concat(r));return}return JSON.parse(n)}catch{console.error("Amplitude Logger [Error]: Failed to parse cookie value for key: ".concat(t,", value: ").concat(r));return}},e.prototype.getSync=function(t){var r=this.getRawSync(t);return this.decodeCookieValue(t,r)},e.prototype.getRaw=function(t){var r,n;return T(this,void 0,void 0,function(){var i,o,a,s,l,u,c,d,f,v;return y(this,function(p){switch(p.label){case 0:i=C(),o=i,p.label=1;
4case 1:return p.trys.push([1,4,,5]),a=o?.cookieStore,a?[4,a.getAll(t)]:[3,3];case 2:if(s=p.sent(),s){s.length>1&&((r=this.config.diagnosticsClient)===null||r===void 0||r.recordEvent("cookies.duplicate",{cookies:s.map(function(h){return h.domain})}),(n=this.config.diagnosticsClient)===null||n===void 0||n.increment("cookies.duplicate.occurrence.cookieStore"));try{for(l=P(s),u=l.next();!u.done;u=l.next())if(c=u.value,Gr(c.domain,this.options.domain))return[2,c.value]}catch(h){f={error:h}}finally{try{u&&!u.done&&(v=l.return)&&v.call(l)}finally{if(f)throw f.error}}}p.label=3;case 3:return[3,5];case 4:return d=p.sent(),[3,5];case 5:return[2,this.getRawSync(t)]}})})},e.prototype.getRawSync=function(t){var r=this,n,i,o=C(),a=((i=(n=o?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&i!==void 0?i:[]).filter(function(u){return u.indexOf(t+"=")===0}),s=void 0,l=this.config.duplicateResolverFn;if(typeof l=="function"&&a.length>1&&(s=a.find(function(u){var c;try{var d=l(u.substring(t.length+1));return d||(c=r.config.diagnosticsClient)===null||c===void 0||c.increment("cookies.duplicate.occurrence.document.cookie"),d}catch{return!1}})),s||(s=a[0]),!!s)return s.substring(t.length+1)},e.prototype.set=function(t,r){return T(this,void 0,void 0,function(){return y(this,function(n){return this.setSync(t,r),[2]})})},e.prototype.setSync=function(t,r){var n;try{var i=C();if(!i||!i.document||typeof i.btoa!="function"||typeof i.encodeURIComponent!="function")return;var o=(n=this.options.expirationDays)!==null&&n!==void 0?n:0,a=r!==null?o:-1,s=void 0;if(a){var l=new Date;l.setTime(l.getTime()+a*24*60*60*1e3),s=l}var u="".concat(t,"=").concat(i.btoa(i.encodeURIComponent(JSON.stringify(r))));s&&(u+="; expires=".concat(s.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)),i.document.cookie=u}catch(d){var c=d instanceof Error?d.message:String(d);console.error("Amplitude Logger [Error]: Failed to set cookie for key: ".concat(t,". Error: ").concat(c))}},e.prototype.remove=function(t){return T(this,void 0,void 0,function(){return y(this,function(r){switch(r.label){case 0:return[4,this.set(t,null)];case 1:return r.sent(),[2]}})})},e.prototype.reset=function(){return T(this,void 0,void 0,function(){return y(this,function(t){return[2]})})},e.isDomainWritable=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a;return y(this,function(s){switch(s.label){case 0:if(e.cachedTlds[t])return[2,!0];r={domain:"."+t},n="AMP_TLDTEST",i=new e(r),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.transaction(n,function(l){if(e.cachedTlds[t])return!0;try{l.set(1);var u=!!l.get();return u&&(e.cachedTlds[t]=!0),u}finally{l.set(null)}})];case 2:return o=s.sent(),[2,!!o];case 3:return a=s.sent(),[2,!1];case 4:return[2]}})})},e.prototype.transaction=function(t,r){return T(this,void 0,void 0,function(){var n,i,o,a=this;return y(this,function(s){switch(s.label){case 0:if(n=Hc(),i=function(){var l={get:function(){return a.getSync(t)},set:function(u){return a.setSync(t,u)}};return r(l)},!n)return[2,i()];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.request("com.amplitude:cookie-lock:".concat(t),i)];case 2:return[2,s.sent()];case 3:return o=s.sent(),[2,i()];case 4:return[2]}})})},e.cachedTlds={},e})();var Bc=function(e){try{return decodeURIComponent(atob(e))}catch{return}},Wc=function(e){try{return decodeURIComponent(atob(decodeURIComponent(e)))}catch{return}},Vr=function(e){var t;return(t=Bc(e))!==null&&t!==void 0?t:Wc(e)},Gr=function(e,t){if(e===""&&t==="")return!0;if(!e||!t)return!1;var r=e.startsWith(".")?e.substring(1):e,n=t.startsWith(".")?t.substring(1):t;return r.toLowerCase()===n.toLowerCase()};var Hr=function(e,t,r){return t===void 0&&(t=""),r===void 0&&(r=10),[yt,t,e.substring(0,r)].filter(Boolean).join("_")};var qe=(function(){function e(t){this.storage=t}return e.prototype.isEnabled=function(){return T(this,void 0,void 0,function(){var t,r,n,i,o;return y(this,function(a){switch(a.label){case 0:if(!this.storage)return[2,!1];t=String(Date.now()),r=new e(this.storage),n="AMP_TEST",a.label=1;case 1:return a.trys.push([1,4,5,7]),[4,r.set(n,t)];case 2:return a.sent(),[4,r.get(n)];case 3:return i=a.sent(),[2,i===t];case 4:return o=a.sent(),[2,!1];case 5:return[4,r.remove(n)];case 6:return a.sent(),[7];case 7:return[2]}})})},e.prototype.get=function(t){return T(this,void 0,void 0,function(){var r,n;return y(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(t)];case 1:return r=i.sent(),r?[2,JSON.parse(r)]:[2,void 0];case 2:return n=i.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},e.prototype.getRaw=function(t){var r;return T(this,void 0,void 0,function(){return y(this,function(n){return[2,((r=this.storage)===null||r===void 0?void 0:r.getItem(t))||void 0]})})},e.prototype.set=function(t,r){var n;return T(this,void 0,void 0,function(){return y(this,function(i){try{(n=this.storage)===null||n===void 0||n.setItem(t,JSON.stringify(r))}catch{}return[2]})})},e.prototype.remove=function(t){var r;return T(this,void 0,void 0,function(){return y(this,function(n){try{(r=this.storage)===null||r===void 0||r.removeItem(t)}catch{}return[2]})})},e.prototype.reset=function(){var t;return T(this,void 0,void 0,function(){return y(this,function(r){try{(t=this.storage)===null||t===void 0||t.clear()}catch{}return[2]})})},e})();var qc=10,Kc=1,q={TAGS:"tags",COUNTERS:"counters",HISTOGRAMS:"histograms",EVENTS:"events",INTERNAL:"internal"},Ua={LAST_FLUSH_TIMESTAMP:"last_flush_timestamp"},_i=(function(){function e(t,r){this.dbPromise=null,this.logger=r,this.dbName="AMP_diagnostics_".concat(t.substring(0,10))}return e.isSupported=function(){var t;return((t=C())===null||t===void 0?void 0:t.indexedDB)!==void 0},e.prototype.getDB=function(){return T(this,void 0,void 0,function(){return y(this,function(t){return this.dbPromise||(this.dbPromise=this.openDB()),[2,this.dbPromise]})})},e.prototype.openDB=function(){var t=this;return new Promise(function(r,n){var i=indexedDB.open(t.dbName,Kc);i.onerror=function(){t.dbPromise=null,n(new Error("Failed to open IndexedDB"))},i.onsuccess=function(){var o=i.result;
4o.onclose=function(){t.dbPromise=null,t.logger.debug("DiagnosticsStorage: DB connection closed.")},o.onerror=function(a){t.logger.debug("DiagnosticsStorage: A global database error occurred.",a),o.close()},r(o)},i.onupgradeneeded=function(){var o=i.result;if(!o){t.logger.debug("DiagnosticsStorage: Missing DB during upgrade.");return}t.createTables(o)}})},e.prototype.createTables=function(t){if(t.objectStoreNames.contains(q.TAGS)||t.createObjectStore(q.TAGS,{keyPath:"key"}),t.objectStoreNames.contains(q.COUNTERS)||t.createObjectStore(q.COUNTERS,{keyPath:"key"}),t.objectStoreNames.contains(q.HISTOGRAMS)||t.createObjectStore(q.HISTOGRAMS,{keyPath:"key"}),!t.objectStoreNames.contains(q.EVENTS)){var r=t.createObjectStore(q.EVENTS,{keyPath:"id",autoIncrement:!0});r.createIndex("time_idx","time",{unique:!1})}t.objectStoreNames.contains(q.INTERNAL)||t.createObjectStore(q.INTERNAL,{keyPath:"key"})},e.prototype.setTags=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a=this;return y(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(t).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([q.TAGS],"readwrite"),i=n.objectStore(q.TAGS),[2,new Promise(function(l){var u=Object.entries(t);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set tags",c),l()},u.forEach(function(c){var d=w(c,2),f=d[0],v=d[1],p=i.put({key:f,value:v});p.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to set tag",f,v,h)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set tags",o),[3,3];case 3:return[2]}})})},e.prototype.incrementCounters=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a=this;return y(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(t).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([q.COUNTERS],"readwrite"),i=n.objectStore(q.COUNTERS),[2,new Promise(function(l){var u=Object.entries(t);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to increment counters",c),l()},u.forEach(function(c){var d=w(c,2),f=d[0],v=d[1],p=i.get(f);p.onsuccess=function(){var h=p.result,g=h?h.value:0,m=i.put({key:f,value:g+v});m.onerror=function(E){a.logger.debug("DiagnosticsStorage: Failed to update counter",f,E)}},p.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to read existing counter",f,h)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to increment counters",o),[3,3];case 3:return[2]}})})},e.prototype.setHistogramStats=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a=this;return y(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),Object.entries(t).length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([q.HISTOGRAMS],"readwrite"),i=n.objectStore(q.HISTOGRAMS),[2,new Promise(function(l){var u=Object.entries(t);n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",c),l()},u.forEach(function(c){var d=w(c,2),f=d[0],v=d[1],p=i.get(f);p.onsuccess=function(){var h=p.result,g;h?g={key:f,count:h.count+v.count,min:Math.min(h.min,v.min),max:Math.max(h.max,v.max),sum:h.sum+v.sum}:g={key:f,count:v.count,min:v.min,max:v.max,sum:v.sum};var m=i.put(g);m.onerror=function(E){a.logger.debug("DiagnosticsStorage: Failed to set histogram stats",f,E)}},p.onerror=function(h){a.logger.debug("DiagnosticsStorage: Failed to read existing histogram stats",f,h)}})})];case 2:return o=s.sent(),this.logger.debug("DiagnosticsStorage: Failed to set histogram stats",o),[3,3];case 3:return[2]}})})},e.prototype.addEventRecords=function(t){return T(this,void 0,void 0,function(){var r,n,i,o,a=this;return y(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),t.length===0?[2]:[4,this.getDB()];case 1:return r=s.sent(),n=r.transaction([q.EVENTS],"readwrite"),i=n.objectStore(q.EVENTS),[2,new Promise(function(l){n.oncomplete=function(){l()},n.onabort=function(c){a.logger.debug("DiagnosticsStorage: Failed to add event records",c),l()};var u=i.count();u.onsuccess=function(){var c=u.result,d=Math.max(0,qc-c);d<t.length&&a.logger.debug("DiagnosticsStorage: Only added ".concat(d," of ").concat(t.length," events due to storage limit")),t.slice(0,d).forEac
4h(function(f){var v=i.add(f);v.onerror=function(p){a.logger.debug("DiagnosticsStorage: Failed to add event record",p)}})},u.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]}})})},e.prototype.setInternal=function(t,r){return T(this,void 0,void 0,function(){var n,i,o,a;return y(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([q.INTERNAL],"readwrite"),o=i.objectStore(q.INTERNAL),[2,new Promise(function(l,u){i.onabort=function(){return u(new Error("Failed to set internal value"))};var c=o.put({key:t,value:r});c.onsuccess=function(){return l()},c.onerror=function(){return u(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]}})})},e.prototype.getInternal=function(t){return T(this,void 0,void 0,function(){var r,n,i,o;return y(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([q.INTERNAL],"readonly"),i=n.objectStore(q.INTERNAL),[2,new Promise(function(s,l){n.onabort=function(){return l(new Error("Failed to get internal value"))};var u=i.get(t);u.onsuccess=function(){return s(u.result)},u.onerror=function(){return l(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]}})})},e.prototype.getLastFlushTimestamp=function(){return T(this,void 0,void 0,function(){var t,r;return y(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.getInternal(Ua.LAST_FLUSH_TIMESTAMP)];case 1:return t=n.sent(),[2,t?parseInt(t.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]}})})},e.prototype.setLastFlushTimestamp=function(t){return T(this,void 0,void 0,function(){var r;return y(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.setInternal(Ua.LAST_FLUSH_TIMESTAMP,t.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]}})})},e.prototype.clearTable=function(t,r){return new Promise(function(n,i){var o=t.objectStore(r),a=o.clear();a.onsuccess=function(){return n()},a.onerror=function(){return i(new Error("Failed to clear table ".concat(r)))}})},e.prototype.getAllAndClear=function(){return T(this,void 0,void 0,function(){var t,r,n,i,o,a,s,l;return y(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,5]),[4,this.getDB()];case 1:return t=u.sent(),r=t.transaction([q.TAGS,q.COUNTERS,q.HISTOGRAMS,q.EVENTS],"readwrite"),[4,Promise.all([this.getAllFromStore(r,q.TAGS),this.getAllFromStore(r,q.COUNTERS),this.getAllFromStore(r,q.HISTOGRAMS),this.getAllFromStore(r,q.EVENTS)])];case 2:return n=w.apply(void 0,[u.sent(),4]),i=n[0],o=n[1],a=n[2],s=n[3],[4,Promise.all([this.clearTable(r,q.COUNTERS),this.clearTable(r,q.HISTOGRAMS),this.clearTable(r,q.EVENTS)])];case 3:return u.sent(),[2,{tags:i,counters:o,histogramStats:a,events:s}];case 4:return l=u.sent(),this.logger.debug("DiagnosticsStorage: Failed to get all and clear data",l),[2,{tags:[],counters:[],histogramStats:[],events:[]}];case 5:return[2]}})})},e.prototype.getAllFromStore=function(t,r){return new Promise(function(n,i){var o=t.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)))}})},e})();var Xc="__AMPLITUDE_SCRIPT_URL__",jc="sdk.error.uncaught",zc=function(){var e=C();if(!e)return[];var t=e[Xc];return Array.isArray(t)?t:typeof t=="string"?[t]:[]};var Va=function(e){var t=C();if(!(!t||typeof t.addEventListener!="function")){var r=function(o){var a=o.error instanceof Error?o.error:void 0,s=a?.stack,l=Fa({filename:o.filename,stack:s});l&&i({type:"error",message:o.message,stack:s,filename:o.filename,errorName:a?.name,metadata:{colno:o.colno,lineno:o.lineno,isTrusted:o.isTrusted,matchReason:l}})},n=function(o){var a,s=o.reason instanceof Error?o.reason:void 0,l=s?.stack,u=Yc(l),c=
4Fa({filename:u,stack:l});c&&i({type:"unhandledrejection",message:(a=s?.message)!==null&&a!==void 0?a:$c(o.reason),stack:l,filename:u,errorName:s?.name,metadata:{isTrusted:o.isTrusted,matchReason:c}})},i=function(o){e.recordEvent(jc,b({type:o.type,message:o.message,filename:o.filename,error_name:o.errorName,stack:o.stack},o.metadata))};t.addEventListener("error",r,!0),t.addEventListener("unhandledrejection",n,!0)}},Fa=function(e){var t,r,n=zc();if(n.length!==0)try{for(var i=P(n),o=i.next();!o.done;o=i.next()){var a=o.value;if(e.filename&&e.filename.includes(a))return"filename";if(e.stack&&e.stack.includes(a))return"stack"}}catch(s){t={error:s}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}};var Yc=function(e){if(e){var t=e.match(/(https?:\/\/\S+?)(?=[)\s]|$)/);return t?t[1]:void 0}},$c=function(e){if(typeof e=="string")return e;try{return JSON.stringify(e)}catch{return"[object Object]"}};var Jc=1e3,Br=300*1e3,Qc="https://diagnostics.prod.us-west-2.amplitude.com/v1/capture",Zc="https://diagnostics.prod.eu-central-1.amplitude.com/v1/capture",yi=1e4,ed=10,Ti=(function(){function e(t,r,n,i,o){n===void 0&&(n="US"),this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},this.inMemoryEvents=[],this.saveTimer=null,this.flushTimer=null,this.apiKey=t,this.logger=r,this.serverUrl=n==="US"?Qc:Zc,this.logger.debug("DiagnosticsClient: Initializing with options",JSON.stringify(i,null,2)),this.config=b({enabled:!0,sampleRate:0},i),this.startTimestamp=Date.now(),this.shouldTrack=bi(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,o?this.storage=o:_i.isSupported()?this.storage=new _i(t,r):this.logger.debug("DiagnosticsClient: IndexedDB is not supported"),this.initializeFlushInterval(),this.shouldTrack&&(this.increment("sdk.diagnostics.sampled.in.and.enabled"),Va(this))}return e.prototype.isStorageAndTrackEnabled=function(){return!!this.storage&&!!this.shouldTrack},e.prototype.setTag=function(t,r){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryTags).length>=yi){this.logger.debug("DiagnosticsClient: Early return setTags as reaching memory limit");return}this.inMemoryTags[t]=r,this.startTimersIfNeeded()}},e.prototype.increment=function(t,r){if(r===void 0&&(r=1),!!this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryCounters).length>=yi){this.logger.debug("DiagnosticsClient: Early return increment as reaching memory limit");return}this.inMemoryCounters[t]=(this.inMemoryCounters[t]||0)+r,this.startTimersIfNeeded()}},e.prototype.recordHistogram=function(t,r){if(this.isStorageAndTrackEnabled()){if(Object.keys(this.inMemoryHistograms).length>=yi){this.logger.debug("DiagnosticsClient: Early return recordHistogram as reaching memory limit");return}var n=this.inMemoryHistograms[t];n?(n.count+=1,n.min=Math.min(n.min,r),n.max=Math.max(n.max,r),n.sum+=r):this.inMemoryHistograms[t]={count:1,min:r,max:r,sum:r},this.startTimersIfNeeded()}},e.prototype.recordEvent=function(t,r){if(this.isStorageAndTrackEnabled()){if(this.inMemoryEvents.length>=ed){this.logger.debug("DiagnosticsClient: Early return recordEvent as reaching memory limit");return}this.inMemoryEvents.push({event_name:t,time:Date.now(),event_properties:r}),this.startTimersIfNeeded()}},e.prototype.startTimersIfNeeded=function(){var t=this;this.saveTimer||(this.saveTimer=setTimeout(function(){t.saveAllDataToStorage().catch(function(r){t.logger.debug("DiagnosticsClient: Failed to save all data to storage",r)}).finally(function(){t.saveTimer=null})},Jc)),this.flushTimer||(this.flushTimer=setTimeout(function(){t._flush().catch(function(r){t.logger.debug("DiagnosticsClient: Failed to flush",r)}).finally(function(){t.flushTimer=null})},Br))},e.prototype.saveAllDataToStorage=function(){return T(this,void 0,void 0,function(){var t,r,n,i;return y(this,function(o){switch(o.label){case 0:return this.storage?(t=b({},this.inMemoryTags),r=b({},this.inMemoryCounters),n=b({},this.inMemoryHistograms),i=N([],w(this.inMemoryEvents),!1),this.inMemoryEvents=[],this.inMemoryTags={},this.inMemoryCounters={},this.inMemoryHistograms={},[4,Promise.all([this.storage.setTags(t),this.storage.incrementCounters(r),this.storage.setHistogramStats(n),this.storage.addEventRecords(i)])]):[2];case 1:return o.sent(),[2]}})})},e.prototype._flush=function(){return T(this,void 0,void 0,function(){var t,r,n,i,o,a,s,l,u,c;return y(this,function(d){switch(d.label){case 0:return this.storage?[4,this.saveAllDataToStorage()]:[2];case 1:return d.sent(),this.saveTimer=null,this.flushTimer=null,[4,this.storage.getAllAndClear()];case 2:return t=d.sent(),r=t.tags,n=t.counters,i=t.histogramStats,o=t.events,this.storage.setLastFlushTimestamp(Date.now()),a={},r.forEach(function(f){a[f.key]=f.value}),s={}
4,n.forEach(function(f){s[f.key]=f.value}),l={},i.forEach(function(f){l[f.key]={count:f.count,min:f.min,max:f.max,avg:Math.round(f.sum/f.count*100)/100}}),u=o.map(function(f){return{event_name:f.event_name,time:f.time,event_properties:f.event_properties}}),Object.keys(s).length===0&&Object.keys(l).length===0&&u.length===0?[2]:(c={tags:a,histogram:l,counters:s,events:u},this.fetch(c),[2])}})})},e.prototype.fetch=function(t){return T(this,void 0,void 0,function(){var r,n;return y(this,function(i){switch(i.label){case 0:if(i.trys.push([0,2,,3]),!C())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(t)})];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]}})})},e.prototype.initializeFlushInterval=function(){return T(this,void 0,void 0,function(){var t,r,n;return y(this,function(i){switch(i.label){case 0:return this.storage?(t=Date.now(),[4,this.storage.getLastFlushTimestamp()]):[2];case 1:return r=i.sent()||-1,r===-1?(this.storage.setLastFlushTimestamp(t),this._setFlushTimer(Br),[2]):(n=t-r,n>=Br?(this._flush(),[2]):(this._setFlushTimer(Br-n),[2]))}})})},e.prototype._setFlushTimer=function(t){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})},t)},e.prototype._setSampleRate=function(t){this.logger.debug("DiagnosticsClient: Setting sample rate to",t),this.config.sampleRate=t,this.shouldTrack=bi(this.startTimestamp,this.config.sampleRate)&&this.config.enabled,this.logger.debug("DiagnosticsClient: Should track is",this.shouldTrack)},e})();var at=(function(){function e(){}return e.prototype.send=function(t,r,n){return Promise.resolve(null)},e.prototype.buildResponse=function(t){var r,n,i,o,a,s,l,u,c,d,f,v,p,h,g,m,E,_,S,I,A,x;if(typeof t!="object")return null;var R=t.code||0,D=this.buildStatus(R);switch(D){case te.Success:return{status:D,statusCode:R,body:{eventsIngested:(r=t.events_ingested)!==null&&r!==void 0?r:0,payloadSizeBytes:(n=t.payload_size_bytes)!==null&&n!==void 0?n:0,serverUploadTime:(i=t.server_upload_time)!==null&&i!==void 0?i:0}};case te.Invalid:return{status:D,statusCode:R,body:{error:(o=t.error)!==null&&o!==void 0?o:"",missingField:(a=t.missing_field)!==null&&a!==void 0?a:"",eventsWithInvalidFields:(s=t.events_with_invalid_fields)!==null&&s!==void 0?s:{},eventsWithMissingFields:(l=t.events_with_missing_fields)!==null&&l!==void 0?l:{},eventsWithInvalidIdLengths:(u=t.events_with_invalid_id_lengths)!==null&&u!==void 0?u:{},epsThreshold:(c=t.eps_threshold)!==null&&c!==void 0?c:0,exceededDailyQuotaDevices:(d=t.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(f=t.silenced_devices)!==null&&f!==void 0?f:[],silencedEvents:(v=t.silenced_events)!==null&&v!==void 0?v:[],throttledDevices:(p=t.throttled_devices)!==null&&p!==void 0?p:{},throttledEvents:(h=t.throttled_events)!==null&&h!==void 0?h:[]}};case te.PayloadTooLarge:return{status:D,statusCode:R,body:{error:(g=t.error)!==null&&g!==void 0?g:""}};case te.RateLimit:return{status:D,statusCode:R,body:{error:(m=t.error)!==null&&m!==void 0?m:"",epsThreshold:(E=t.eps_threshold)!==null&&E!==void 0?E:0,throttledDevices:(_=t.throttled_devices)!==null&&_!==void 0?_:{},throttledUsers:(S=t.throttled_users)!==null&&S!==void 0?S:{},exceededDailyQuotaDevices:(I=t.exceeded_daily_quota_devices)!==null&&I!==void 0?I:{},exceededDailyQuotaUsers:(A=t.exceeded_daily_quota_users)!==null&&A!==void 0?A:{},throttledEvents:(x=t.throttled_events)!==null&&x!==void 0?x:[]}};case te.Timeout:default:return{status:D,statusCode:R}}},e.prototype.buildStatus=function(t){return Bt(t)?te.Success:t===429?te.RateLimit:t===413?te.PayloadTooLarge:t===408?te.Timeout:t>=400&&t<500?te.Invalid:t>=500?te.Failed:te.Unknown},e})();var Yt=2*1024;function $t(){return typeof CompressionStream<"u"}function Jt(e){return T(this,void 0,void 0,function(){var t,r,n;return y(this,function(i){switch(i.label){case 0:if(t=CompressionStream,typeof t>"u")return[2,void 0];i.label=1;case 1:return i.trys.push([1,3,,4]),r=new Blob([e]).stream().pipeThrough(new t("gzip")),[4,new Response(r).arrayBuffer()];case 2:return[2,i.sent()];case 3:return n=i.sent(),[2,void 0];case 4:return[2]}})})}var Ga=(function(){function e(t,r){this.key="AMP_remote_config_".concat(t.substring(0,10)),this.logger=r;try{this.isSupported=typeof localStorage<"u"}catch(n){this.logger.debug("Remote config localstorage failed to access: ",n),this.isSupported=!1}}return e.prototype.fetchConfig=function(){var t=null,r={remoteConfig:null,lastFetch:new Date};if(!this.isSupported)return Promise.resolve(r);try{t=localStorage.getItem(this.key)}catch(i){return this.logger.debug("Remote config localstorage failed to access: ",i),Promise.resolve(r)}if(t===null)return this.logger.debug("Remote config localstorage gets null because the key does not exist"),Promise.resolve(r);try{var n=JSON.parse(t);return this.logger.debug("Remote config localstorage parsed successfully: ".concat(me(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)}},e.prototype.setConfig=function(t){if(!this.isSupported)return Promise.resolve(!1);try{return localStorage.setItem(this.key,JSON.stringify(t)),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)},e})();function td(e,t){return new Promise(function(r,n){var i=function(){var o=new Error("Remote config custom fetch aborted by timeout");o.name="AbortError",n(o)};t.addEventListener("abort",i,{once:!0}),e.then(function(o){t.removeEventListener("abort",i),r(o)},function(o){t.removeEventListener("abort",i),n(o)})})}var rd="https://sr-client-cfg.amplitude.com/config",nd="https://sr-client-cfg.eu.amplitude.com/config",id=3,Si={INVALID_API_KEY:401,FORB
4IDDEN:403,RATE_LIMIT:429},od=1e3,ad=300*1e3,Ai=(function(){function e(t,r,n,i,o,a,s){n===void 0&&(n="US"),a===void 0&&(a=e.DEFAULT_CONFIG_GROUP),this.callbackInfos=[],this.lastSuccessfulFetch=null,this.fetchPromise=null,this.isLastFetchInvalidApiKey=!1,this.apiKey=t,this.configGroup=a,this.serverUrl=i||(n==="US"?rd:nd),this.logger=r,this.storage=s||new Ga(t,r),this.customFetch=o}return e.prototype.subscribe=function(t,r,n){var i=ne(),o={id:i,key:t,deliveryMode:r,callback:n};return this.callbackInfos.push(o),r==="all"?this.subscribeAll(o):this.subscribeWaitForRemote(o,r.timeout),i},e.prototype.unsubscribe=function(t){var r=this.callbackInfos.findIndex(function(n){return n.id===t});return r===-1?(this.logger.debug("Remote config client unsubscribe failed because callback with id ".concat(t," doesn't exist.")),!1):(this.callbackInfos.splice(r,1),this.logger.debug("Remote config client unsubscribe succeeded removing callback with id ".concat(t,".")),!0)},e.prototype.updateConfigs=function(){return T(this,void 0,void 0,function(){var t,r,n=this;return y(this,function(i){switch(i.label){case 0:return this.lastSuccessfulFetch&&(t=Date.now()-this.lastSuccessfulFetch,t<ad)?(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]}})})},e.prototype.getOrCreateFetchPromise=function(){var t=this;return this.fetchPromise?this.fetchPromise:this.isLastFetchInvalidApiKey?(this.logger.debug("Remote config client skipping fetch: Invalid API key"),this.fetchPromise=Promise.resolve({remoteConfig:null,lastFetch:new Date}).finally(function(){t.fetchPromise=null}),this.fetchPromise):(this.fetchPromise=this.fetch().then(function(r){return r.remoteConfig!==null&&(t.lastSuccessfulFetch=Date.now()),r}).finally(function(){t.fetchPromise=null}),this.fetchPromise)},e.prototype.subscribeAll=function(t){return T(this,void 0,void 0,function(){var r,n,i,o=this;return y(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(t,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(t,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]}})})},e.prototype.subscribeWaitForRemote=function(t,r){return T(this,void 0,void 0,function(){var n,o,i,o;return y(this,function(a){switch(a.label){case 0:n=new Promise(function(s,l){setTimeout(function(){l("Timeout exceeded")},r)}),a.label=1;case 1:return a.trys.push([1,3,,5]),[4,Promise.race([this.getOrCreateFetchPromise(),n])];case 2:return o=a.sent(),this.logger.debug("Remote config client subscription wait for remote mode returns from remote."),this.sendCallback(t,o,"remote"),this.storage.setConfig(o),[3,5];case 3:return i=a.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 o=a.sent(),o.remoteConfig!==null?(this.logger.debug("Remote config client subscription wait for remote mode returns a cached copy."),this.sendCallback(t,o,"cache")):(this.logger.debug("Remote config client subscription wait for remote mode failed to fetch cache."),this.sendCallback(t,o,"remote")),[3,5];case 5:return[2]}})})},e.prototype.sendCallback=function(t,r,n){t.lastCallback=new Date;var i;t.key?i=t.key.split(".").reduce(function(o,a){return o===null?o:a in o?o[a]:null},r.remoteConfig):i=r.remoteConfig,t.callback(i,n,r.lastFetch)},e.prototype.fetch=function(t,r){return t===void 0&&(t=id),r===void 0&&(r=od),T(this,void 0,void 0,function(){var n,i,o,a,s,l,u=this;return y(this,function(c){switch(c.label){case 0:n=r/t,i={remoteConfig:null,lastFetch:new Date},o=function(d){var f,v,p,h,g,m,E,_,S,I,A;return y(this,function(x){switch(x.label){case 0:f=!0,v=new AbortController,p=setTimeout(function(){return v.abort()},r),x.label=1;case 1:return x.trys.push([1,10,11,12]),h=a.getUrlParams(),g={Accept:"*/*"},a.customFetch?[4,td(a.customFetch({url:h,method:"GET",headers:g,signal:v.signal}),v.signal)]:[3,3];case 2:return E=x.sent(),[3,5];case 3:return[4,fetch(h,{method:"GET",headers:g,signal:v.signal})];case 4:E=x.sent(),x.label=5;case 5:return m=E,_=m.ok||m.status>=200&&m.status<300,_?[3,7]:[4,m.text()];case 6:return S=x.sent(),a.logger.debug("Remote config client fetch with retry time ".concat(t," failed with ").concat(m.status,": ").concat(S)),m.status===Si.INVALID_API_KEY||m.status===Si.FORBIDDEN?(a.logger.error("Remote config client fetch failed with ".concat(m.status,". Invalid API key; future fetches will be skipped.")),a.isLastFetchInvalidApiKey=!0,f=!1):m.status>=400&&m.status<500&&m.status!==Si.RATE_LIMIT&&(f=!1),[3,9];case 7:return[4,m.json()];case 8:return I=x.sent(),[2,{value:{remoteConfig:I,lastFetch:new Date}}];case 9:return[3,12];case 10:return A=x.sent(),A instanceof Error&&A.name==="AbortError"?a.logger.debug("Remote config client fetch with retry time ".concat(t," timed out after ").concat(r,"ms")):a.logger.debug("Remote config client fetch with retry time ".concat(t," is rejected because: "),A),[3,12];case 11:return clearTimeout(p),[7];case 12:return f?d<t-1?[4,new Promise(function(R){return setTimeout(R,u.getJitterDelay(n))})]:[3,14]:[2,"break"];case 13:x.sent(),x.label=14;case 14:return[2]}})},a=this,s=0,c.label=1;case 1:return s<t?[5,o(s)]:[3,4];case 2:if(l=c.sent(),typeof l=="object")return[2,l.value];if(l==="break")return[3,4];c.label=3;case 3:return s++,[3,1];case 4:return[2,i]}})})},e.prototype.getJitterDelay=function(t){return Math.floor(Math.random()*t)},e.prototype.getUrlParams=function(){var t=encodeURIComponent(this.apiKey),r=new URLSearchParams;return r.append("config_group",this.configGroup),"".concat(this.serverUrl,"/").concat(t,"?").concat(r.toString())},e.DEFAULT_CONFIG_GROUP="browser",e})();var Ii=C(),At=Ii?.console,st={},Qt={},xi=!1;function sd(e){if(!At||typeof At[e]!="function")return!1;if(Qt[e])return!0;var t=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];try{if(st[e]&&!xi){xi=!0;var i=st[e];i&&i.forEach(function(o){try{o(e,r)}catch{}})}}catch{}return xi=!1,Qt[e].apply(At,r)};return Qt[e]=At[e],At[e]=t,!0}function ud(e,t){var r=sd(e);if(!r)return new Error("Console override failed");st[e]?st[e].push(t):st[e]=[t]}function ld(e){var t,r;try{for(var n=P(Object.values(st)),i=n.next();!i.done;i=n.next())for(var o=i.value,a=o.length-1;a>=0;a--)if(o[a]===e){o.splice(a,1);break}}catch(s){t={error:s}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}function cd(){var e,t;try{for(var r=P(Object.entries(Qt)),n=r.next();!n.done;n=r.next()){var i=w(n.value,2),o=i[0],a=i[1];a&&(At[o]=a)}}catch(s){e={error:s}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}Qt={},st={}}var Wr={addListener:ud,removeListener:ld,_restoreConsole:cd};var Zt;(function(e){e.US="US",e.EU="EU",e.STAGING="STAGING"})(Zt||(Zt={}));var er=null;var tr=["a","button","input","select","textarea","label","video","audio",'[contenteditable="true" i]',"[data-amp-default-track]",".amp-default-track"],ut="data-amp-track-",rr=["div","span","h1","h2","h3","h4","h5","h6"],nr=150;var dd=["a","button",'[role="button"]','[role="link"]','[role="menuitem"]','[role="menuitemcheckbox"]','[role="menuitemradio"]','[role="option"]','[role="tab"]','[role="treeitem"]','[contenteditable="true" i]'],Ha=N(['input[type="button"]','input[type="submit"]','input[type="reset"]','input[type="image"]','input[type="file"]'],w(dd),!1),wi=Ha,Pi=Ha,Ci=["*"];var Ri=1e3,Li=4,Oi=50;function fd(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null||e===void 0}function Di(e,t,r){if(e){var n=t.map(Ba),i=r.map(Ba);qa({json:e,allowlist:n,excludelist:i,ancestors:[]})}}function qa(e){var t,r,n=e.json,i=e.targetObject,o=e.allowlist,a=e.excludelist,s=e.ancestors,l=e.parentObject,u=e.targetKey;
4i||(i=n);var c=Object.keys(i);try{for(var d=P(c),f=d.next();!f.done;f=d.next()){var v=f.value,p=N(N([],w(s),!1),[v],!1);fd(i[v])?(!Wa(p,o)||Wa(p,a))&&delete i[v]:qa({json:n,targetObject:i[v],allowlist:o,excludelist:a,ancestors:p,parentObject:i,targetKey:v})}}catch(h){t={error:h}}finally{try{f&&!f.done&&(r=d.return)&&r.call(d)}finally{if(t)throw t.error}}Object.keys(i).length===0&&l&&u&&delete l[u]}function Ba(e){return e.startsWith("/")&&(e=e.slice(1)),e.split("/").map(function(t){return t.replace(/~0/g,"~").replace(/~1/g,"/")})}function ki(e,t,r,n){if(r===void 0&&(r=0),n===void 0&&(n=0),n===t.length)return r===e.length;if(r===e.length){for(;n<t.length&&t[n]==="**";)n++;return n===t.length}var i=t[n];if(i==="**"){if(n+1===t.length)return!0;for(var o=r;o<=e.length;o++)if(ki(e,t,o,n+1))return!0;return!1}else return i==="*"||i===e[r]?ki(e,t,r+1,n+1):!1}function Wa(e,t){return t.some(function(r){return ki(e,r)})}var vd=500,Xa=100,ja=(function(){function e(t){this.request=t}return e.prototype.headers=function(t){var r,n;t===void 0&&(t=[]);var i=this.request.headers,o={};if(Array.isArray(i))i.forEach(function(d){var f=w(d,2),v=f[0],p=f[1];o[v]=p});else if(i instanceof Headers)i.forEach(function(d,f){o[f]=d});else if(typeof i=="object"&&i!==null)try{for(var a=P(Object.entries(i)),s=a.next();!s.done;s=a.next()){var l=w(s.value,2),u=l[0],c=l[1];o[u]=c}}catch(d){r={error:d}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return qr(o,{allow:t})},Object.defineProperty(e.prototype,"bodySize",{get:function(){if(typeof this._bodySize=="number")return this._bodySize;var t=C();if(t?.TextEncoder){var r=this.request.body;return this._bodySize=Ya(r,Xa),this._bodySize}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"method",{get:function(){return this.request.method},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return typeof this.request.body=="string"?this.request.body:null},enumerable:!1,configurable:!0}),e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),T(this,void 0,void 0,function(){var n;return y(this,function(i){return t.length===0?[2,null]:(n=this.body,[2,Ni(n,t,r)])})})},e})();var za=(function(){function e(t,r){this.bodyRaw=t,this.requestHeaders=r}return e.prototype.headers=function(t){return t===void 0&&(t=[]),qr(this.requestHeaders,{allow:t})},Object.defineProperty(e.prototype,"bodySize",{get:function(){return Ya(this.bodyRaw,Xa)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return typeof this.bodyRaw=="string"?this.bodyRaw:null},enumerable:!1,configurable:!0}),e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),T(this,void 0,void 0,function(){var n;return y(this,function(i){return t.length===0?[2,null]:(n=this.body,[2,Ni(n,t,r)])})})},e})();function Ya(e,t){var r,n,i,o=C(),a=o?.TextEncoder;if(a&&e!=null){var s;if(typeof e=="string")s=e,i=new a().encode(s).length;else if(typeof Blob<"u"&&e instanceof Blob)s=e,i=s.size;else if(typeof URLSearchParams<"u"&&e instanceof URLSearchParams)s=e,i=new a().encode(s.toString()).length;else if(ArrayBuffer.isView(e))s=e,i=s.byteLength;else if(e instanceof ArrayBuffer)s=e,i=s.byteLength;else if(typeof FormData<"u"&&e instanceof FormData){var l=e,u=0,c=0;try{for(var d=P(l.entries()),f=d.next();!f.done;f=d.next()){var v=w(f.value,2),p=v[0],h=v[1];if(u+=p.length,typeof h=="string")u+=new a().encode(h).length;else if(typeof Blob<"u"&&h instanceof Blob)u+=h.size;else return;if(++c>=t)return}}catch(g){r={error:g}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}i=u}else if(typeof ReadableStream<"u"&&e instanceof ReadableStream){s=e;return}return i}}var $a=(function(){function e(t){this.response=t}return e.prototype.headers=function(t){var r;if(t===void 0&&(t=[]),this.response.headers instanceof Headers){var n=this.response.headers,i={};return(r=n?.forEach)===null||r===void 0||r.call(n,function(o,a){i[a]=o}),qr(i,{allow:t})}},Object.defineProperty(e.prototype,"bodySize",{get:function(){var t,r;if(this._bodySize!==void 0)return this._bodySize;var n=(r=(t=this.response.headers)===null||t===void 0?void 0:t.get)===null||r===void 0?void 0:r.call(t,"content-length"),i=n?parseInt(n,10):void 0;return this._bodySize=i,i}
4,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.response.status},enumerable:!1,configurable:!0}),e.prototype.text=function(){return T(this,void 0,void 0,function(){var t,r,n,i;return y(this,function(o){switch(o.label){case 0:this.clonedResponse||(this.clonedResponse=this.response.clone()),o.label=1;case 1:return o.trys.push([1,3,,4]),t=this.clonedResponse.text(),r=new Promise(function(a){return setTimeout(function(){return a(null)},vd)}),[4,Promise.race([t,r])];case 2:return n=o.sent(),[2,n];case 3:return i=o.sent(),[2,null];case 4:return[2]}})})},e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),T(this,void 0,void 0,function(){var n;return y(this,function(i){switch(i.label){case 0:return t.length===0?[2,null]:[4,this.text()];case 1:return n=i.sent(),[2,Ni(n,t,r)]}})})},e})();var Ja=(function(){function e(t,r,n,i){this.statusCode=t,this.headersString=r,this.size=n,this.getJson=i}return Object.defineProperty(e.prototype,"bodySize",{get:function(){return this.size},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"status",{get:function(){return this.statusCode},enumerable:!1,configurable:!0}),e.prototype.headers=function(t){var r,n;if(t===void 0&&(t=[]),!this.headersString)return{};var i={},o=this.headersString.split(`\r
5`);try{for(var a=P(o),s=a.next();!s.done;s=a.next()){var l=s.value,u=w(l.split(": "),2),c=u[0],d=u[1];c&&d&&(i[c]=d)}}catch(f){r={error:f}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(r)throw r.error}}return qr(i,{allow:t})},e.prototype.json=function(t,r){return t===void 0&&(t=[]),r===void 0&&(r=[]),T(this,void 0,void 0,function(){var n;return y(this,function(i){return t.length===0?[2,null]:(n=this.getJson(),n?(Di(n,t,r),[2,n]):[2,null])})})},e})();function Ni(e,t,r){if(!e)return null;try{var n=JSON.parse(e);return Di(n,t,r),n}catch{return null}}var ir;(function(e){e.REDACT="redact",e.REMOVE="remove"})(ir||(ir={}));var Ka="[REDACTED]",qr=function(e,t){var r,n,i=t.allow,o=i===void 0?[]:i,a=t.strategy,s=a===void 0?ir.REMOVE:a,l=N([],w(ii),!1),u={},c=function(p){var h=p.toLowerCase();l.find(function(g){return g.toLowerCase()===h})?s===ir.REDACT&&(u[p]=Ka):o.find(function(g){return g.toLowerCase()===h})?u[p]=e[p]:s===ir.REDACT&&(u[p]=Ka)};try{for(var d=P(Object.keys(e)),f=d.next();!f.done;f=d.next()){var v=f.value;c(v)}}catch(p){r={error:p}}finally{try{f&&!f.done&&(n=d.return)&&n.call(d)}finally{if(r)throw r.error}}return u},Qa=(function(){function e(t,r,n,i,o,a,s,l,u,c,d){s===void 0&&(s=0),this.type=t,this.method=r,this.timestamp=n,this.startTime=i,this.url=o,this.requestWrapper=a,this.status=s,this.duration=l,this.responseWrapper=u,this.error=c,this.endTime=d}return e.prototype.toSerializable=function(){var t,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:(t=this.requestWrapper)===null||t===void 0?void 0:t.headers(N([],w(We),!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(N([],w(We),!1)),responseBodySize:(i=this.responseWrapper)===null||i===void 0?void 0:i.bodySize};return Object.fromEntries(Object.entries(o).filter(function(a){var s=w(a,2),l=s[0],u=s[1];return u!==void 0}))},e})();function pd(e){return typeof e=="object"&&e!==null&&"url"in e&&"method"in e}var Mi=(function(){function e(t,r){r===void 0&&(r=ne()),this.callback=t,this.id=r}return e})();function lt(e){try{e()}catch{}}var hd=(function(){function e(t){this.eventCallbacks=new Map,this.isObserving=!1,this.logger=t;var r=C();e.isSupported()&&(this.globalScope=r)}return e.isSupported=function(){var t=C();return!!t&&!!t.fetch},e.prototype.subscribe=function(t,r){var n,i,o,a,s,l,u,c,d,f;if(this.logger||(this.logger=r),this.eventCallbacks.set(t.id,t),!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,p=(l=(s=(a=this.globalScope)===null||a===void 0?void 0:a.XMLHttpRequest)===null||s===void 0?void 0:s.prototype)===null||l===void 0?void 0:l.send,h=(d=(c=(u=this.globalScope)===null||u===void 0?void 0:u.XMLHttpRequest)===null||c===void 0?void 0:c.prototype)===null||d===void 0?void 0:d.setRequestHeader;v&&p&&h&&this.observeXhr(v,p,h);var g=(f=this.globalScope)===null||f===void 0?void 0:f.fetch;g&&this.observeFetch(g),this.isObserving=!0}},e.prototype.unsubscribe=function(t){this.eventCallbacks.delete(t.id)},e.prototype.triggerEventCallbacks=function(t){var r=this;this.eventCallbacks.forEach(function(n){try{n.callback(t)}catch(i){lt(function(){var o;(o=r.logger)===null||o===void 0||o.debug("an unexpected error occurred while triggering event callbacks",i)})}})},e.prototype.handleNetworkRequestEvent=function(t,r,n,i,o,a,s){var l;if(!(a===void 0||s===void 0)){var u,c="GET";if(pd(r)?(u=r.url,c=r.method):u=(l=r?.toString)===null||l===void 0?void 0:l.call(r),u)try{var d=new URL(u);u="".concat(d.protocol,"//").concat(d.host).concat(d.pathname).concat(d.search).concat(d.hash)}catch{}c=n?.method||c;var f,v;i&&(f=i.status),o&&(v={name:o.name||"UnknownError",message:o.message||"An unknown error occurred"},f=0);var p=Math.floor(performance.now()-s),h=Math.floor(a+p),g=new Qa(t,c,a,a,u,n,f,p,i,v,h);this.triggerEventCallbacks(g)}},e.prototype.getTimestamps=function(){var t,r;return{startTime:(t=Date.now)===null||t===void 0?void 0:t.call(Date),durationStart:(r=performance?.now)===null||r===void 0?void 0:r.call(performance)}},e.prototype.observeFetch=function(t){var r=this;!this.globalScope||!t||(this.globalScope.fetch=function(n,i){return T(r,void 0,void 0,function(){var o,a,s,l,u=this;return y(this,function(c){switch(c.label){case 0:try{o=this.getTimestamps()}catch(d){lt(function(){var f;return(f=u.logger)===null||f===void 0?void 0:f.debug("an unexpected error occurred while retrieving timestamps",d)})}c.label=1;case 1:return c.trys.push([1,3,,4]),[4,t(n,i)];case 2:return a=c.sent(),[3,4];case 3:return l=c.sent(),s=l,[3,4];case 4:try{this.handleNetworkRequestEvent("fetch",n,i?new ja(i):void 0,a?new $a(a):void 0,s,o?.startTime,o?.durationStart)}catch(d){lt(function(){var f;return(f=u.logger)===null||f===void 0?void 0:f.debug("an unexpected error occurred while handling fetch",d)})}if(a)return[2,a];throw s}})})})},e.createXhrJsonParser=function(t,r){return function(){var n;try{if(t.responseType==="json"){if(!((n=r.globalScope)===null||n===void 0)&&n.structuredClone)return r.globalScope.structuredClone(t.response)}else if(["text",""].includes(t.responseType))return JSON.parse(t.responseText)}catch(i){return i instanceof Error&&i.name==="InvalidStateError"&&lt(function(){var o;return(o=r.logger)===null||o===void 0?void 0:o.debug("unexpected error when retrieving responseText. responseType='".concat(t.responseType,"'"))}),null}return null}},e.prototype.observeXhr=function(t,r,n){if(!(!this.globalScope||!t||!r)){var i=this.globalScope.XMLHttpRequest.prototype,o=this;i.open=function(){for(var a,s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];var u=this,c=w(s,2),d=c[0],f=c[1];try{u.$$AmplitudeAnalyticsEvent=b({method:d,url:(a=f?.toString)===null||a===void 0?void 0:a.call(f),headers:{}},o.getTimestamps())}catch(v){lt(function(){var p;return(p=o.logger)===null||p===void 0?void 0:p.debug("an unexpected error occurred while calling xhr open",v)})}return t.apply(u,s)},i.send=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];var l=this,u=l,c=e.createXhrJsonParser(l,o),d=a[0],f=u.$$AmplitudeAnalyticsEvent;return u.$$AmplitudeAnalyticsEvent&&u.addEventListener("loadend",function(){try{var v=u.getAllResponseHeaders(),p=u.getResponseHeader("content-length"),h=new Ja(u.status,v,p?parseInt(p,10):void 0,c),g=u.$$AmplitudeAnalyticsEvent.headers,m=new za(d,g);f.status=u.status,o.handleNetworkRequestEvent("xhr",{url:f.url,method:f.method},m,h,void 0,f.startTime,f.durationStart)}catch(E){lt(function(){var _;return(_=o.logger)===null||_===void 0?void 0:_.debug("an unexpected error occurred while handling xhr send",E)})}}),r.apply(u,a)},i.setRequestHeader=function(a,s){var l=this;try{var u=l.$$AmplitudeAnalyticsEvent;u&&(u.headers[a]=s)}catch(c){lt(function(){var d;return(d=o.logger)===null||d===void 0?void 0:d.debug("an unexpected error occurred while calling xhr setRequestHeader",c)})}n.apply(l,[a,s])}}},e})();var Kr=new hd;var Ui=function(e,t){return e?.map(function(r){var n,i;if(!((n=r.urls)===null||n===void 0)&&n.length&&(!((i=r.hosts)===null||i===void 0)&&i.length)){var o=JSON.stringify(r.hosts),a=JSON.stringify(r.urls);return t?.warn("Found network capture rule with both urls='".concat(a,"' and hosts='").concat(o,"' set. ")+"Definition of urls takes precedence over hosts, so ignoring hosts."),b(b({},r),{hosts:void 0})}return r})};var ct=(function(){function e(){}return e.prototype.parse=function(){return T(this,void 0,void 0,function(){return y(this,function(t){return[2,b(b(b(b({},Be),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},e.prototype.getUtmParam=function(){var t=Ye(),r=t[ca],n=t[da],i=t[fa],o=t[va],a=t[pa],s=t[ha];return{utm_campaign:r,utm_content:n,utm_id:i,utm_medium:o,utm_source:a,utm_term:s}},e.prototype.getReferrer=function(){var t,r,n={referrer:void 0,referring_domain:void 0};try{n.referrer=document.referrer||void 0,n.referring_domain=(r=(t=n.referrer)===null||t===void 0?void 0:t.split("/")[2])!==null&&r!==void 0?r:void 0}catch{}return n},e.prototype.getClickIds=function(){var t,r=Ye();return t={},t[jn]=r[jn],t[zn]=r[zn],t[Yn]=r[Yn],t[$n]=r[$n],t[Jn]=r[Jn],t[Qn]=r[Qn],t[Zn]=r[Zn],t[ei]=r[ei],t[ti]=r[ti],t[ri]=r[ri],t[ni]=r[ni],t},e})();var De="data-amp-mask",ke="*****",Za=/\b(?:\d[ -]*?){13,16}\b/,es=/(\d{3}-?\d{2}-?\d{4})/g,ts=/[^\s@]+@[^\s@.]+\.[^\s@]+/g,dt=function(e,t){var r,n;if(t===void 0&&(t=[]),typeof e!="string")return"";var i=e;i=i.replace(Za,ke),i=i.replace(es,ke),i=i.replace(ts,ke);try{for(var o=P(t),a=o.next();!a.done;a=o.next()){var s=a.value;try{i=i.replace(s,ke)}catch{}}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}
5,ft=function(e){if(typeof document>"u"||!document.title)return"";var t=document.querySelector("title");return t&&t.hasAttribute(De)?ke:e?e(document.title):document.title};var Q=ua(us());function vt(e,t){return new Q.default(function(r){e.subscribe({next:function(n){t(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 we(e,t){return new Q.default(function(r){var n=!1,i=new Set,o=function(){var s,l;n=!0;try{for(var u=P(i),c=u.next();!c.done;c=u.next()){var d=c.value;try{d.unsubscribe()}catch{}}}catch(f){s={error:f}}finally{try{c&&!c.done&&(l=u.return)&&l.call(u)}finally{if(s)throw s.error}}i.clear()},a=function(s){var l=s.subscribe({next:function(u){n||r.next(u)},error:function(u){n||(n=!0,r.error(u),o())},complete:function(){i.delete(l),!n&&i.size===0&&(r.complete(),o(),n=!0)}});i.add(l)};return a(e),a(t),o})}function _e(e){var t=new Set,r=null;function n(){r?.unsubscribe(),r=null,t.clear()}return new Q.default(function(i){return t.add(i),r===null&&(r=e.subscribe({next:function(o){var a,s,l;try{for(var u=P(t),c=u.next();!c.done;c=u.next()){var d=c.value;(l=d.next)===null||l===void 0||l.call(d,o)}}catch(f){a={error:f}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}},error:function(o){var a,s,l;try{for(var u=P(t),c=u.next();!c.done;c=u.next()){var d=c.value;(l=d.error)===null||l===void 0||l.call(d,o)}}catch(f){a={error:f}}finally{try{c&&!c.done&&(s=u.return)&&s.call(u)}finally{if(a)throw a.error}}n()},complete:function(){var o,a,s;try{for(var l=P(t),u=l.next();!u.done;u=l.next()){var c=u.value;(s=c.complete)===null||s===void 0||s.call(c)}}catch(d){o={error:d}}finally{try{u&&!u.done&&(a=l.return)&&a.call(l)}finally{if(o)throw o.error}}n()}})),function(){t.delete(i),t.size===0&&r&&(r.unsubscribe(),r=null)}})}var wt="https://app.amplitude.com",Wi="https://app.eu.amplitude.com",qi="https://apps.stag2.amplitude.com",Yr={US:wt,EU:Wi,STAGING:qi},$r="https://cdn.amplitude.com/libs/background-capture-1.1.0.js.gz";var ls=function(e){var t=document.querySelector('script[src="'.concat(CSS.escape(e),'"]'));return t?Promise.resolve({status:!0}):new Promise(function(r,n){var i;try{var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=e,o.addEventListener("load",function(){r({status:!0})},{once:!0}),o.addEventListener("error",function(){n({status:!1,message:"Failed to load the script ".concat(e)})}),(i=document.head)===null||i===void 0||i.appendChild(o)}catch(a){n(a)}})};function cs(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).substr(2,9))}var ds,Ki="__AMPLITUDE_MESSENGER_INSTANCE__",Jr="__AMPLITUDE_MESSENGER__",bd=(function(){function e(t){var r=t===void 0?{}:t,n=r.origin,i=n===void 0?wt:n;this[ds]=!0,this.isSetup=!1,this.messageHandler=null,this.requestCallbacks={},this.actionHandlers=new Map,this.pendingMessages=new Map,this.scriptLoadPromises=new Map,this.endpoint=i}return e.prototype.notify=function(t){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(t)),(o=(i=window.opener)===null||i===void 0?void 0:i.postMessage)===null||o===void 0||o.call(i,t,this.endpoint)},e.prototype.sendRequest=function(t,r,n){var i=this;n===void 0&&(n={timeout:15e3});var o=cs(),a={id:o,action:t,args:r},s=new Promise(function(l,u){i.requestCallbacks[o]={resolve:l,reject:u},i.notify(a),n.timeout>0&&setTimeout(function(){u(new Error("".concat(t," timed out (id: ").concat(o,")"))),delete i.requestCallbacks[o]},n.timeout)});return s},e.prototype.handleResponse=function(t){var r;if(!this.requestCallbacks[t.id]){(r=this.logger)===null||r===void 0||r.warn("No callback found for request id: ".concat(t.id));return}this.requestCallbacks[t.id].resolve(t.responseData),delete this.requestCallbacks[t.id]},e.prototype.registerActionHandler=function(t,r){var n,i,o,a;this.actionHandlers.has(t)&&((a=(o=this.logger)===null||o===void 0?void 0:o.warn)===null||a===void 0||a.call(o,"Overwriting existing action handler for: ".concat(t))),this.actionHandlers.set(t,r);var s=this.pendingMessages.get(t);if(s){this.pendingMessages.delete(t);try{for(var l=P(s),u=l.next();!u.done;u=l.next()){var c=u.value;r(c)}}catch(d){n={error:d}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}}},e.prototype.loadScriptOnce=function(t){return T(this,void 0,void 0,function(){var r,n,i;return y(this,function(o){switch(o.label){case 0:if(r=this.scriptLoadPromises.get(t),r)return[2,r];n=ls(t).then(function(){}),this.scriptLoadPromises.set(t,n),o.label=1;case 1:return o.trys.push([1,3,,4]),[4,n];case 2:return o.sent(),[3,4];case 3:throw i=o.sent(),this.scriptLoadPromises.delete(t),i;case 4:return[2]}})})},e.prototype.setup=function(t){var r=this,n,i,o=t===void 0?{}:t,a=o.logger,s=o.endpoint;a&&(this.logger=a),s&&this.endpoint===wt&&(this.endpoint=s),!this.isSetup&&(this.isSetup=!0,(i=(n=this.logger)===null||n===void 0?void 0:n.debug)===null||i===void 0||i.call(n,"Setting up messenger"),this.messageHandler=function(l){var u,c,d,f,v;if((c=(u=r.logger)===null||u===void 0?void 0:u.debug)===null||c===void 0||c.c
5all(u,"Message received: ",JSON.stringify(l)),r.endpoint===l.origin){var p=l.data,h=p?.action;if(h)if("id"in p&&p.id)(f=(d=r.logger)===null||d===void 0?void 0:d.debug)===null||f===void 0||f.call(d,"Received Response to previous request: ",JSON.stringify(l)),r.handleResponse(p);else{if(h==="ping"){r.notify({action:"pong"});return}var g=r.actionHandlers.get(h);if(g)g(p.data);else{var m=(v=r.pendingMessages.get(h))!==null&&v!==void 0?v:[];m.push(p.data),r.pendingMessages.set(h,m)}}}},window.addEventListener("message",this.messageHandler),this.notify({action:"page-loaded"}))},e.prototype.destroy=function(){this.messageHandler&&(window.removeEventListener("message",this.messageHandler),this.messageHandler=null),this.isSetup=!1,this.actionHandlers.clear(),this.pendingMessages.clear(),this.requestCallbacks={},this.scriptLoadPromises.clear();var t=C();t?.[Jr]===this&&delete t[Jr]},e})();ds=Ki;function _d(e){return typeof e=="object"&&e!==null&&Ki in e&&e[Ki]===!0}function Xi(e){var t=C(),r=t?.[Jr];if(_d(r))return r;var n=new bd(e);return t&&(t[Jr]=n),n}var yd=["desktop","tablet","mobile"],fs=function(e){if(typeof e=="string")return yd.includes(e)?e:void 0};var vs="__AMPLITUDE_BACKGROUND_CAPTURE__";function ji(e,t){var r,n=e;if(n[vs]!==!0){n[vs]=!0;var i=(r=t?.scriptUrl)!==null&&r!==void 0?r:$r,o=null,a=function(s,l){var u,c;s==="background-capture-complete"&&((c=(u=e.logger)===null||u===void 0?void 0:u.debug)===null||c===void 0||c.call(u,"Background capture complete"),e.notify({action:"background-capture-complete",data:l}))};e.registerActionHandler("initialize-background-capture",function(s){var l,u;(u=(l=e.logger)===null||l===void 0?void 0:l.debug)===null||u===void 0||u.call(l,"Initializing background capture (external script)");var c=new URL(i,e.endpoint).toString(),d=s&&typeof s=="object"?fs(s.deviceMode):void 0;e.loadScriptOnce(c).then(function(){var f,v,p;(v=(f=e.logger)===null||f===void 0?void 0:f.debug)===null||v===void 0||v.call(f,"Background capture script loaded (external)"),o=(p=window?.amplitudeBackgroundCapture)===null||p===void 0?void 0:p.call(window,b({messenger:e,onBackgroundCapture:a},d!==void 0?{initialDeviceMode:d}:{})),e.notify({action:"background-capture-loaded"})}).catch(function(){var f;(f=e.logger)===null||f===void 0||f.warn("Failed to initialize background capture")})}),e.registerActionHandler("close-background-capture",function(){var s;(s=o?.close)===null||s===void 0||s.call(o),o=null})}}var pt={always:"always",ifEmptyCampaign:"ifEmptyCampaign"};function ps(e,t){var r=0;if(Number.isFinite(e)&&Number.isFinite(t)&&t>0){var n=e/t*100;r=Math.min(100,Math.max(0,n))}return r}function ar(e,t){var r=e.currentTime,n=e.duration;return b({duration:n,start_time:r,last_position:r,percent_completed:ps(r,n)},t!==void 0?{stop_reason:t}:{})}function sr(e){return{mux_playback_id:e.getAttribute("playback-id"),mux_video_id:e.getAttribute("metadata-video-id"),mux_video_title:e.getAttribute("metadata-video-title")}}function hs(e,t,r){var n=function(){var u=b(b({},ar(e)),r==="mux"?sr(e):{});t.onPlay(u)};e.addEventListener("play",n);var i=function(){var u=b(b({},ar(e,"paused")),r==="mux"?sr(e):{});t.onPause(u)};e.addEventListener("pause",i);var o=function(){var u=b(b({},ar(e,"ended")),r==="mux"?sr(e):{});t.onEnded(u)};e.addEventListener("ended",o);var a=function(){var u=b(b({},ar(e,"seeking")),r==="mux"?sr(e):{});t.onSeeking(u)};e.addEventListener("seeking",a);var s=function(){var u=b(b({},ar(e)),r==="mux"?sr(e):{});t.onSeeked(u)};e.addEventListener("seeked",s);var l=function(){var u=e,c={position:e.currentTime,isSeeking:!!u.seeking};t.onTimeUpdate(c)};return e.addEventListener("timeupdate",l),function(){e.removeEventListener("play",n),e.removeEventListener("pause",i),e.removeEventListener("ended",o),e.removeEventListener("seeking",a),e.removeEventListener("seeked",s),e.removeEventListener("timeupdate",l)}}function Td(e){return T(this,void 0,void 0,function(){var t;return y(this,function(r){switch(r.label){case 0:return[4,new Promise(function(n){return e.getCurrentTime(n)})];case 1:return t=r.sent(),[2,{currentTime:t}]}})})}function ur(e,t,r,n){return T(this,void 0,void 0,function(){var i,o,a,s,l;return y(this,function(u){switch(u.label){case 0:return[4,Promise.all([new Promise(function(c){return e.getDuration(c)}),new Promise(function(c){return e.getCurrentTime(c)})])];case 1:if(i=w.apply(void 0,[u.sent(),2]),o=i[0],a=i[1],s={},r==="mux"){l=void 0;try{l=new URL(t.getAttribute("src")),s.mux_video_title=l.searchParams.get("metadata-video-title"),s.mux_video_id=l.searchParams.get("metadata-video-id"),s.mux_playback_id=l.pathname.split("/").pop()}catch{}}return[2,b(b({duration:o,start_time:a,last_position:a,percent_completed:ps(a,o)},n!==void 0?{stop_reason:n}:{}),s)]}})})}function gs(e,t,r){r===void 0&&(r=null);var n=[],i=function(){var o=e.elem,a=!1,s=function(){ur(e,o,r).then(function(v){t.onPlay(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'play' handler: ".concat(v))})};e.on("play",s),n.push(function(){return e.off("play",s)});var l=function(){ur(e,o,r,"paused").then(function(v){t.onPause(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'pause' handler: ".concat(v))})};e.on("pause",l),n.push(function(){return e.off("pause",l)});var u=function(){ur(e,o,r,"ended").then(function(v){t.onEnded(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'ended' handler: ".concat(v))})};e.on("ended",u),n.push(function(){return e.off("ended",u)});var c=function(){a=!0,ur(e,o,r,"seeking").then(function(v){t.onSeeking(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'seeking' handler: ".concat(v))})};e.on("seeking",c),n.push(function(){return e.off("seeking",c)});var d=function(){a=!1,ur(e,o,r).then(function(v){t.onSeeked(v)}).catch(function(v){t.onError("Error getting iframe metadata from 'seeked' handler: ".concat(v))})};e.on("seeked",d),n.push(function(){return e.off("seeked",d)});var f=function(){Td(e).then(function(v){var p=v.currentTime,h={position:p,isSeeking:a};t.onTimeUpdate(h)}).catch(function(v){t.onError("Error getting iframe metadata from 'timeupdate' handler: ".concat(v))})};e.on("timeupdate",f),n.push(function(){return e.off("timeupdate",f)})};
5return e.on("ready",i),function(){e.off("ready",i),n.forEach(function(o){return o()})}}var zi=(function(){function e(t){var r=t.videoEl,n=t.onStateChange,i=t.vendor,o=t.isEmbedded,a=this;this.state={playbackState:"paused"},this.handler={onPlay:function(s){a.updatePlaybackState("playing",s)},onPause:function(s){a.updatePlaybackState("paused",s)},onEnded:function(s){a.updatePlaybackState("ended",s)},onSeeking:function(){var s=b(b({},a.state),{isSeeking:!0});a.updateState(s)},onSeeked:function(s){var l=b(b({},a.state),{isSeeking:!1,position:s.last_position});a.updateState(l)},onError:function(s){a.updateStateWithError(s)},onTimeUpdate:function(s){a.updateTime(s)}},this.onStateChange=n,o?this.untrack=gs(r,this.handler,i):this.untrack=hs(r,this.handler,i)}return e.prototype.stateChangeHandler=function(t,r){try{this.onStateChange(t,r)}catch{}},e.prototype.updateStateWithError=function(t){var r=this.state,n=b(b({},r),{playbackState:"error",errorMessage:t});this.updateState(n)},e.prototype.updatePlaybackState=function(t,r){var n=b(b({},this.state),{playbackState:t,lastEvent:r,position:r.last_position});this.updateState(n)},e.prototype.updateTime=function(t){var r,n,i=this.state.lastEvent;if(!(!i||this.state.playbackState!=="playing")){var o=t.isSeeking||this.state.isSeeking,a=(r=this.state.position)!==null&&r!==void 0?r:0,s=t.position;if(o){this.state=b(b({},this.state),{position:s});return}var l=s-a,u=b(b({},this.state),{position:s,watchTime:((n=this.state.watchTime)!==null&&n!==void 0?n:0)+l});this.updateState(u)}},e.prototype.updateState=function(t){var r=this.state;this.state=t,this.stateChangeHandler(r,t)},e.prototype.destroy=function(){this.untrack()},e})();function Yi(){var e,t,r=C();return typeof((t=(e=r?.chrome)===null||e===void 0?void 0:e.runtime)===null||t===void 0?void 0:t.id)=="string"}function $i(){var e,t=C();return((e=t?.navigator)===null||e===void 0?void 0:e.product)==="ReactNative"}function Qr(e,t,r){var n,i,o=[];try{for(var a=P(t??[]),s=a.next();!s.done;s=a.next()){var l=s.value;try{o.push(new RegExp(l))}catch(u){r.warn("Invalid regex pattern: ".concat(l),u)}}}catch(u){n={error:u}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return e.concat(o)}function Ji(e,t){var r,n,i,o,a;if(!(typeof e!="object"||e===null||!(!((i=e.captureRules)===null||i===void 0)&&i.length))){var s=b({},e),l=(o=s.captureRules)!==null&&o!==void 0?o:[];try{for(var u=P(l),c=u.next();!c.done;c=u.next()){var d=c.value;d.urls=Qr((a=d.urls)!==null&&a!==void 0?a:[],d.urlsRegex,t),delete d.urlsRegex}}catch(f){r={error:f}}finally{try{c&&!c.done&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}return s}}function Zr(e){var t,r,n,i,o,a,s,l,u,c,d,f,v;if(!(typeof e!="object"||e===null)&&!Array.isArray(e)){var p=Object.keys(e);try{for(var h=P(p),g=h.next();!g.done;g=h.next()){var m=g.value;try{var E=e[m];typeof E?.enabled=="boolean"&&(E.enabled?(delete E.enabled,Object.keys(E).length===0&&(e[m]=!0)):e[m]=!1),Zr(E)}catch{}}}catch(V){t={error:V}}finally{try{g&&!g.done&&(r=h.return)&&r.call(h)}finally{if(t)throw t.error}}try{if(!((u=(l=(s=e.autocapture)===null||s===void 0?void 0:s.networkTracking)===null||l===void 0?void 0:l.captureRules)===null||u===void 0)&&u.length)try{for(var _=P(e.autocapture.networkTracking.captureRules),S=_.next();!S.done;S=_.next()){var I=S.value;try{for(var A=(o=void 0,P(["responseHeaders","requestHeaders"])),x=A.next();!x.done;x=A.next()){var R=x.value,D=(c=I[R])!==null&&c!==void 0?c:{},G=D.captureSafeHeaders,k=D.allowlist;if(!(!G&&!k)){if(k!==void 0&&!Array.isArray(k)){delete I[R];continue}I[R]=N(N([],w(G?We:[]),!1),w(k??[]),!1)}}}catch(V){o={error:V}}finally{try{x&&!x.done&&(a=A.return)&&a.call(A)}finally{if(o)throw o.error}}}}catch(V){n={error:V}}finally{try{S&&!S.done&&(i=_.return)&&i.call(_)}finally{if(n)throw n.error}}}catch{}((d=e.autocapture)===null||d===void 0?void 0:d.pageViews)!==void 0&&(e.autocapture.screenViews=e.autocapture.pageViews);var U=(f=e.autocapture)===null||f===void 0?void 0:f.frustrationInteractions;U&&(U.rageClick&&(U.rageClicks=U.rageClick,delete U.rageClick),U.deadClick&&(U.deadClicks=U.deadClick,delete U.deadClick));try{var L=(v=e.autocapture)===null||v===void 0?void 0:v.elementInteractions;if(L&&typeof L=="object"&&(L.viewportContentUpdated===!0&&(L.viewportContentUpdated={}),L.viewportContentUpdated===!1&&(L.viewportContentUpdated={enabled:!1}),L.exposureDuration!==void 0)){var M=L.viewportContentUpdated;M===void 0?L.viewportContentUpdated={exposureDuration:L.exposureDuration}:typeof M=="object"&&M.exposureDuration===void 0&&M.enabled!==!1&&(M.exposureDuration=L.exposureDuration),delete L.exposureDuration}}catch{}}}var Pt=function(e,t){return typeof e=="boolean"?e:e?.[t]===!1?!1:Yi()?!!e?.[t]:!0},en=function(e){return Pt(e,"attribution")},ms=function(e){return Pt(e,"fileDownloads")},Qi=function(e){return Pt(e,"formInteractions")},Zi=function(e){return Pt(e,"pageViews")},eo=function(e){return Pt(e,"sessions")},Es=function(e){return Pt(e,"pageUrlEnrichment")},to=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.networkTracking===!0||typeof e.networkTracking=="object")},ro=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.elementInteractions===!0||typeof e.elementInteractions=="object")},bs=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.webVitals===!0||typeof e.webVitals=="object"&&e.webVitals!==null)},_s=function(e){if(typeof e.autocapture=="object"){var t=e.autocapture.webVitals;if(typeof t=="object"&&t!==null)return t}},no=function(e){return typeof e=="boolean"?e:typeof e=="object"&&(e.frustrationInteractions===!0||typeof e.frustrationInteractions=="object")},ys=function(e){return typeof e=="object"&&(e.performanceTracking===!0||typeof e.performanceTracking=="object")},Ts=function(e){if(typeof e.autocapture=="object"){var t=e.autocapture.performanceTracking;if(t===!0)return{mainThreadBlock:!0};if(typeof t=="object"&&t!==null)return t}},Ss=function(e){return typeof e=="boolean"?e:typeof e=="object"&&e!==null&&e.enabled!==!1},As=function(e){if(ro(e.autocapture)&&typeof e.autocapture=="object"&&typeof e.autocapture.elementInteractions=="object")return e.autocapture.elementInteractions},Is=function(e){if(no(e.autocapture)&&typeof e.autocapture=="object"&&typeof e.autocapture.frustrationInteractions=="object")return e.autocapture.frustrationInteractions},xs=function(e){if(to(e.autocapture)){var t=void 0;
5return typeof e.autocapture=="object"&&typeof e.autocapture.networkTracking=="object"?t=e.autocapture.networkTracking:e.networkTrackingOptions&&(t=e.networkTrackingOptions),b(b({},t),{captureRules:Ui(t?.captureRules,e.loggerProvider)})}},io=function(e){var t=function(){return!1},r=void 0,n,i=e.pageCounter,o=Zi(e.defaultTracking);return o&&(t=void 0,n=void 0,e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.pageViews&&typeof e.defaultTracking.pageViews=="object"&&("trackOn"in e.defaultTracking.pageViews&&(t=e.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in e.defaultTracking.pageViews&&(r=e.defaultTracking.pageViews.trackHistoryChanges),"eventType"in e.defaultTracking.pageViews&&e.defaultTracking.pageViews.eventType&&(n=e.defaultTracking.pageViews.eventType))),{trackOn:t,trackHistoryChanges:r,eventType:n,pageCounter:i}},ws=function(e){return en(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking=="object"&&e.defaultTracking.attribution&&typeof e.defaultTracking.attribution=="object"?b({},e.defaultTracking.attribution):{}},Ps=function(e){if(Qi(e.defaultTracking)&&e.defaultTracking&&typeof e.defaultTracking=="object"&&typeof e.defaultTracking.formInteractions=="object")return e.defaultTracking.formInteractions};var Sd=function(e,t){lr(e,t)},lr=function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.name,o=n.args,a=n.resolve,s=e&&e[i];if(typeof s=="function"){var l=s.apply(e,o);typeof a=="function"&&a(l?.promise)}}return e},tn=function(e){var t=e;return t&&t._q!==void 0};var Ad=function(e){var t,r;return typeof((r=(t=e.chrome)===null||t===void 0?void 0:t.runtime)===null||r===void 0?void 0:r.id)=="string"},Id=function(e){var t=e.ServiceWorkerGlobalScope;return typeof t=="function"&&e instanceof t},xd=function(e){var t=e.WorkerGlobalScope;return typeof t=="function"&&e instanceof t},wd=function(e){return typeof e.document<"u"},Pd=function(e){var t,r;return typeof((r=(t=e.process)===null||t===void 0?void 0:t.versions)===null||r===void 0?void 0:r.node)=="string"};function Cs(){var e=C();if(!e)return"unknown";var t=Ad(e);return Id(e)?t?"chrome_extension_service_worker":"service_worker":xd(e)?"web_worker":wd(e)?t?"chrome_extension":"browser":Pd(e)?"node":"unknown"}var Ct="2.47.1";var rn="amplitude-ts";var oo="Web",Cd="$remote",Rs=(function(){function e(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="".concat(rn,"/").concat(Ct),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return e.prototype.setup=function(t){return this.config=t,Promise.resolve(void 0)},e.prototype.execute=function(t){var r,n;return T(this,void 0,void 0,function(){var i,o,a,s;return y(this,function(l){return i=new Date().getTime(),o=(r=this.config.lastEventId)!==null&&r!==void 0?r:-1,a=(n=t.event_id)!==null&&n!==void 0?n:o+1,this.config.lastEventId=a,t.time||(this.config.lastEventTime=i),s=b(b(b(b(b(b(b(b({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:oo}),this.config.trackingOptions.language&&{language:Ei()}),this.config.trackingOptions.ipAddress&&{ip:Cd}),{insert_id:ne(),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}}),t),{event_id:a,library:this.library,user_agent:this.userAgent}),[2,s]})})},e})();var nn=1e3,ao=(function(e){ge(t,e);function t(r){var n=this,i,o,a;try{a=(i=C())===null||i===void 0?void 0:i.localStorage}catch(s){(o=r?.loggerProvider)===null||o===void 0||o.debug("Failed to access localStorage. error=".concat(JSON.stringify(s))),a=void 0}return n=e.call(this,a)||this,n.loggerProvider=r?.loggerProvider,n}return t.prototype.set=function(r,n){var i;return T(this,void 0,void 0,function(){var o;return y(this,function(a){switch(a.label){case 0:return Array.isArray(n)&&n.length>nn?(o=n.length-nn,[4,e.prototype.set.call(this,r,n.slice(0,nn))]):[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(nn,".")),[3,4];case 2:return[4,e.prototype.set.call(this,r,n)];case 3:a.sent(),a.label=4;case 4:return[2]}})})},t})(qe);var Ls=(function(e){ge(t,e);function t(){var r;return e.call(this,(r=C())===null||r===void 0?void 0:r.sessionStorage)||this}return t})(qe);var Os=(function(e){ge(t,e);function t(r){r===void 0&&(r={});var n=e.call(this)||this;return n.state={done:4},n.customHeaders=r,n}return t.prototype.send=function(r,n,i){return i===void 0&&(i=!1),T(this,void 0,void 0,function(){var o=this;return y(this,function(a){return[2,new Promise(function(s,l){typeof XMLHttpRequest>"u"&&l(new Error("XHRTransport is not supported."));var u=new XMLHttpRequest;u.open("POST",r,!0),u.onreadystatechange=function(){if(u.readyState===o.state.done){var h=u.responseText;try{s(o.buildResponse(JSON.parse(h)))}catch{s(o.buildResponse({code:u.status}))}}};var c={"Content-Type":"application/json",Accept:"*/*"},d=JSON.stringify(n),f=i&&d.length>=Yt&&$t(),v=function(h){var g,m;c=b(b({},o.customHeaders),c);try{for(var E=P(Object.entries(c)),_=E.next();!_.done;_=E.next()){var S=w(_.value,2),I=S[0],A=S[1];u.setRequestHeader(I,A)}}catch(x){g={error:x}}finally{try{_&&!_.done&&(m=E.return)&&m.call(E)}finally{if(g)throw g.error}}
5u.send(h)},p=function(){return T(o,void 0,void 0,function(){var h;return y(this,function(g){switch(g.label){case 0:return f?[4,Jt(d)]:[3,2];case 1:return h=g.sent(),h?(c["Content-Encoding"]="gzip",v(h)):v(d),[3,3];case 2:v(d),g.label=3;case 3:return[2]}})})};p().catch(l)})]})})},t})(at);var Rd=16*1024,ks=(function(e){ge(t,e);function t(r,n,i){r===void 0&&(r={});var o=e.call(this)||this;return o.customHeaders=r,o.enableKeepalive=n!==!1,o.referrerPolicy=i,o}return t.prototype.send=function(r,n,i){return i===void 0&&(i=!1),T(this,void 0,void 0,function(){var o,a,s,l,u,c,d,f,v;return y(this,function(p){switch(p.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return o=JSON.stringify(n),a=i&&o.length>=Yt&&$t(),s=o,l={"Content-Type":"application/json",Accept:"*/*"},a?[4,Jt(o)]:[3,2];case 1:u=p.sent(),u&&(l["Content-Encoding"]="gzip",s=u),p.label=2;case 2:return l=b(b({},this.customHeaders),l),c=typeof s=="string"?s.length:s.byteLength,d={headers:l,body:s,method:"POST",keepalive:this.enableKeepalive&&c<=Rd},this.referrerPolicy&&(d.referrerPolicy=this.referrerPolicy),[4,fetch(r,d)];case 3:return f=p.sent(),[4,f.text()];case 4:v=p.sent();try{return[2,this.buildResponse(JSON.parse(v))]}catch{return[2,this.buildResponse({code:f.status})]}return[2]}})})},t})(at);var Ds=(function(e){ge(t,e);function t(){return e.call(this)||this}return t.prototype.send=function(r,n,i){return i===void 0&&(i=!1),T(this,void 0,void 0,function(){var o=this;return y(this,function(a){return[2,new Promise(function(s,l){var u=C();if(!u?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var c=JSON.stringify(n),d=u.navigator.sendBeacon(r,c);return s(d?o.buildResponse({code:200,events_ingested:n.events.length,payload_size_bytes:c.length,server_upload_time:Date.now()}):o.buildResponse({code:500}))}catch(f){l(f)}})]})})},t})(at);var Ns=function(e,t,r){return r===void 0&&(r=!0),T(void 0,void 0,void 0,function(){var n,i,o,a,s,l,u,c,d;return y(this,function(f){switch(f.label){case 0:return n=mi(e),[4,t.getRaw(n)];case 1:return i=f.sent(),i?r?[4,t.remove(n)]:[3,3]:[2,{optOut:!1}];case 2:f.sent(),f.label=3;case 3:return o=w(i.split("."),6),a=o[0],s=o[1],l=o[2],u=o[3],c=o[4],d=o[5],[2,{deviceId:a,userId:Ld(s),sessionId:so(u),lastEventId:so(d),lastEventTime:so(c),optOut:!!l}]}})})},so=function(e){var t=parseInt(e,32);if(!isNaN(t))return t},Ld=function(e){if(!(!atob||!escape||!e))try{return decodeURIComponent(escape(atob(e)))}catch{return}};var Pe="[Amplitude]",zm="".concat(Pe," Page Viewed"),uo="".concat(Pe," Form Started"),Ms="".concat(Pe," Form Submitted"),Us="".concat(Pe," File Downloaded"),lo="session_start",co="session_end",Fs="".concat(Pe," File Extension"),Vs="".concat(Pe," File Name"),Gs="".concat(Pe," Link ID"),Hs="".concat(Pe," Link Text"),Bs="".concat(Pe," Link URL"),on="".concat(Pe," Form ID"),an="".concat(Pe," Form Name"),sn="".concat(Pe," Form Destination"),cr="cookie",un="US";var Ws={};Sc(Ws,{DEFAULT_ACTION_CLICK_ALLOWLIST:()=>rr,DEFAULT_CSS_SELECTOR_ALLOWLIST:()=>tr,DEFAULT_DATA_ATTRIBUTE_PREFIX:()=>ut,EXCLUDE_INTERNAL_REFERRERS_CONDITIONS:()=>pt,IdentifyOperation:()=>Ee,LogLevel:()=>re,OfflineDisabled:()=>er,RevenueProperty:()=>be,ServerZone:()=>Zt,SpecialEventType:()=>se});var qs=function(e){var t=e.split(".");return t.length<=2?e:t.slice(t.length-2,t.length).join(".")},Od=function(e){return Object.values(e).every(function(t){return!t})},kd=function(e){var t=b(b({},e),{referring_domain:void 0,referrer:void 0});return Object.values(t).every(function(r){return!r})},Xs=function(e,t,r,n,i,o){i===void 0&&(i=!0);var a=e.referrer,s=e.referring_domain,l=nt(e,["referrer","referring_domain"]),u=t||{},c=u.referrer,d=u.referring_domain,f=nt(u,["referrer","referring_domain"]),v=r.excludeInternalReferrers;if(v){var p=Md(v,n);if(!(p instanceof TypeError)&&e.referring_domain&&Ud(e.referring_domain,o)){if(p==="always")return Ks(p,e.referring_domain,n),!1;if(p==="ifEmptyCampaign"&&kd(e))return Ks(p,e.referring_domain,n),!1}}if(Dd(r.excludeReferrers,e.referring_domain))return n.debug("This is not a new campaign because ".concat(e.referring_domain," is in the exclude referrer list.")),!1;if(!i&&Od(e)&&t)return n.debug("This is not a new campaign because this is a direct traffic in the same session."),!1;var h=JSON.stringify(l)!==JSON.stringify(f),g=qs(s||"")!==qs(d||""),m=!t||h||g;return m?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."),m},Dd=function(e,t){return e===void 0&&(e=[]),t===void 0&&(t=""),e.some(function(r){return r instanceof RegExp?r.test(t):r===t})},Nd=function(e,t){var r=t.startsWith(".")?t:".".concat(t),n=e.startsWith(".")?e:".".concat(e);return!!n.endsWith(r)},js=function(e,t){var r=b(b({},Be),e),n=Object.entries(r).reduce(function(i,o){var a,s=w(o,2),l=s[0],u=s[1];return i.setOnce("initial_".concat(l),(a=u??t.initialEmptyValue)!==null&&a!==void 0?a:"EMPTY"),u?i.set(l,u):i.unset(l)},new Ue);return it(n)},zs=function(e){var t=e;
5return t?(t.startsWith(".")&&(t=t.substring(1)),[new RegExp("".concat(t.replace(".","\\."),"$"))]):[]},Md=function(e,t){if(e===!0)return pt.always;if(typeof e=="object"){var r=e.condition;if(typeof r=="string"&&Object.keys(pt).includes(r))return r;if(typeof r>"u")return pt.always}var n="Invalid configuration provided for attribution.excludeInternalReferrers: ".concat(JSON.stringify(e));return t.error(n),new TypeError(n)};function Ks(e,t,r){var n="This is not a new campaign because referring_domain=".concat(t," is on the same domain as the current page and it is configured to exclude internal referrers");e==="always"?r.debug(n):e==="ifEmptyCampaign"&&r.debug("".concat(n," with empty campaign parameters"))}var fo=["ac.in","ac.jp","ac.kr","ac.th","ac.uk","ac.za","appspot.com","asn.au","azurewebsites.net","cloudfront.net","myshopify.com","blogspot.com","co.ca","co.in","co.jp","co.kr","co.nz","co.th","co.uk","co.za","com.ar","com.au","com.br","com.cn","com.hk","com.in","com.jp","com.kr","com.mx","com.pl","com.sg","com.tr","com.tw","ed.jp","edu.au","edu.br","edu.cn","edu.hk","edu.sg","edu.th","edu.tr","edu.tw","firebaseapp.com","fly.dev","gc.ca","geek.nz","github.io","gitlab.io","go.jp","go.kr","go.th","gob.ar","gob.mx","gov.au","gov.br","gov.cn","gov.hk","gov.in","gov.pl","gov.sg","gov.tr","gov.tw","gov.uk","gov.za","govt.nz","gr.jp","herokuapp.com","id.au","idv.hk","iwi.nz","lg.jp","ltd.uk","maori.nz","me.uk","mil.kr","ne.jp","ne.kr","net.au","net.br","net.cn","net.hk","net.in","net.nz","net.pl","net.sg","net.tr","net.tw","net.za","onrender.com","or.jp","or.kr","or.th","org.ar","org.au","org.br","org.cn","org.hk","org.in","org.mx","org.nz","org.pl","org.sg","org.tw","org.uk","org.za","pages.dev","pe.kr","plc.uk","re.kr","res.in","sch.uk","vercel.app","netlify.app","workers.dev"],vo=function(e){var t,r,n=e||((r=(t=C())===null||t===void 0?void 0:t.location)===null||r===void 0?void 0:r.hostname);if(!n)return"";var i=n.split("."),o=i[i.length-1],a=i[i.length-2];return fo.find(function(s){return n.endsWith(".".concat(s))})&&(o=i[i.length-2]+"."+i[i.length-1],a=i[i.length-3]),a?"".concat(a,".").concat(o):o},Ud=function(e,t){var r=C();if(!r)return!1;var n=(t||"").trim()||vo(r.location.hostname);return Nd(e,n)};var Fd=(function(e){ge(t,e);function t(r,n,i,o,a,s,l,u,c,d,f,v,p,h,g,m,E,_,S,I,A,x,R,D,G,k,U,L,M,V,H,X,pe,Se,Ne,F,B,ee,oe,de,he,ae,Ae,ue){i===void 0&&(i=new zt),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),u===void 0&&(u=1e3),c===void 0&&(c=5),d===void 0&&(d=30),f===void 0&&(f=cr),m===void 0&&(m=new ot),E===void 0&&(E=re.Warn),S===void 0&&(S=!1),I===void 0&&(I=!1),R===void 0&&(R=""),D===void 0&&(D=un),U===void 0&&(U=1800*1e3),L===void 0&&(L=new ao({loggerProvider:m})),M===void 0&&(M={ipAddress:!0,language:!0,platform:!0}),V===void 0&&(V="fetch"),H===void 0&&(H=!1),X===void 0&&(X=!0),ee===void 0&&(ee=!0),oe===void 0&&(oe=0),Ae===void 0&&(Ae=!1);var O=this,fe;O=e.call(this,{apiKey:r,instanceName:p,storageProvider:L,transportProvider:po(V)})||this,O.apiKey=r,O.appVersion=n,O.cookieOptions=o,O.defaultTracking=a,O.autocapture=s,O.flushIntervalMillis=u,O.flushMaxRetries=c,O.flushQueueSize=d,O.identityStorage=f,O.ingestionMetadata=v,O.loggerProvider=m,O.logLevel=E,O.minIdLength=_,O.offline=S,O.partnerId=A,O.plan=x,O.serverUrl=R,O.serverZone=D,O.sessionTimeout=U,O.storageProvider=L,O.trackingOptions=M,O.transport=V,O.useBatch=H,O.fetchRemoteConfig=X,O.networkTrackingOptions=F,O.identify=B,O.enableDiagnostics=ee,O.diagnosticsSampleRate=oe,O.diagnosticsClient=de,O.remoteConfig=he,O.topLevelDomain=ae,O.enableRequestBodyCompression=Ae,O.customEnrichment=ue,O.version=Ct,O._optOut=!1,O._cookieStorage=i,O.deviceId=l,O.lastEventId=h,O.lastEventTime=g,O.optOut=I,O.deferredSessionId=k,O.sessionId=G,O.pageCounter=Se,O.userId=pe,O.debugLogsEnabled=Ne,O.loggerProvider.enable(Ne?re.Debug:O.logLevel),O.networkTrackingOptions=F,O.identify=B,O.enableDiagnostics=ee,O.diagnosticsSampleRate=oe,O.diagnosticsClient=de;var ve=(fe=he?.fetchRemoteConfig)!==null&&fe!==void 0?fe:X;return O.remoteConfig=O.remoteConfig||{},O.remoteConfig.fetchRemoteConfig=ve,O.fetchRemoteConfig=ve,O.topLevelDomain=ae||vo(),O}return Object.defineProperty(t.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(r){this._cookieStorage!==r&&(this._cookieStorage=r,this.updateStorage())}
5,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceId",{get:function(){return this._deviceId},set:function(r){this._deviceId!==r&&(this._deviceId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"userId",{get:function(){return this._userId},set:function(r){this._userId!==r&&(this._userId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sessionId",{get:function(){return this._sessionId},set:function(r){this._sessionId!==r&&(this._sessionId=r,r!==void 0&&this._deferredSessionId!==void 0&&(this._deferredSessionId=void 0),this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deferredSessionId",{get:function(){return this._deferredSessionId},set:function(r){this._deferredSessionId!==r&&r!==this.sessionId&&(this._deferredSessionId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(r){this._optOut!==r&&(this._optOut=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(r){this._lastEventTime!==r&&(this._lastEventTime=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(r){this._lastEventId!==r&&(this._lastEventId=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(r){this._pageCounter!==r&&(this._pageCounter=r,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugLogsEnabled",{set:function(r){this._debugLogsEnabled!==r&&(this._debugLogsEnabled=r,this.updateStorage())},enumerable:!1,configurable:!0}),t.prototype.updateStorage=function(){var r={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,deferredSessionId:this._deferredSessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter,debugLogsEnabled:this._debugLogsEnabled,cookieDomain:void 0};this.cookieStorage instanceof St&&(r.cookieDomain=this.cookieStorage.options.domain),this.cookieStorage.set(Fr(this.apiKey),r)},t})(ci);var Ys=function(e,t,r,n,i){return t===void 0&&(t={}),T(void 0,void 0,void 0,function(){var o,a,s,l,u,c,d,f,v,p,h,g,m,E,_,S,I,A,x,R,D,G,k,U,L,M,V,H,X,pe,Se,Ne,F,B,ee,oe,de,he,ae,Ae,ue,O,fe,ve,Re,K,Ie,Le,Me,tt,rt;return y(this,function(He){switch(He.label){case 0:return o=t.identityStorage||cr,a="",o===cr&&!(!((G=t.cookieOptions)===null||G===void 0)&&G.domain)&&((k=t.cookieOptions)===null||k===void 0?void 0:k.domain)!==""?[4,Gd(void 0,n)]:[3,2];case 1:a=He.sent(),He.label=2;case 2:return s=b({domain:(L=(U=t.cookieOptions)===null||U===void 0?void 0:U.domain)!==null&&L!==void 0?L:a,expiration:365,sameSite:"Lax",secure:!1,upgrade:!0},t.cookieOptions),l={duplicateResolverFn:function(Mt){var _t=Vr(Mt);if(!_t)return!1;var Ut=JSON.parse(_t);return Gr(Ut.cookieDomain,s.domain)},diagnosticsClient:n},u=Vd(t.identityStorage,s,l),[4,Ns(e,u,(V=(M=t.cookieOptions)===null||M===void 0?void 0:M.upgrade)!==null&&V!==void 0?V:!0)];case 3:return c=He.sent(),[4,u.get(Fr(e))];case 4:return d=He.sent(),f=Ye(),v=f.ampTimestamp?Number(f.ampTimestamp):void 0,p=v?Date.now()<v:!0,h=(Ne=(Se=(pe=(H=t.deviceId)!==null&&H!==void 0?H:p?(X=f.ampDeviceId)!==null&&X!==void 0?X:f.deviceId:void 0)!==null&&pe!==void 0?pe:d?.deviceId)!==null&&Se!==void 0?Se:c.deviceId)!==null&&Ne!==void 0?Ne:ne(),g=(F=d?.lastEventId)!==null&&F!==void 0?F:c.lastEventId,m=(B=d?.lastEventTime)!==null&&B!==void 0?B:c.lastEventTime,E=(oe=(ee=t.optOut)!==null&&ee!==void 0?ee:d?.optOut)!==null&&oe!==void 0?oe:c.optOut,_=(de=d?.sessionId)!==null&&de!==void 0?de:c.sessionId,S=d?.deferredSessionId,I=(ae=(he=t.userId)!==null&&he!==void 0?he:d?.userId)!==null&&ae!==void 0?ae:c.userId,r.previousSessionDeviceId=(Ae=d?.deviceId)!==null&&Ae!==void 0?Ae:c.deviceId,r.previousSessionUserId=(ue=d?.userId)!==null&&ue!==void 0?ue:c.userId,A={ipAddress:(fe=(O=t.trackingOptions)===null||O===void 0?void 0:O.ipAddress)!==null&&fe!==void 0?fe:!0,language:(Re=(ve=t.trackingOptions)===null||ve===void 0?void 0:ve.language)!==null&&Re!==void 0?Re:!0,platform:(Ie=(K=t.trackingOptions)===null||K===void 0?void 0:K.platform)!==null&&Ie!==void 0?Ie:!0}
5,x=d?.pageCounter,R=d?.debugLogsEnabled,t.autocapture!==void 0&&(t.defaultTracking=t.autocapture),D=new Fd(e,t.appVersion,u,s,t.defaultTracking,t.autocapture,h,t.flushIntervalMillis,t.flushMaxRetries,t.flushQueueSize,o,t.ingestionMetadata,t.instanceName,g,m,(Le=i?.loggerProvider)!==null&&Le!==void 0?Le:t.loggerProvider,t.logLevel,t.minIdLength,t.offline,E,t.partnerId,t.plan,t.serverUrl,(Me=i?.serverZone)!==null&&Me!==void 0?Me:t.serverZone,_,S,t.sessionTimeout,t.storageProvider,A,t.transport,t.useBatch,t.fetchRemoteConfig,I,x,R,t.networkTrackingOptions,t.identify,(tt=i?.enableDiagnostics)!==null&&tt!==void 0?tt:t.enableDiagnostics,(rt=i?.diagnosticsSampleRate)!==null&&rt!==void 0?rt:r._diagnosticsSampleRate,n,t.remoteConfig,a,t.enableRequestBodyCompression,t.customEnrichment),[4,D.storageProvider.isEnabled()];case 5:return He.sent()||(D.loggerProvider.warn("Storage provider ".concat(D.storageProvider.constructor.name," is not enabled. Falling back to MemoryStorage.")),D.storageProvider=new zt),[2,D]}})})},Vd=function(e,t,r){switch(e===void 0&&(e=cr),t===void 0&&(t={}),e){case"localStorage":return new ao;case"sessionStorage":return new Ls;case"none":return new zt;default:return new St(b(b({},t),{expirationDays:t.expiration}),r)}},$s=function(e){var t,r;return e===void 0&&(e={}),((t=e.remoteConfig)===null||t===void 0?void 0:t.fetchRemoteConfig)===!0?!0:!(((r=e.remoteConfig)===null||r===void 0?void 0:r.fetchRemoteConfig)===!1||e.fetchRemoteConfig===!1)},po=function(e){var t=typeof e=="object"?e.type:e,r=typeof e=="object"?e.headers:void 0,n=typeof e=="object"?e.enableKeepalive:void 0,i=typeof e=="object"?e.referrerPolicy:void 0;return t==="xhr"?new Os(r):t==="beacon"?new Ds:new ks(r,n,i)},Gd=function(e,t){return T(void 0,void 0,void 0,function(){var r,n,i,o,a,a,s,l,u;return y(this,function(c){switch(c.label){case 0:return[4,new St(void 0,{diagnosticsClient:t}).isEnabled()];case 1:if(!c.sent()||!e&&(typeof location>"u"||!location.hostname))return[2,""];if(r=e??location.hostname,n=r.split("."),n.length===1)return[2,""];for(i=[],o=1,fo.find(function(d){return r.endsWith(".".concat(d))})&&(o=2),a=n.length-o-1;a>=0;--a)i.push(n.slice(a).join("."));a=0,c.label=2;case 2:if(!(a<i.length))return[3,7];s=i[a],c.label=3;case 3:return c.trys.push([3,5,,6]),[4,St.isDomainWritable(s)];case 4:return l=c.sent(),l?[2,"."+s]:[3,6];case 5:return u=c.sent(),t&&t.recordEvent("cookies.tld.failure",{reason:"Unexpected exception checking domain is writable: ".concat(s),error:u instanceof Error?u.message:String(u)}),[3,6];case 6:return a++,[3,2];case 7:return t&&t.recordEvent("cookies.tld.failure",{reason:"Could not determine TLD for host ".concat(r)}),[2,""]}})})};var Hd="[Amplitude] Page Viewed",ho="AMP_PAGE_VIEW",ln=function(e){e===void 0&&(e={});var t,r=C(),n=void 0,i=!1,o,a,s=e.trackOn,l=e.trackHistoryChanges,u=e.eventType,c=u===void 0?Hd:u,d=function(E){var _=E;try{_=decodeURI(E)}catch(S){n?.error("Malformed URI sequence: ",S)}return _},f=function(E){return T(void 0,void 0,void 0,function(){var _,S,I;return y(this,function(A){switch(A.label){case 0:return _=d(typeof location<"u"&&location.href||""),I={event_type:c},S=[{}],[4,Bd()];case 1:return[2,(I.event_properties=b.apply(void 0,[b.apply(void 0,S.concat([A.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":_,"[Amplitude] Page Path":typeof location<"u"&&d(location.pathname)||"","[Amplitude] Page Title":ft(dt),"[Amplitude] Page URL":_.split("?")[0],"[Amplitude] Page View ID":E}]),I)]}})})},v=function(){return typeof s>"u"||typeof s=="function"&&s()},p=typeof location<"u"?location.href:null,h=function(){return T(void 0,void 0,void 0,function(){var E,_,S,I,A,x;return y(this,function(R){switch(R.label){case 0:return E=location.href,_=qd(l,E,p||"")&&v(),p=E,_?(S=void 0,a&&(S=ne(),a.set(ho,{pageViewId:S})),n?.log("Tracking page view event"),t!=null?[3,1]:(I=void 0,[3,3])):[3,4];case 1:return x=(A=t).track,[4,f(S)];case 2:I=x.apply(A,[R.sent()]),R.label=3;case 3:R.label=4;case 4:return[2]}})})},g=function(){h()},m={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(E,_){return T(void 0,void 0,void 0,function(){var S,I,A;return y(this,function(x){switch(x.label){case 0:if(t=_,o=E,n=E.loggerProvider,n.log("Installing @amplitude/plugin-page-view-tracking-browser"),i=!0,r){try{a=new qe(r.sessionStorage)}catch{n?.debug("sessionStorage is not available in this environment.")}r.addEventListener("popstate",g),r.history.pushState=new Proxy(r.history.pushState,{apply:function(R,D,G){var k=w(G,3),U=k[0],L=k[1],M=k[2];R.apply(D,[U,L,M]),i&&g()}})}return v()?(n.log("Tracking page view event"),S=void 0,a&&(S=ne(),a.set(ho,{pageViewId:S})),A=(I=t).track,[4,f(S)]):[3,2];case 1:A.apply(I,[x.sent()]),x.label=2;case 2:return[2]}})})},execute:function(E){return T(void 0,void 0,void 0,function(){var _,S,I;return y(this,function(A){switch(A.label){case 0:return s==="attribution"&&Wd(E)?(n?.log("Enriching c
5ampaign event to page view event with campaign parameters"),_=void 0,a?[4,a.get(ho)]:[3,2]):[3,4];case 1:S=A.sent(),_=S?.pageViewId,A.label=2;case 2:return[4,f(_)];case 3:I=A.sent(),E.event_type=I.event_type,E.event_properties=b(b({},E.event_properties),I.event_properties),A.label=4;case 4:return o&&E.event_type===c&&(o.pageCounter=o.pageCounter?o.pageCounter+1:1,E.event_properties=b(b({},E.event_properties),{"[Amplitude] Page Counter":o.pageCounter})),[2,E]}})})},teardown:function(){return T(void 0,void 0,void 0,function(){return y(this,function(E){return r&&(r.removeEventListener("popstate",g),i=!1),[2]})})}};return m},Bd=function(){return T(void 0,void 0,void 0,function(){var e;return y(this,function(t){switch(t.label){case 0:return e=jt,[4,new ct().parse()];case 1:return[2,e.apply(void 0,[t.sent()])]}})})},Wd=function(e){if(e.event_type==="$identify"&&e.user_properties){var t=e.user_properties,r=t[Ee.SET]||{},n=t[Ee.UNSET]||{},i=N(N([],w(Object.keys(r)),!1),w(Object.keys(n)),!1);return Object.keys(Be).every(function(o){return i.includes(o)})}return!1},qd=function(e,t,r){switch(e){case"pathOnly":{if(r=="")return!0;var n=new URL(t),i=new URL(r),o=n.origin+n.pathname,a=i.origin+i.pathname;return o!==a}default:return t!==r}};var Qs=function(){var e,t=[],r=function(c,d,f){c.addEventListener(d,f),t.push({element:c,type:d,handler:f})},n=function(){t.forEach(function(c){var d=c.element,f=c.type,v=c.handler;d?.removeEventListener(f,v)}),t=[]},i,o="@amplitude/plugin-form-interaction-tracking-browser",a="enrichment",s=function(c,d){return T(void 0,void 0,void 0,function(){var f,v;return y(this,function(p){return i=Ps(c),f=function(){if(!d){c.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 h=new WeakSet,g=function(E){if(!h.has(E)){h.add(E);var _=!1;r(E,"change",function(){var S,I=Js(E);_||d.track(uo,(S={},S[on]=Rt(E.id),S[an]=Rt(E.name),S[sn]=I,S)),_=!0}),r(E,"submit",function(S){var I,A,x=Js(E);if(_||d.track(uo,(I={},I[on]=Rt(E.id),I[an]=Rt(E.name),I[sn]=x,I)),_=!0,i?.shouldTrackSubmit!==void 0)if(typeof i.shouldTrackSubmit=="function"&&typeof SubmitEvent<"u"&&S instanceof SubmitEvent)try{var R=i.shouldTrackSubmit(S);if(!R)return}catch{c.loggerProvider.warn("shouldTrackSubmit callback threw an error, proceeding with tracking.")}else c.loggerProvider.warn("shouldTrackSubmit is ignored because it is not a function or event is not a SubmitEvent.");d.track(Ms,(A={},A[on]=Rt(E.id),A[an]=Rt(E.name),A[sn]=x,A)),_=!1})}},m=Array.from(document.getElementsByTagName("form"));m.forEach(g),typeof MutationObserver<"u"&&(e=new MutationObserver(function(E){E.forEach(function(_){_.addedNodes.forEach(function(S){try{if(S.nodeName==="FORM"&&g(S),"querySelectorAll"in S&&typeof S.querySelectorAll=="function"){var I=S,A=I.querySelectorAll("form");A?.forEach(g)}}catch(x){c.loggerProvider.warn("Failed to track form interactions for an added node: ".concat(String(x)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?f():(v=C(),v?v.addEventListener("load",f):c.loggerProvider.debug("Form interaction tracking is not installed because global is undefined.")),[2]})})},l=function(c){return T(void 0,void 0,void 0,function(){return y(this,function(d){return[2,c]})})},u=function(){return T(void 0,void 0,void 0,function(){return y(this,function(c){return e?.disconnect(),n(),[2]})})};return{name:o,type:a,setup:s,execute:l,teardown:u}},Rt=function(e){if(typeof e=="string")return e},Js=function(e){var t=e.getAttribute("action");try{t=new URL(encodeURI(t??""),window.location.href).href}catch{}return t};var Zs=function(){var e,t=[],r=function(u,c,d){u.addEventListener(c,d),t.push({element:u,type:c,handler:d})},n=function(){t.forEach(function(u){var c=u.element,d=u.type,f=u.handler;c?.removeEventListener(d,f)}),t=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",a=function(u,c){return T(void 0,void 0,void 0,function(){var d,f;return y(this,function(v){return d=function(){if(!c){u.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 p=function(m){var E;try{E=new URL(m.href,window.location.href)}catch{return}var _=h.exec(E.href),S=_?.[1];S&&r(m,"click",function(){var I;S&&c.track(Us,(I={},I[Fs]=S,I[Vs]=E.pathname,I[Gs]=m.id,I[Hs]=m.text,I[Bs]=m.href,I))})},h=/\.(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)(\?.+)?$/,g=Array.from(document.getElementsByTagName("a"));g.forEach(p),typeof MutationObserver<"u"&&(e=new MutationObserver(function(m){m.forEach(function(E){E.addedNodes.forEac
5h(function(_){try{if(_.nodeName==="A"&&p(_),"querySelectorAll"in _&&typeof _.querySelectorAll=="function"){var S=_,I=S.querySelectorAll("a");I?.forEach(p)}}catch(A){u.loggerProvider.warn("Failed to track file downloads for an added node: ".concat(String(A)))}})})}),e.observe(document.body,{subtree:!0,childList:!0}))}},document.readyState==="complete"?d():(f=C(),f?f.addEventListener("load",d):u.loggerProvider.debug("File download tracking is not installed because global is undefined.")),[2]})})},s=function(u){return T(void 0,void 0,void 0,function(){return y(this,function(c){return[2,u]})})},l=function(){return T(void 0,void 0,void 0,function(){return y(this,function(u){return e?.disconnect(),n(),[2]})})};return{name:i,type:o,setup:a,execute:s,teardown:l}};var eu=!1,tu=function(e){if(!(eu||e.defaultTracking!==void 0)){var t=`\`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:
6
7amplitude.init(<YOUR_API_KEY>, {
8  defaultTracking: true,
9});
10
11Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-default-events for more details.`;e.loggerProvider.warn(t),eu=!0}};var ru=function(){var e="@amplitude/plugin-network-checker-browser",t="before",r=C(),n=[],i=function(l,u){r?.addEventListener&&(r?.addEventListener(l,u),n.push({type:l,handler:u}))},o=function(){n.forEach(function(l){var u=l.type,c=l.handler;r?.removeEventListener(u,c)}),n=[]},a=function(l,u){return T(void 0,void 0,void 0,function(){return y(this,function(c){return typeof navigator>"u"?(l.loggerProvider.debug("Network connectivity checker plugin is disabled because navigator is not available."),l.offline=!1,[2]):(l.offline=!navigator.onLine,i("online",function(){l.offline!==!1&&(l.loggerProvider.debug("Network connectivity changed to online."),l.offline=!1,setTimeout(function(){u.flush()},l.flushIntervalMillis))}),i("offline",function(){l.loggerProvider.debug("Network connectivity changed to offline."),l.offline=!0}),[2])})})},s=function(){return T(void 0,void 0,void 0,function(){return y(this,function(l){return o(),[2]})})};return{name:e,type:t,setup:a,teardown:s}};function nu(e,t){var r,n;if(e){Zr(e);try{t.loggerProvider.debug("Update browser config with remote configuration:",me(e));var i=e;if(i&&"autocapture"in i){if(typeof i.autocapture=="boolean"&&(t.autocapture=i.autocapture),typeof i.autocapture=="object"&&i.autocapture!==null){var o=b({},i.autocapture);if(t.autocapture===void 0&&(t.autocapture=i.autocapture),typeof i.autocapture.elementInteractions=="object"&&i.autocapture.elementInteractions!==null&&(!((r=i.autocapture.elementInteractions.pageUrlAllowlistRegex)===null||r===void 0)&&r.length)){o.elementInteractions=b({},i.autocapture.elementInteractions);var a=o.elementInteractions,s=(n=a.pageUrlAllowlist)!==null&&n!==void 0?n:[],l=i.autocapture.elementInteractions.pageUrlAllowlistRegex;a.pageUrlAllowlist=Qr(s,l,t.loggerProvider),delete a.pageUrlAllowlistRegex}var u=Ji(i.autocapture.networkTracking,t.loggerProvider);u&&(o.networkTracking=u),typeof t.autocapture=="boolean"&&(t.autocapture=b({attribution:t.autocapture,fileDownloads:t.autocapture,formInteractions:t.autocapture,pageViews:t.autocapture,sessions:t.autocapture,elementInteractions:t.autocapture,webVitals:t.autocapture,frustrationInteractions:t.autocapture},o)),typeof t.autocapture=="object"&&(t.autocapture=b(b({},t.autocapture),o))}t.defaultTracking=t.autocapture}"customEnrichment"in i&&i.customEnrichment!==null&&t.customEnrichment!==!1&&(t.customEnrichment=i.customEnrichment),t.loggerProvider.debug("Browser config after remote config update:",me(t))}catch(c){t.loggerProvider.error("Failed to apply remote configuration because of error: ",c)}}}var cn="1.29.4";var iu="@amplitude/plugin-autocapture-browser",ou="@amplitude/plugin-frustration-browser",au="@amplitude/plugin-performance-browser",dn="[Amplitude] Element Clicked",su="[Amplitude] Dead Click",uu="[Amplitude] Rage Click",lu="[Amplitude] Error Click",cu="[Amplitude] Element Changed";var du="[Amplitude] Thrashed Cursor",fu="[Amplitude] Main Thread Block",vu="[Amplitude] Element ID",pu="[Amplitude] Element Class",go="[Amplitude] Element Tag",mo="[Amplitude] Element Text",hu="[Amplitude] Element Hierarchy",gu="[Amplitude] Element Href",mu="[Amplitude] Element Position Left",Eu="[Amplitude] Element Position Top",bu="[Amplitude] Element Aria Label",_u="[Amplitude] Element Attributes",yu="[Amplitude] Element Path",Tu="[Amplitude] Element Parent Label",dr="[Amplitude] Page URL",Su="[Amplitude] Page Title",fn="[Amplitude] Viewport Height",vn="[Amplitude] Viewport Width",Au="[Amplitude] Max Page X",Iu="[Amplitude] Max Page Y",pn="[Amplitude] Page View ID",xu="https://cdn.amplitude.com/libs/visual-tagging-selector-1.0.0-alpha.js.gz",wu="amp-visual-tagging-selector-highlight",hn="data-amp-mask-attributes",Eo="data-amp-internal-shadow",Pu=25,gn=128,Cu="AMP_PAGE_VIEW",Ru=18e3,Lu=.5,Ou=150,ku=4e3,Du=50;var Nu=[/^:r[0-9a-z]+:$/,/^radix-/,/^headlessui-/,/^mui-/,/^[a-f0-9]{16,}$/i,/-\d{8,}$/,/\d{4,}/];function Mu(e,t){var r,n,i=[];try{for(var o=P(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(u){var l=u instanceof Error?u.message:String(u);t?.warn('@amplitude/element-selector: ignoring invalid autogenerated-id pattern "'.concat(s,'" (').concat(l,")"))}}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}function Uu(e,t){var r,n;if(e==null||e==="")return!1;try{for(var i=P(t),o=i.next();!o.done;o=i.next()){var a=o.value;if(a.test(e))return!1}}catch(s){r={error:s}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}var Fu=[/^(p|m|px|py|mx|my|pt|pb|pl|pr|mt|mb|ml|mr)-\d+$/,/^(w|h|min-w|max-w|min-h|max-h)-/,/^(text|bg|border|ring|fill|stroke)-/,/^(hover|focus|active|disabled|group-hover):/,/^(sm|md|lg|xl|2xl):/,/^z-\d+$/,/^data-\[/,/^\[/,/^css-[a-z0-9]{6,}$/,/^[a-zA-Z]+_[a-zA-Z0-9]{3,}__[a-zA-Z0-9]{5,}$/,/^sc-[a-zA-Z0-9]{6,}$/,/^jsx-\d+$/,/^swiper-slide-(visible|fully-visible|active|prev|next|duplicate)$/,/^is-(active|open|selected|hovered|focused|expanded)$/,/^Mui[A-Z][a-zA-Z]+-(focused|selected|disabled|expanded|focusVisible|active|checked)$/,/^Mui-(selected|focused|disabled|expanded|focusVisible|active|checked)$/,/^data-state-/];function Vu(e,t){var r,n,i=[];try{for(var o=P(e),a=o.next();!a.done;a=o.next()){var s=a.value;try{i.push(new RegExp(s))}catch(u){var l=u instanceof Error?u.message:String(u);t?.warn('@amplitude/element-selector: ignoring invalid unstable-class pattern "'.concat(s,'" (').concat(l,")"))}}}catch(u){r={error:u}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}function mn(e,t){var r=e.getAttribute(t.explicitTrackingAttribute);if(r!==null&&r==="")return null;var n=e.getAttribute("id");return n===null||n===""||!Uu(n,t.autogeneratedIdPatterns)?null:n}function Gu(e,t){return t.map(Kd).join(" > ")}function Kd(e){var t=e.tagName.toLowerCase(),r=e.parentElement;if(r===null)return t;var n=Xd(e,r);return"".concat(t,":nth-of-type(").concat(n,")")}function Xd(e,t){for(var r=0,n=0;n<t.children.length;n++){var i=t.children[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var bo=" >>> ",_o=":scope > ";function ye(e){return typeof ShadowRoot<"u"&&e instanceof ShadowRoot}function Bu(e,t,r){return e&&r&&ye(t)?"".concat(_o).concat(e):e}function Wu(e){for(var t=e;t!==null;t=t.parentElement)if(t.getAttribute("id"))return!1;return!0}
11function jd(e){var t,r=e.getRootNode();return ye(r)?r:(t=e.ownerDocument)!==null&&t!==void 0?t:document}function qu(e){if(e.parentElement)return e.parentElement;var t=e.getRootNode();return ye(t)?t.host:null}var yo=1024,Ku=5e4;function fr(e,t){var r,n,i,o;return y(this,function(a){switch(a.label){case 0:r=e,n=0,i=0,a.label=1;case 1:return r!==null&&i<yo?(i+=1,[4,r]):[3,3];case 2:return a.sent(),r.parentElement?(r=r.parentElement,[3,1]):n<t&&typeof r.getRootNode=="function"&&(o=qu(r),o&&o!==r)?(n+=1,r=o,[3,1]):[3,3];case 3:return[2]}})}function vr(e,t){var r=[];if(t<=0)return r;for(var n=[[e,0]],i=0;n.length&&i<Ku;){i+=1;var o=w(n.pop(),2),a=o[0],s=o[1],l=a.shadowRoot;if(l&&s+1<=t){r.push({root:l,depth:s+1});for(var u=l.children,c=0;c<u.length;c++)n.push([u[c],s+1])}for(var d=a.children,c=0;c<d.length;c++)n.push([d[c],s])}return r}function pr(e,t){for(var r=[],n=e,i=0;n!==null&&i<yo;){i+=1;var o=jd(n);r.push({root:o,target:n});var a=n.getRootNode();if(!ye(a))break;n=a.host}var s=r.length-1,l=!1,u=r;return s>t&&(u=r.slice(s-t),l=!0),{segments:u.reverse(),truncated:l}}function Xu(e,t){var r=e.tagName.toLowerCase(),n=e.parentElement;if(n===null){var i=e.getRootNode();return t&&ye(i)?"".concat(r,":nth-of-type(").concat(Hu(e,i.children),")"):r}return"".concat(r,":nth-of-type(").concat(Hu(e,n.children),")")}function Hu(e,t){for(var r=0,n=0;n<t.length;n++){var i=t[n];if(i.tagName===e.tagName&&(r+=1,i===e))return r}return 1}var ju={name:"explicitTrackingAttribute",try:function(e,t){var r=t.config.explicitTrackingAttribute,n=e.getAttribute(r);return n===null||n===""?null:"[".concat(r,"=").concat(JSON.stringify(n),"]")}};function Lt(e){var t=globalThis.CSS;if(t&&typeof t.escape=="function")return t.escape(e);for(var r=String(e),n=r.length,i="",o=0;o<n;o++){var a=r.charCodeAt(o);if(a===0){i+="\uFFFD";continue}if(a>=1&&a<=31||a===127||o===0&&a>=48&&a<=57||o===1&&a>=48&&a<=57&&r.charCodeAt(0)===45){i+="\\".concat(a.toString(16)," ");continue}if(o===0&&n===1&&a===45){i+="\\-";continue}if(a>=128||a===45||a===95||a>=48&&a<=57||a>=65&&a<=90||a>=97&&a<=122){i+=r.charAt(o);continue}i+="\\".concat(r.charAt(o))}return i}function En(e){return Lt(e)}var zu={name:"stableId",try:function(e,t){var r=mn(e,t.config);return r===null?null:"".concat(e.tagName.toLowerCase(),"#").concat(En(r))}};var To=!1,So=1,$u=10,Je=Object.freeze({enabled:!1,explicitTrackingAttribute:"data-amp-track-id",autogeneratedIdPatterns:N([],w(Nu),!1),unstableClassPatterns:N([],w(Fu),!1),maxAncestorWalkDepth:void 0,shadowDomEnabled:To,maxShadowDomDepth:So});function Ke(e){var t;return b(b({},e),{shadowDomEnabled:(t=e.shadowDomEnabled)!==null&&t!==void 0?t:To,maxShadowDomDepth:Ju(e.maxShadowDomDepth)})}function bn(e,t){if(!e)return Yu();var r=Yu();return typeof e.enabled=="boolean"&&(r.enabled=e.enabled),typeof e.explicitTrackingAttribute=="string"&&e.explicitTrackingAttribute!==""&&(r.explicitTrackingAttribute=e.explicitTrackingAttribute),Array.isArray(e.autogeneratedIdPatterns)&&(r.autogeneratedIdPatterns=Mu(e.autogeneratedIdPatterns,t)),Array.isArray(e.unstableClassPatterns)&&(r.unstableClassPatterns=Vu(e.unstableClassPatterns,t)),r.maxAncestorWalkDepth=zd(e.maxAncestorWalkDepth),typeof e.shadowDomEnabled=="boolean"&&(r.shadowDomEnabled=e.shadowDomEnabled),r.maxShadowDomDepth=Ju(e.maxShadowDomDepth),Ke(r)}function zd(e){if(typeof e=="number"&&Number.isFinite(e)&&!(e<=0))return Math.floor(e)}function Ju(e){return typeof e!="number"||!Number.isFinite(e)?So:Math.min(Math.max(Math.floor(e),1),$u)}function Yu(){return{enabled:Je.enabled,explicitTrackingAttribute:Je.explicitTrackingAttribute,autogeneratedIdPatterns:N([],w(Je.autogeneratedIdPatterns),!1),unstableClassPatterns:N([],w(Je.unstableClassPatterns),!1),maxAncestorWalkDepth:Je.maxAncestorWalkDepth,shadowDomEnabled:Je.shadowDomEnabled,maxShadowDomDepth:Je.maxShadowDomDepth}}var Yd=[ju,zu];function Zu(e,t,r){var n,i,o,a,s;r===void 0&&(r={});var l=Ke(t),u=(o=r.strategies)!==null&&o!==void 0?o:Yd,c=(s=(a=r.scope)!==null&&a!==void 0?a:e.ownerDocument)!==null&&s!==void 0?s:document,d={scope:c,config:l},f=$d(e,l.maxAncestorWalkDepth);try{for(var v=P(u),p=v.next();!p.done;p=v.next())for(var h=p.value,g=0;g<f.length;g++){var m=f[g],E=h.try(m,d);if(E!==null){if(g===0){if(Qu(c,E,e,h.name,r.logger))return E;continue}var _=f.slice(0,g).reverse(),S=Gu(m,_),I="".concat(E," > ").concat(S);if(Qu(c,I,e,h.name,r.logger))return I}}}catch(A){n={error:A}}finally{try{p&&!p.done&&(i=v.return)&&i.call(v)}finally{if(n)throw n.error}}return null}function $d(e,t){for(var r=[],n=e;n!==null&&(r.push(n),!(t!==void 0&&r.length>t));)n=n.parentElement;return r}function Qu(e,t,r,n,i){var o;try{o=e.querySelectorAll(t)}catch(s){var a=s instanceof Error?s.message:String(s);return i?.debug('@amplitude/element-selector: strategy "'.concat(n,'" emitted a malformed selector "').concat(t,'" (').concat(a,")")),!1}return o.length===1&&o[0]===r}function el(e,t,r){var n,i;r===void 0&&(r={});for(var o=Ke(t),a=(i=(n=r.scope)!==null&&n!==void 0?n:e.ownerDocument)!==null&&i!==void 0?i:document,s=ye(a),l=[],u=e,c=0,d=!(o.shadowDomEnabled&&s);u!==null&&!(d&&o.maxAncestorWalkDepth!==void 0&&c>o.maxAncestorWalkDepth);){var f=mn(u,o);if(f!==null){var v="".concat(u.tagName.toLowerCase(),"#").concat(En(f)),p=N([v],w(l),!1).join(" > ");if(Jd(a,p,e))return p}l.unshift(Xu(u,o.shadowDomEnabled)),u=u.parentElement,c+=1}var h=l.join(" > ");return o.shadowDomEnabled&&s&&u===null?"".concat(_o).concat(h):h}function Jd(e,t,r){var n;try{n=e.querySelectorAll(t)}catch{return!1}return n.length===1&&n[0]===r}var hr=(function(){function e(t,r){this.value=t,this.optimized=r}return e.prototype.toString=function(){return this.value},e})(),Qd=function(e,t){if(e.nodeType!==Node.ELEMENT_NODE)return"";for(var r=[],n=e;n;){var i=Zd(n,!!t,n===e);if(!i||(r.push(i),i.optimized))break;n=n.parentElement}return r.reverse(),r.join(" > ")},Zd=function(e,t,r){var n,i;if(e.nodeType!==Node.ELEMENT_NODE)return null;var o=e.getAttribute("id");if(t){if(o)return new hr(rl(o),!0);var a=e.tagName.toLowerCase();if(a==="body"||a==="head"||a==="html")return new hr(a,!0)}var s=e.tagName.toLowerCase();if(o)return new hr(s+rl(o),!0);var l=e.parentNode;if(!l||l.nodeType===Node.DOCUMENT_NODE)return new hr(s,!0);for(var u=tl(e),c=!1,d=!1,f=-1,v=-1,p=l.children,h=0;p&&(f===-1||!d)&&h<p.length;++h){var g=p[h];if(g.nodeType===Node.ELEMENT_NODE){if(v+=1,g===e){f=v;continue}if(!d&&g.tagName.toLowerCase()===s){c=!0;var m=new Set(u);
11if(!m.size){d=!0;continue}for(var E=tl(g),_=0;_<E.length;++_){var S=E[_];if(m.has(S)&&(m.delete(S),!m.size)){d=!0;break}}}}}var I=s;if(r&&s.toLowerCase()==="input"&&e.getAttribute("type")&&!e.getAttribute("id")&&!e.getAttribute("class")&&(I+="[type="+Lt(e.getAttribute("type")||"")+"]"),d)I+=":nth-child("+String(f+1)+")";else if(c)try{for(var A=P(u),x=A.next();!x.done;x=A.next()){var R=x.value;I+="."+Lt(R.slice(1))}}catch(D){n={error:D}}finally{try{x&&!x.done&&(i=A.return)&&i.call(A)}finally{if(n)throw n.error}}return new hr(I,!1)},tl=function(e){var t=e.getAttribute("class");return t?t.split(/\s+/g).filter(Boolean).map(function(r){return"$"+r}):[]},rl=function(e){return"#"+Lt(e)};function Ao(e,t){try{return Qd(e)}catch(n){var r=n instanceof Error?n.message:String(n);return t?.warn("@amplitude/element-selector: legacyCssPath threw \u2014 emitting empty selector: ".concat(r)),""}}function Io(e,t){t===void 0&&(t={});var r=Ke(e),n=new Set,i=t.logger,o=function(u){return Ao(u,i)},a=function(u,c){var d;return(d=Zu(u,r,{strategies:t.strategies,scope:c,logger:i}))!==null&&d!==void 0?d:el(u,r,{scope:c})},s=function(u,c){return Bu(o(u,c),c,Wu(u))};function l(u,c){var d=pr(u,r.maxShadowDomDepth),f=d.segments,v=d.truncated;return v&&i?.debug("@amplitude/element-selector: target is nested deeper than maxShadowDomDepth (".concat(r.maxShadowDomDepth,") \u2014 emitting a best-effort selector for the outermost in-budget shadow host")),f.map(function(p){var h=p.target,g=p.root;return c(h,g)}).join(bo)}return{generate:function(u){var c,d;try{if(!r.shadowDomEnabled){var f=r.enabled?a:o;return f(u,(d=(c=t.scope)!==null&&c!==void 0?c:u.ownerDocument)!==null&&d!==void 0?d:document)}return l(u,r.enabled?a:s)}catch(p){var v=p instanceof Error?p.message:String(p);return i?.warn("@amplitude/element-selector: selector generation threw \u2014 falling back to legacy cssPath: ".concat(v)),Ao(u,i)}},getConfig:function(){return r},updateConfig:function(u){var c,d;r=Ke(u);try{for(var f=P(n),v=f.next();!v.done;v=f.next()){var p=v.value;try{p(r)}catch(g){var h=g instanceof Error?g.message:String(g);i?.warn("@amplitude/element-selector: onConfigChange subscriber threw \u2014 ".concat(h))}}}catch(g){c={error:g}}finally{try{v&&!v.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}},onConfigChange:function(u){return n.add(u),function(){n.delete(u)}}}}var ef=1,Xe=Object.freeze({enabled:!1,maxDepth:0}),nl=function(e){var t,r=(t=e.maxShadowDomDepth)!==null&&t!==void 0?t:ef;return!e.shadowDomEnabled||r<=0?Xe:Object.freeze({enabled:!0,maxDepth:r})},tf=function(){var e=Xe,t=new Set,r=function(n){var i,o;try{for(var a=P(N([],w(t),!1)),s=a.next();!s.done;s=a.next()){var l=s.value;try{l(n)}catch{}}}catch(u){i={error:u}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(i)throw i.error}}t.clear()};return{get:function(){return e},arm:function(n){return e.enabled||!n.enabled||(e=n,r(n)),e},onArm:function(n){if(e.enabled){var i=e;try{n(i)}catch{}return function(){}}return t.add(n),function(){t.delete(n)}}}},xo,il=function(){return xo||(xo=tf()),xo};var rf=["input","select","textarea"],ol=function(e,t){var r,n=(r=window?.getComputedStyle)===null||r===void 0?void 0:r.call(window,e);return n?.getPropertyValue("cursor")==="pointer"&&t==="click"},gr=function(e){var t=e.pageUrlAllowlist,r=e.pageUrlExcludelist;return!(r&&r.length>0&&Tt(window.location.href,r)||!Tt(window.location.href,t))},Ze=function(e,t){return function(r,n){var i,o,a=e.shouldTrackEventResolver,s=(o=(i=n?.tagName)===null||i===void 0?void 0:i.toLowerCase)===null||o===void 0?void 0:o.call(i);if(!s)return!1;if(a)return a(r,n);if(!gr(e))return!1;var l=String(n?.getAttribute("type"))||"";if(typeof l=="string")switch(l.toLowerCase()){case"hidden":return!1;case"password":return!1}if(t){var u=t.some(function(c){var d;return!!(!((d=n?.matches)===null||d===void 0)&&d.call(n,c))});if(!u)return!1}switch(s){case"input":case"select":case"textarea":return r==="change"||r==="click";default:return r==="click"}}};var al=function(e){var t,r,n,i=(r=(t=e?.tagName)===null||t===void 0?void 0:t.toLowerCase)===null||r===void 0?void 0:r.call(t),o=e instanceof HTMLElement?((n=e.getAttribute("contenteditable"))===null||n===void 0?void 0:n.toLowerCase())==="true":!1;return!rf.includes(i)&&!o},sl=function(e){return e?e.split(",").map(function(t){return t.trim()}).filter(function(t){return t.length>0&&t!=="id"&&t!=="class"}):[]},ul=function(e,t){return Object.entries(e).reduce(function(r,n){var i=w(n,2),o=i[0],a=i[1];if(o.startsWith(t)){var s=o.replace(t,"");
11s&&(r[s]=a||"")}return r},{})},nf=function(e){return e==null||typeof e=="object"&&Object.keys(e).length===0||typeof e=="string"&&e.trim().length===0},wo=function(e){return Object.keys(e).reduce(function(t,r){var n=e[r];return nf(n)||(t[r]=n),t},{})},_n=function(){var e;try{var t=C(),r=(e=t?.sessionStorage)===null||e===void 0?void 0:e.getItem(Cu);if(!r)return;var n=JSON.parse(r);if(typeof n.pageViewId=="string")return n.pageViewId}catch{}};var yn=function(e,t,r){return r===void 0&&(r=Xe),r.enabled?of(e,t,r.maxDepth):ll(e,t)},ll=function(e,t){return e?t.some(function(r){var n;return(n=e?.matches)===null||n===void 0?void 0:n.call(e,r)})?e:ll(e?.parentElement,t):null},of=function(e,t,r){var n,i;if(!e)return null;var o=function(c){if(t.some(function(d){var f;return(f=c?.matches)===null||f===void 0?void 0:f.call(c,d)}))return{value:c}};try{for(var a=P(fr(e,r)),s=a.next();!s.done;s=a.next()){var l=s.value,u=o(l);if(typeof u=="object")return u.value}}catch(c){n={error:c}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}return null},Po=function(e,t,r){return r===void 0&&(r=Xe),r.enabled?af(e,t,r.maxDepth):cl(e,t)},cl=function(e,t){var r=[];return t&&e.querySelectorAll(t).forEach(function(n){return r.push(n)}),r},af=function(e,t,r){var n=cl(e,t),i=e instanceof Document?e.documentElement:e;return i&&vr(i,r).forEach(function(o){var a=o.root;a.querySelectorAll(t).forEach(function(s){return n.push(s)})}),n},dl=function(e,t){var r,n;if(t===void 0&&(t=Xe),!t.enabled)return e.target;var i=(r=e.composedPath)===null||r===void 0?void 0:r.call(e),o=(n=e.target)!==null&&n!==void 0?n:null;if(!i||i.length===0)return o;var a=i[0];if(!(a instanceof Element))return a??o;var s=pr(a,t.maxDepth),l=s.segments,u=s.truncated;return u&&l.length>0?l[l.length-1].target:a};var Ve=function(e){return!(e.event.target===null||!e.closestTrackedAncestor)};function fl(e){return e.type==="click"||e.type==="change"}function Tn(e){if(!e)return"";try{var t=new URL(e);return t.search="",ie(t.href)}catch{return ie(e)}}function Qe(e){var t,r;return e===void 0&&(e=C()),Tn((r=(t=e?.location)===null||t===void 0?void 0:t.href)!==null&&r!==void 0?r:"")}function vl(e,t){var r;if(t===void 0&&(t=C()),e==null||e==="")return Qe(t);var n=((r=t?.location)===null||r===void 0?void 0:r.href)||"http://localhost/";try{return Tn(new URL(e,n).href)}catch{return Qe(t)}}var Ot;(function(e){e[e.LEFT_OR_TOUCH_CONTACT=0]="LEFT_OR_TOUCH_CONTACT",e[e.MIDDLE=1]="MIDDLE",e[e.RIGHT=2]="RIGHT"})(Ot||(Ot={}));var pl="__AMPLITUDE_VISUAL_TAGGING__";function hl(e,t){var r=e;if(r[pl]!==!0){r[pl]=!0;var n=t.dataExtractor,i=t.isElementSelectable,o=t.cssSelectorAllowlist,a=t.actionClickAllowlist,s=null,l=function(c){e.notify({action:"element-selected",data:c})},u=function(c,d){c==="selector-mode-changed"?e.notify({action:"track-selector-mode-changed",data:d}):c==="selector-moved"&&e.notify({action:"track-selector-moved",data:d})};e.registerActionHandler("initialize-visual-tagging-selector",function(c){e.loadScriptOnce(xu).then(function(){var d;s=(d=window?.amplitudeVisualTaggingSelector)===null||d===void 0?void 0:d.call(window,{getEventTagProps:n.getEventTagProps,isElementSelectable:function(f){return i?i(c?.actionType||"click",f):!0},onTrack:u,onSelect:l,visualHighlightClass:wu,messenger:e,cssSelectorAllowlist:o,actionClickAllowlist:a,extractDataFromDataSource:n.extractDataFromDataSource,dataExtractor:n,diagnostics:{autocapture:{version:cn}}}),e.notify({action:"selector-loaded"})}).catch(function(){var d;(d=e.logger)===null||d===void 0||d.warn("Failed to initialize visual tagging selector")})}),e.registerActionHandler("close-visual-tagging-selector",function(){var c;(c=s?.close)===null||c===void 0||c.call(s)})}}function gl(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackEvent,i=e.evaluateTriggers,o=r.clickObservable,a=o.filter(Ve).filter(function(l){return n("click",l.closestTrackedAncestor)}).map(function(l){return i(l)}),s=a;return s.subscribe(function(l){t?.track(dn,l.targetElementProperties)})}function ml(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackEvent,o=e.evaluateTriggers,a=r.changeObservable,s=a.filter(Ve).filter(function(l){return i("change",l.closestTrackedAncestor)}).map(function(l){return o(l)});return s.subscribe(function(l){t?.track(cu,n("change",l.closestTrackedAncestor))})}function El(e){var t=e.amplitude,r=e.allObservables,n=e.options,i=e.getEventProperties,o=e.shouldTrackEvent,a=e.shouldTrackActionClick,s=r.clickObservable,l=r.mutationObservable,u=r.navigateObservable,c=s.filter(function(g){return!o("click",g.closestTrackedAncestor)}).map(function(g){var m=yn(g.event.target,n.actionClickAllowlist);return g.closestTrackedAncestor=m,g.closestTrackedAncestor!==null&&(g.targetElementProperties=i(g.type,g.closestTrackedAncestor)),g}).filter(Ve).filter(function(g){return a("click",g.closestTrackedAncestor)}),d=u?we(l,u):l,f=we(c,d),v=null,p=null,h=vt(f,function(g){if(v&&(clearTimeout(v),v=null),g.type==="click")return p=g,v=setTimeout(function(){v=null,p=null},500),Promise.resolve(null);if(p){var m=p;return p=null,Promise.resolve(m)}return Promise.resolve(null)});return h.subscribe(function(g){g&&t?.track(dn,i("click",g.closestTrackedAncestor))})}function bl(e){var t=e.amplitude,r=e.allObservables,n=r.scrollObservable,i={maxX:0,maxY:0},o=n.subscribe(function(){var a,s,l,u,c=C(),d=Math.floor((s=(a=c?.scrollX)!==null&&a!==void 0?a:c?.pageXOffset)!==null&&s!==void 0?s:0),f=Math.floor((u=(l=c?.scrollY)!==null&&l!==void 0?l:c?.pageYOffset)!==null&&u!==void 0?u:0);
11i.maxX=Math.max(i.maxX,d),i.maxY=Math.max(i.maxY,f)});return{unsubscribe:function(){o.unsubscribe()},getState:function(){return i},reset:function(){i.maxX=0,i.maxY=0}}}var kt=C(),mr=function(e){return e.get()},sf={childList:!0,attributes:!0,characterData:!0,subtree:!0},Sn=function(e){return e?new Q.default(function(t){var r=new WeakSet,n=new WeakMap,i=function(c,d){r.has(c)||(r.add(c),ye(c)&&n.set(c,d),s.observe(c,sf))},o=function(c,d,f){var v=f-d;v<=0||vr(c,v).forEach(function(p){var h=p.root,g=p.depth;return i(h,d+g)})},a=function(c){var d=c.getRootNode();if(!ye(d))return 0;var f=n.get(d);return f??0},s=new MutationObserver(function(c){var d,f;t.next(c);try{var v=mr(e);if(!v.enabled)return;var p=function(E){var _=a(E.target);E.addedNodes.forEach(function(S){S instanceof Element&&o(S,_,v.maxDepth)})};try{for(var h=P(c),g=h.next();!g.done;g=h.next()){var m=g.value;p(m)}}catch(E){d={error:E}}finally{try{g&&!g.done&&(f=h.return)&&f.call(h)}finally{if(d)throw d.error}}}catch{}}),l;if(document.body){var u=document.body;i(u,0),l=e.onArm(function(c){o(u,0,c.maxDepth)})}return function(){l?.(),s.disconnect()}}):new Q.default(function(t){var r=new MutationObserver(function(n){t.next(n)});return document.body&&r.observe(document.body,{childList:!0,attributes:!0,characterData:!0,subtree:!0}),function(){return r.disconnect()}})},An=function(e){return e===void 0&&(e="click"),new Q.default(function(t){var r,n=function(i){t.next(i)};return(r=C())===null||r===void 0||r.document.addEventListener(e,n,{capture:!0}),function(){var i;(i=C())===null||i===void 0||i.document.removeEventListener(e,n,{capture:!0})}})},_l=function(){return new Q.default(function(e){var t,r,n=function(i){e.next(i)};return(t=C())===null||t===void 0||t.addEventListener("scroll",n,{capture:!0,passive:!0}),(r=C())===null||r===void 0||r.addEventListener("resize",n,{passive:!0}),function(){var i,o;(i=C())===null||i===void 0||i.removeEventListener("scroll",n,{capture:!0}),(o=C())===null||o===void 0||o.removeEventListener("resize",n)}})},uf=function(){return new Q.default(function(e){var t=function(r){for(var n=[],i=1;i<arguments.length;i++)n[i-1]=arguments[i];var o=void 0;Array.isArray(n[0])&&typeof n[0][0]=="string"&&(o=n[0][0]),e.next({kind:"console",message:o})};return Wr.addListener("error",t),function(){Wr.removeListener(t)}})},yl=function(e,t,r,n){var i=typeof r=="function"?r:void 0,o=typeof r=="function"?n:r;return new Q.default(function(a){var s=C();if(!s?.IntersectionObserver)return function(){};var l=new IntersectionObserver(function(h){h.forEach(function(g){a.next(g)})},{root:null,rootMargin:"0px",threshold:0}),u=t.join(","),c=function(h){h instanceof Element&&h.matches(u)&&l.observe(h),h.querySelectorAll(u).forEach(function(g){l.observe(g)})},d=function(h){if(o)try{Po(h,u,mr(o)).forEach(function(g){l.observe(g)})}catch{}},f=function(){var h=s?.document;if(h){var g=[];try{o&&mr(o).enabled?g=Po(h,u,mr(o)):g=h.querySelectorAll(u)}catch{return}Array.from(g).forEach(function(m){l.unobserve(m),l.observe(m)})}};i?.(f),f();var v=o?.onArm(function(){s?.document&&d(s.document)}),p=e.subscribe(function(h){var g=h.event;return g.forEach(function(m){var E=m.addedNodes;return E.forEach(function(_){if(_ instanceof DocumentFragment){c(_);return}if(_ instanceof Element){if(!o||!mr(o).enabled){c(_);return}try{_.matches(u)&&l.observe(_)}catch{}d(_)}})})});return function(){i?.(void 0),v?.(),p.unsubscribe(),l.disconnect()}})},lf=function(){return new Q.default(function(e){var t=function(r){if(r instanceof ErrorEvent){var n={kind:"error"};r.error instanceof Error||r.error instanceof DOMException?n=b(b({},n),{message:r.error.message,stack:r.error.stack,filename:r.filename,lineNumber:r.lineno,columnNumber:r.colno}):typeof r.error=="string"&&(n.message=r.error),e.next(n)}};return kt.addEventListener("error",t),function(){kt.removeEventListener("error",t)}})},cf=function(){return new Q.default(function(e){var t=function(r){var n={kind:"unhandledrejection"};r.reason instanceof Error||r.reason instanceof DOMException?(n.message=r.reason.message,n.stack=r.reason.stack):typeof r.reason=="str
11ing"&&(n.message=r.reason),e.next(n)};return kt.addEventListener("unhandledrejection",t),function(){kt.removeEventListener("unhandledrejection",t)}})},Tl=function(){var e=we(lf(),cf());return we(e,uf())},Sl=function(){return new Q.default(function(e){var t=function(n){e.next(n)},r={capture:!0};return kt.document.addEventListener("mousemove",t,r),function(){kt.document.removeEventListener("mousemove",t,r)}})};var Al=function(e,t){try{if(t.subprop_key==="[Amplitude] Element Text")return t.subprop_op==="is"&&t.subprop_value.includes(e.targetElementProperties["[Amplitude] Element Text"]);if(t.subprop_key==="[Amplitude] Element Hierarchy")return t.subprop_op==="autotrack css match"&&!!e.closestTrackedAncestor.closest(t.subprop_value.toString())}catch(r){return console.error("Error matching event to filter",r),!1}return!1};var Il=function(e,t){try{if(e.sourceType==="DOM_ELEMENT"){var r=document.documentElement;return e.scope&&t&&(r=t.closest(e.scope)),r&&e.selector?r.querySelector(e.selector):r}}catch{return}},xl=function(e,t,r){e.forEach(function(n){if(typeof n!="string"&&n.actionType==="ATTACH_EVENT_PROPERTY"){var i=r.extractDataFromDataSource(n.dataSource,t.closestTrackedAncestor);t.targetElementProperties[n.destinationKey]=i}})};var Co={"[Amplitude] Element Clicked":"click","[Amplitude] Element Changed":"change"},Ro=function(e){var t,r,n,i,o=Object.values(Co).reduce(function(v,p){return v[p]=new Set,v},{});if(!e)return o;try{for(var a=P(e),s=a.next();!s.done;s=a.next()){var l=s.value;try{try{for(var u=(n=void 0,P(l.definition)),c=u.next();!c.done;c=u.next()){var d=c.value,f=Co[d.event_type];f&&o[f].add(l.id)}}catch(v){n={error:v}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}catch(v){console.warn("Skipping Labeled Event due to malformed definition",l?.id,v)}}}catch(v){t={error:v}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},Lo=function(e){var t,r,n,i,o=new Map;try{for(var a=P(e),s=a.next();!s.done;s=a.next()){var l=s.value;try{for(var u=(n=void 0,P(l.conditions)),c=u.next();!c.done;c=u.next()){var d=c.value;if(d.type==="LABELED_EVENT"){var f=d.match.eventId,v=o.get(f);v||(v=[],o.set(f,v)),v.push(l)}}}catch(p){n={error:p}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}}}catch(p){t={error:p}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},df=function(e,t){return t.filter(function(r){return r.definition.some(function(n){return Co[n.event_type]===e.type&&n.filters.every(function(i){return Al(e,i)})})})},ff=function(e,t){var r,n,i,o,a=new Set;try{for(var s=P(e),l=s.next();!l.done;l=s.next()){var u=l.value,c=t.get(u.id);if(c)try{for(var d=(i=void 0,P(c)),f=d.next();!f.done;f=d.next()){var v=f.value;a.add(v)}}catch(p){i={error:p}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(i)throw i.error}}}}catch(p){r={error:p}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return Array.from(a)},vf=(function(){function e(t,r,n,i){this.groupedLabeledEvents=t,this.labeledEventToTriggerMap=r,this.dataExtractor=n,this.options=i}return e.prototype.evaluate=function(t){var r,n,i=this.options.pageActions;if(!i)return t;var o=df(t,Array.from(this.groupedLabeledEvents[t.type]).map(function(c){return i.labeledEvents[c]})),a=ff(o,this.labeledEventToTriggerMap);try{for(var s=P(a),l=s.next();!l.done;l=s.next()){var u=l.value;xl(u.actions,t,this.dataExtractor)}}catch(c){r={error:c}}finally{try{l&&!l.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return t},e.prototype.update=function(t,r,n){this.groupedLabeledEvents=t,this.labeledEventToTriggerMap=r,this.options=n},e})();var wl=function(e,t,r,n){return new vf(e,t,r,n)};var pf=new Set(["id","class","style","value","onclick","onchange","oninput","onblur","onsubmit","onfocus","onkeydown","onkeyup","onkeypress","data-reactid","data-react-checksum","data-reactroot",hn,De,Eo]),hf=["type"],gf=["svg","path","g"],mf=["password","hidden"];function Ef(e,t){if(e.parentElement)return e.parentElement.children;var r=e.getRootNode();return t&&ye(r)?r.children:[]}function Pl(e,t,r){var n,i,o,a,s;if(r===void 0&&(r=Xe),e===null)return null;var l=String(e.tagName).toLowerCase(),u={tag:l},c=Array.from(Ef(e,r.enabled));c.length&&(u.index=c.indexOf(e),u.indexOfType=c.filter(function(I){return I.tagName===e.tagName}).indexOf(e));var d=(s=(a=e.previousElementSibling)===null||a===void 0?void 0:a.tagName)===null||s===void 0?void 0:s.toLowerCase();d&&(u.prevSib=String(d));var f=e.getAttribute("id");f&&(u.id=String(f));var v=Array.from(e.classList);v.length&&(u.classes=v);var p={},h=Array.from(e.attributes),g=h.filter(function(I){return!pf.has(I.name)}),m=!al(e);if(!mf.includes(String(e.getAttribute("type")))&&!gf.includes(l))try{for(var E=P(g),_=E.next();!_.done;_=E.next()){var S=_.value;
11if(!(m&&!hf.includes(S.name))){if(t.has(S.name)){p[S.name]=ke;continue}p[S.name]=String(S.value).substring(0,gn)}}}catch(I){n={error:I}}finally{try{_&&!_.done&&(i=E.return)&&i.call(E)}finally{if(n)throw n.error}}return Object.keys(p).length&&(u.attrs=p),e.shadowRoot&&(u.attrs=b(b({},u.attrs||{}),(o={},o[Eo]="true",o)),u.shadow=!0),u}function Oo(e,t){return t===void 0&&(t=Xe),e?t.enabled?_f(e,t.maxDepth):bf(e):[]}function bf(e){var t=[];t.push(e);for(var r=e.parentElement;r&&r.tagName!=="HTML";)t.push(r),r=r.parentElement;return t}function _f(e,t){var r,n,i=[];try{for(var o=P(fr(e,t)),a=o.next();!a.done;a=o.next()){var s=a.value;if(s.tagName==="HTML")break;i.push(s)}}catch(l){r={error:l}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i}var yf=function(e){return e.closest("[".concat(De,"]"))!==null},Tf=function(e,t){var r,n;return Oo(e,t).some(function(i){return i.hasAttribute(De)})?!0:(n=(r=document.documentElement)===null||r===void 0?void 0:r.hasAttribute(De))!==null&&n!==void 0?n:!1},ko;function Sf(){return ko||(ko=Io(bn())),ko}var In=(function(){function e(t,r){var n,i,o=this,a;this.replaceSensitiveString=function(f){return dt(f,o.additionalMaskTextPatterns)},this.getHierarchy=function(f){var v,p,h,g,m=performance.now(),E=[];if(!f)return[];for(var _=o.getShadowMode(),S=Oo(f,_),I=new Map,A=S.length-1;A>=0;A--){var x=S[A];if(x){var R=sl(x.getAttribute(hn)),D=A===S.length-1?[]:(h=I.get(S[A+1]))!==null&&h!==void 0?h:new Set,G=new Set(N(N([],w(D),!1),w(R),!1));I.set(x,G)}}E=S.map(function(H){var X;return Pl(H,(X=I.get(H))!==null&&X!==void 0?X:new Set,_)});var k=function(H){H?.attrs&&Object.entries(H.attrs).forEach(function(X){var pe=w(X,2),Se=pe[0],Ne=pe[1];H.attrs&&(H.attrs[Se]=o.replaceSensitiveString(Ne))})};try{for(var U=P(E),L=U.next();!L.done;L=U.next()){var M=L.value;k(M)}}catch(H){v={error:H}}finally{try{L&&!L.done&&(p=U.return)&&p.call(U)}finally{if(v)throw v.error}}var V=performance.now();return(g=o.diagnosticsClient)===null||g===void 0||g.recordHistogram("autocapturePlugin.getHierarchy",V-m),E},this.getNearestLabel=function(f){var v=f.parentElement;if(!v)return"";var p;try{p=v.querySelector(":scope>span,h1,h2,h3,h4,h5,h6")}catch{p=null}return p?o.getText(p):o.getNearestLabel(v)},this.getElementPath=function(f){var v;if(!f)return"";var p=performance.now(),h=o.selectorEngine.generate(f),g=performance.now();return(v=o.diagnosticsClient)===null||v===void 0||v.recordHistogram("autocapturePlugin.getElementPath",g-p),h},this.updateSelectorConfig=function(f,v){var p;if(f!=null){var h=typeof f.enabled=="boolean",g=typeof f.shadowDomEnabled=="boolean";if(!h&&!g){v?.debug("@amplitude/element-selector: ignoring remote-config delivery without an explicit `enabled` or `shadowDomEnabled` flag \u2014 keeping current engine state.");return}var m=bn(f,v),E=o.selectorEngine.getConfig().enabled,_=o.shadowGate.get().enabled,S=o.shadowGate.arm(nl(m));o.selectorEngine.updateConfig(b(b(b({},h?m:o.selectorEngine.getConfig()),{shadowDomEnabled:S.enabled}),S.enabled&&{maxShadowDomDepth:S.maxDepth})),h&&E!==m.enabled&&v?.debug(m.enabled?"@amplitude/element-selector: engine enabled \u2014 now emitting new element-selector element paths for autocapture events.":"@amplitude/element-selector: engine disabled \u2014 reverting to legacy cssPath for element paths."),!_&&S.enabled&&((p=o.diagnosticsClient)===null||p===void 0||p.setTag("plugin.autocapture.shadowDom","enabled:".concat(S.maxDepth)))}}
11,this.getShadowMode=function(){return o.shadowGate.get()},this.getEventProperties=function(f,v,p){var h,g,m,E,_=(m=(g=v?.tagName)===null||g===void 0?void 0:g.toLowerCase)===null||m===void 0?void 0:m.call(g),S=typeof v.getBoundingClientRect=="function"?v.getBoundingClientRect():{left:null,top:null},I=o.getHierarchy(v),A=(E=I[0])===null||E===void 0?void 0:E.attrs,x=o.getNearestLabel(v),R=ul(A??{},p),D=(h={},h[hu]=I,h[go]=_,h[mo]=o.getText(v),h[mu]=S.left==null?null:Math.round(S.left),h[Eu]=S.top==null?null:Math.round(S.top),h[_u]=R,h[yu]=o.getElementPath(v),h[Tu]=x,h[dr]=ie(window.location.href.split("?")[0]),h[Su]=ft(o.replaceSensitiveString),h[fn]=window.innerHeight,h[vn]=window.innerWidth,h),G=_n();if(G&&(D[pn]=G),D[vu]=v.getAttribute("id")||"",D[pu]=v.getAttribute("class"),D[bu]=A?.["aria-label"],_==="a"&&f==="click"&&v instanceof HTMLAnchorElement){var k=v.href.substring(0,gn);D[gu]=o.replaceSensitiveString(k)}return wo(D)},this.addTypeAndTimestamp=function(f,v){return{event:f,timestamp:Date.now(),type:v}},this.addAdditionalEventProperties=function(f,v,p,h,g){g===void 0&&(g=!1);var m=o.addTypeAndTimestamp(f,v);try{if(fl(m)&&m.event.target!==null){var E=o.getShadowMode(),_=dl(m.event,E);if(g){var S=ol(_,m.type);if(S)return m.closestTrackedAncestor=_,m.targetElementProperties=o.getEventProperties(m.type,m.closestTrackedAncestor,h),m}var I=yn(_,p,E);I&&(m.closestTrackedAncestor=I,m.targetElementProperties=o.getEventProperties(m.type,I,h))}}catch{}return m},this.extractDataFromDataSource=function(f,v){if(f.sourceType==="DOM_ELEMENT"){var p=Il(f,v);return p?f.elementExtractType==="TEXT"?o.getText(p):f.elementExtractType==="ATTRIBUTE"&&f.attribute?p.getAttribute(f.attribute):void 0:void 0}},this.getTextWithMaskedDescendants=function(f){var v,p,h="[".concat(De,"], [contenteditable]");if(!f.querySelector(h))return f.innerText;var g="",m=Array.from(f.childNodes);try{for(var E=P(m),_=E.next();!_.done;_=E.next()){var S=_.value;if(S.nodeType===Node.TEXT_NODE){g+=S.textContent||"";continue}if(S instanceof Element){if(S.hasAttribute(De)||S.hasAttribute("contenteditable")){g+=ke;continue}g+=o.getTextWithMaskedDescendants(S)}}}catch(I){v={error:I}}finally{try{_&&!_.done&&(p=E.return)&&p.call(E)}finally{if(v)throw v.error}}return g},this.hasMaskedAncestor=function(f){var v=o.getShadowMode();return v.enabled?Tf(f,v):yf(f)},this.getText=function(f){var v=o.hasMaskedAncestor(f);if(v)return ke;var p="";return f.querySelector("[".concat(De,"], [contenteditable]"))?p=o.getTextWithMaskedDescendants(f):p=f.innerText||"",o.replaceSensitiveString(p.substring(0,255)).replace(/\s+/g," ").trim()},this.getEventTagProps=function(f){var v,p,h;if(!f)return{};var g=(h=(p=f?.tagName)===null||p===void 0?void 0:p.toLowerCase)===null||h===void 0?void 0:h.call(p),m=(v={},v[go]=g,v[mo]=o.getText(f),v[dr]=window.location.href.split("?")[0],v);return wo(m)},this.diagnosticsClient=r?.diagnosticsClient,this.selectorEngine=Sf(),this.shadowGate=il();var s=(a=t.maskTextRegex)!==null&&a!==void 0?a:[],l=[];try{for(var u=P(s),c=u.next();!c.done;c=u.next()){var d=c.value;if(l.length>=Pu)break;if(d instanceof RegExp)l.push(d);else if("pattern"in d&&typeof d.pattern=="string")try{l.push(new RegExp(d.pattern,"i"))}catch{}}}catch(f){n={error:f}}finally{try{c&&!c.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.additionalMaskTextPatterns=l}return e})();var Af="configs.analyticsSDK.browserSDK.autocapture.elementSelector";function xn(e,t){var r=e.remoteConfigClient;if(!(!e.fetchRemoteConfig||!r)){var n=r.subscribe(Af,"all",function(i,o){e.loggerProvider.debug("@amplitude/element-selector: remote-config delivery (source=".concat(String(o),") ").concat(JSON.stringify(i))),t.updateSelectorConfig(i,e.loggerProvider)});return function(){r.unsubscribe(n)}}}var wn=1,If=function(e){var t;return e.assignedSlot||e.parentElement||((t=e.parentNode)===null||t===void 0?void 0:t.host)||null},Cl=function(e,t){return(t==="fixed"||t==="absolute")&&e instanceof HTMLElement?e.offsetParent:If(e)},xf=function(e){var t=C(),r=t.document.documentElement.clientHeight||t.innerHeight,n=t.document.documentElement.clientWidth||t.innerWidth,i=e.getBoundingClientRect(),o=i.top+i.height*Lu,a=Math.max(i.left,0),s=Math.min(i.right,n);if(o<-wn||o>r+wn||a>=s||i.width<=0)return!1;for(var l=Cl(e,t.getComputedStyle(e).position);l;){var u=t.getComputedStyle(l),c=u.overflowY&&u.overflowY!=="visible",d=u.overflowX&&u.overflowX!=="visible";if(c||d){var f=l.getBoundingClientRect();if(c&&(o<f.top-wn||o>f.bottom+wn)||d&&(a=Math.max(a,f.left),s=Math.min(s,f.right),a>=s))return!1}l=Cl(l,u.position)}return!0};function Rl(e){var t=e.allObservables,r=e.onExposure,n=e.dataExtractor,i=e.exposureDuration,o=i===void 0?nr:i,a=new Map,s=new Map,l=new Set,u=function(g){var m=s.get(g);m&&(clearTimeout(m),s.set(g,null))},c=function(g){if(!xf(g)){u(g);return}if(!(a.get(g)||s.get(g))){var m=setTimeout(function(){a.set(g,!0);var E=n.getElementPath(g);r(E),s.set(g,null)},o);s.set(g,m)}},d=t.exposureObservable,f=t.scrollObservable,v=d.subscribe(function(g){var m=g,E=m.target;m.isIntersecting?(l.add(E),c(E)):(l.delete(E),u(E))}),p=f.subscribe(function(){l.forEach(c)}
11),h=function(){s.forEach(function(g){g&&clearTimeout(g)}),s.clear(),a.clear()};return{unsubscribe:function(){v.unsubscribe(),p.unsubscribe(),h(),l.clear()},reset:function(){h(),l.forEach(c)}}}function Ll(e){var t,r,n,i=e.amplitude,o=e.scrollTracker,a=e.currentElementExposed,s=e.elementExposedForPage,l=e.elementExposedInSentEvents,u=e.exposureTracker,c=e.isPageEnd,d=e.lastScroll,f=o.getState(),v=C(),p=(r=v?.innerWidth)!==null&&r!==void 0?r:0,h=(n=v?.innerHeight)!==null&&n!==void 0?n:0,g=Array.from(a).filter(function(S){return!l.has(S)}),m=(t={},t[dr]=Qe(v),t[Au]=f.maxX+p,t[Iu]=f.maxY+h,t[fn]=h,t[vn]=p,t["[Amplitude] Element Exposed"]=g,t),E=_n();E&&(m[pn]=E);var _=function(){o.reset();var S=o.getState();d.maxX=S.maxX,d.maxY=S.maxY,s.clear(),l.clear(),u?.reset()};if(g.length===0&&f.maxX===d.maxX&&f.maxY===d.maxY){c&&_();return}i?.track("[Amplitude] Viewport Content Updated",m),d.maxX=f.maxX,d.maxY=f.maxY,g.forEach(function(S){l.add(S)}),a.clear(),c&&_()}function Ol(e,t,r,n,i){if(!(t.has(e)||r.has(e))){t.add(e),n.add(e);var o=Array.from(n),a=JSON.stringify(o);a.length>=Ru&&i(!1)}}function kl(e){var t=e.mutationObservable,r=e.onRescan,n=e.onFlush,i=e.exposureDuration,o=e.quietMs,a=o===void 0?Ou:o,s=e.maxWaitMs,l=s===void 0?ku:s,u=!1,c,d,f,v,p,h=function(){c&&(clearTimeout(c),c=void 0),d&&(clearTimeout(d),d=void 0),f&&(clearTimeout(f),f=void 0)},g=function(){p&&(document.removeEventListener("DOMContentLoaded",p),p=void 0)},m=function(){return typeof document<"u"&&document.readyState!=="loading"},E=function(){if(!u){if(!m()){p||(p=function(){p=void 0,_()},document.addEventListener("DOMContentLoaded",p));return}u=!0,h(),g(),r(),f=setTimeout(function(){f=void 0,n()},i+Du)}},_=function(){u||(c&&clearTimeout(c),c=setTimeout(E,a))},S=function(){h(),g(),u=!1,_(),d=setTimeout(E,l)};return{start:function(){v||(v=t.subscribe(function(){_()}),S())},reset:function(){S()},stop:function(){v?.unsubscribe(),v=void 0,h(),g()}}}var ce;(function(e){e.ClickObservable="clickObservable",e.PointerDownObservable="pointerDownObservable",e.ChangeObservable="changeObservable",e.NavigateObservable="navigateObservable",e.MutationObservable="mutationObservable",e.ScrollObservable="scrollObservable",e.ExposureObservable="exposureObservable",e.BrowserErrorObservable="browserErrorObservable",e.SelectionObservable="selectionObservable",e.MouseMoveObservable="mouseMoveObservable"})(ce||(ce={}));var Pn=function(e,t){var r,n,i,o,a,s,l,u,c,d,f,v;e===void 0&&(e={}),t?.diagnosticsClient.setTag("plugin.autocapture.version",cn);var p=e.dataAttributePrefix,h=p===void 0?ut:p,g=e.visualTaggingOptions,m=g===void 0?{enabled:!0}:g;e.cssSelectorAllowlist=(r=e.cssSelectorAllowlist)!==null&&r!==void 0?r:tr,e.actionClickAllowlist=(n=e.actionClickAllowlist)!==null&&n!==void 0?n:rr,e.debounceTime=(i=e.debounceTime)!==null&&i!==void 0?i:0;var E=((o=e.viewportContentUpdated)===null||o===void 0?void 0:o.enabled)!==!1,_=(l=(s=(a=e.viewportContentUpdated)===null||a===void 0?void 0:a.exposureDuration)!==null&&s!==void 0?s:e.exposureDuration)!==null&&l!==void 0?l:nr;e.viewportContentUpdated=b(b({},e.viewportContentUpdated),{exposureDuration:_}),e.pageUrlExcludelist=(u=e.pageUrlExcludelist)===null||u===void 0?void 0:u.reduce(function(F,B){if(typeof B=="string"&&F.push(B),B instanceof RegExp&&F.push(B),typeof B=="object"&&B!==null&&"pattern"in B)try{F.push(new RegExp(B.pattern))}catch(ee){return console.warn("Invalid regex pattern: ".concat(B.pattern),ee),F}return F},[]);var S=iu,I="enrichment",A=[],x=new In(e,t),R=new Set,D=new Set,G=new Set,k,U,L=function(){var F,B=_e(An().map(function(ue){return x.addAdditionalEventProperties(ue,"click",e.cssSelectorAllowlist,h)})),ee=_e(new Q.default(function(ue){var O,fe=function(ve){var Re=x.addAdditionalEventProperties(ve,"change",e.cssSelectorAllowlist,h);ue.next(Re)};return(O=C())===null||O===void 0||O.document.addEventListener("change",fe,{capture:!0}),function(){var ve;return(ve=C())===null||ve===void 0?void 0:ve.document.removeEventListener("change",fe)}})),oe;window.navigation&&(oe=_e(new Q.default(function(ue){var O=function(fe){var ve=x.addAdditionalEventProperties(fe,"
11navigate",e.cssSelectorAllowlist,h);ue.next(ve)};return window.navigation.addEventListener("navigate",O),function(){window.navigation.removeEventListener("navigate",O)}})));var de=x.shadowGate,he=_e(Sn(de).map(function(ue){return x.addAdditionalEventProperties(ue,"mutation",e.cssSelectorAllowlist,h)})),ae=_l(),Ae=yl(he,e.cssSelectorAllowlist,function(ue){U=ue},de);return F={},F[ce.ChangeObservable]=ee,F[ce.ClickObservable]=B,F[ce.MutationObservable]=he,F[ce.NavigateObservable]=oe,F[ce.ScrollObservable]=ae,F[ce.ExposureObservable]=Ae,F},M=Ro(Object.values((d=(c=e.pageActions)===null||c===void 0?void 0:c.labeledEvents)!==null&&d!==void 0?d:{})),V=Lo((v=(f=e.pageActions)===null||f===void 0?void 0:f.triggers)!==null&&v!==void 0?v:[]),H=wl(M,V,x,e),X=function(F){var B,ee;F&&(e.pageActions=b(b({},e.pageActions),F),M=Ro(Object.values((B=e.pageActions.labeledEvents)!==null&&B!==void 0?B:{})),V=Lo((ee=e.pageActions.triggers)!==null&&ee!==void 0?ee:[]),H.update(M,V,e))},pe=function(F,B){return T(void 0,void 0,void 0,function(){var ee,oe,de,he,ae,Ae,ue,O,fe,ve,Re,K,Ie,Le,Me,tt,rt,He,Mt,_t,Ut,Ft,Vt,Bn,Wn,xr,qn;return y(this,function(cv){return typeof document>"u"?[2]:(ee=!1,F.fetchRemoteConfig&&(F.remoteConfigClient?F.remoteConfigClient.subscribe("configs.analyticsSDK.pageActions","all",function(W){X(W)}):F.loggerProvider.debug("Remote config client is not provided, skipping remote config fetch")),oe=xn(F,x),oe&&A.push({unsubscribe:oe}),de=Ze(e,e.cssSelectorAllowlist),he=Ze(e,e.actionClickAllowlist),ae=L(),Ae=gl({allObservables:ae,amplitude:B,shouldTrackEvent:de,evaluateTriggers:H.evaluate.bind(H)}),A.push(Ae),ue=ml({allObservables:ae,getEventProperties:function(){for(var W=[],j=0;j<arguments.length;j++)W[j]=arguments[j];return x.getEventProperties.apply(x,N(N([],w(W),!1),[h],!1))},amplitude:B,shouldTrackEvent:de,evaluateTriggers:H.evaluate.bind(H)}),A.push(ue),O=El({allObservables:ae,options:e,getEventProperties:function(){for(var W=[],j=0;j<arguments.length;j++)W[j]=arguments[j];return x.getEventProperties.apply(x,N(N([],w(W),!1),[h],!1))},amplitude:B,shouldTrackEvent:de,shouldTrackActionClick:he}),O&&A.push(O),fe=bl({allObservables:ae,amplitude:B}),A.push(fe),ve=b({},fe.getState()),Re={},K=C(),Le=function(W){W&&Ie?.reset(),!(W&&ee)&&(W&&(ee=!0,setTimeout(function(){ee=!1},100)),Ll({amplitude:B,scrollTracker:fe,currentElementExposed:G,elementExposedForPage:R,elementExposedInSentEvents:D,exposureTracker:Re.exposure,isPageEnd:W,lastScroll:ve}))},Me=Qe(K),tt=function(){var W=Qe(K);W!==Me&&(Me=W,Le(!0))},rt=function(W,j){var Oe=Qe(K),Gt=vl(j,K);if(Oe===Gt){W();return}Me=Gt,Le(!0),W()},He=function(W){Ol(W,R,D,G,Le)},E&&(Re.exposure=Rl({allObservables:ae,onExposure:He,dataExtractor:x,exposureDuration:_}),Re.exposure&&A.push(Re.exposure),Ie=kl({mutationObservable:ae[ce.MutationObservable],onRescan:function(){var W,j;(j=(W=F.loggerProvider)===null||W===void 0?void 0:W.debug)===null||j===void 0||j.call(W,"@amplitude/plugin-autocapture-browser: initial exposure snapshot \u2014 rescanning DOM"),U?.()},onFlush:function(){var W,j;(j=(W=F.loggerProvider)===null||W===void 0?void 0:W.debug)===null||j===void 0||j.call(W,"@amplitude/plugin-autocapture-browser: initial exposure snapshot \u2014 flushing viewport content updated"),Le(!1)},exposureDuration:_}),Ie.start(),A.push({unsubscribe:function(){Ie?.stop()}}),Mt=function(){Le(!0)},K?.addEventListener("beforeunload",Mt),k=function(){K?.removeEventListener("beforeunload",Mt)},A.push({unsubscribe:function(){return k()}}),_t=ae[ce.NavigateObservable],_t?A.push(_t.subscribe(function(W){var j,Oe,Gt=(Oe=(j=W.event)===null||j===void 0?void 0:j.destination)===null||Oe===void 0?void 0:Oe.url;if(Gt){var sa=Tn(Gt);if(sa===Me)return;Me=sa,Le(!0);return}tt()})):K&&(Ut=function(){tt()},K.addEventListener("popstate",Ut),Ft=K.history.pushState,Vt=K.history.replaceState,K.history&&Ft&&(K.history.pushState=new Proxy(Ft,{apply:function(W,j,Oe){rt(function(){W.apply(j,Oe)},Oe[2])}})),K.history&&Vt&&(K.history.replaceState=new Proxy(Vt,{apply:function(W,j,Oe){rt(function(){W.apply(j,Oe)},Oe[2])}})),A.push({unsubscribe:function(){K.removeEventListener("popstate",Ut),K.history&&Ft&&(K.history.pushState=Ft),K.history&&Vt&&(K.history.replaceState=Vt)}}))),(qn=F?.loggerProvider)===null||qn===void 0||qn.log("".concat(S," has been successfully added.")),window.opener&&m.enabled&&(Bn=e.cssSelectorAllowlist,Wn=e.actionClickAllowlist,xr=Xi(),hl(xr,{dataExtractor:x,isElementSelectable:Ze(e,N(N([],w(Bn),!1),w(Wn),!1)),cssSelectorAllowlist:Bn,actionClickAllowlist:Wn}),ji(xr),xr.setup(b({logger:F?.loggerProvider},F?.serverZone&&{endpoint:Yr[F.serverZone]}))),[2])})})},Se=function(F){return T(void 0,void 0,void 0,function(){return y(this,function(B){return[2,F]})})},Ne=function(){return T(void 0,void 0,void 0,function(){var F,B,ee,oe,de;return y(this,function(he){try{for(F=P(A),B=F.next();!B.done;B=F.next())ee=B.value,ee.unsubscribe()}catch(ae){oe={error:ae}}finally{try{B&&!B.done&&(de=F.return)&&de.call(F)}finally{if(oe)throw oe.error}}return[2]})})};return{name:S,type:I,setup:pe,execute:Se,teardown:Ne}};var wf=3e3,Pf=["mutation","navigate"];function Dl(e){var t=e.amplitude,r=e.allObservables,n=e.getEventProperties,i=e.shouldTrackDeadClick,o=r.clickObservable,a=r.mutationObservable,s=r.navigateObservable,l=o.filter(function(v){return Ve(v)&&i("click",v.closestTrackedAncestor)&&v.event.target instanceof Element&&v.event.target.closest('a[target="_blank"]')===null&&v.event.button===Ot.LEFT_OR_TOUCH_CONTACT}),u=s?we(a,s):a,c=we(l,u),d=null,f=vt(c,function(v){return d&&Pf.includes(v.type)?(clearTimeout(d),d=null,Promise.resolve(null)):v.type==="click"?d?Promise.resolve(null):new Promise(function(p){d=setTimeout(function(){p(v),d=null},wf)}):Promise.resolve(null)});return f.subscribe(function(v){if(v){var p={"[Amplitude] X":v.event.clientX,"[Amplitude] Y":v.event.clientY};t.track(su,b(b({},n("click",v.closestTrackedAncestor)),p),{time:v.timestamp})}})}var Fl=Li,Vl=Ri,Nl=Oi;function Ml(e,t){var r,n,i,o,a=t.event,s=a.pageX,l=a.pageY;e.yMin=Math.min((r=e.yMin)!==null&&r!==void 0?r:l,l),e.yMax=Math.max((n=e.yMax)!==null&&n!==void 0?n:l,l),e.xMin=Math.min((i=e.xMin)!==null&&i!==void 0?i:s,s),e.xMax=Math.max((o=e.xMax)!==null&&o!==void 0?o:s,s),e.isOutOfBounds=e.yMax-e.yMin>Nl||e.xMax-e.xMin>Nl}function Ul(e){if(e.length===0)return null;var t=e[0],r=e[e.length-1],n=b({"[Amplitude] Begin Time":new Date(t.timestamp).toISOString(),"[Amplitude] End Time":new Date(r.timestamp).toISOString(),"[Amplitude] Duration":r.timestamp-t.timestamp,"[Amplitude] Clicks":e.map(function(i){return{X:i.event.pageX,Y:i.event.pageY,Time:i.timestamp}}),"[Amplitude] Click Count":e.length},t.targetElementProperties);return{rageClickEvent:n,time:t.timestamp}}function Cf(e,t){var r=Math.max(0,e.length-Fl+1),n=e[r];return t.timestamp-n.timestamp>=Vl}function Rf(e,t){return e.length>0&&e[e.length-1].closestTrackedAncestor!==t.closestTrackedAncestor}function Gl(e){var t=this,r=e.amplitude,n=e.allObservables,i=e.shouldTrackRageClick,o=n.pointerDownObservable,a=n.selectionObservable,s=[],l={},u=null;function c(p){s=[],l={},p&&(Ml(l,p),s.push(p))}var d=vt(o.filter(function(p){return i("click",p.closestTrackedAncestor)}),function(p){return T(t,void 0,void 0,function(){var h;return y(this,function(g){return Ml(l,p),h=null,s.length===0||Rf(s,p)||Cf(s,p)||l.isOutOfBounds?(u&&(h=Ul(s)),c(p)):s.push(p),u&&(clearTimeout(u.timerId),u.resolve(h),u=null),s.length>=Fl?[2,new Promise(function(m){u={resolve:m,timerId:setTimeout(function(){m(Ul(s))},Vl)}})]:[2,null]})})}),f=a?.subscribe(function(){c()}),v=d.subscribe(function(p){p!==null&&r.track(uu,p.rageClickEvent,{time:p.time})});return{unsubscribe:function(){v.unsubscribe(),f?.unsubscribe()}}}var Lf=2e3;function Hl(e){var t=e.amplitude,r=e.allObservables,n=e.shouldTrackErrorClick,i=r.pointerDownObservable,o=r.browserErrorObservable,a=i.filter(function(c){return Ve(c)&&n("click",c.closestTrackedAncestor)&&c.event.target instanceof Element&&c.event.target.closest('a[target="_blank"]')===null&&c.event.button===Ot.LEFT_OR_TOUCH_CONTACT}),s=null,l=null,u=function(){s!==null&&(clearTimeout(s),s=null),l=null};return we(a,o).subscribe(function(c){var d;if(c.type==="click"){u(),l=c,s=setTimeout(u,Lf);return}c.type==="error"&&l&&(t.track(lu,b((d={},d["[Amplitude] Kind"]=c.event.kind,d["[Amplitude] Message"]=c.event.message,d["[Amplitude] Stack"]=c.event.stack,d["[Amplitude] Filename"]=c.event.filename,d["[Amplitude] Line Number"]=c.event.lineNumber,d["[Amplitude] Column Number"]=c.event.columnNumber,d),l.targetElementProperties)),u())})}var Ge;(function(e){e.INCREASING="increasing",e.DECREASING="decreasing"})(Ge||(Ge={}));var ht;(function(e){e.X="x",e.Y="y"})(ht||(ht={}));var Of=function(e){var t=e.allWindowObservables,r=t.mouseMoveObservable;return new Q.default(function(n){var i=null,o=null,a=null;return r.subscribe(function(s){var l={x:s.clientX,y:s.clientY};if(i===null){i=l;return}l.x>i.x?(o===Ge.DECREASING&&n.next(ht.X),o=Ge.INCREASING):l.x<i.x&&(o===Ge.INCREASING&&n.next(ht.X),o=Ge.DECREASING),l.y>i.y?(a===Ge.DECREASING&&n.next(ht.Y),a=Ge.INCREASING):l.y<i.y&&(a===Ge.INCREASING&&n.next(ht.Y),a=Ge.DECREASING),i=l})})};function kf(e){var t=+Date.now();e.startTime=e.startTime||t;var r=e.changes,n=e.changesThreshold;r.push(t),r.length>n&&r.shift()}function Bl(e){var t=e.changes,r=e.changesThreshold,n=e.thresholdMs;if(t.length<r)return!1;var i=t[t.length-1]-t[0];return i<n}function Wl(e){e.changes=[],e.startTime=void 0}function ql(e){for(var t=e.changes,r=e.thresholdMs,n=0,i=t[t.length-1];n<t.length;n++){var o=i-t[n];if(o<r)break}n!==0&&(e.startTime=t[n],e.changes.splice(0,n))}function Df(e,t){var r=void 0;if(Bl(e)&&(r=e.startTime),Bl(t)){var n=t.startTime;n&&(!r||n<r)&&(r=n)}return r}var Kl=20,Xl=2e3,Nf=function(e){var t=e.mouseDirectionChangeObservable,r=e.directionChanges,n=r===void 0?Kl:r,i=e.thresholdMs,o=i===void 0?Xl:i;return new Q.default(function(a){var s={changes:[],changesThreshold:n,thresholdMs:o},l={changes:[],changesThreshold:n,thresholdMs:o},u=void 0,c=null;function d(){u!==void 0&&(a.next(u),u=void 0,c!==null&&clearTimeout(c),Wl(s),Wl(l))}return t.subscribe(function(f){c!==null&&clearTimeout(c),kf(f===ht.X?s:l);var v=Df(s,l);return v?(u=u||v,c=setTimeout(function(){d(),c=null},o)):d(),ql(s),ql(l),function(){c!==null&&(clearTimeout(c),c=null)}})})},jl=function(e){var t=e.amplitude,r=e.options,n=e.allObservables,i=e.directionChanges,o=i===void 0?Kl:i,a=e.thresholdMs,s=a===void 0?Xl:a,l=Of({allWindowObservables:n}),u=Nf({mouseDirectionChangeObservable:l,directionChanges:o,thresholdMs:s});return u.subscribe(function(c){gr(r)&&t.track(du,void 0,{time:c})})};function Do(e,t,r,n){if(!n)return[];var i=e[t];return typeof i=="object"&&i!==null&&"cssSelectorAllowlist"in i&&Array.isArray(i.cssSelectorAllowlist)?i.cssSelectorAllowlist:r}var Cn=5,Rn=4e3,No=function(e){var t;e===void 0&&(e={});var r=ou,n="enrichment",i=[],o=e.errorClicks!==!1;e.errorClicks||(o=!1);var a=e.deadClicks!==!1&&e.deadClicks!==null,s=e.rageClicks!==!1&&e.rageClicks!==null,l=e.thrashedCursor!==!1&&e.thrashedCursor!==null;e.thrashedCursor||(l=!1);var u=Do(e,"rageClicks",Ci,s),c=Do(e,"deadClicks",wi,a),d=Do(e,"errorClicks",Pi,o),f=(t=e.dataAttributePrefix)!==null&&t!==void 0?t:ut,v=new In(e),p=N([],w(new Set(N(N(N([],w(u),!1),w(c),!1),w(d),!1))),!1),h=function(){var _,S=function(L){return _e(An(L).map(function(M){return v.addAdditionalEventProperties(M,"click",p,f,!0)}))},I=S("click"),A=S("pointerdown"),x=_e(Tl().map(function(L){return v.addTypeAndTimestamp(L,"error")})),R=_e(Sn(v.shadowGate).map(function(L){return v.addAdditionalEventProperties(L,"mutation",p,f)})),D;if(window.navigation){var G=new Q.default(function(L){var M=function(V){L.next(b(b({},V),{type:"navigate"}))};return window.navigation.addEventListener("navigate",M),function(){window.navigation.removeEventListener("navigate",M)}});D=_e(G.map(function(L){return v.addAdditionalEventProperties(L,"navigate",p,f)}
11))}var k=_e(new Q.default(function(L){var M=function(){var V=document.activeElement;if(V&&(V.tagName==="TEXTAREA"||V.tagName==="INPUT")){var H=void 0,X=void 0;try{if(H=V.selectionStart,X=V.selectionEnd,H===X)return}catch{return}return L.next()}var pe=window.getSelection();if(!(!pe||pe.isCollapsed))return L.next()};return window.document.addEventListener("selectionchange",M),function(){window.document.removeEventListener("selectionchange",M)}})),U=_e(Sl());return _={},_[ce.ClickObservable]=I,_[ce.PointerDownObservable]=A,_[ce.MutationObservable]=R,_[ce.NavigateObservable]=D,_[ce.BrowserErrorObservable]=x,_[ce.SelectionObservable]=k,_[ce.MouseMoveObservable]=U,_},g=function(_,S){return T(void 0,void 0,void 0,function(){var I,A,x,R,D,G,k,U,L,M,V,H;return y(this,function(X){return typeof document>"u"?[2]:(I=h(),A=xn(_,v),A&&i.push({unsubscribe:A}),s&&(x=Ze(e,u),R=Gl({allObservables:I,amplitude:S,shouldTrackRageClick:x}),i.push(R)),a&&(D=Ze(e,c),G=Dl({amplitude:S,allObservables:I,getEventProperties:function(pe,Se){return v.getEventProperties(pe,Se,f)},shouldTrackDeadClick:D}),i.push(G)),o&&(k=Ze(e,d),U=Hl({amplitude:S,allObservables:I,shouldTrackErrorClick:k}),i.push(U)),l&&(L=void 0,M=void 0,typeof e.thrashedCursor=="object"&&(L=e.thrashedCursor.directionChanges,M=e.thrashedCursor.threshold,L&&L<Cn&&(_.loggerProvider.warn("'thrashedCursor.directionChanges' of ".concat(L," is below the minimum of ").concat(Cn,", setting to ").concat(Cn)),L=Cn),M&&M>Rn&&(_.loggerProvider.warn("'thrashedCursor.threshold' of ".concat(M," is above the maximum of ").concat(Rn,", setting to ").concat(Rn)),M=Rn)),V=jl({amplitude:S,options:e,allObservables:I,directionChanges:L,thresholdMs:M}),i.push(V)),(H=_?.loggerProvider)===null||H===void 0||H.log("".concat(r," has been successfully added.")),[2])})})},m=function(_){return T(void 0,void 0,void 0,function(){return y(this,function(S){return[2,_]})})},E=function(){return T(void 0,void 0,void 0,function(){var _,S,I,A,x;return y(this,function(R){try{for(_=P(i),S=_.next();!S.done;S=_.next())I=S.value,I.unsubscribe()}catch(D){A={error:D}}finally{try{S&&!S.done&&(x=_.return)&&x.call(_)}finally{if(A)throw A.error}}return[2]})})};return{name:r,type:n,setup:g,execute:m,teardown:E}};var Mf=100,Uf=1e4;function zl(e,t){var r=e.startTime+e.duration;return t.filter(function(n){return n.startTime<r&&n.startTime+n.duration>e.startTime}).map(function(n){return n.name})}function Ff(e,t){var r,n=zl(e,t),i=(r=e.scripts)!==null&&r!==void 0?r:[],o=i.map(function(c){return c.sourceURL}).filter(Boolean),a=i.map(function(c){return c.sourceFunctionName}).filter(Boolean),s=i.map(function(c){return c.sourceCharPosition}).filter(function(c){return typeof c=="number"&&c>=0}),l=i.map(function(c){return c.invokerType}).filter(Boolean),u=i.map(function(c){return c.invoker}).filter(Boolean);return b(b(b(b(b(b(b({"[Amplitude] Main Thread Block Source":"long-animation-frame","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.blockingDuration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),{"[Amplitude] Main Thread Block Render Start":e.renderStart,"[Amplitude] Main Thread Block Style And Layout Start":e.styleAndLayoutStart,"[Amplitude] Main Thread Block Script Count":i.length}),o.length>0&&{"[Amplitude] Main Thread Block Script URLs":o}),a.length>0&&{"[Amplitude] Main Thread Block Script Functions":a}),s.length>0&&{"[Amplitude] Main Thread Block Script Positions":s}),l.length>0&&{"[Amplitude] Main Thread Block Invoker Types":l}),u.length>0&&{"[Amplitude] Main Thread Block Invokers":u})}function Vf(e,t){var r,n=zl(e,t),i=(r=e.attribution)!==null&&r!==void 0?r:[];return b(b({"[Amplitude] Main Thread Block Source":"long-task","[Amplitude] Main Thread Block Duration":e.duration,"[Amplitude] Main Thread Block Blocking Duration":e.duration,"[Amplitude] Main Thread Block Start Time":e.startTime},n.length>0&&{"[Amplitude] Main Thread Block Measures":n}),i.length>0&&{"[Amplitude] Main Thread Block Attribution":i.map(function(o){return o.name})})}function Gf(){if(typeof PerformanceObserver>"u")return null;try{var e=PerformanceObserver.supportedEntryTypes;if(e.includes("long-animation-frame"))return"long-animation-frame";if(e.includes("longtask"))return"longtask"}catch{}return null}function Yl(e){var t=e.amplitude,r=e.options,n=e.durationThreshold,i=n===void 0?Mf:n,o=Gf();if(!o)return{unsubscribe:function(){}};var a=[],s=new PerformanceObserver(function(u){var c,d,f=performance.now();try{for(var v=P(u.getEntries()),p=v.next();!p.done;p=v.next()){var h=p.value;a.push(h)}}catch(m){c={error:m}}finally{try{p&&!p.done&&(d=v.return)&&d.call(v)}finally{if(c)throw c.error}}for(var g=f-Uf;a.length>0&&a[0].startTime<g;)a.shift()});try{s.observe({entryTypes:["measure"]})}catch{}var l=new PerformanceObserver(function(u){var c,d;try{for(var f=P(u.getEntries()),v=f.next();!v.done;v=f.next()){var p=v.value;if(!gr(r))return;if(!(p.duration<i)){var h=o==="long-animation-frame"?Ff(p,a):Vf(p,a);t.track(fu,h)}}}catch(g){c={error:g}}finally{try{v&&!v.done&&(d=f.return)&&d.call(f)}finally{if(c)throw c.error}}});try{l.observe({entryTypes:[o]})}catch{return s.disconnect(),{unsubscribe:function(){}}}return{unsubscribe:function(){l.disconnect(),s.disconnect()}}}var Hf=100,Mo=function(e){e===void 0&&(e={});var t=au,r="enrichment",n=[],i=e.mainThreadBlock===!0||typeof e.mainThreadBlock=="object"&&e.mainThreadBlock!==null,o=function(l,u){return T(void 0,void 0,void 0,function(){var c,d,f;return y(this,function(v){return typeof document>"u"?[2]:(i&&(c=Hf,typeof e.mainThreadBlock=="object"&&e.mainThreadBlock.durationThreshold!==void 0&&(c=e.mainThreadBlock.durationThreshold),d=Yl({amplitude:u,options:e,durationThreshold:c}),n.push(d)),(f=l?.loggerProvider)===null||f===void 0||f.log("".concat(t," performance tracking has been successfully added.")),[2])})})},a=function(l){return T(void 0,void 0,void 0,function(){return y(this,function(u){return[2,l]})})},s=function(){return T(void 0,void 0,void 0,function(){var l,u,c,d,f;return y(this,function(v){try{for(l=P(n),u=l.next();!u.done;u=l.next())c=u.value,c.unsubscribe()}catch(p){d={error:p}}finally{try{u&&!u.done&&(f=l.return)&&f.call(l)}finally{if(d)throw d.error}}return[2]})})};return{name:t,type:r,setup:o,execute:a,teardown:s}};var $l="@amplitude/plugin-network-capture-browser",Uo="[Amplitude] Network Request",Jl=!0;var ec="500-599";function Ln(e,t){var r=t.replace(/[-[\]{}()+?.,\\^$|#\s]/g,"\\$&"),n="^"+r.replace(/\*/g,".*")+"$",i=new RegExp(n);return i.test(e)}function tc(e,t){var r,n,i=t.split(",");try{for(var o=P(i),a=o.next();!a.done;a=o.next()){var s=a.value,l=w(s.split("-").map(Number),2),u=l[0],c=l[1];if(e===u&&c===void 0||e>=u&&e<=c)return!0}}catch(d){r={error:d}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return!1}function Wf(e,t,r,n,i){if(!(e.hosts&&!e.hosts.find(function(a){return Ln(t,a)}))&&!(n&&e.urls&&!Tt(n,e.urls))&&!(i&&e.methods&&!e.methods.find(function(a){return i.toLowerCase()===a.toLowerCase()||a==="*"}))){if(r||r===0){var o=e.statusCodeRange||ec;if(!tc(r,o))return!1}return!0}}function qf(e){var t,r=e.indexOf("#"),n=r>=0?e.slice(r+1):"",i=r>=0?e.slice(0,r):e,o=i.indexOf("?"),a=o>=0?i.slice(o+1):"",s=o>=0?i.slice(0,o):i,l=s.match(/^[a-z][a-z0-9+.-]*:\/\/([^/?#]+)/i),u=(t=l?.[1])!==null&&t!==void 0?t:"";
11return{query:a,fragment:n,href:e,hrefWithoutQueryOrHash:s,host:u}}function rc(e){var t;if(e)try{var r=(t=C())===null||t===void 0?void 0:t.location.href,n=new URL(e,r),i=n.searchParams.toString(),o=n.hash.replace("#",""),a=n.href,s=n.host;n.hash="",n.search="";var l=n.href;return{query:i,fragment:o,href:a,hrefWithoutQueryOrHash:l,host:s}}catch{try{return qf(e)}catch{return}}}function Kf(e,t){if(e.includes("amplitude.com"))try{var r=t.body;if(typeof r!="string")return!1;var n=JSON.parse(r),i=n.events;if(i.find(function(o){return o.event_type===Uo}))return!0}catch{}return!1}function Ql(e){if(typeof e!="object"||e===null){if(e)return N([],w(We),!1);if(e===void 0){var t=Jl?void 0:N([],w(We),!1);return t}return}if(e.length!==0)return e}function Zl(e){var t,r,n;return!(!((t=e?.allowlist)===null||t===void 0)&&t.length)&&!(!((r=e?.blocklist)===null||r===void 0)&&r.length)&&!(!((n=e?.excludelist)===null||n===void 0)&&n.length)}function Xf(e,t){var r;t===void 0&&(t={});var n=rc(e.url);if(!n)return!1;var i=n.host;if(t.ignoreAmplitudeRequests!==!1&&(Ln(i,"*.amplitude.com")||Ln(i,"amplitude.com"))||!((r=t.ignoreHosts)===null||r===void 0)&&r.find(function(a){return Ln(i,a)})||!t.captureRules&&e.status!==void 0&&!tc(e.status,ec))return!1;if(t.captureRules){var o;if(N([],w(t.captureRules),!1).reverse().find(function(a){if(o=Wf(a,i,e.status,e.url,e.method),o){var s=Ql(a.responseHeaders);if(e.responseWrapper&&s){var l=e.responseWrapper.headers(s);l&&(e.responseHeaders=l)}var u=Ql(a.requestHeaders);if(e.requestWrapper&&u){var c=e.requestWrapper.headers(u);c&&(e.requestHeaders=c)}if(e.responseWrapper&&a.responseBody&&!Zl(a.responseBody)){var d=a.responseBody.excludelist||a.responseBody.blocklist;e.responseBodyJson=e.responseWrapper.json(a.responseBody.allowlist,d)}if(e.requestWrapper&&a.requestBody&&!Zl(a.requestBody)){var d=a.requestBody.excludelist||a.requestBody.blocklist;e.requestBodyJson=e.requestWrapper.json(a.requestBody.allowlist,d)}}return o!==void 0}),!o)return!1}return!(e.requestWrapper&&Kf(i,e.requestWrapper))}function jf(e,t,r,n){return T(this,void 0,void 0,function(){var i,o,a;return y(this,function(s){switch(s.label){case 0:return t.requestBodyJson||t.responseBodyJson?[4,Promise.all([t.requestBodyJson,t.responseBodyJson])]:[3,2];case 1:if(i=w.apply(void 0,[s.sent(),2]),o=i[0],a=i[1],o)try{e["[Amplitude] Request Body"]=JSON.stringify(o)}catch(l){n?.debug("Failed to stringify request body",l)}if(a)try{e["[Amplitude] Response Body"]=JSON.stringify(a)}catch{n?.debug("Failed to stringify response body")}s.label=2;case 2:return r?.track(Uo,e),[2]}})})}function nc(e){var t=e.allObservables,r=e.networkTrackingOptions,n=e.amplitude,i=e.loggerProvider,o=t.networkObservable,a=o.filter(function(s){return Xf(s.event,r)});return a.subscribe(function(s){var l,u,c,d=s.event,f=rc(d.url);if(f){var v=(u=d.responseWrapper)===null||u===void 0?void 0:u.bodySize,p=(c=d.requestWrapper)===null||c===void 0?void 0:c.bodySize,h=(l={},l["[Amplitude] URL"]=f.hrefWithoutQueryOrHash,l["[Amplitude] URL Query"]=f.query,l["[Amplitude] URL Fragment"]=f.fragment,l["[Amplitude] Request Method"]=d.method,l["[Amplitude] Status Code"]=d.status,l["[Amplitude] Start Time"]=d.startTime,l["[Amplitude] Completion Time"]=d.endTime,l["[Amplitude] Duration"]=d.duration,l["[Amplitude] Request Body Size"]=p,l["[Amplitude] Response Body Size"]=v,l["[Amplitude] Request Type"]=d.type,l["[Amplitude] Request Headers"]=d.requestHeaders,l["[Amplitude] Response Headers"]=d.responseHeaders,l);jf(h,d,n,i)}})}var Fo;(function(e){e.NetworkObservable="networkObservable"})(Fo||(Fo={}));var ic,On=function(e){e===void 0&&(e={});var t=$l,r="enrichment",n,i=function(u,c){var d={event:u,timestamp:Date.now(),type:c};return d},o=function(){var u,c=new Q.default(function(d){var f=new Mi(function(v){var p=i(v,"network");d.next(p)});return Kr.subscribe(f,n),function(){Kr.unsubscribe(f)}});return u={},u[Fo.NetworkObservable]=c,u},a=function(u,c){return T(void 0,void 0,void 0,function(){var d;return y(this,function(f){return typeof document>"u"&&!$i()?[2]:(d=o(),n=u?.loggerProvider,ic=nc({allObservables:d,networkTrackingOptions:e,amplitude:c,loggerProvider:n}),n?.log("".concat(t," has been successfully added.")),[2])})})},s=function(u){return T(void 0,void 0,void 0,function(){return y(this,function(c){return[2,u]})})},l=function(){return T(void 0,void 0,void 0,function(){return y(this,function(u){return ic.unsubscribe(),[2]})})};return{name:t,type:r,setup:a,execute:s,teardown:l}};var kn="web-vitals-browser",Dn="[Amplitude] Web Vitals",oc=1e3,gt={LCP:"[Amplitude] LCP",FCP:"[Amplitude] FCP",INP:"[Amplitude] INP",CLS:"[Amplitude] CLS",TTFB:"[Amplitude] TTFB"};var dc=-1,Dt=()=>dc,Nt=e=>{addEventListener("pageshow",t=>{t.persisted&&(dc=t.timeStamp,e(t))},!0)},Te=(e,t,r,n)=>{let i,o;return a=>{t.value>=0&&(a||n)&&(o=t.value-(i??0),(o||i===void 0)&&(i=t.value,t.delta=o,t.rating=((s,l)=>s>l[1]?"poor":s>l[0]?"needs-improvement":"good")(t.value,r),e(t)))}},$o=e=>{requestAnimationFrame(()=>requestAnimationFrame(()=>e()))},Jo=()=>{let e=performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},br=()=>Jo()?.activationStart??0,mt=-1,fc=new Set,ac=()=>document.visibilityState!=="hidden"||document.prerendering?1/0:0,Wo=e=>{if(document.visibilityState==="hidden"){if(e.type==="visibilitychange")for(let t of fc)t();isFinite(mt)||(mt=e.type==="visibilitychange"?e.timeStamp:0,removeEventListener("prerenderingchange",Wo,!0))}},Er=(e=!1)=>
11{if(e&&(mt=1/0),mt<0){let t=br();mt=(document.prerendering?void 0:globalThis.performance.getEntriesByType("visibility-state").find(n=>n.name==="hidden"&&n.startTime>=t)?.startTime)??ac(),addEventListener("visibilitychange",Wo,!0),addEventListener("prerenderingchange",Wo,!0),Nt(()=>{setTimeout(()=>{mt=ac()})})}return{get firstHiddenTime(){return mt},onHidden(t){fc.add(t)}}},Ce=(e,t=-1,r,n=0,i,o,a)=>{let s=Jo(),l=s?.navigationId||0,u="navigate";return r?u=r:Dt()>=0?u="back-forward-cache":s&&(document.prerendering||br()>0?u="prerender":document.wasDiscarded?u="restore":s.type&&(u=s.type.replace(/_/g,"-"))),{name:e,value:t,rating:"good",delta:0,entries:[],id:`v6-${Date.now()}-${Math.floor(8999999999999*Math.random())+1e12}`,navigationType:u,navigationId:n||l,navigationInteractionId:i,navigationURL:o||s?.name,navigationStartTime:a||0}},sc=new WeakMap;function Mn(e,t){let r=sc.get(t);return r||(r=new WeakMap,sc.set(t,r)),r.get(e)||r.set(e,new t),r.get(e)}var qo=class{constructor(){xe(this,"t");xe(this,"i",0);xe(this,"o",[])}h(t){if(t.hadRecentInput)return;let r=this.o[0],n=this.o.at(-1);this.i&&r&&n&&t.startTime-n.startTime<1e3&&t.startTime-r.startTime<5e3?(this.i+=t.value,this.o.push(t)):(this.i=t.value,this.o=[t]),this.t?.(t)}},Et=(e,t,r={})=>{try{let n=e.filter(i=>PerformanceObserver.supportedEntryTypes.includes(i));if(n.length>0){let i=new PerformanceObserver(o=>{queueMicrotask(()=>{let a=o.getEntries();n.length>1&&a.sort((s,l)=>s.startTime+s.duration-(l.startTime+l.duration)),t(a)})});for(let o of n)i.observe({type:o,buffered:!0,...r});return i}}catch{}},_r=e=>globalThis.PerformanceObserver?.supportedEntryTypes?.includes("soft-navigation")&&typeof globalThis.PerformanceSoftNavigation?.prototype?.getLargestInteractionContentfulPaint=="function"&&e&&e.reportSoftNavs,vc=(e,t)=>{if(e.set(t.navigationId,t),e.size>2){let r=e.keys().next().value;r!==void 0&&e.delete(r)}},pc=e=>{let t=!1;return()=>{t||(e(),t=!0)}},Ko=class{constructor(){xe(this,"l")}},Un=e=>{document.prerendering?addEventListener("prerenderingchange",e,!0):e()},Vo=[1800,3e3],yr=(e,t={})=>{let r=_r(t);Un(()=>{let n=Mn(t,Ko),i=Er(),o,a=Ce("FCP"),s=Et(["paint"],l=>{for(let u of l)u.name==="first-contentful-paint"&&(s.disconnect(),u.startTime<i.firstHiddenTime&&(a.value=Math.max(u.startTime-br(),0),a.entries.push(u),a.navigationId=u.navigationId||a.navigationId,o(!0)))});s&&(o=Te(e,a,Vo,t.reportAllChanges),Nt(l=>{a=Ce("FCP",-1,"back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Dt()),o=Te(e,a,Vo,t.reportAllChanges),$o(()=>{a.value=performance.now()-l.timeStamp,o(!0)})})),r&&Et(["soft-navigation"],l=>{l.forEach(u=>{n.l&&u.navigationId&&vc(n.l,u);let c=Math.max((u.presentationTime||u.paintTime||0)-u.startTime,0);a=Ce("FCP",c,"soft-navigation",u.navigationId,u.interactionId,u.name,u.startTime),o=Te(e,a,Vo,t.reportAllChanges),o(!0)})},t)})},uc=[.1,.25],Fn=(e,t={})=>{let r=Er();yr(pc(()=>{let n,i=Ce("CLS",0),o=Mn(t,qo),a=(f,v,p,h,g)=>{i=Ce("CLS",0,f,v,p,h,g),o.i=0,n=Te(e,i,uc,t.reportAllChanges)},s=(f=!1)=>{o.i>i.value&&(i.value=o.i,i.entries=o.o),n(f)},l=f=>{s(!0),a("soft-navigation",f.navigationId,f.interactionId,f.name,f.startTime)},u=f=>{for(let v of f)v.entryType!=="soft-navigation"?o.h(v):l(v);s()},c=["layout-shift"];_r(t)&&c.push("soft-navigation");let d=Et(c,u);d&&(n=Te(e,i,uc,t.reportAllChanges),r.onHidden(()=>{u(d.takeRecords()),n(!0)}),Nt(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Dt()),$o(n)}),setTimeout(n))}))},hc=0,Go=1/0,Nn=0,zf=e=>{for(let t of e)t.interactionId&&(Go=Math.min(Go,t.interactionId),Nn=Math.max(Nn,t.interactionId),hc=Nn?(Nn-Go)/7+1:0)},Xo,lc=()=>Xo?hc:performance.interactionCount??0,Yf=()=>{"interactionCount"in performance||Xo||(Xo=Et(["event"],zf,{durationThreshold:0}))},jo=class{constructor(){xe(this,"u",0);xe(this,"v",[]);xe(this,"m",new Map);xe(this,"p");xe(this,"T")}_(){return lc()-this.u}M(){this.u=lc(),this.v.length=0,this.m.clear()}L(t){let r=this._(),n=Math.min(this.v.length-1,Math.floor(r/50));return!r||n!==-1||t!=="soft-navigation"&&t!=="back-forward-cache"?this.v[n]:{P:8,id:-1,entries:[]}}h(t){if(this.p?.(t),!t.interactionId)return;let r=this.v.at(-1),n=this.m.get(t.interactionId);if(n||this.v.length<10||t.duration>r.P){if(n?t.duration>n.P?(n.entries=[t],n.P=t.duration):t.duration===n.P&&t.startTime===n.entries[0].startTime&&n.entries.push(t):(n={id:t.interactionId,entries:[t],P:t.duration},this.m.set(n.id,n),this.v.push(n)),this.v.sort((i,o)=>o.P-i.P),this.v.length>10){let i=this.v.splice(10);for(let o of i)this.m.delete(o.id)}this.T?.(n)}}},gc=e=>{let t="requestIdleCallback"in globalThis?1e3:0,r=globalThis.requestIdleCallback||setTimeout,n=globalThis.cancelIdleCallback||clearTimeout;if(document.visibilityState==="hidden")e();else{let i=pc(e),o=-1,a=()=>{n(o),i()};addEventListener("visibilitychange",a,{once:!0,capture:!0}),o=r(()=>{removeEventListener("visibilitychange",a,{capture:!0}),i()},{timeout:t})}},cc=[200,500],Vn=(e,t={})=>
11{if(!globalThis.PerformanceEventTiming||!("interactionId"in PerformanceEventTiming.prototype))return;let r=Er();Un(()=>{Yf();let n,i=Ce("INP"),o=Mn(t,jo),a=(f,v,p,h,g)=>{o.M(),i=Ce("INP",-1,f,v,p,h,g),n=Te(e,i,cc,t.reportAllChanges)},s=()=>{let f=o.L(i.navigationType);f&&f.P!==i.value&&(i.value=f.P,i.entries=f.entries,n())},l=f=>{s(),n(!0),a("soft-navigation",f.navigationId,f.interactionId,f.name,f.startTime)},u=(f,v=!1)=>{gc(()=>{for(let p of f)p.entryType!=="soft-navigation"?o.h(p):l(p);s(),v&&n(!0)})},c=["event","first-input"];_r(t)&&c.push("soft-navigation");let d=Et(c,u,{...t,durationThreshold:t.durationThreshold??40});n=Te(e,i,cc,t.reportAllChanges),d&&(r.onHidden(()=>{u(d.takeRecords(),!0)}),Nt(()=>{a("back-forward-cache",i.navigationId,i.navigationInteractionId,i.navigationURL,Dt())}))})},zo=class{constructor(){xe(this,"p");xe(this,"l")}h(t){this.p?.(t)}},Ho=[2500,4e3],Gn=(e,t={})=>{let r=!1,n=_r(t);Un(()=>{let i,o=Er(),a=Ce("LCP"),s=Mn(t,zo),l=(v,p,h,g,m)=>{a=Ce("LCP",-1,v,p,h,g,m),i=Te(e,a,Ho,t.reportAllChanges),r=!1,v==="soft-navigation"&&(o=Er(!0))},u=v=>{s.l&&v.navigationId&&vc(s.l,v),r||i(!0),l("soft-navigation",v.navigationId,v.interactionId,v.name,v.startTime);let p=v.getLargestInteractionContentfulPaint?.();p&&c([p])},c=v=>{t.reportAllChanges||n||(v=v.slice(-1));for(let p of v){if(!p)continue;if(p.entryType==="soft-navigation"){u(p);continue}let h=0,g=[],m=p.startTime;if(p.entryType==="largest-contentful-paint")h=Math.max(p.startTime-br(),0),s.h(p),g=[p];else if(p.entryType==="interaction-contentful-paint"){let E=p;if(!a.navigationId||"interactionId"in E&&E.interactionId!=a.navigationInteractionId)continue;m=E.largestContentfulPaint?.renderTime||0,h=Math.max(m-p.startTime,0),E.largestContentfulPaint&&(s.h(E.largestContentfulPaint),g=[E.largestContentfulPaint])}m<o.firstHiddenTime&&(a.value=h,a.entries=g,i())}},d=["largest-contentful-paint"];n&&d.push("interaction-contentful-paint","soft-navigation");let f=Et(d,c);if(f){i=Te(e,a,Ho,t.reportAllChanges);let v=["keydown","click","visibilitychange"],p=h=>{if(h.isTrusted&&!r){let g=a.id;gc(()=>{if(!r){if(!n){f.disconnect();for(let m of v)removeEventListener(m,p,{capture:!0})}g===a.id&&(r=!0,i(!0))}})}};for(let h of v)addEventListener(h,p,{capture:!0});Nt(h=>{l("back-forward-cache",a.navigationId,a.navigationInteractionId,a.navigationURL,Dt()),i=Te(e,a,Ho,t.reportAllChanges),$o(()=>{a.value=performance.now()-h.timeStamp,r=!0,i(!0)})})}})},Bo=[800,1800],Yo=e=>{document.prerendering?Un(()=>Yo(e)):document.readyState!=="complete"?addEventListener("load",()=>Yo(e),!0):setTimeout(e)},Hn=(e,t={})=>{let r=_r(t),n=Ce("TTFB"),i=Te(e,n,Bo,t.reportAllChanges);Yo(()=>{let o=Jo();if(o){let a=o.responseStart;n.value=Math.max(a-br(),0),n.entries=[o],i(!0),Nt(()=>{n=Ce("TTFB",0,"back-forward-cache",n.navigationId,n.navigationInteractionId,n.navigationURL,Dt()),i=Te(e,n,Bo,t.reportAllChanges),i(!0)}),r&&Et(["soft-navigation"],s=>{s.forEach(l=>{l.navigationId&&(n=Ce("TTFB",0,"soft-navigation",l.navigationId,l.interactionId,l.name,l.startTime),n.entries=[l],i=Te(e,n,Bo,t.reportAllChanges),i(!0))})},t)}})};function $f(e){var t,r=((t=e.entries[0])===null||t===void 0?void 0:t.startTime)||0;return performance.timeOrigin+r}function et(e,t){t===void 0&&(t=!1);var r={value:e.value,rating:e.rating,delta:e.delta,navigationType:e.navigationType,id:e.id,timestamp:Math.floor($f(e)),navigationStart:Math.floor(t?performance.timeOrigin+(e.navigationStartTime||0):performance.timeOrigin)};return t&&(r.navigationId=e.navigationId),r}var mc=function(){var e=null,t=C(),r=t?.document,n=t?.location,i=function(s,l){return T(void 0,void 0,void 0,function(){var u,c;return y(this,function(d){return r===void 0?[2]:(u=ie(n?.href||"",s.loggerProvider),c={"[Amplitude] Page Domain":n?.hostname||"","[Amplitude] Page Location":u,"[Amplitude] Page Path":ie(n?.pathname||"",s.loggerProvider),"[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":ie(u.split("?")[0],s.loggerProvider)},Gn(function(f){c["[Amplitude] LCP"]=et(f)}),yr(function(f){c["[Amplitude] FCP"]=et(f)}),Vn(function(f){c["[Amplitude] INP"]=et(f)}),Fn(function(f){c["[Amplitude] CLS"]=et(f)}),Hn(function(f){c["[Amplitude] TTFB"]=et(f)}),e=function(){r.visibilityState==="hidden"&&e&&(l.track(Dn,c),r.removeEventListener("visibilitychange",e),e=null)},r.addEventListener("visibilitychange",e),[2])})})},o=function(s){return T(void 0,void 0,void 0,function(){return y(this,function(l){return[2,s]})})},a=function(){return T(void 0,void 0,void 0,function(){return y(this,function(s){return e&&r?.removeEventListener("visibilitychange",e),[2]})})};return{name:kn,type:"enrichment",setup:i,execute:o,teardown:a}};var Jf=Object.values(gt);function Qf(e,t,r){var n="",i="";try{var o=new URL(e);n=o.hostname,i=o.pathname}catch(s){r.debug("Web vitals plugin is unable to parse page URL: ",s)}var a=ie(e,r);return{"[Amplitude] Page Domain":n,"[Amplitude] Page Location":a,"[Amplitude] Page Path":ie(i,r),"[Amplitude] Page Title":t,"[Amplitude] Page URL":ie(a.split("?")[0],r)}}function Zf(e){return Jf.some(function(t){return t in e})}var Ec=function(){var e=null,t,r=C(),n=r?.document,i=r?.location,o=!1,a=new Set,s=function(c,d){return T(void 0,void 0,void 0,function(){var f,v,p,h,g,m,E,_;return y(this,function(S){return n===void 0?[2]:(o=!0,f=new Map,v=-1,p=function(I){var A=I.navigationId,x=f.get(A);return x||(x=Qf(I.navigationURL||i?.href||"",n.title||"",c.loggerProvider),f.set(A,x)),x},h=function(I){a.add(I);var A=f.get(I);A&&(f.delete(I),Zf(A)&&d.track(Dn,A))},g=function(){var I,A;try{for(var x=P(Array.from(f.keys())),R=x.next();!R.done;R=x.next()){var D=R.value;h(D)}}catch(G){I={error:G}}finally{try{R&&!R.done&&(A=x.return)&&A.call(x)}finally{if(I)throw I.error}}},m=function(I){t!==void 0&&clearTimeout(t),t=setTimeout(function(){var A,x;t=void 0;try{for(var R=P(Array.from(f.keys())),D=R.next();!D.done;D=R.next()){var G=D.value;G<I&&h(G)}}catch(k){A={error:k}}finally{try{D&&!D.done&&(x=R.return)&&x.call(R)}finally{if(A)throw A.error}}},oc)},E=function(I){return function(A){!o||a.has(A.navigationId)||(p(A)[I]=et(A,!0),A.navigationId>v&&(v!==-1&&m(A.navigationId),v=A.navigationId))}},_={reportSoftNavs:!0},Gn(E(gt.LCP),_),yr(E(gt.FCP),_),Vn(E(gt.INP),_),Fn(E(gt.CLS),_),Hn(E(gt.TTFB),_),e=function(){n.visibilityState==="hidden"&&e&&g()},n.addEventListener("visibilitychange",e),[2])})})},l=function(c){return T(void 0,void 0,void 0,function(){return y(this,function(d){return[2,c]})})},u=function(){return T(void 0,void 0,void 0,function(){return y(this,function(c){return o=!1,t!==void 0&&(clearTimeout(t),t=void 0),e&&(n?.removeEventListener("visibilitychange",e),e=null),[2]})})};return{name:kn,type:"enrichment",setup:s,execute:l,teardown:u}};var ev=function(){var e=C();return e&&"PerformanceSoftNavigation"in e},bc=function(e){return e===void 0&&(e={}),e.reportSoftNav===!0&&ev()?Ec():mc()};var Qo=(function(){function e(t,r){var n;this.shouldTrackNewCampaign=!1,this.options=b({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:zs(((n=r.cookieOptions)===null||n===void 0?void 0:n.domain)||r.topLevelDomain),optOut:r.optOut},t),this.storage=r.cookieStorage,this.storageKey=Hr(r.apiKey,"MKTG"),this.webExpStorageKey=Hr(r.apiKey,"MKTG_ORIGINAL"),this.currentCampaign=Be,this.sessionTimeout=r.sessionTimeout,this.lastEventTime=r.lastEventTime,this.logger=r.loggerProvider,this.topLevelDomain=r.topLevelDomain,r.loggerProvider.log("Installing web attribution tracking.")}return e.prototype.init=function(){return T(this,void 0,void 0,function(){var t,r;return y(this,function(n){switch(n.label){case 0:return this.options.optOut?[2]:[4,this.fetchCampaign()];case 1:return r=w.apply(void 0,[n.sent(),2]),this.currentCampaign=r[0],this.previousCampaign=r[1],t=this.lastEventTime?Xt(this.sessionTimeout,this.lastEventTime):!0,Xs(this.currentCampaign,this.previousCampaign,this.options,this.logger,t,this.topLevelDomain)?(this.shouldTrackNewCampaign=!0,[4,this.storage.set(this.storageKey,this.currentCampaign)]):[3,3];case 2:n.sent(),n.label=3;case 3:return[2]}})})},e.prototype.fetchCampaign=function(){return T(this,void 0,void 0,function(){var t;return y(this,function(r){switch(r.label){case 0:return[4,this.storage.get(this.webExpStorageKey)];case 1:return t=r.sent(),t?[4,this.storage.remove(this.webExpStorageKey)]:[3,3];case 2:r.sent(),r.label=3;case 3:return[4,Promise.all([t||new ct().parse(),this.storage.get(this.storageKey)])];case 4:return[2,r.sent()]}})})},e.prototype.generateCampaignEvent=function(t){this.shouldTrackNewCampaign=!1;var r=js(this.currentCampaign,this.options);return t&&(r.event_id=t),r},e.prototype.shouldSetSessionIdOnNewCampaign=function(){return this.shouldTrackNewCampaign&&!!this.options.resetSessionOnNewCampaign},e})();var tv="[Amplitude] Attribution",rv=new Set([se.IDENTIFY,se.GROUP_IDENTIFY]),nv=function(e){return jt(e)},Zo=function(e){var t;e===void 0&&(e={});var r=(t=e.fallbackAttributionEvent)!==null&&t!==void 0?t:!1,n=C(),i,o,a={},s=!1,l=!1,u,c,d,f,v=function(){return T(void 0,void 0,void 0,function(){var g;return y(this,function(m){switch(m.label){case 0:return[4,new ct().parse()];case 1:return g=m.sent(),a=nv(g),r&&(o?.log("Tracking attribution fallback event."),i?.track(tv,a)),[2]}})})},p=function(){v()},h=function(g){return new Proxy(g,{apply:function(m,E,_){Reflect.apply(m,E,_),s&&p()}})};return{name:"@amplitude/plugin-event-property-attribution-browser",type:"enrichment",setup:function(g,m){return T(void 0,void 0,void 0,function(){return y(this,function(E){switch(E.label){case 0:return i=m,o=g.loggerProvider,s=!0,o.log("Installing event property attribution tracking."),[4,v()];case 1:if(E.sent(),!n)return[2];if(n.addEventListener("popstate",p),!l){if(u=Reflect.get(n.history,"pushState"),c=Reflect.get(n.history,"replaceState"),!u||!c)return[2];d=h(u),n.history.pushState=d,f=h(c),n.history.replaceState=f,l=!0}return[2]}})})},execute:function(g){return T(void 0,void 0,void 0,function(){return y(this,function(m){return rv.has(g.event_type)?[2,g]:(g.event_properties=b(b({},a),g.event_properties),[2,g])})})},teardown:function(){return T(void 0,void 0,void 0,function(){var g,m;return y(this,function(E){return n&&(n.removeEventListener("popstate",p),g=Reflect.get(n.history,"pushState"),m=Reflect.get(n.history,"replaceState"),l&&g===d&&u&&(n.history.pushState=u),l&&m===f&&c&&(n.history.replaceState=c)),s=!1,l=!1,u=void 0,c=void 0,d=void 0,f=void 0,a={},[2]})})}}};var Sr="AMP_CURRENT_PAGE",Ar="AMP_PREVIOUS_PAGE",bt="AMP_URL_INFO",Ir;(function(e){e.Direct="direct",e.Internal="internal",e.External="external"})(Ir||(Ir={}));var iv=new Set([se.IDENTIFY,se.GROUP_IDENTIFY,se.REVENUE]);var ea=function(e){var t=e===void 0?{}:e,r=t.internalDomains,n=r===void 0?[]:r,i=C(),o=void 0,a=!1,s=void 0,l=!1,u=!1,
11c=function(h){var g;try{var m=ie(h,s);g=new URL(m).hostname}catch(E){s?.error("Could not parse URL: ",E)}return g},d=function(h){var g=typeof location<"u"&&location.hostname||"",m=h?c(h):void 0;if(!m)return Ir.Direct;var E=n.some(function(S){return g.indexOf(S)!==-1}),_=n.some(function(S){return m.indexOf(S)!==-1});return g===m||_&&E?Ir.Internal:Ir.External},f=function(){return T(void 0,void 0,void 0,function(){var h,g,m,E,_;return y(this,function(S){switch(S.label){case 0:return o&&a?[4,o.get(bt)]:[3,3];case 1:return h=S.sent(),g=ie(typeof location<"u"&&location.href||""),m=h?.[Sr]||"",E=void 0,g===m?E=h?.[Ar]||"":m?E=m:E=document.referrer||"",[4,o.set(bt,(_={},_[Sr]=g,_[Ar]=E,_))];case 2:S.sent(),S.label=3;case 3:return[2]}})})},v=function(){f()},p={name:"@amplitude/plugin-page-url-enrichment-browser",type:"enrichment",setup:function(h,g){return T(void 0,void 0,void 0,function(){var m,E,_,S,I,A,x,R,D;return y(this,function(G){switch(G.label){case 0:if(s=h.loggerProvider,s.log("Installing @amplitude/plugin-page-url-enrichment-browser"),u=!0,!i)return[3,7];try{o=new qe(i.sessionStorage)}catch{s?.debug("sessionStorage is not available in this environment.")}return[4,o?.isEnabled()];case 1:return a=(D=G.sent())!==null&&D!==void 0?D:!1,o&&a?(m=typeof document<"u"&&document.referrer||"",E=m?c(m):void 0,_=typeof location<"u"&&location.hostname||"",S=ie(typeof location<"u"&&location.href||""),[4,o.get(bt)]):[3,6];case 2:return I=G.sent(),A=I?.[Sr]||"",x=!!E&&E!==_&&A!==S,x?[4,o.set(bt,(R={},R[Sr]=S,R[Ar]=m,R))]:[3,4];case 3:return G.sent(),[3,6];case 4:return[4,f()];case 5:G.sent(),G.label=6;case 6:i.addEventListener("popstate",v),l||(i.history.pushState=new Proxy(i.history.pushState,{apply:function(k,U,L){var M=w(L,3),V=M[0],H=M[1],X=M[2];k.apply(U,[V,H,X]),u&&v()}}),i.history.replaceState=new Proxy(i.history.replaceState,{apply:function(k,U,L){var M=w(L,3),V=M[0],H=M[1],X=M[2];k.apply(U,[V,H,X]),u&&v()}}),l=!0),G.label=7;case 7:return[2]}})})},execute:function(h){return T(void 0,void 0,void 0,function(){var g,m,E;return y(this,function(_){switch(_.label){case 0:return g=ie(typeof location<"u"&&location.href||""),o&&a?[4,o.get(bt)]:[3,2];case 1:if(m=_.sent(),E=m?.[Ar]||"",iv.has(h.event_type))return[2,h];h.event_properties=b(b({},h.event_properties||{}),{"[Amplitude] Page Domain":Tr(h,"[Amplitude] Page Domain",typeof location<"u"&&location.hostname||""),"[Amplitude] Page Location":Tr(h,"[Amplitude] Page Location",g),"[Amplitude] Page Path":Tr(h,"[Amplitude] Page Path",typeof location<"u"&&ie(location.pathname)||""),"[Amplitude] Page Title":Tr(h,"[Amplitude] Page Title",ft(dt)),"[Amplitude] Page URL":Tr(h,"[Amplitude] Page URL",g.split("?")[0]),"[Amplitude] Previous Page Location":E,"[Amplitude] Previous Page Type":d(E)}),_.label=2;case 2:return[2,h]}})})},teardown:function(){return T(void 0,void 0,void 0,function(){return y(this,function(h){switch(h.label){case 0:return i&&(i.removeEventListener("popstate",v),u=!1),o&&a?[4,o.set(bt,{})]:[3,2];case 1:h.sent(),h.label=2;case 2:return[2]}})})}};return p};function Tr(e,t,r){return e.event_properties||(e.event_properties={}),e.event_properties[t]===void 0?r:e.event_properties[t]}var ta=function(){var e,t,r;function n(a){return typeof a!="object"||a===null?!1:"body"in a&&typeof a.body=="string"}function i(a){if(a)try{var s=new Function("return "+a)();if(typeof s=="function")return s;e?.error("Custom enrichment body did not evaluate to a function")}catch(l){e?.error("Could not create custom enrichment function",l)}return function(l){return l}}var o={name:"@amplitude/plugin-custom-enrichment-browser",type:"enrichment",setup:function(a,s){return T(void 0,void 0,void 0,function(){var l,u;return y(this,function(c){return e=a.loggerProvider,e?.log("Installing @amplitude/plugin-custom-enrichment-browser"),!((u=a.remoteConfig)===null||u===void 0)&&u.fetchRemoteConfig&&(a.remoteConfigClient?(l=a.remoteConfigClient.subscribe("configs.analyticsSDK.browserSDK.customEnrichment","all",function(d){d&&n(d)?r=i(d.body||""):r=i("")}),t=function(){var d;return(d=a.remoteConfigClient)===null||d===void 0?void 0:d.unsubscribe(l)}):e?.debug("Remote config client is not provided, skipping remote config fetch")),[2]})})},execute:function(a){return T(void 0,void 0,void 0,function(){var s;return y(this,function(l){if(r)try{return[2,(s=r(a))!==null&&s!==void 0?s:null]}catch(u){return e?.error("Could not execute custom enrichment function",u),[2,a]}return[2,a]})})},teardown:function(){return T(void 0,void 0,void 0,function(){return y(this,function(a){return t&&t(),[2]})})}};return o};var ra="userProperty",na="eventProperty",ov=function(e){return e===ra||e===na},av=[ra,na],sv=function(e){var t=N([],w(new Set((Array.isArray(e)?e:[e]).filter(ov))),!1);return t.length>0?t:N([],w(av),!1)},_c=function(e,t){return sv(e.trackingMethod).includes(t)},ia=function(e){return _c(e,ra)},yc=function(e){return _c(e,na)};var oa=-1,aa=(function(e){ge(t,e);function t(){var r=e!==null&&e.apply(this,arguments)||this;return r._diagnosticsSampleRate=0,r}return t.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?.userId,a=n),le(this._init(b(b({},a),{userId:o,apiKey:r})))},t.prototype._init=function(r){var n,i,o,a,s,l,u,c;return T(this,void 0,void 0,function(){var d,f,v,p,h,g,m,E,_,S,I,A,x,R,D,G=this;return y(this,function(k){switch(k.label){case 0:return this.initializing?[2]:(this.initializing=!0,d=$s(r),f=(n=r.loggerProvider)!==null&&n!==void 0?n:new ot,r.loggerProvider||f.enable((i=r.logLevel)!==null&&i!==void 0?i:re.Warn),v=(o=r.serverZone)!==null&&o!==void 0?o:un,h=this._diagnosticsSampleRate,g=(a=r.enableDiagnostics)!==null&&a!==void 0?a:!0,d?(p=new Ai(r.apiKey,f,v,(s=r.remoteConfig)===null||s===void 0?void 0:s.serverUrl),[4,new Promise(function(U){p?.subscribe("configs.diagnostics.browserSDK","all",function(L,M,V){if(f.debug("Diagnostics remote configuration received:",JSON.stringify({remoteConfig:L,source:M,lastFetch:V},null,2)),L){var H=L.sampleRate;typeof H=="number"&&!isNaN(H)&&(h=H);var X=L.enabled;typeof X=="boolean"&&(g=X)}U()})})]):[3,2]);case 1:k.sent(),k.label=2;case 2:return m=new Ti(r.apiKey,f,v,{enabled:g,sampleRate:h}),m.setTag("library","".concat(rn,"/").concat(Ct)),m.setTag("platform",oo),m.setTag("web_environment",Cs()),typeof navigator<"u"&&m.setTag("user_agent",navigator.userAgent),[4,Ys(r.apiKey,r,this,m,{loggerProvider:f,serverZone:v,enableDiagnostics:g,diagnosticsSampleRate:h})];case 3:return E=k.sent(),d&&p?[4,new Promise(function(U){p?.subscribe("configs.analyticsSDK.browserSDK","all",function(L,M,V){E.loggerProvider.debug("Remote configuration received:",JSON.stringify({remoteConfig:L,source:M,lastFetch:V},null,2)),L&&nu(L,E),U()})})]:[3,5];case 4:k.sent(),k.label=5;case 5:return[4,e.prototype._init.call(this,E)];case 6:return k.sent(),this.logBrowserOptions(E),this.config.remoteConfigClient=p,_=ws(this.config),en(this.config.defaultTracking)&&ia(_)?(this.config.optOut&&this.timeline.addOptOutListener(function(U){return T(G,void 0,void 0,function(){return y(this,function(L){switch(L.label){case 0:return U?[3,2]:(this.webAttribution=new Qo(_,this.config),[4,this.webAttribution.init()]);case 1:L.sent(),L.label=2;case 2:return[2]}})})}),this.webAttribution=new Qo(_,this.config),[4,this.webAttribution.init()]):[3,8];case 7:k.sent(),k.label=8;case 8:return S=Ye(),I=S.ampTimestamp?Number(S.ampTimestamp):void 0,A=I?Date.now()<I:!0,x=A&&!Number.isNaN(Number(S.ampSessionId))?Number(S.ampSessionId):void 0,R=this.config.deferredSessionId,R===oa&&!this.config.optOut&&(R=Date.now()),this.setSessionId((c=(u=(l=r.sessionId)!==null&&l!==void 0?l:x)!==null&&u!==void 0?u:R
11)!==null&&c!==void 0?c:this.config.sessionId),this.config.optOut&&this.timeline.addOptOutListener(function(U){return T(G,void 0,void 0,function(){return y(this,function(L){return!U&&this.config.deferredSessionId&&(this.config.deferredSessionId===oa?this.setSessionId(void 0):this.setSessionId(this.config.deferredSessionId)),[2]})})}),D=ze(this.config.instanceName),D.identityStore.setIdentity({userId:this.config.userId,deviceId:this.config.deviceId}),this.config.offline===er?[3,10]:[4,this.add(ru()).promise];case 9:k.sent(),k.label=10;case 10:return[4,this.add(new vi({diagnosticsClient:m})).promise];case 11:return k.sent(),[4,this.add(new Rs).promise];case 12:return k.sent(),[4,this.add(new gi).promise];case 13:return k.sent(),tu(this.config),ms(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding file download tracking plugin"),[4,this.add(Zs()).promise]):[3,15];case 14:k.sent(),k.label=15;case 15:return Qi(this.config.defaultTracking)?(this.config.loggerProvider.debug("Adding form interaction plugin"),[4,this.add(Qs()).promise]):[3,17];case 16:k.sent(),k.label=17;case 17:return Zi(this.config.defaultTracking)?this.config.optOut?[3,19]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(ln(io(this.config))).promise]):[3,20];case 18:return k.sent(),[3,20];case 19:this.timeline.addOptOutListener(function(U){return T(G,void 0,void 0,function(){return y(this,function(L){switch(L.label){case 0:return U?[2]:(this.config.loggerProvider.debug("Adding page view tracking plugin"),[4,this.add(ln(io(this.config))).promise]);case 1:return L.sent(),[2]}})})}),k.label=20;case 20:return en(this.config.defaultTracking)&&yc(_)?(this.config.loggerProvider.debug("Adding event property attribution plugin"),[4,this.add(Zo(_)).promise]):[3,22];case 21:k.sent(),k.label=22;case 22:return ro(this.config.autocapture)?(this.config.loggerProvider.debug("Adding user interactions plugin (autocapture plugin)"),[4,this.add(Pn(As(this.config),{diagnosticsClient:m})).promise]):[3,24];case 23:k.sent(),k.label=24;case 24:return no(this.config.autocapture)?(this.config.loggerProvider.debug("Adding frustration interactions plugin"),[4,this.add(No(Is(this.config))).promise]):[3,26];case 25:k.sent(),k.label=26;case 26:return to(this.config.autocapture)?(this.config.loggerProvider.debug("Adding network tracking plugin"),[4,this.add(On(xs(this.config))).promise]):[3,28];case 27:k.sent(),k.label=28;case 28:return bs(this.config.autocapture)?(this.config.loggerProvider.debug("Adding web vitals plugin"),[4,this.add(bc(_s(this.config))).promise]):[3,30];case 29:k.sent(),k.label=30;case 30:return ys(this.config.autocapture)?(this.config.loggerProvider.debug("Adding performance tracking plugin"),[4,this.add(Mo(Ts(this.config))).promise]):[3,32];case 31:k.sent(),k.label=32;case 32:return Es(this.config.autocapture)?(this.config.loggerProvider.debug("Adding referrer page url plugin"),[4,this.add(ea()).promise]):[3,34];case 33:k.sent(),k.label=34;case 34:return Ss(this.config.customEnrichment)?(this.config.loggerProvider.debug("Adding custom enrichment plugin"),[4,this.add(ta()).promise]):[3,36];case 35:k.sent(),k.label=36;case 36:return this.initializing=!1,[4,this.runQueuedFunctions("dispatchQ")];case 37:return k.sent(),D.eventBridge.setEventReceiver(function(U){var L=U.eventProperties||{},M=L.time,V=nt(L,["time"]),H=typeof M=="number"?{time:M}:void 0;G.track(U.eventType,V,H)}),[2]}})})},t.prototype.getUserId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.userId},t.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}),pi(r,this.config.instanceName))},t.prototype.getDeviceId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.deviceId},t.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}),hi(r,this.config.instanceName))},t.prototype.reset=function(){this.setDeviceId(ne()),this.setUserId(void 0),this.timeline.onReset()},t.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}},t.prototype.setIdentity=function(r){var n,i,o;if("userId"in r&&this.setUserId(r.userId),"deviceId"in r&&r.deviceId&&this.setDeviceId(r.deviceId),"userProperties"in r){this.userProperties=r.userProperties;var a=new Ue,s=(o=r.userProperties)!==null&&o!==void 0?o:{};try{for(var l=P(Object.entries(s)),u=l.next();!u.done;u=l.next()){var c=w(u.value,2),d=c[0],f=c[1];a.set(d,f)}}catch(v){n={error:v}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(n)throw n.error}}this.identify(a)}},t.prototype.getOptOut=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.optOut},t.prototype.getSessionId=function(){var r;return(r=this.config)===null||r===void 0?void 0:r.sessionId},t.prototype.setSessionId=function(r){var n,i=[];if(!this.config)return this.q.push(this.setSessionId.bind(this,r)),le(Promise.resolve());if(this.config.optOut)return this.config.deferredSessionId=r??oa,le(Promise.resolve());if(r===void 0&&(r=Date.now()),r===this.config.sessionId)return le(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,eo(this.config.defaultTracking)&&(o&&a&&i.push(this.track(co,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 l=this.trackCampaignEventIfNeeded(++s,i);return this.config.identify&&i.push(this.track(it(this.config.identify)).promise),eo(this.config.defaultTracking)&&i.push(this.track(lo,void 0,{event_id:l?++s:s,session_id:this.config.sessionId,time:this.config.lastEventTime}).promise),this.previousSessionDeviceId=this.config.deviceId,this.previousSessionUserId=this.config.userId,le(Promise.all(i))},t.prototype.extendSession=function(){if(!this.config){this.q.push(this.extendSession.bind(this));return}
11this.config.lastEventTime=Date.now()},t.prototype.setTransport=function(r){if(!this.config){this.q.push(this.setTransport.bind(this,r));return}this.config.transportProvider=po(r)},t.prototype.identify=function(r,n){if(tn(r)){var i=r._q;r._q=[],r=lr(new Ue,i)}return n?.user_id&&this.setUserId(n.user_id),n?.device_id&&this.setDeviceId(n.device_id),e.prototype.identify.call(this,r,n)},t.prototype.groupIdentify=function(r,n,i,o){if(tn(i)){var a=i._q;i._q=[],i=lr(new Ue,a)}return e.prototype.groupIdentify.call(this,r,n,i,o)},t.prototype.revenue=function(r,n){if(tn(r)){var i=r._q;r._q=[],r=lr(new Or,i)}return e.prototype.revenue.call(this,r,n)},t.prototype.trackCampaignEventIfNeeded=function(r,n){if(!this.webAttribution||!this.webAttribution.shouldTrackNewCampaign||!ia(this.webAttribution.options))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},t.prototype.process=function(r){return T(this,void 0,void 0,function(){var n,i,o;return y(this,function(a){return n=Date.now(),i=Xt(this.config.sessionTimeout,this.config.lastEventTime),o=this.webAttribution&&this.webAttribution.shouldSetSessionIdOnNewCampaign(),r.event_type!==lo&&r.event_type!==co&&(!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()),[2,e.prototype.process.call(this,r)]})})},t.prototype.logBrowserOptions=function(r){try{var n=b(b({},r),{apiKey:r.apiKey.substring(0,10)+"********"});this.config.loggerProvider.debug("Initialized Amplitude with BrowserConfig:",me(n))}catch(i){this.config.loggerProvider.error("Error logging browser config",i)}},t.prototype._setDiagnosticsSampleRate=function(r){if(!(r>1||r<0)&&!this.config){this._diagnosticsSampleRate=r;return}},t})(li);var Tc=function(){var e=new aa;return{init:J(e.init.bind(e),"init",Y(e),$(e,["config"])),add:J(e.add.bind(e),"add",Y(e),$(e,["config.apiKey","timeline.plugins"])),remove:J(e.remove.bind(e),"remove",Y(e),$(e,["config.apiKey","timeline.plugins"])),track:J(e.track.bind(e),"track",Y(e),$(e,["config.apiKey","timeline.queue.length"])),logEvent:J(e.logEvent.bind(e),"logEvent",Y(e),$(e,["config.apiKey","timeline.queue.length"])),identify:J(e.identify.bind(e),"identify",Y(e),$(e,["config.apiKey","timeline.queue.length"])),groupIdentify:J(e.groupIdentify.bind(e),"groupIdentify",Y(e),$(e,["config.apiKey","timeline.queue.length"])),setGroup:J(e.setGroup.bind(e),"setGroup",Y(e),$(e,["config.apiKey","timeline.queue.length"])),revenue:J(e.revenue.bind(e),"revenue",Y(e),$(e,["config.apiKey","timeline.queue.length"])),flush:J(e.flush.bind(e),"flush",Y(e),$(e,["config.apiKey","timeline.queue.length"])),getUserId:J(e.getUserId.bind(e),"getUserId",Y(e),$(e,["config","config.userId"])),setUserId:J(e.setUserId.bind(e),"setUserId",Y(e),$(e,["config","config.userId"])),getDeviceId:J(e.getDeviceId.bind(e),"getDeviceId",Y(e),$(e,["config","config.deviceId"])),setDeviceId:J(e.setDeviceId.bind(e),"setDeviceId",Y(e),$(e,["config","config.deviceId"])),reset:J(e.reset.bind(e),"reset",Y(e),$(e,["config","config.userId","config.deviceId"])),getSessionId:J(e.getSessionId.bind(e),"getSessionId",Y(e),$(e,["config"])),setSessionId:J(e.setSessionId.bind(e),"setSessionId",Y(e),$(e,["config"])),extendSession:J(e.extendSession.bind(e),"extendSession",Y(e),$(e,["config"])),setOptOut:J(e.setOptOut.bind(e),"setOptOut",Y(e),$(e,["config"])),setTransport:J(e.setTransport.bind(e),"setTransport",Y(e),$(e,["config"])),getIdentity:J(e.getIdentity.bind(e),"getIdentity",Y(e),$(e,["config"])),setIdentity:J(e.setIdentity.bind(e),"setIdentity",Y(e),$(e,["config","config.userId","config.deviceId"])),getOptOut:J(e.getOptOut.bind(e),"getOptOut",Y(e),$(e,["config"])),_setDiagnosticsSampleRate:J(e._setDiagnosticsSampleRate.bind(e),"_setDiagnosticsSampleRate",Y(e),$(e,["config"]))}},Z=Tc();var uv=(function(){function e(t){this.amplitude=t,this.videoEl=null,this.embeddedVideoPlayer=null,this.extraEventProperties={},this.listeners=[],this.onRemoveListeners=[]}return e.prototype.withVideoElement=function(t){return this.videoEl=t,this},e.prototype.withEmbeddedPlayer=function(t){return this.embeddedVideoPlayer=t,this},e.prototype.withVendor=function(t){return this.vendor=t,this},e.prototype.withExtraEventProperties=function(t){return this.extraEventProperties=t,this},e.prototype.captureVideoStarted=function(){var t=this;return this.listeners.push(function(r,n){r.playbackState!=="playing"&&n.playbackState==="playing"&&t.amplitude.track("Video Content Started",b(b({},n.lastEvent),t.extraEventProperties))}),this},e.prototype.captureVideoStopped=function(){var t=this;return this.listeners.push(function(r,n){r.playbackState==="playing"&&n.playbackState!=="playing"&&t.amplitude.track("Video Content Stopped",b(b(b({},n.lastEvent),{watch_duration:n.watchTime}),t.extraEventProperties))}),this},e.prototype.start=function(){var t=this,r,n=(r=this.videoEl)!==null&&r!==void 0?r:this.embeddedVideoPlayer;if(!n)throw new Error("Video element not specified. Use withVideoElement() or withEmbeddedPlayer() to specify the video element.");if(this.videoEl&&this.embeddedVideoPlayer)throw new Error("Both video element and embedded video player specified. Use only one of withVideoElement() or withEmbeddedPlayer() to specify the video element.");var i=new zi({videoEl:n,onStateChange:function(o,a){t.listeners.forEac
11h(function(s){return s(o,a)})},vendor:this.vendor,isEmbedded:!!this.embeddedVideoPlayer});return this.onRemoveListeners.push(function(){i.destroy()}),this},e.prototype.stop=function(){this.onRemoveListeners.forEach(function(t){return t()}),this.onRemoveListeners=[]},e})();function lv(e,t,r){var n;r===void 0&&(r={});var i=new uv(e);t instanceof HTMLVideoElement?i.withVideoElement(t):i.withEmbeddedPlayer(t),r.vendor&&i.withVendor(r.vendor);var o=(n=r.extraEventProperties)!==null&&n!==void 0?n:{};try{i.withExtraEventProperties(b({view_session_id:ne()},o)).captureVideoStarted().captureVideoStopped().start()}catch(a){return a}return function(){return i.stop()}}var dT=Z.add,fT=Z.extendSession,vT=Z.flush,pT=Z.getDeviceId,hT=Z.getIdentity,gT=Z.getOptOut,mT=Z.getSessionId,ET=Z.getUserId,bT=Z.groupIdentify,_T=Z.identify,yT=Z.init,TT=Z.logEvent,ST=Z.remove,AT=Z.reset,IT=Z.revenue,xT=Z.setDeviceId,wT=Z.setGroup,PT=Z.setIdentity,CT=Z.setOptOut,RT=Z.setSessionId,LT=Z.setTransport,OT=Z.setUserId,kT=Z.track,DT=Z._setDiagnosticsSampleRate;export{aa as AmplitudeBrowser,Ue as Identify,Or as Revenue,Ws as Types,DT as _setDiagnosticsSampleRate,dT as add,Tc as createInstance,fT as extendSession,vT as flush,pT as getDeviceId,hT as getIdentity,gT as getOptOut,mT as getSessionId,ET as getUserId,bT as groupIdentify,_T as identify,yT as init,TT as logEvent,ST as remove,AT as reset,IT as revenue,Sd as runQueuedFunctions,xT as setDeviceId,wT as setGroup,PT as setIdentity,CT as setOptOut,RT as setSessionId,LT as setTransport,OT as setUserId,kT as track,lv as trackVideo};
12//# sourceMappingURL=amplitude-analytics-browser.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.