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